branch_name
stringclasses
149 values
text
stringlengths
23
89.3M
directory_id
stringlengths
40
40
languages
listlengths
1
19
num_files
int64
1
11.8k
repo_language
stringclasses
38 values
repo_name
stringlengths
6
114
revision_id
stringlengths
40
40
snapshot_id
stringlengths
40
40
refs/heads/master
<file_sep>import { RouteRecordRaw } from 'vue-router' const home: Array<RouteRecordRaw> = [ { path: '/blog', name: 'Blog', component: () => import('@/views/blog/index.vue'), meta: { title: '博客管理', }, children: [ { path: 'list', name: 'BlogList', component: () => import('@/views/blog/lists/index.vue'), meta: { title: '博客列表' } }, { path: 'class', name: 'BlogClass', component: () => import('@/views/blog/class/index.vue'), meta: { title: '博客分类' } }, { path: 'add', name: 'BlogAdd', component: () => import('@/views/blog/add/index.vue'), meta: { title: '新增博客' } } ] } ] export default home<file_sep>import { GetterTree } from 'vuex' import { UserData } from '@/@types' import { RootState } from '@/store' import { State } from './state' export type Getters = { userData(state: State): UserData userToken(state: State): string } export const getters: GetterTree<State, RootState> & Getters = { userData: (state) => state.userData, userToken: (state) => state.userToken, }<file_sep>import path from "path" import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' // https://vitejs.dev/config/ export default defineConfig({ plugins: [vue()], resolve: { alias: { '@': path.resolve(__dirname, 'src') } }, server: { port: 3001, strictPort: true, open: false, proxy: { // 选项写法 '/api': { target: 'http://localhost:3000', changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, '') }, } }, css: { preprocessorOptions: { scss: { additionalData: `@import "@/styles/variables.scss";` } } } }) <file_sep>// 菜单选中项 const defaultActiveMenuPath = '/home' // 面包屑默认首页 const defaultBreadcrumb = ['首页'] export type State = { breadcrumb: string[] activeMenuPath: string } export const state: State = { breadcrumb: defaultBreadcrumb, activeMenuPath: defaultActiveMenuPath, }<file_sep>export * from './app.d' export * from './user.d' <file_sep>import { MutationTree } from 'vuex' import { UserData } from '@/@types' import { State } from './state' import { UserMutationTypes as types } from './mutations-types' export type Mutations<S = State> = { [types.SET_USER](state: S, payload: UserData): void [types.SET_TOKEN](state: S, payload: String): void } export const mutations: MutationTree<State> & Mutations = { [types.SET_USER](state: State, user: UserData) { state.userData = user }, [types.SET_TOKEN](state: State, token: string) { state.userToken = token } } <file_sep>import { UserData } from '@/@types' export type State = { userData: UserData, userToken: string } const defaultUserData = { id: 0, name: '', nickName: '', mail: '', sex: '', headImg: '' } export const state: State = { userData: defaultUserData, userToken: '' } <file_sep>// accessToken: "<KEY>" // auth: "0" // code: "" // codeTime: "2021-05-22T14:24:19.000Z" // creatTime: "2021-05-22T14:24:19.000Z" // headImg: "http://www.dlhtx.top:3000/file/randomAvatar" // id: 2 // info: null // mail: "<EMAIL>" // name: "test111" // nickName: null // num: null // password: "<PASSWORD>" // sex: nul export type UserData = { id: number name: string nickName: string mail: string sex: string headImg: string } <file_sep>/** * 文件上传相关 */ import http from '@/utils/request' // 二进制,file // {"success":true,"data":"http://www.dlhtx.top:3000/img/1621745110802-素养打卡-press.png","msg":"上传成功"} export const uploadImg = () => { http.post({ url: '/file/upImg' }) }<file_sep>export enum AppActionsTypes { NON_ACTION = 'NON_ACTION' }<file_sep>import { GetterTree } from 'vuex' import { RootState } from '@/store' import { State } from './state' export type Getters = { breadcrumb(state: State): string[] activeMenu(state: State): string } export const getters: GetterTree<State, RootState> & Getters = { breadcrumb: (state) => state.breadcrumb, activeMenu: (state) => state.activeMenuPath, } <file_sep># 开发问题记录 1. 路由文件名称不能命名为list,否则无法加载到文件 应该是vite的问题<file_sep>import { createStore } from 'vuex' // 持久化存储vuex信息,默认localStorage import createPersistedState from 'vuex-persistedstate' import { store as app, AppStore, State as appState } from './modules/app' import { store as user, UserStore, State as userState } from './modules/user' export type RootState = { app: appState, user: userState } export type Store = UserStore<Pick<RootState, 'user'>> & AppStore<Pick<RootState, 'app'>> // const debug = import.meta.env.MODE !== 'production' // const plugins = debug ? [createLogger({})] : [] const plugins = [] plugins.push(createPersistedState({ storage: window.sessionStorage })) export const store = createStore({ plugins, modules: { user, app } }) console.log(store) export function useStore(): Store { return store as Store } <file_sep>import { RouteRecordRaw } from 'vue-router' const home: Array<RouteRecordRaw> = [ { path: '/home', name: 'Home', component: () => import('@/views/home/Index.vue'), meta: { title: '首页', } } ] export default home<file_sep>export enum UserActionsTypes { NON_ACTION = 'NON_ACTION' } <file_sep>import http from '@/utils/request' export interface IClassName { className: string } interface IBlogClass { title: string, className: string, page: number, row: number, userName: string } interface IBlog { bgImg: string, body: string, className: string, isTop: string, name: string, showIndex: string, title: string, upFileUrl: string } /** * 增加分类信息 * @param data * @returns */ export const AddBlogClass = (data: IClassName) => { return http.post({ url: '/api/blog/addBlogClass', data }) } /** * 删除分类信息 * @param data * @returns */ export const DeleteBlogClass = (data: IClassName) => { return http.delete({ url: '/api/blog/deleteBlogClass', data }) } /** * 获取博客所有分类信息 * @returns Array */ export const FindBlogClass = () => { return http.get({ url: '/api/blog/findBlogClass' }) } /** * 根据用户名查询博客列表 * @param data * @returns */ export const FindBlogByUsernameHasPage = (data: IBlogClass) => { return http.get({ url: '/api/blog/findBlogByUsernameHasPage', data }) } /** * 新增博客 * @param data * @returns */ export const addBlog = (data: IBlog) => { return http.post({ url: '/api/blog/addBlog', data }) }<file_sep>import "normalize.css/normalize.css" import router from './router' import { store } from './store' import ElementPlus from 'element-plus' import 'element-plus/lib/theme-chalk/index.css' import { createApp } from 'vue' import App from './App.vue' // 引入markdown编辑器 import VMdEditor from '@kangc/v-md-editor'; import '@kangc/v-md-editor/lib/style/base-editor.css'; import githubTheme from '@kangc/v-md-editor/lib/theme/github.js'; import '@kangc/v-md-editor/lib/theme/style/github.css'; VMdEditor.use(githubTheme) const app = createApp(App) app.use(ElementPlus).use(store).use(router).use(VMdEditor) router.isReady().then(() => app.mount('#app')) <file_sep>import http from '@/utils/request' interface loginParams { name: string, password: string } // interface logoutParams { // name: string // } interface registerParams { name: string, password: string, code: string } interface codeParams { name: string, mail: string } /** * 登陆 * @param data * @returns */ export const Login = (data: loginParams) => { return http.post({ url: '/api/user/login', data }) } /** * 注册 * @param data * @returns */ export const Register = (data: registerParams) => { return http.post({ url: '/api/user/register', data }) } /** * 获取注册码 * @param data */ export const GetCode = (data: codeParams) => { return http.get({ url: '/api/user/getCode', data }) } /** * 注销接口 */ // export const Logout = (name: string) => { // return http.post({ // url: '/api/user/login', // name // }) // } <file_sep>export enum UserMutationTypes { SET_USER = 'SET_USER', SET_TOKEN = 'SET_TOKEN' } <file_sep>export enum AppMutationTypes { SET_ACTIVE_MENU = 'SET_ACTIVE_MENU', SET_BREADCRUMB = 'SET_BREADCRUMB' } <file_sep>import Axios, { AxiosRequestConfig, AxiosInstance, AxiosResponse, AxiosError, AxiosPromise } from 'axios' import { ElMessage, ElMessageBox } from 'element-plus' import qs from 'qs' import router from '@/router' import { store } from '@/store' function networkErrorMessage (e: AxiosError) { ElMessage({ type: 'error', message: '请求异常, 请稍后再试' }) } const pendingRequest = new Map() const instance: AxiosInstance = Axios.create({ baseURL: import.meta.env.VITE_API_URL as string, timeout: 10000, withCredentials: true }) const generateReqKey = (config: AxiosRequestConfig) => { const { method, url, params, data } = config return [method, url, qs.stringify(params), qs.stringify(data)].join('&') } // 将当前请求加入pendingRequest const addPendingRequest = (config: AxiosRequestConfig) => { const requestKey = generateReqKey(config) config.cancelToken = config.cancelToken || new Axios.CancelToken((cancel) => { if (!pendingRequest.has(requestKey)) { pendingRequest.set(requestKey, cancel) } }) } // 检查是否存在重复请求,若存在则取消已发的请求 const removePendingRequest = (config: AxiosRequestConfig) => { const requestKey = generateReqKey(config) if (pendingRequest.has(requestKey)) { const cancelToken = pendingRequest.get(requestKey) cancelToken(requestKey) pendingRequest.delete(requestKey) } } instance.interceptors.request.use( async (config: AxiosRequestConfig) => { removePendingRequest(config) // 检查是否存在重复请求,若存在则取消已发的请求 addPendingRequest(config) // 把当前请求信息添加到pendingRequest对象中 const token = store.getters.userToken if (token) { config.headers = { Authorization: 'Bearer ' + token } } return config }, (error: AxiosError) => { console.log(error) networkErrorMessage(error) } ) instance.interceptors.response.use( async (response: AxiosResponse) => { removePendingRequest(response.config) // 从pendingRequest对象中移除请求 return response }, (error: AxiosError) => { removePendingRequest(error.config || {}) // 从pendingRequest对象中移除请求 if (Axios.isCancel(error)) { console.log('已取消的重复请求:' + error.message) } else { ElMessageBox.confirm('发生异常, 请稍后', '错误', { confirmButtonText: '重新登录', cancelButtonText: '稍后再试', type: 'error', center: true }).then(() => { // 重新登录逻辑 router.push({ path: '/login', }) sessionStorage.clear() }).catch(err => { // 退出系统重新登录逻辑 router.push({ path: '/login', }) sessionStorage.clear() }) } } ) export interface RequestParams { url: string data?: unknown type?: string } export default { post ({ url, data = {}, type = 'application/json;charset=UTF-8' }: RequestParams): AxiosPromise { return new Promise((resolve, reject) => { instance({ method: 'post', headers: { 'Content-Type': type, }, url, data }).then(res => { resolve(res) }).catch(err => { reject(err) }) }) }, get ({ url, data }: RequestParams): AxiosPromise { return new Promise((resolve, reject) => { instance({ method: 'get', url, params: data }).then(res => { resolve(res) }).catch(err => { reject(err) }) }) }, delete ({ url, data = {} }: RequestParams): AxiosPromise { return new Promise((resolve, reject) => { instance({ method: 'delete', url, data }).then(res => { resolve(res) }).catch(err => { reject(err) }) }) } } <file_sep>export const resolve = (path1: string, path2: string) => { return path1 + path2 } <file_sep>import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router' // import { Meta } from '@/@types' // import { store } from '@/store' import Layout from '@/layouts/Main.vue' // 自动加载模块中的路由模块 const routesModules = import.meta.globEager('./modules/*.ts') export const customRoutes = Object.keys(routesModules).reduce<RouteRecordRaw[]>( (pre, k) => [...pre, ...routesModules[k].default], [] ) const whiteUrls = ['/login', '/404'] export const constantRoutes: Array<RouteRecordRaw> = [ { path: '/', name: 'Home', component: Layout, redirect: '/home', meta: { title: '首页' }, children: [...customRoutes] }, { path: '/404', name: '404', component: () => import('@/views/404.vue'), meta: { title: '404' } }, { path: '/login', name: 'login', component: () => import('@/views/login/index.vue'), meta: { title: '登陆' } }, { path: '/register', name: 'register', component: () => import('@/views/login/register.vue'), meta: { title: '注册' } } // { // path: '*', // redirect: '/404' // } ] console.log(constantRoutes) const _createRouter = () => createRouter({ history: createWebHashHistory(), routes: constantRoutes, scrollBehavior: () => ({ left: 0, top: 0 }) }) let router = _createRouter() // router.beforeEach((to, from, next) => { // if (!to.matched.length) { // router.push({ // path: '/404' // }) // } else { // if (!whiteUrls.some(item => item === to.path)) { // if (store.getters.userToken) { // // 设置相关信息 // } // } else { // router.push({ // path: '/login' // }) // } // } // next() // }) export function resetRouter() { router = _createRouter() } export default router <file_sep>import { ActionTree } from 'vuex' import { RootState } from '@/store' import { State } from './state' import { AppActionsTypes as types } from './actions-types' export interface Actions { [types.NON_ACTION](): void } export const actions: ActionTree<State, RootState> & Actions = { [types.NON_ACTION]() {}, }<file_sep>import { MutationTree } from 'vuex' import { State } from './state' import { AppMutationTypes as types } from './mutations-types' export type Mutations<S = State> = { [types.SET_ACTIVE_MENU](state: S, payload: string): void [types.SET_BREADCRUMB](state: S, payload: string[]): void } export const mutations: MutationTree<State> & Mutations = { [types.SET_ACTIVE_MENU](state: State, path: string) { state.activeMenuPath = path }, [types.SET_BREADCRUMB](state: State, breadcrumb: string[]) { state.breadcrumb = breadcrumb } }
fd114cfd0d697379e2f10f502befaf7ca22a3750
[ "Markdown", "TypeScript" ]
25
TypeScript
chen8ih/nestjs-blog-admin
618ccbf4b5d73a1b620850f7f60d708ae372d520
eedbf17cd95249cea608e617364a3f0a927f1505
refs/heads/develop
<repo_name>fegzycole/Weather-App<file_sep>/src/index.js // eslint-disable-next-line import/no-unresolved import '@babel/polyfill'; import dataController from './data'; import contentLoader from './contentLoader'; const searchBox = document.querySelector('#location'); const celsiusIcon = document.querySelector('.celsius'); const fahrenheitIcon = document.querySelector('.fahrenheit'); const loader = document.querySelector('.loader'); const errorMessage = document.querySelector('.error-message'); const resultArea = document.querySelector('.result'); const handleData = async (unit) => { resultArea.innerHTML = ''; loader.setAttribute('style', 'display: block !important'); try { const response = await dataController.getWeatherInfo(searchBox.value, unit); loader.removeAttribute('style'); errorMessage.removeAttribute('style'); if (response === 'City not found') { errorMessage.setAttribute('style', 'display: block !important'); } else { contentLoader(response, unit); } } catch (error) { errorMessage.setAttribute('style', 'display: block !important'); errorMessage.innerText = error.message; } }; celsiusIcon.addEventListener('click', () => handleData('metric')); fahrenheitIcon.addEventListener('click', () => handleData('imperial')); <file_sep>/src/contentLoader.js const displayArea = document.querySelector('.result'); const contentLoader = (response, unit) => { displayArea.innerHTML = ''; const cityInfo = document.createElement('div'); cityInfo.classList.add('city-info'); const location = document.createElement('h3'); location.innerText = response.name; const temperature = document.createElement('h3'); temperature.classList.add('temp'); if (unit === 'metric') { temperature.innerHTML = `${Math.floor(response.main.temp)}<span>&#xb0;</span>C`; } else { temperature.innerHTML = `${Math.floor(response.main.temp)}<span>&#xb0;</span>F`; } cityInfo.appendChild(location); cityInfo.appendChild(temperature); const weatherDescription = document.createElement('div'); weatherDescription.classList.add('weather-description'); const weatherIcon = document.createElement('img'); weatherIcon.src = `http://openweathermap.org/img/wn/${response.weather[0].icon}@2x.png`; weatherIcon.alt = response.weather[0].description; const description = document.createElement('h4'); description.classList.add('weather-desc'); description.innerText = response.weather[0].description; weatherDescription.appendChild(weatherIcon); weatherDescription.appendChild(description); displayArea.appendChild(cityInfo); displayArea.appendChild(weatherDescription); return displayArea; }; export default contentLoader;
0322d1eaf0183e11f1efff95195b964226c410bd
[ "JavaScript" ]
2
JavaScript
fegzycole/Weather-App
af3a12a6f55de354b26dff58dc4c60f7f6c7aac8
89b9a06afc8392cbd80777253e51136ace8d51df
refs/heads/main
<repo_name>CessarGarcia/Ionicbasic<file_sep>/src/app/detalle-receta/detalle-receta.page.ts import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { Receta } from '../recetas/receta.models'; import { RecetaService } from '../recetas/receta.service'; @Component({ selector: 'app-detalle-receta', templateUrl: './detalle-receta.page.html', styleUrls: ['./detalle-receta.page.scss'], }) export class DetalleRecetaPage implements OnInit { idReceta:number; receta:Receta; constructor( private ActivatedRoute:ActivatedRoute, private router: Router, private recetaService: RecetaService ) { } ngOnInit() { this.ActivatedRoute.paramMap.subscribe( paraMap =>{ this.idReceta =Number.parseInt(paraMap.get('idReceta')); console.log(this.idReceta); this.receta = this.recetaService.getRecetas(this.idReceta); console.log(this.idReceta); } ); } } <file_sep>/src/app/recetas/recetas.page.ts import { Component, OnInit } from '@angular/core'; import { Receta } from './receta.models'; import { RecetaService } from './receta.service'; @Component({ selector: 'app-recetas', templateUrl: './recetas.page.html', styleUrls: ['./recetas.page.scss'], }) export class RecetasPage implements OnInit { recetas:Receta[]; constructor(private recetaService: RecetaService) { } ngOnInit() { this.recetas=this.recetaService.getRectas(); } }
3a673e1a904c58d3fd77fdfd6e581856e7c4923e
[ "TypeScript" ]
2
TypeScript
CessarGarcia/Ionicbasic
37b2d7922e0f25413837444dac59eb09a060481b
e35d2ffec7d94c13a7c1b3fe19a24d5525f9137c
refs/heads/main
<file_sep>cmake_minimum_required(VERSION 3.10) project(labyrinth) set(CMAKE_CXX_STANDARD 11) add_executable(Labyrinth labyrinth.cpp) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/input.txt ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)<file_sep># Longest Path in a Labyrinth The C++ code finds the longest path in a Labyrinth. A simple recursive approach is used to find the solution here. ## How to build Build using following commands: ``` mkdir build && cd build cmake ../ make ``` ## How to run To run for the default input: Run ` ./labyrinth` To give your own input: Run ` ./labyrinth <path to input file>` Example `./labyrinth ../input2.txt`<file_sep>#include <iostream> #include <fstream> #include <vector> #include <string> std::vector<int> dir_r = {0, 0, -1, 1}; std::vector<int> dir_c = {-1, 1, 0, 0}; std::vector<std::string> read_maze(std::string file) { std::vector<std::string> maze; std::ifstream maze_file; std::string row; maze_file.open(file); if (!maze_file) { std::cout << "Unable to open file!"; return {}; } else { while (std::getline(maze_file, row)) maze.emplace_back(row); maze_file.close(); return maze; } } void print_maze(std::vector<std::string> &maze) { for (int i = 0; i < maze.size(); i++) { for (int j = 0; j < maze[0].size(); j++) { std::cout << maze[i][j] << " "; } std::cout << "\n"; } } bool is_safe(std::vector<std::string> &maze, std::pair<int, int> cell) { return (cell.first >= 0 && cell.first < maze.size() && cell.second >= 0 && cell.second < maze[0].size() && maze[cell.first][cell.second] == '.'); } int labyrinth_solver(std::vector<std::string> &maze, std::pair<int, int> cell, int counter) { maze[cell.first][cell.second] = '0' + counter; int max_length = 0; for (int i = 0; i < dir_r.size(); i++) { std::pair<int, int> new_cell; new_cell.first = cell.first + dir_r[i]; new_cell.second = cell.second + dir_c[i]; if (is_safe(maze, new_cell)) { int length = labyrinth_solver(maze, new_cell, counter + 1); max_length = std::max(max_length, length); } } return 1 + max_length; } std::pair<int, std::pair<int, int>> find_longest_path(std::vector<std::string> maze) { std::pair<int, int> cell = std::make_pair(-1, -1); int longest_length = -1; for (int i = 0; i < maze[0].size(); i++) { if (maze[0][i] == '.') { int length = labyrinth_solver(maze, std::make_pair(0, i), 0); if (length > longest_length) { longest_length = length; cell = std::make_pair(0, i); } } } return std::make_pair(longest_length, cell); } int main(int argc, char *argv[]) { std::string input_file = "input.txt"; std::vector<std::string> maze; std::pair<int, std::pair<int, int>> longest_path; if (argc > 1) { input_file = argv[1]; } maze = read_maze(input_file); longest_path = find_longest_path(maze); labyrinth_solver(maze, longest_path.second, 0); std::cout << longest_path.first << "\n"; print_maze(maze); return 0; }
3108384b0bbfa07b042815c6d3feb45f3f6b8f48
[ "Markdown", "CMake", "C++" ]
3
CMake
tomvieira/longest-path-in-labyrinth
5fae7ab0c245b243845d019069ad8e153775e4e9
b8deb02952ff36f4a9a57508669d61c6af502dfe
refs/heads/master
<repo_name>BIC-MNI/EBTKS<file_sep>/version.cc #include <config.h> char* bicpl_version_string = PACKAGE " v" VERSION; <file_sep>/src/amoeba.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: amoeba.cc,v $ $Revision: 1.1 $ $Author: jason $ $Date: 2001-11-09 16:37:24 $ $State: Exp $ --------------------------------------------------------------------------*/ /* ---------------------------------------------------------------------------- @COPYRIGHT : Copyright 1993,1994,1995 <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- */ #include <config.h> #include "amoeba.h" #include <assert.h> #include "trivials.h" #define FLIP_RATIO 1.0 #define CONTRACT_RATIO 0.5 #define STRETCH_RATIO 2.0 #define for_less( i, start, end ) for( (i) = (start); (i) < (end); ++(i) ) /* ----------------------------- MNI Header ----------------------------------- @NAME : numerically_close @INPUT : n1 n2 threshold_ratio @OUTPUT : @RETURNS : TRUE if the numbers are within the threshold ratio @DESCRIPTION: Decides if two numbers are close to each other. @METHOD : @GLOBALS : @CALLS : @CREATED : 1993 <NAME> @MODIFIED : ---------------------------------------------------------------------------- */ Boolean numerically_close( double n1, double n2, double threshold_ratio ) { double avg, diff; diff = n1 - n2; if( diff < 0.0 ) diff = -diff; if( n1 <= threshold_ratio && n1 >= -threshold_ratio && n2 <= threshold_ratio && n2 >= -threshold_ratio ) { return( diff <= threshold_ratio ); } avg = (n1 + n2) / 2.0; if( avg == 0.0 ) return( diff <= (double) threshold_ratio ); if( avg < 0.0 ) avg = -avg; return( (diff / avg) <= (double) threshold_ratio ); } /* ----------------------------- MNI Header ----------------------------------- @NAME : get_function_value @INPUT : amoeba parameters @OUTPUT : @RETURNS : function value @DESCRIPTION: Evaluates the function being minimized by amoeba, by calling the user function. @METHOD : @GLOBALS : @CALLS : @CREATED : 1993 <NAME> @MODIFIED : ---------------------------------------------------------------------------- */ double get_function_value( amoeba_struct *amoeba, float parameters[] ) { return( (*amoeba->function) ( amoeba->function_data, parameters ) ); } /* ----------------------------- MNI Header ----------------------------------- @NAME : initialize_amoeba @INPUT : n_parameters initial_parameters parameter_deltas function function_data tolerance @OUTPUT : amoeba @RETURNS : @DESCRIPTION: Initializes the amoeba structure to minimize the function. @METHOD : @GLOBALS : @CALLS : @CREATED : 1993 <NAME> @MODIFIED : ---------------------------------------------------------------------------- */ void initialize_amoeba( amoeba_struct *amoeba, int n_parameters, double initial_parameters[], double parameter_deltas[], amoeba_function function, void *function_data, double tolerance ) { int i, j; amoeba->n_parameters = n_parameters; amoeba->function = function; amoeba->function_data = function_data; amoeba->tolerance = tolerance; amoeba->n_steps_no_improvement = 0; typedef float * FloatPtr; amoeba->parameters = new FloatPtr[n_parameters + 1]; assert(amoeba->parameters); for (i = 0; i < n_parameters + 1; i++) { amoeba->parameters[i] = new float[n_parameters]; assert(amoeba->parameters[i]); } amoeba->values = new double[n_parameters + 1]; amoeba->sum = new double[n_parameters]; /* ALLOC2D( amoeba->parameters, n_parameters+1, n_parameters ); ALLOC( amoeba->values, n_parameters+1 ); ALLOC( amoeba->sum, n_parameters ); */ for_less( j, 0, n_parameters ) amoeba->sum[j] = 0.0; for_less( i, 0, n_parameters+1 ) { for_less( j, 0, n_parameters ) { amoeba->parameters[i][j] = (float) initial_parameters[j]; if( i > 0 && j == i - 1 ) amoeba->parameters[i][j] += parameter_deltas[j]; amoeba->sum[j] += amoeba->parameters[i][j]; } amoeba->values[i] = get_function_value( amoeba, amoeba->parameters[i] ); } } /* ----------------------------- MNI Header ----------------------------------- @NAME : get_amoeba_parameters @INPUT : amoeba @OUTPUT : parameters @RETURNS : function value @DESCRIPTION: Passes back the current position of the amoeba (best value), and returns the function value at that point. @METHOD : @GLOBALS : @CALLS : @CREATED : 1993 <NAME> @MODIFIED : ---------------------------------------------------------------------------- */ double get_amoeba_parameters( amoeba_struct *amoeba, double parameters[] ) { int i, j, low; low = 0; for_less( i, 1, amoeba->n_parameters+1 ) { if( amoeba->values[i] < amoeba->values[low] ) low = i; } for_less( j, 0, amoeba->n_parameters ) parameters[j] = (double) amoeba->parameters[low][j]; return( amoeba->values[low] ); } /* ----------------------------- MNI Header ----------------------------------- @NAME : terminate_amoeba @INPUT : amoeba @OUTPUT : @RETURNS : @DESCRIPTION: Frees the amoeba. @METHOD : @GLOBALS : @CALLS : @CREATED : 1993 <NAME> @MODIFIED : ---------------------------------------------------------------------------- */ void terminate_amoeba( amoeba_struct *amoeba ) { for (unsigned i = 0; i < amoeba->n_parameters + 1; i++) delete [] amoeba->parameters[i]; delete [] amoeba->parameters; delete [] amoeba->values; delete [] amoeba->sum; /* FREE2D( amoeba->parameters ); FREE( amoeba->values ); FREE( amoeba->sum ); */ } /* ----------------------------- MNI Header ----------------------------------- @NAME : try_amoeba @INPUT : amoeba sum high fac @OUTPUT : @RETURNS : value @DESCRIPTION: Does a modification to the high vertex of the amoeba and returns the value of the new point. If the new point is better (smaller value), it replaces the high vertex of the amoeba. @METHOD : @GLOBALS : @CALLS : @CREATED : 1993 <NAME> @MODIFIED : ---------------------------------------------------------------------------- */ double try_amoeba( amoeba_struct *amoeba, double sum[], int high, double fac ) { int j; double y_try, fac1, fac2; float *parameters; parameters = new float[amoeba->n_parameters]; assert(parameters); /* ALLOC( parameters, amoeba->n_parameters ); */ fac1 = (1.0 - fac) / amoeba->n_parameters; fac2 = fac - fac1; for_less( j, 0, amoeba->n_parameters ) parameters[j] = sum[j] * fac1 + amoeba->parameters[high][j] * fac2; y_try = get_function_value( amoeba, parameters ); if( y_try < amoeba->values[high] ) { amoeba->values[high] = y_try; for_less( j, 0, amoeba->n_parameters ) { sum[j] += parameters[j] - amoeba->parameters[high][j]; amoeba->parameters[high][j] = parameters[j]; } } delete [] parameters; // FREE( parameters ); return( y_try ); } #define N_STEPS_NO_IMPROVEMENT 20 /* ----------------------------- MNI Header ----------------------------------- @NAME : perform_amoeba @INPUT : amoeba @OUTPUT : @RETURNS : TRUE if numerically significant improvement @DESCRIPTION: Performs one iteration of an amoeba, returning true if a numerically significant improvement has been found recently. Even if it returns FALSE, you can keep calling this function, since it may be contracting with no improvement, but will eventually shrink small enough to get an improvment. @METHOD : @GLOBALS : @CALLS : @CREATED : 1993 <NAME> @MODIFIED : ---------------------------------------------------------------------------- */ Boolean perform_amoeba( amoeba_struct *amoeba ) { int i, j, low, high, next_high; double y_try, y_save; Boolean improvement_found; improvement_found = TRUE; if( amoeba->values[0] > amoeba->values[1] ) { high = 0; next_high = 1; } else { high = 1; next_high = 0; } low = next_high; for_less( i, 2, amoeba->n_parameters+1 ) { if( amoeba->values[i] < amoeba->values[low] ) low = i; else if( amoeba->values[i] > amoeba->values[high] ) { next_high = high; high = i; } else if( amoeba->values[i] > amoeba->values[next_high] ) next_high = i; } if( numerically_close( amoeba->values[low], amoeba->values[high], amoeba->tolerance ) ) { if( ++amoeba->n_steps_no_improvement >= N_STEPS_NO_IMPROVEMENT ) improvement_found = FALSE; } else amoeba->n_steps_no_improvement = 0; y_try = try_amoeba( amoeba, amoeba->sum, high, -FLIP_RATIO ); if( y_try <= amoeba->values[low] ) y_try = try_amoeba( amoeba, amoeba->sum, high, STRETCH_RATIO ); else if( y_try >= amoeba->values[next_high] ) { y_save = amoeba->values[high]; y_try = try_amoeba( amoeba, amoeba->sum, high, CONTRACT_RATIO ); if( y_try >= y_save ) { for_less( i, 0, amoeba->n_parameters+1 ) { if( i != low ) { for_less( j, 0, amoeba->n_parameters ) { amoeba->parameters[i][j] = (amoeba->parameters[i][j] + amoeba->parameters[low][j]) / 2.0; } amoeba->values[i] = get_function_value( amoeba, amoeba->parameters[i] ); } } for_less( j, 0, amoeba->n_parameters ) { amoeba->sum[j] = 0.0; for_less( i, 0, amoeba->n_parameters+1 ) amoeba->sum[j] += amoeba->parameters[i][j]; } } } return( improvement_found ); } <file_sep>/templates/Matrix3D.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: Matrix3D.cc,v $ $Revision: 1.2 $ $Author: bert $ $Date: 2003-04-16 15:09:37 $ $State: Exp $ --------------------------------------------------------------------------*/ #include "Matrix3D.h" #include "MatrixSupport.h" #include "FileIO.h" #include <sys/stat.h> template <class Type> unsigned Mat3D<Type>::_rangeErrorCount = 10; template <class Type> Boolean Mat3D<Type>::flushToDisk = TRUE; // // Some mathematical operations // template <class T1, class T2> Mat3D<T1>& operator += (Mat3D<T1>& A, const Mat3D<T2>& B) { unsigned nslis = A.getslis(); if ((B.getslis() != nslis) || (B.getrows() != A.getrows()) || (B.getcols() != A.getcols())) { cerr << "Matrices of incompatible sizes for +=" << endl; return A; } for(unsigned s = 0; s < nslis; s++) A[s] += B[s]; return A; } template <class T1, class T2> Mat3D<T1>& operator -= (Mat3D<T1>& A, const Mat3D<T2>& B) { unsigned nslis = A.getslis(); if ((B.getslis() != nslis) || (B.getrows() != A.getrows()) || (B.getcols() != A.getcols())) { cerr << "Matrices of incompatible sizes for -=" << endl; return A; } for(unsigned s = 0; s < nslis; s++) A[s] -= B[s]; return A; } template <class T1, class T2> Mat3D<T1>& pmultEquals (Mat3D<T1>& A, const Mat3D<T2>& B) { unsigned nslis = A.getslis(); if ((B.getslis() != nslis) || (B.getrows() != A.getrows()) || (B.getcols() != A.getcols())) { cerr << "Matrices of incompatible sizes for pmultEquals" << endl; return A; } for(unsigned s = 0; s < nslis; s++) pmultEquals(A[s], B[s]); return A; } template <class T1, class T2> Mat3D<T1>& pdivEquals (Mat3D<T1>& A, const Mat3D<T2>& B) { unsigned nslis = A.getslis(); if ((B.getslis() != nslis) || (B.getrows() != A.getrows()) || (B.getcols() != A.getcols())) { cerr << "Matrices of incompatible sizes for pdivEquals" << endl; return A; } for(unsigned s = 0; s < nslis; s++) pdivEquals(A[s], B[s]); return A; } /* template <class T1, class T2> Mat<T1> operator * (const Mat<T1>& A, const Mat<T2>& B) { unsigned arows = A.getrows(); unsigned acols = A.getcols(); unsigned brows = B.getrows(); unsigned bcols = B.getcols(); unsigned bmaxcols = B.getmaxcols(); Mat<T1> Temp(arows, bcols); if (acols != brows) { cerr << "Mat sizes incompatible for *" << endl; return Temp; } T1 *tempPtr = (T1 *) Temp.getEl()[0]; const T1 **rowPtr = A.getEl(); for (unsigned i = arows; i; i--) { const T2 *argColPtr = B.getEl()[0]; for (unsigned j = bcols; j; j--) { const T1 *ptr = *rowPtr; const T2 *argPtr = argColPtr++; *tempPtr = (T1) 0; for (unsigned k = acols; k; k--) { *tempPtr += *ptr++ * (T1) *argPtr; argPtr += bmaxcols; } tempPtr++; } rowPtr++; } return Temp; } */ /********************************* Mat3D class definitions and member functions **********************************/ // //-------------------------// // template <class Type> Mat3D<Type>::Mat3D(const Mat3D<Type>& A) { _slis = A._slis; _rows = A._rows; _cols = A._cols; _slices = 0; _el = 0; _allocateEl(); for(unsigned s=0; s<_slis ; s++) _slices[s] = A._slices[s]; _setEl(); } // //-------------------------// // template <class Type> Mat3D<Type>::Mat3D(unsigned nslis, unsigned nrows, unsigned ncols, Type value) { if (((int)nslis < 0) || ((int)nrows < 0) || ((int)ncols < 0)) { cerr << "Error: cannot create Mat3D with negative dimension." << endl; exit(1); } _slis = nslis; _rows = nrows; _cols = ncols; _el = 0; _slices = 0; _allocateEl(); if (value != 0){ for(unsigned s=0; s<_slis; s++) _slices[s].fill(value); } } // //-------------------------// // template <class Type> Mat3D<Type>::Mat3D(unsigned nslis, unsigned nrows, unsigned ncols) { _slis = nslis; _rows = nrows; _cols = ncols; _el = 0; _slices = 0; _allocateEl(); } // //-------------------------// // //this function will copy same block of data to every slice in image template <class Type> Mat3D<Type>::Mat3D(unsigned nslis, unsigned nrows, unsigned ncols, const Type *data) { _slis = nslis; _rows = nrows; _cols = ncols; _el = 0; _slices = 0; _allocateEl(); for(unsigned s=0; s<_slis; s++) _slices[s] = Mat<Type>(_rows, _cols, data); _setEl(); } // //-------------------------// // template <class Type> Mat3D<Type>::Mat3D(const char *filename, int type) { _slis = 0; _rows = 0; _cols = 0; _el = 0; _slices = 0; switch(type) { case RAW: loadRaw(filename); break; case ASCII: loadAscii(filename); break; } } // //-------------------------// // template <class Type> Mat3D<Type>::~Mat3D() { clear(); } //// template <class Type> void Mat3D<Type>::clear() { if (_slices) { #ifdef DEBUG cout << "Freeing 3D Matrix " << _el << endl; #endif delete [] _slices; delete [] _el; } _slices = 0; _el = 0; _slis = _rows = _cols = 0; } // // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::setSlice(unsigned slice, const Mat<Type>& A) { if ((A.getrows() != _rows) || (A.getcols() != _cols)) { cerr << "Blabla" << endl; return *this; } if (slice >= _slis) { cerr << "Blabla" << endl; return *this; } _slices[slice] = A; _setEl(); return *this; } /************************************************************************ Three dimensional Mat display functions *************************************************************************/ /************************************************************************ This display function displays each two dimensional slice of the entire matrix. A seperate function is used for matrices with complex _elements *************************************************************************/ template <class Type> ostream& Mat3D<Type>::display(ostream& os) const { for(unsigned s=0; s < _slis; s++) os << s << endl << _slices[s] << endl; return os; } /************************************************************************ This display function displays the requested portion of the three dimensional matrix. The first two arguments are the start and stop _slices(respectiv_ely)(first slice starts at zero) that are to be displayed. The third and fourth arguments are the start and stop _rows and the fifth and sixth arguments are the start and stop columns(all start at zero). A seperate function is used for three dimensional matrices. *************************************************************************/ template <class Type> ostream& Mat3D<Type>::display(ostream& os, unsigned s1, unsigned s2, unsigned r1, unsigned r2, unsigned c1, unsigned c2) const { //Make sure that the stop dimensions are greater than the start dimensions if ((s1 > s2) || (r1 > r2) || (c1 > c2)){ cerr << "Error in display: improper slice or row or column sizes." << endl; cerr << s1 << " to " << s2 << " and" << endl; cerr << r1 << " to " << r2 << " and" << endl; cerr << c1 << " to " << c2 << endl; exit(1); } //Make sure that the requested _slices are actually within the matrix if (s2 >= _slis) { cerr<<"The requested _slices are not all defined for this matrix"<<endl; exit(1); } for(unsigned s=s1; s <= s2; s++) os << s << endl << _slices[s](r1,r2,c1,c2) << endl; return os; } /***************************************************************************** Three dimensional matrix assignment operators******************************************************************************/ template <class Type> Mat3D<Type>& Mat3D<Type>::operator = (const Mat3D<Type>& A) { if (this == &A) return *this; if ((A._slis != _slis) || (A._rows != _rows) || (A._cols != _cols)) { _slis = A._slis; _rows = A._rows; _cols = A._cols; _allocateEl(); } if (_slices && _el) { for(unsigned s=0; s < _slis ; s++) _slices[s] = A._slices[s]; _setEl(); } return *this; } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::absorb(Mat3D<Type>& A) { if (this == &A) return *this; // Delete current contents; if (_slices) { delete [] _slices; delete [] _el; } // Copy all from A _slis = A._slis; _rows = A._rows; _cols = A._cols; _slices = A._slices; _el = A._el; // Empty A A._slis = A._rows = A._cols = 0; A._slices = 0; A._el = 0; return *this; } // //-------------------------// // template <class Type> Type Mat3D<Type>::operator () (unsigned s, unsigned r, unsigned c) const { if ((s >= _slis) || (r >= _rows) || (c >= _cols)) { if (_rangeErrorCount) { cerr << "Error: indices (" << s << ", " << r << ", " << c << ") exceed matrix dimensions. Changed to (" << ::min(s, _slis - 1) << ", " << ::min(r, _rows - 1) << ", " << ::min(c, _cols - 1) << ")" << endl; _rangeErrorCount--; } s = ::min(s, _slis - 1); r = ::min(r, _rows - 1); c = ::min(c, _cols - 1); } return(_el[s][r][c]); } // //-------------------------// // template <class Type> Type& Mat3D<Type>::operator () (unsigned s, unsigned r, unsigned c) { if ((s >= _slis) || (r >= _rows) || (c >= _cols)) { if (_rangeErrorCount) { cerr << "Error: indices (" << s << ", " << r << ", " << c << ") exceed matrix dimensions. Changed to (" << ::min(s, _slis - 1) << ", " << ::min(r, _rows - 1) << ", " << ::min(c, _cols - 1) << ")" << endl; _rangeErrorCount--; } s = ::min(s, _slis - 1); r = ::min(r, _rows - 1); c = ::min(c, _cols - 1); } return(_el[s][r][c]); } // // // crop a section of the Mat3D template <class Type> Mat3D<Type> Mat3D<Type>::operator () (unsigned s1, unsigned s2, unsigned r1, unsigned r2, unsigned c1, unsigned c2) const { if ((s1 > s2) || (s1 >= _slis) || (s2 >= _slis)) { cerr << "Error in cropting: improper _slis sizes." << endl; cerr << s1 << " to " << s2 << " and" << endl; exit(1); } Mat3D<Type> A(s2-s1+1,r2-r1+1,c2-c1+1); for(unsigned s=s1; s<= s2 ; s++) A.setSlice(s, _slices[s](r1,r2,c1,c2)); return(A); } /**************************************************************************** These overloaded operators allow accessing of individual _elements within the 3D matrix. By convention, the first _element of the first slice of the matrix is lab_eled _element zero. Since the matrix is stored in row major format, The _element numbers increase going to the right and at the following row. The _element at the last row and last column of the last slice corresponds to the largest possible value of the input argument. *****************************************************************************/ /**************************************************************************** This accessing operator prevents accidental modification by having a constant output argument. A seperate function is used for accessing _elements within complex matrices. *****************************************************************************/ template <class Type> Type Mat3D<Type>::operator () (unsigned n) const { if (n >= _slis*_rows*_cols) { if (_rangeErrorCount) { cerr << "Error: index " << n << " exceeds matrix dimensions. "; cerr << "Changed to " << _slis*_rows*_cols - 1 << endl; _rangeErrorCount--; } n = _slis*_rows*_cols - 1; } unsigned slice_index= n/(_rows*_cols); unsigned twoD_index= (n%(_rows*_cols)); unsigned row_index= twoD_index/_cols; unsigned columnindex= twoD_index%_cols; return _el[slice_index][row_index][columnindex]; } /**************************************************************************** This accessing operator allows modification of the individual _elements of the matrix. A seperate function is used for accessing _elements within complex matrices. *****************************************************************************/ template <class Type> Type& Mat3D<Type>::operator () (unsigned n) { if (n >= _slis*_rows*_cols) { if (_rangeErrorCount) { cerr << "Error: index " << n << " exceeds matrix dimensions. "; cerr << "Changed to " << _slis*_rows*_cols - 1 << endl; _rangeErrorCount--; } n = _slis*_rows*_cols - 1; } unsigned slice_index= n/(_rows*_cols); unsigned twoD_index= (n%(_rows*_cols)); unsigned row_index= twoD_index/_cols; unsigned columnindex= twoD_index%_cols; return _el[slice_index][row_index][columnindex]; } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::operator () (const Mat3D<Type>& A) { if ((A._slis != _slis) || (A._rows != _rows) || (A._cols != _cols)) { _slis = A._slis; _rows = A._rows; _cols = A._cols; _allocateEl(); } for(unsigned s=0; s < _slis ; s++) _slices[s] = A._slices[s]; _setEl(); return *this; } // //-------------------------// // template <class Type> int Mat3D<Type>::operator != (const Mat3D<Type>& Arg) const { if ((_slis != Arg._slis)) return 1; for(unsigned s=0; s<_slis; s++) if (_slices[s] != Arg._slices[s]) return 1; return 0; } template <class Type> Mat3D<Type>& Mat3D<Type>::operator += (complex addend) { for(unsigned s=0; s<_slis ; s++) _slices[s] += addend; return *this; } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::operator *= (complex scale) { for(unsigned s=0; s<_slis ; s++) _slices[s] *= scale; return *this; } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::applyElementWise(double (*function)(double)) { for(unsigned s = 0; s < _slis; s++) _slices[s].applyElementWise(function); return(*this); } template <class Type> Mat3D<Type>& Mat3D<Type>::applyElementWiseC2D(double (*function)(complex)) { for(unsigned s = 0; s < _slis; s++) _slices[s].applyElementWiseC2D(function); return(*this); } template <class Type> Mat3D<Type>& Mat3D<Type>::applyElementWiseC2C(complex (*function)(complex)) { for(unsigned s = 0; s < _slis; s++) _slices[s].applyElementWiseC2C(function); return(*this); } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::applyIndexFunction(IndexFunction3D F) { for (unsigned s = 0; s < _slis; s++) { Type *elPtr = *(_el[s]); for (unsigned r = 0; r < _rows; r++) for (unsigned c = 0; c < _rows; c++) *elPtr++ = Type(F(s, r, c)); } return(*this); } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::applyIndexFunction(ComplexIndexFunction3D F) { for (unsigned s = 0; s < _slis; s++) { Type *elPtr = *(_el[s]); for (unsigned r = 0; r < _rows; r++) for (unsigned c = 0; c < _rows; c++) *elPtr++ = Type(F(s, r, c)); } return(*this); } // //-------------------------// // template <class Type> unsigned Mat3D<Type>::length() const { return ::max(_slis, _rows, _cols); } // //-------------------------// // template <class Type> Type Mat3D<Type>::min(unsigned *sli, unsigned *row, unsigned *col) const { Type min = ***_el; unsigned sliOfMin = 0, rowOfMin = 0, colOfMin = 0; Type ***sliPtr = _el; for(unsigned s=_slis; s != 0; s--){ Type **rowPtr = *sliPtr++; for(unsigned i = _rows ; i != 0 ; i--) { Type *colPtr = *rowPtr++; for(unsigned j = _cols ; j != 0 ; j--){ if (*colPtr < min) { min = *colPtr; rowOfMin = i; colOfMin = j; sliOfMin = s; } colPtr++; } } } if (row) *row = rowOfMin; if (col) *col = colOfMin; if (sli) *sli = sliOfMin; return(min); } #ifdef USE_COMPMAT complex Mat3D<complex>::min(unsigned *, unsigned *, unsigned *) const { cerr << "Mat3D<complex>::min() called but not implemented" << endl; return 0; } #endif #ifdef USE_FCOMPMAT fcomplex Mat3D<fcomplex>::min(unsigned *, unsigned *, unsigned *) const { cerr << "Mat3D<fcomplex>::min() called but not implemented" << endl; return 0; } #endif // //-------------------------// // template <class Type> Type Mat3D<Type>::max(unsigned *sli, unsigned *row, unsigned *col) const { Type max = ***_el; unsigned sliOfMax = 0, rowOfMax = 0, colOfMax = 0; for (unsigned s=0 ; s< _slis ; s++){ Type **rowPtr = _el[s]; for(unsigned i = _rows ; i != 0 ; i--) { Type *colPtr = *rowPtr++; for(unsigned j = _cols ; j != 0 ; j--){ if (*colPtr > max) { max = *colPtr; rowOfMax = i; colOfMax = j; colOfMax = s; } colPtr++; } } } if (row) *row = rowOfMax; if (col) *col = colOfMax; if (sli) *sli = sliOfMax; return(max); } #ifdef USE_COMPMAT complex Mat3D<complex>::max(unsigned *, unsigned *, unsigned *) const { cerr << "Mat3D<complex>::max() called but not implemented" << endl; return 0; } #endif #ifdef USE_FCOMPMAT fcomplex Mat3D<fcomplex>::max(unsigned *, unsigned *, unsigned *) const { cerr << "Mat3D<fcomplex>::max() called but not implemented" << endl; return 0; } #endif // //-------------------------// // template <class Type> Type Mat3D<Type>::median(Type minVal, Type maxVal) const { return asArray(minVal, maxVal).medianVolatile(); } #ifdef USE_COMPMAT complex Mat3D<complex>::median(complex, complex) const { cerr << "Mat3D<complex>::median() called but not implemented" << endl; return 0; } #endif #ifdef USE_FCOMPMAT fcomplex Mat3D<fcomplex>::median(fcomplex, fcomplex) const { cerr << "Mat3D<fcomplex>::median() called but not implemented" << endl; return 0; } #endif // //-------------------------// // template <class Type> complex Mat3D<Type>::csum() const { complex result = 0; for(unsigned s=0; s<_slis ; s++) result += _slices[s].csum(); return result; } template <class Type> complex Mat3D<Type>::csum2() const { complex result = 0; for(unsigned s=0; s<_slis ; s++) result += _slices[s].csum2(); return result; } template <class Type> complex Mat3D<Type>::ctrace() const { unsigned mindim = ::min(_slis, _rows, _cols); complex temp = 0; for (unsigned i=0 ; i < mindim ; i++) temp += _el[i][i][i]; return(temp); } template <class Type> complex Mat3D<Type>::cdet() const { cerr << "Mat3D::cdet() called but not implemented" << endl; return 0; } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::exp() { for(unsigned s = 0; s < _slis; s++) _slices[s].exp(); return *this; } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::log() { for(unsigned s = 0; s < _slis; s++) _slices[s].log(); return *this; } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::cos() { for(unsigned s = 0; s < _slis; s++) _slices[s].cos(); return *this; } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::sin() { for(unsigned s = 0; s < _slis; s++) _slices[s].sin(); return *this; } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::abs() { for(unsigned s = 0; s < _slis; s++) _slices[s].abs(); return *this; } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::conj() { for(unsigned s=0; s<_slis; s++) _slices[s].conj(); return *this; } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::round() { for(unsigned s = 0; s < _slis; s++) _slices[s].round(); return *this; } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::sqrt() { for(unsigned s = 0; s < _slis; s++) _slices[s].sqrt(); return *this; } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::pow(double exponent) { for(unsigned s = 0; s < _slis; s++) _slices[s].pow(exponent); return *this; } // //-------------------------// // template < class Type> Mat3D<Type>& Mat3D<Type>::clip(Type minVal, Type maxVal, Type minFill, Type maxFill) { for (unsigned s = 0; s < _slis; s++) _slices[s].clip(minVal, maxVal, minFill, maxFill); return(*this); } // //-------------------------// // template < class Type> Mat3D<Type>& Mat3D<Type>::map(const ValueMap& valueMap) { for(unsigned s = 0; s < _slis; s++) _slices[s].map(valueMap); return(*this); } // //-------------------------// // //The imagescale function will scale the image between 0 and 255 //unless given a range with a minimum and maximum value //It also accept minimum and maximum values template < class Type> Mat3D<Type>& Mat3D<Type>::scale(double minout, double maxout, double minin, double maxin) { if (minin >= maxin) { minin = asDouble(min()); maxin = asDouble(max()); } for(unsigned s = 0; s < _slis; s++) _slices[s].scale(minout, maxout, minin, maxin); return(*this); } // //------------------------/ // template <class Type> Boolean Mat3D<Type>::load(const char *filename, int type) const { Boolean status = FALSE; switch(type) { case RAW: status = loadRaw(filename); break; case ASCII: status = loadAscii(filename); break; default: cerr << "Unrecognized type for loading" << endl; status = FALSE; break; } return status; } template <class Type> Boolean Mat3D<Type>::loadRaw(const char *filename, unsigned nslis, unsigned nrows, unsigned ncols) { InputFile matrixFile(filename); if (!matrixFile) { cerr << "Error in loadRaw: error opening file." << endl; return FALSE; } _checkMatrixDimensions(filename, nslis, nrows, ncols); if ((nslis && (nslis != _slis)) || (nrows && (nrows != _rows)) || (_cols && (ncols != _cols))) { _slis = nslis; _rows = nrows; _cols = ncols; _allocateEl(); } for(unsigned s=0; s<_slis; s++) if (!matrixFile.stream().read((unsigned char *)_el[s] + _rows*sizeof(Type *), _rows*_cols*sizeof(Type))) return FALSE; return TRUE; } // //-------------------------// // template <class Type> Boolean Mat3D<Type>::loadAscii(const char *filename) { InputFile infile(filename); if (!infile){ cerr << "Error in loadAsccii: error opening file." << endl; return FALSE; } infile >> _slis >> _rows >> _cols; _allocateEl(); for(unsigned s=0; s<_slis; s++) { for(unsigned i=0; i < _rows; i++) { for(unsigned j=0; j < _cols ; j++) infile >> _el[s][i][j]; } } return TRUE; } #ifdef USE_COMPMAT Boolean Mat3D<complex>::loadAscii(const char *) { cerr << "Mat3D<complex>::loadAscii() called but not implemented" << endl; return FALSE; } #endif #ifdef USE_FCOMPMAT Boolean Mat3D<fcomplex>::loadAscii(const char *) { cerr << "Mat3D<fcomplex>::loadAscii() called but not implemented" << endl; return FALSE; } #endif template <class Type> Boolean Mat3D<Type>::save(const char *filename, int type) const { Boolean status = FALSE; switch(type) { case RAW: status = saveRaw(filename); break; case ASCII: status = saveAscii(filename); break; default: cerr << "Unrecognized type for saving" << endl; status = FALSE; break; } return status; } // //-------------------------// // template <class Type> Boolean Mat3D<Type>::saveRaw(const char *filename) const { ofstream outfile(filename); if (!outfile) { cerr << "Error in saveRaw: error opening file." << endl; return FALSE; } Boolean status = TRUE; for(unsigned s=0; s<_slis && status; s++) if (!outfile.write((unsigned char *)_el[s] + _rows*sizeof(Type *), _rows*_cols*sizeof(Type))) status = FALSE; outfile.close(); return status; } template <class Type> Boolean Mat3D<Type>::saveAscii(const char *filename) const { ofstream outfile(filename); if (!outfile){ cerr << "Error in saveAscciifile: error opening file." << endl; return FALSE; } Boolean status = TRUE; outfile << _slis << " " << _rows << " " << _cols << endl; if (!outfile) status = FALSE; for(unsigned s=0; s<_slis && status; s++) { for(unsigned i=0; i < _rows && status; i++) { for(unsigned j=0; j < _cols && status; j++) if (!(outfile << _el[s][i][j] << " ")) status = FALSE; outfile << endl; } outfile << endl; } outfile.close(); return status; } // //------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::insert(const Mat3D<Type>& A, int slice, int row, int col) { int nSlis = A._slis; if ((slice + nSlis > _slis)) cerr << "Warning: Mat3D<Type>::insert() in _slis" << endl; if (slice + nSlis > _slis) nSlis = _slis - slice; for(unsigned s=0; s< nSlis; s++) _slices[s+slice] = _slices[s+slice].insert(A._slices[s], row, col); return *this; } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::insert(const char *path, unsigned nslis, unsigned nrows, unsigned ncols, int slice, int row, int col) { InputFile argFile(path); if (!argFile) { cerr << "Couldn't open file " << path << endl; return *this; } _checkMatrixDimensions(path, nslis, nrows, ncols); // Create a row-sized buffer Type *buffer = 0; allocateArray(ncols, buffer); if (!buffer) { cerr << "Couldn't allocate buffer" << endl; return *this; } int destSlice = slice; for (unsigned s = nslis; s; s--, destSlice++) { Boolean sliceValid = (destSlice >= 0) && (destSlice < _slis); int destRow = row; for (unsigned i = nrows; i; i--, destRow++) { if (!(argFile.stream().read((unsigned char *) buffer, ncols*sizeof(Type)))) { cerr << "Error while reading file " << path << endl; freeArray(buffer); return *this; } if (sliceValid && (destRow >= 0) && (destRow < _rows)) { Type *elPtr = _el[destSlice][destRow] + col; const Type *bufferPtr = buffer; int destCol = col; for (unsigned j = ncols; j; j--, destCol++, elPtr++, bufferPtr++) if ((destCol >= 0) && (destCol < _cols)) *elPtr = *bufferPtr; } } } freeArray(buffer); return *this; } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::fill(Type value) { for(unsigned s=0; s<_slis; s++) _slices[s].fill(value); return *this; } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::randuniform(double min, double max) { for(unsigned s=0; s<_slis; s++) _slices[s].randuniform(min, max); return *this; } // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::randnormal(double mean, double std) { for(unsigned s=0; s<_slis; s++) _slices[s].randnormal(mean, std); return *this; } // //-------------------------// // // Private functions start // template <class Type> void Mat3D<Type>::_allocateEl() { if (_slices) { #ifdef DEBUG cout << "Freeing 3D Matrix " << _el << endl; #endif delete [] _slices; delete [] _el; } _slices = 0; _el = 0; if (_slis && _rows && _cols) { _slices = new Mat<Type> [_slis]; assert(_slices); _el = new Type** [_slis]; assert(_el); #ifdef DEBUG cout << "Allocating 3D real matrix of " << _slis << " _slices at " << _el << endl; #endif for (unsigned slice = 0; slice < _slis; slice++) _slices[slice].resize(_rows, _cols); //done this way to save memory _setEl(); } } // //----------------// // template <class Type> void Mat3D<Type>::_setEl() { if (_slices && _el) for (unsigned s = 0; s < _slis; s++) _el[s] = (Type **) _slices[s].getEl(); } template <class Type> void Mat3D<Type>::_checkMatrixDimensions(const char *path, unsigned& nslis, unsigned& nrows, unsigned& ncols) const { if (Path(path).hasCompressedExtension()) return; struct stat buf; stat(path, &buf); inferDimensions(buf.st_size/sizeof(Type), nslis, nrows, ncols); } template <class Type> Mat3D<Type>& Mat3D<Type>::_fft(unsigned nslis, unsigned nrows, unsigned ncols, FFTFUNC fftFunc) { // Verify dimensions of FFT if ((nslis > 1) && ((nslis < _slis) || !isPowerOf2(nslis))) { cerr << "Warning! Mat3D<Type>::fft():" << endl << " Requested # slices for FFT (" << nslis << ") invalid;" << endl; nslis = ::max(unsigned(4), nextPowerOf2(::max(nslis, _slis))); cerr << " increased to " << nslis << endl; } if ((nrows > 1) && ((nrows < _rows) || !isPowerOf2(nrows))) { cerr << "Warning! Mat3D<Type>::fft():" << endl << " Requested # rows for FFT (" << nrows << ") invalid;" << endl; nrows = ::max(unsigned(4), nextPowerOf2(::max(nrows, _rows))); cerr << " increased to " << nrows << endl; } if ((ncols > 1) && ((ncols < _cols) || !isPowerOf2(ncols))) { cerr << "Warning! Mat3D<Type>::fft():" << endl << " Requested # cols for FFT (" << ncols << ") invalid;" << endl; ncols = ::max(unsigned(4), nextPowerOf2(::max(ncols, _cols))); cerr << " increased to " << ncols << endl; } Boolean doX = (ncols != 1) && (_cols != 1) ? TRUE : FALSE; Boolean doY = (nrows != 1) && (_rows != 1) ? TRUE : FALSE; Boolean doZ = (nslis != 1) && (_slis != 1) ? TRUE : FALSE; if (!nslis) nslis = ::max(unsigned(4), nextPowerOf2(_slis)); else if (nslis == 1) nslis = _slis; if (!nrows) nrows = ::max(unsigned(4), nextPowerOf2(_rows)); else if (nrows == 1) nrows = _rows; if (!ncols) ncols = ::max(unsigned(4), nextPowerOf2(_cols)); else if (ncols == 1) ncols = _cols; // Pad matrix to the final FFT dimensions pad(nslis, nrows, ncols, (nslis - _slis)/2, (nrows - _rows)/2, (ncols - _cols)/2, 0); // Allocate temporary arrays double *real = 0; double *imag = 0; unsigned maxDim = ::max((doZ ? _slis : 1), (doY ? _rows : 1), (doX ? _cols : 1)); allocateArray(maxDim, real); allocateArray(maxDim, imag); assert(real && imag); unsigned slice, row, col; // Take 1D FFT in X (row) direction if (doX) for (slice = 0; slice < _slis; slice++) for(row = 0; row < _rows; row++) { // Fill temporary FFT array double *realPtr = real; double *imagPtr = imag; Type *sourcePtr = _el[slice][row]; for(col = _cols; col; col--) { complex value(*sourcePtr++); *realPtr++ = ::real(value); *imagPtr++ = ::imag(value); } // Calculate 1D FFT fftFunc(_cols, real, imag); // Put results back realPtr = real; imagPtr = imag; sourcePtr = _el[slice][row]; for(col = _cols; col; col--) *sourcePtr++ = Type(abs(complex(*realPtr++, *imagPtr++))); } // Take 1D FFT in Y (column) direction if (doY) for (slice = 0; slice < _slis; slice++) for(col = 0; col < _cols; col++) { // Fill temporary FFT array double *realPtr = real; double *imagPtr = imag; Type *sourcePtr = *_el[slice] + col; for(row = _rows; row; row--) { complex value(*sourcePtr); *realPtr++ = ::real(value); *imagPtr++ = ::imag(value); sourcePtr += _cols; } // Calculate 1D FFT fftFunc(_rows, real, imag); // Put results back realPtr = real; imagPtr = imag; sourcePtr = *_el[slice] + col; for(row = _rows; row; row--) { *sourcePtr = Type(abs(complex(*realPtr++, *imagPtr++))); sourcePtr += _cols; } } // Take 1D FFT in Z (slice) direction if (doZ) { unsigned offset = 0; for (row = 0; row < _rows; row++) for (col = 0; col < _cols; col++, offset++) { // Fill temporary FFT array double *realPtr = real; double *imagPtr = imag; Type ***sourcePtr = _el; for(slice = _slis; slice; slice--) { complex value(*(**sourcePtr++ + offset)); *realPtr++ = ::real(value); *imagPtr++ = ::imag(value); } // Calculate 1D FFT fftFunc(_slis, real, imag); // Put results back realPtr = real; imagPtr = imag; sourcePtr = _el; for(slice = _slis; slice; slice--) *(**sourcePtr++ + offset) = Type(abs(complex(*realPtr++, *imagPtr++))); } } // Free temporary arrays freeArray(real); freeArray(imag); return *this; } #ifdef USE_COMPMAT Mat3D<complex>& Mat3D<complex>::_fft(unsigned nslis, unsigned nrows, unsigned ncols, FFTFUNC fftFunc) { // Verify dimensions of FFT if ((nslis > 1) && ((nslis < _slis) || !isPowerOf2(nslis))) { cerr << "Warning! Mat3D<complex>::fft():" << endl << " Requested # slices for FFT (" << nslis << ") invalid;" << endl; nslis = ::max(unsigned(4), nextPowerOf2(::max(nslis, _slis))); cerr << " increased to " << nslis << endl; } if ((nrows > 1) && ((nrows < _rows) || !isPowerOf2(nrows))) { cerr << "Warning! Mat3D<complex>::fft():" << endl << " Requested # rows for FFT (" << nrows << ") invalid;" << endl; nrows = ::max(unsigned(4), nextPowerOf2(::max(nrows, _rows))); cerr << " increased to " << nrows << endl; } if ((ncols > 1) && ((ncols < _cols) || !isPowerOf2(ncols))) { cerr << "Warning! Mat3D<complex>::fft():" << endl << " Requested # cols for FFT (" << ncols << ") invalid;" << endl; ncols = ::max(unsigned(4), nextPowerOf2(::max(ncols, _cols))); cerr << " increased to " << ncols << endl; } Boolean doX = (ncols != 1) && (_cols != 1) ? TRUE : FALSE; Boolean doY = (nrows != 1) && (_rows != 1) ? TRUE : FALSE; Boolean doZ = (nslis != 1) && (_slis != 1) ? TRUE : FALSE; if (!nslis) nslis = ::max(unsigned(4), nextPowerOf2(_slis)); else if (nslis == 1) nslis = _slis; if (!nrows) nrows = ::max(unsigned(4), nextPowerOf2(_rows)); else if (nrows == 1) nrows = _rows; if (!ncols) ncols = ::max(unsigned(4), nextPowerOf2(_cols)); else if (ncols == 1) ncols = _cols; // Pad matrix to the final FFT dimensions pad(nslis, nrows, ncols, (nslis - _slis)/2, (nrows - _rows)/2, (ncols - _cols)/2, 0); // Allocate temporary arrays double *real = 0; double *imag = 0; unsigned maxDim = ::max((doZ ? _slis : 1), (doY ? _rows : 1), (doX ? _cols : 1)); allocateArray(maxDim, real); allocateArray(maxDim, imag); assert(real && imag); unsigned slice, row, col; // Take 1D FFT in X (row) direction if (doX) for (slice = 0; slice < _slis; slice++) for(row = 0; row < _rows; row++) { // Fill temporary FFT array double *realPtr = real; double *imagPtr = imag; complex *sourcePtr = _el[slice][row]; for(col = _cols; col; col--) { complex value(*sourcePtr++); *realPtr++ = ::real(value); *imagPtr++ = ::imag(value); } // Calculate 1D FFT fftFunc(_cols, real, imag); // Put results back realPtr = real; imagPtr = imag; sourcePtr = _el[slice][row]; for(col = _cols; col; col--) *sourcePtr++ = complex(*realPtr++, *imagPtr++); } // Take 1D FFT in Y (column) direction if (doY) for (slice = 0; slice < _slis; slice++) for(col = 0; col < _cols; col++) { // Fill temporary FFT array double *realPtr = real; double *imagPtr = imag; complex *sourcePtr = *_el[slice] + col; for(row = _rows; row; row--) { complex value(*sourcePtr); *realPtr++ = ::real(value); *imagPtr++ = ::imag(value); sourcePtr += _cols; } // Calculate 1D FFT fftFunc(_rows, real, imag); // Put results back realPtr = real; imagPtr = imag; sourcePtr = *_el[slice] + col; for(row = _rows; row; row--) { *sourcePtr = complex(*realPtr++, *imagPtr++); sourcePtr += _cols; } } // Take 1D FFT in Z (slice) direction if (doZ) { unsigned offset = 0; for (row = 0; row < _rows; row++) for (col = 0; col < _cols; col++, offset++) { // Fill temporary FFT array double *realPtr = real; double *imagPtr = imag; complex ***sourcePtr = _el; for(slice = _slis; slice; slice--) { complex value(*(**sourcePtr++ + offset)); *realPtr++ = ::real(value); *imagPtr++ = ::imag(value); } // Calculate 1D FFT fftFunc(_slis, real, imag); // Put results back realPtr = real; imagPtr = imag; sourcePtr = _el; for(slice = _slis; slice; slice--) *(**sourcePtr++ + offset) = complex(*realPtr++, *imagPtr++); } } // Free temporary arrays freeArray(real); freeArray(imag); return *this; } #endif #ifdef USE_FCOMPMAT Mat3D<fcomplex>& Mat3D<fcomplex>::_fft(unsigned nslis, unsigned nrows, unsigned ncols, FFTFUNC fftFunc) { // Verify dimensions of FFT if ((nslis > 1) && ((nslis < _slis) || !isPowerOf2(nslis))) { cerr << "Warning! Mat3D<fcomplex>::fft():" << endl << " Requested # slices for FFT (" << nslis << ") invalid;" << endl; nslis = ::max(unsigned(4), nextPowerOf2(::max(nslis, _slis))); cerr << " increased to " << nslis << endl; } if ((nrows > 1) && ((nrows < _rows) || !isPowerOf2(nrows))) { cerr << "Warning! Mat3D<fcomplex>::fft():" << endl << " Requested # rows for FFT (" << nrows << ") invalid;" << endl; nrows = ::max(unsigned(4), nextPowerOf2(::max(nrows, _rows))); cerr << " increased to " << nrows << endl; } if ((ncols > 1) && ((ncols < _cols) || !isPowerOf2(ncols))) { cerr << "Warning! Mat3D<fcomplex>::fft():" << endl << " Requested # cols for FFT (" << ncols << ") invalid;" << endl; ncols = ::max(unsigned(4), nextPowerOf2(::max(ncols, _cols))); cerr << " increased to " << ncols << endl; } Boolean doX = (ncols != 1) && (_cols != 1) ? TRUE : FALSE; Boolean doY = (nrows != 1) && (_rows != 1) ? TRUE : FALSE; Boolean doZ = (nslis != 1) && (_slis != 1) ? TRUE : FALSE; if (!nslis) nslis = ::max(unsigned(4), nextPowerOf2(_slis)); else if (nslis == 1) nslis = _slis; if (!nrows) nrows = ::max(unsigned(4), nextPowerOf2(_rows)); else if (nrows == 1) nrows = _rows; if (!ncols) ncols = ::max(unsigned(4), nextPowerOf2(_cols)); else if (ncols == 1) ncols = _cols; // Pad matrix to the final FFT dimensions pad(nslis, nrows, ncols, (nslis - _slis)/2, (nrows - _rows)/2, (ncols - _cols)/2, 0); // Allocate temporary arrays double *real = 0; double *imag = 0; unsigned maxDim = ::max((doZ ? _slis : 1), (doY ? _rows : 1), (doX ? _cols : 1)); allocateArray(maxDim, real); allocateArray(maxDim, imag); assert(real && imag); unsigned slice, row, col; // Take 1D FFT in X (row) direction if (doX) for (slice = 0; slice < _slis; slice++) for(row = 0; row < _rows; row++) { // Fill temporary FFT array double *realPtr = real; double *imagPtr = imag; fcomplex *sourcePtr = _el[slice][row]; for(col = _cols; col; col--) { fcomplex value(*sourcePtr++); *realPtr++ = ::real(value); *imagPtr++ = ::imag(value); } // Calculate 1D FFT fftFunc(_cols, real, imag); // Put results back realPtr = real; imagPtr = imag; sourcePtr = _el[slice][row]; for(col = _cols; col; col--) *sourcePtr++ = fcomplex(*realPtr++, *imagPtr++); } // Take 1D FFT in Y (column) direction if (doY) for (slice = 0; slice < _slis; slice++) for(col = 0; col < _cols; col++) { // Fill temporary FFT array double *realPtr = real; double *imagPtr = imag; fcomplex *sourcePtr = *_el[slice] + col; for(row = _rows; row; row--) { fcomplex value(*sourcePtr); *realPtr++ = ::real(value); *imagPtr++ = ::imag(value); sourcePtr += _cols; } // Calculate 1D FFT fftFunc(_rows, real, imag); // Put results back realPtr = real; imagPtr = imag; sourcePtr = *_el[slice] + col; for(row = _rows; row; row--) { *sourcePtr = fcomplex(*realPtr++, *imagPtr++); sourcePtr += _cols; } } // Take 1D FFT in Z (slice) direction if (doZ) { unsigned offset = 0; for (row = 0; row < _rows; row++) for (col = 0; col < _cols; col++, offset++) { // Fill temporary FFT array double *realPtr = real; double *imagPtr = imag; fcomplex ***sourcePtr = _el; for(slice = _slis; slice; slice--) { fcomplex value(*(**sourcePtr++ + offset)); *realPtr++ = ::real(value); *imagPtr++ = ::imag(value); } // Calculate 1D FFT fftFunc(_slis, real, imag); // Put results back realPtr = real; imagPtr = imag; sourcePtr = _el; for(slice = _slis; slice; slice--) *(**sourcePtr++ + offset) = fcomplex(*realPtr++, *imagPtr++); } } // Free temporary arrays freeArray(real); freeArray(imag); return *this; } #endif template <class Type> ostream& operator << (ostream& os, const Mat3D<Type>& A) { return A.display(os); } //***********************pad function ****************************** template <class Type> Mat3D<Type>& Mat3D<Type>::pad(unsigned nslis, unsigned nrows, unsigned ncols, int slice, int row, int col, Type value) { if ((nslis == _slis) && (nrows == _rows) && (ncols == _cols) && !slice && !row && !col) return *this; char tempFile[256]; get_temp_filename(tempFile); // Save the current matrix to disk if (flushToDisk && saveRaw(tempFile)) { unsigned argSlis = _slis; unsigned argRows = _rows; unsigned argCols = _cols; clear(); _slis = nslis; _rows = nrows; _cols = ncols; _allocateEl(); fill(value); insert(tempFile, argSlis, argRows, argCols, slice, row, col); } else { // Saving fails, create a new matrix Mat3D<Type> result(nslis, nrows, ncols, value); result.insert(*this, slice, row, col); this->absorb(result); } unlink(tempFile); return *this; } // //-----------------------// // /***************************morphology functions*******************************/ //note works for odd and even se assumung the even se //is centered at the right lowest pix_el of the four center pix_els. #ifdef USE_DBLMAT template <class Type> Mat3D<Type> Mat3D<Type>::erode(const Mat3D<double>& strel) const { unsigned strelSlices = strel.getslis(); unsigned strelHeight = strel.getrows(); unsigned strelWidth = strel.getcols(); if (((strelHeight == 1) && (strelWidth == 1) && (strelSlices == 1)) || !strelHeight || !strelWidth || !strelSlices) return Mat3D<Type>(*this); Mat3D<Type> padMatrix(pad(strelSlices/2, strelHeight/2, strelWidth/2)); Mat3D<Type> result(_slis, _rows, _cols); unsigned padMatrixPtr2incr = padMatrix._cols - strelWidth; unsigned padMatrixPtr1incr = (strelWidth/2) * 2; unsigned n; for (unsigned s = 0; s < _slis ; s++){ int padk=0; Type *resultPtr = result._el[s][0]; for (unsigned y = _rows; y != 0; y--) { for (unsigned x = _cols; x != 0; x--) { n=s; double minimum = MAXDOUBLE; for (register unsigned k = 0; k < strelSlices; k++) { Type *padMatrixPtr2 = padMatrix._el[n++][0] + padk; const double *strelPtr = strel.getEl()[k][0]; for (register unsigned j = strelHeight; j != 0; j--) { for (register unsigned i = strelWidth; i != 0; i--) { if (*strelPtr >= 0) minimum = MIN(minimum, (double) *padMatrixPtr2 - *strelPtr); strelPtr++; padMatrixPtr2++; } padMatrixPtr2 += padMatrixPtr2incr; } } *resultPtr = Type(minimum); resultPtr++; padk++; } padk += padMatrixPtr1incr; } } //for (unsigned s ... return result; } #ifdef USE_COMPMAT Mat3D<complex> Mat3D<complex>::erode(const Mat3D<double>&) const { cerr << "Mat3D<complex>::erode() called but not implemented" << endl; return Mat3D<complex>(*this); } #endif #ifdef USE_FCOMPMAT Mat3D<fcomplex> Mat3D<fcomplex>::erode(const Mat3D<double>&) const { cerr << "Mat3D<fcomplex>::erode() called but not implemented" << endl; return Mat3D<fcomplex>(*this); } #endif template <class Type> Mat3D<Type> Mat3D<Type>::dilate(const Mat3D<double>& strel) const { unsigned strelSlices = strel.getslis(); unsigned strelHeight = strel.getrows(); unsigned strelWidth = strel.getcols(); unsigned sl=0; unsigned r=0; unsigned c=0; if (((strelHeight == 1) && (strelWidth == 1) && (strelSlices == 1)) || !strelHeight || !strelWidth || !strelSlices) return Mat3D<Type>(*this); if ((strelSlices % 2) == 0) { strelSlices++; sl++; } if ((strelHeight % 2) == 0) { strelHeight++; r++; } if ((strelWidth % 2) == 0) { strelWidth++; c++; } // strel.display(cout); // cout << endl; Mat3D<double> newstrel(strelSlices, strelHeight, strelWidth, -1); // newstrel.display(cout); // cout << endl; newstrel.insert(strel.rotate180(), sl, r, c); // newstrel.display(cout); // cout << endl; Mat3D<Type> padMatrix(pad(strelSlices/2, strelHeight/2, strelWidth/2)); Mat3D<Type> result(_slis, _rows, _cols); unsigned padMatrixPtr2incr = padMatrix._cols - strelWidth; unsigned padMatrixPtr1incr = (strelWidth/2) * 2; unsigned n; for (unsigned s = 0; s < _slis ; s++){ int padk=0; Type *resultPtr = result._el[s][0]; for (unsigned y = _rows; y != 0; y--) { for (unsigned x = _cols; x != 0; x--) { n=s; double maximum = -MAXDOUBLE; for (register unsigned k = 0; k < strelSlices; k++) { Type *padMatrixPtr2 = padMatrix._el[n++][0] + padk; const double *strelPtr = newstrel.getEl()[k][0]; for (register unsigned j = strelHeight; j != 0; j--) { for (register unsigned i = strelWidth; i != 0; i--) { if (*strelPtr >= 0) maximum = MAX(maximum, (double) *padMatrixPtr2 + *strelPtr); strelPtr++; padMatrixPtr2++; } padMatrixPtr2 += padMatrixPtr2incr; } } *resultPtr = Type(maximum); resultPtr++; padk++; } padk += padMatrixPtr1incr; } } //for (unsigned s ... return result; } #ifdef USE_COMPMAT Mat3D<complex> Mat3D<complex>::dilate(const Mat3D<double>&) const { cerr << "Mat3D<complex>::dilate() called but not implemented" << endl; return Mat3D<complex>(*this); } #endif #ifdef USE_FCOMPMAT Mat3D<fcomplex> Mat3D<fcomplex>::dilate(const Mat3D<double>&) const { cerr << "Mat3D<fcomplex>::dilate() called but not implemented" << endl; return Mat3D<fcomplex>(*this); } #endif #endif //************************ //reverse the filter or rotate by 180 //used for convolution and morphology //-------------------------// // template <class Type> Mat3D<Type> Mat3D<Type>::rotate180() const { Mat3D<Type> Temp(_slis,_rows,_cols); unsigned ks,kr,kc; for (unsigned s=0 ; s < _slis ; s++) { ks = _slis -s -1; for (unsigned i=0 ; i < _rows ; i++) { kr = _rows -i -1; for (unsigned j=0 ; j < _cols ; j++){ kc = _cols -j -1; Temp(ks,kr,kc) = _el[s][i][j]; } } } return Temp; } //3D histogram //this histogram works in the following way //if there is no input in the histogram ex: histogram(), then //it takes the defaults 0,0 and does the histogram from the smallest //value in the volume to the largest value. //if the input is histogram(0,255) it will give the histogram //between 0 and 255. If the input is 10,20 it will give only 10,20 //values //Can be written in 3D return or 2D return //Mat3D<Type> /*template <class Type> Mat<Type> Mat3D<Type>::histogram(int minin, int maxin) const { if(minin == maxin){ minin=(int)min(); maxin=(int)max(); } int range = maxin - minin + 1; Mat<Type> histogram1(1,range); //Mat3D<Type> histogram1(1,1,range); Type *histPtr = (Type *)histogram1.getEl()[0]; //Type *histPtr = histogram1._el[0][0]; Type ***sliPtr = _el; for (unsigned s = _slis; s != 0; s--) { Type **rowPtr = *sliPtr++; for (unsigned i = _rows; i != 0; i--) { Type *colPtr = *rowPtr++; for (unsigned j = _cols; j != 0; j--) { if ((*colPtr >= minin) && (*colPtr <= maxin)) { int roundedEl = (int) rint((double)*colPtr); (*(histPtr + roundedEl - minin))++; //(*(histPtr + roundedEl - minin))++; } colPtr++; } } } return(histogram1); } */ template <class Type> Histogram Mat3D<Type>::histogram(double minin, double maxin, unsigned n) const { if (maxin <= minin) { minin = min(); maxin = max(); } Histogram histogram(minin, maxin, n); for(unsigned s=0; s < _slis; s++) histogram += _slices[s].histogram(minin, maxin, n); return(histogram); } #ifdef USE_COMPMAT Histogram Mat3D<complex>::histogram(double, double, unsigned) const { cerr << "Mat3D<complex>::histogram() called but not implemented" << endl; return Histogram(0); } #endif #ifdef USE_FCOMPMAT Histogram Mat3D<fcomplex>::histogram(double, double, unsigned) const { cerr << "Mat3D<fcomplex>::histogram() called but not implemented" << endl; return Histogram(0); } #endif // //-------------------------// // template <class Type> Mat3D<Type>& Mat3D<Type>::histmod(const Histogram& hist1, const Histogram& hist2) { return map(equalize(hist1, hist2)); } // //-------------------------// // template <class Type> SimpleArray<Type> Mat3D<Type>::asArray(Type minVal, Type maxVal) const { unsigned N = 0; Type ***slisPtr; Type **rowPtr; Type *elPtr; if (maxVal <= minVal) { minVal = min(); maxVal = max(); N = nElements(); } else { // Scan matrix to determine # elements in the range slisPtr = _el; for (unsigned s = _slis; s; s--) { rowPtr = *slisPtr++; for (unsigned i = _rows; i; i--) { elPtr = *rowPtr++; for (unsigned j = _cols; j; j--, elPtr++) if ((*elPtr >= minVal) && (*elPtr <= maxVal)) N++; } } } SimpleArray<Type> array(N); if (N) { Type *arrayPtr = array.contents(); slisPtr = _el; for (unsigned s = _slis; s; s--) { rowPtr = *slisPtr++; for (unsigned i = _rows; i; i--) { elPtr = *rowPtr++; for (unsigned j = _cols; j; j--) if ((*elPtr >= minVal) && (*elPtr <= maxVal)) *arrayPtr++ = *elPtr++; } } } return array; } template <class Type> Mat3D<Type>& Mat3D<Type>::ifft(unsigned nslis, unsigned nrows, unsigned ncols) { _fft(nslis, nrows, ncols, ::ifft); unsigned factor = 1; if (nslis != 1) factor *= _slis; if (nrows != 1) factor *= _rows; if (ncols != 1) factor *= _cols; return *this /= factor; } // // Type conversions // #ifdef USE_DBLMAT template <class Type> DblMat3D asDblMat(const Mat3D<Type>& A) { unsigned _slis = A.getslis(); DblMat3D cast(_slis, A.getrows(), A.getcols()); for(unsigned s=0; s < _slis; s++) cast.setSlice(s, asDblMat(A[s])); return cast; } #endif /// #ifdef USE_FLMAT template <class Type> FlMat3D asFlMat(const Mat3D<Type>& A) { unsigned _slis = A.getslis(); FlMat3D cast(_slis, A.getrows(), A.getcols()); for(unsigned s=0; s < _slis; s++) cast.setSlice(s, asFlMat(A[s])); return cast; } #endif /// #ifdef USE_INTMAT template <class Type> IntMat3D asIntMat(const Mat3D<Type>& A) { unsigned _slis = A.getslis(); IntMat3D cast(_slis, A.getrows(), A.getcols()); for(unsigned s=0; s < _slis; s++) cast.setSlice(s, asIntMat(A[s])); return cast; } #endif /// #ifdef USE_UINTMAT template <class Type> UIntMat3D asUIntMat(const Mat3D<Type>& A) { unsigned _slis = A.getslis(); UIntMat3D cast(_slis, A.getrows(), A.getcols()); for(unsigned s=0; s < _slis; s++) cast.setSlice(s, asUIntMat(A[s])); return cast; } #endif /// #ifdef USE_SHMAT template <class Type> ShMat3D asShMat(const Mat3D<Type>& A) { unsigned _slis = A.getslis(); ShMat3D cast(_slis, A.getrows(), A.getcols()); for(unsigned s=0; s < _slis; s++) cast.setSlice(s, asShMat(A[s])); return cast; } #endif /// #ifdef USE_USHMAT template <class Type> UShMat3D asUShMat(const Mat3D<Type>& A) { unsigned _slis = A.getslis(); UShMat3D cast(_slis, A.getrows(), A.getcols()); for(unsigned s=0; s < _slis; s++) cast.setSlice(s, asUShMat(A[s])); return cast; } #endif /// #ifdef USE_CHRMAT template <class Type> ChrMat3D asChrMat(const Mat3D<Type>& A) { unsigned _slis = A.getslis(); ChrMat3D cast(_slis, A.getrows(), A.getcols()); for(unsigned s=0; s < _slis; s++) cast.setSlice(s, asChrMat(A[s])); return cast; } #endif /// #ifdef USE_UCHRMAT template <class Type> UChrMat3D asUChrMat(const Mat3D<Type>& A) { unsigned _slis = A.getslis(); UChrMat3D cast(_slis, A.getrows(), A.getcols()); for(unsigned s=0; s < _slis; s++) cast.setSlice(s, asUChrMat(A[s])); return cast; } #endif // //-------------------------// // #ifdef USE_COMPMAT template <class Type> Mat3D<complex> asCompMat(const Mat3D<Type>& A) { unsigned nslis = A.getslis(); Mat3D<complex> cast(nslis, A.getrows(), A.getcols()); for (unsigned s = 0; s < nslis; s++) cast.setSlice(s, asCompMat(A[s])); return cast; } template <class Type> Mat3D<complex> asCompMat(const Mat3D<Type>& Re, const Mat3D<Type>& Im) { unsigned nslis = Re.getslis(); if ((Im.getslis() != nslis) || (Im.getcols() != Re.getcols()) || (Im.getrows() != Re.getrows())) { cerr << "asCompMat: Re and Im matrices don't have the same dimensions; using Re only" << endl; return asCompMat(Re); } Mat3D<complex> cast(nslis, Re.getrows(), Re.getcols()); for (unsigned s = 0; s < nslis; s++) cast.setSlice(s, asCompMat(Re[s], Im[s])); return cast; } #endif #ifdef USE_FCOMPMAT template <class Type> Mat3D<fcomplex> asFcompMat(const Mat3D<Type>& A) { unsigned nslis = A.getslis(); Mat3D<fcomplex> cast(nslis, A.getrows(), A.getcols()); for (unsigned s = 0; s < nslis; s++) cast.setSlice(s, asFcompMat(A[s])); return cast; } template <class Type> Mat3D<fcomplex> asFcompMat(const Mat3D<Type>& Re, const Mat3D<Type>& Im) { unsigned nslis = Re.getslis(); if ((Im.getslis() != nslis) || (Im.getcols() != Re.getcols()) || (Im.getrows() != Re.getrows())) { cerr << "asFcompMat: Re and Im matrices don't have the same dimensions; using Re only" << endl; return asFcompMat(Re); } Mat3D<fcomplex> cast(nslis, Re.getrows(), Re.getcols()); for (unsigned s = 0; s < nslis; s++) cast.setSlice(s, asFcompMat(Re[s], Im[s])); return cast; } #endif #ifdef USE_COMPMAT #ifdef USE_DBLMAT Mat3D<double> applyElementWiseC2D(const Mat3D<complex>& A, double (*function)(const complex&)) { Mat3D<double> T(A._slis, A._rows, A._cols); for (unsigned s = 0; s < A._slis; s++) T[s] = applyElementWiseC2D(A[s], function); return T; } Mat3D<double> arg(const Mat3D<complex>& A) { unsigned nslis = A.getslis(); Mat3D<double> T(nslis, A.getrows(), A.getcols()); for (unsigned s = 0; s < nslis; s++) T.setSlice(s, arg(A[s])); return T; } Mat3D<double> real(const Mat3D<complex>& A) { return applyElementWiseC2D(A, real); } Mat3D<double> imag(const Mat3D<complex>& A) { return applyElementWiseC2D(A, imag); } #endif #endif #ifdef USE_FCOMPMAT #ifdef USE_FLMAT Mat3D<float> applyElementWiseC2D(const Mat3D<fcomplex>& A, double (*function)(const complex&)) { Mat3D<float> T(A._slis, A._rows, A._cols); for (unsigned s = 0; s < A._slis; s++) T[s] = applyElementWiseC2D(A[s], function); return T; } Mat3D<float> arg(const Mat3D<fcomplex>& A) { unsigned nslis = A.getslis(); Mat3D<float> T(nslis, A.getrows(), A.getcols()); for (unsigned s = 0; s < nslis; s++) T.setSlice(s, arg(A[s])); return T; } Mat3D<float> real(const Mat3D<fcomplex>& A) { return applyElementWiseC2D(A, real); } Mat3D<float> imag(const Mat3D<fcomplex>& A) { return applyElementWiseC2D(A, imag); } #endif #endif ////////////////////////////////////////////////////////////////////// <file_sep>/templates/Array.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: Array.cc,v $ $Revision: 1.3 $ $Author: bert $ $Date: 2004-12-08 16:43:44 $ $State: Exp $ --------------------------------------------------------------------------*/ #include <config.h> #include "Array.h" #include "dcomplex.h" #include <assert.h> #include <iostream> // (bert) changed from iostream.h #include <math.h> //#include <string> // (bert) changed from string.h #include <cstring> using namespace std; // (bert) added /****************** * Array base class ******************/ #ifndef __GNUC__ template <class Type> unsigned Array<Type>::_arrayCtr = 0; template <class Type> Boolean Array<Type>::_debug = FALSE; template <class Type> unsigned Array<Type>::_rangeErrorCount = 25; #endif template <class Type> unsigned Array<Type>::debug(Boolean on) { unsigned N = _arrayCtr; if (_debug = on) _arrayCtr = 0; return N; } // // constructors for Array class // template <class Type> Array<Type>::Array (unsigned sz) { _self = this; _size = _maxSize = sz; if (_size) { _contents = new Type[_size]; assert(_contents); } else _contents = 0; if (_debug) { _arrayCtr++; cout << "C" << _arrayCtr << ":" << long(this) << ":" << _size << " " << flush; } } template <class Type> Array<Type>::Array (const Type& value, unsigned sz) { _self = this; _size = _maxSize = sz; if (_size) { _contents = new Type[_size]; assert(_contents); clear(value); } else _contents = 0; if (_debug) { _arrayCtr++; cout << "C" << _arrayCtr << ":" << long(this) << ":" << _size << " " << flush; } } template <class Type> Array<Type>::Array(const Type *initArray, unsigned nElements) { _self = this; _size = _maxSize = nElements; if (_size) { _contents = new Type[_size]; assert(_contents); memcpy(_contents, initArray, _size*sizeof(Type)); } else _contents = 0; if (_debug) { _arrayCtr++; cout << "C" << _arrayCtr << ":" << long(this) << ":" << _size << " " << flush; } } // // Copy constructor // template <class Type> Array<Type>::Array (const Array<Type>& array) { _self = this; _size = _maxSize = 0; _contents = 0; operator = (array); if (_debug) { _arrayCtr++; cout << "C" << _arrayCtr << ":" << long(this) << ":" << _size << " " << flush; } } // // destructor // template <class Type> Array<Type>::~Array () { if (_debug) { _arrayCtr--; cout << "D" << _arrayCtr << ":" << long(this) << ":" << _size << " " << flush; } destroy(); } // // Iterator functions // /* template <class Type> void Array<Type>::resetIterator(unsigned i) { if (!_size) return; assert(i < _size); _itIndex = i; return; } */ template <class Type> void Array<Type>::resetIterator(unsigned i) const { if (!_size) return; assert(i < _size); _self->_itIndex = i; return; } template <class Type> Array<Type> Array<Type>::operator () (unsigned nElements) const { if (nElements > _size) { if (_rangeErrorCount) { cerr << "Warning! Array::operator(" << nElements << ") called with on array of size " << _size << ". Value truncated!" << endl; _rangeErrorCount--; } nElements = _size; } Array<Type> subArray(nElements); Type *sourcePtr = _contents; Type *destPtr = subArray._contents; for (register unsigned i = nElements; i != 0; i--) *destPtr++ = *sourcePtr++; return(subArray); } template <class Type> Array<Type> Array<Type>::operator () (unsigned start, unsigned end) const { unsigned n = end - start + 1; if (start + n > _size) { if (_rangeErrorCount) { cerr << "Warning! Array::operator(" << start << ", " << end << ") called with on array of size " << _size << ". Truncated!" << endl; _rangeErrorCount--; } n = _size - start; } Array<Type> subArray(n); Type *sourcePtr = _contents + start; Type *destPtr = subArray._contents; for (register unsigned i = n; i != 0; i--) *destPtr++ = *sourcePtr++; return(subArray); } template <class Type> Boolean Array<Type>::operator ! () const { return Boolean(!_size); } template <class Type> Type& Array<Type>::first() { return _contents[0]; } template <class Type> Type& Array<Type>::last() { return _contents[_size - 1]; } template <class Type> unsigned Array<Type>::size() const { return _size; } template <class Type> const Type * Array<Type>::contents() const { return (_size) ? _contents : 0; } template <class Type> Type * Array<Type>::contents() { return (_size) ? _contents : 0; } template <class Type> Array<Type>::operator const Type *() const { return (_size) ? _contents : 0; } template <class Type> Array<Type>::operator Type *() { return (_size) ? _contents : 0; } template <class Type> Array<Type>& Array<Type>::operator = (const Array<Type>& array ) { if (this == &array) return *this; newSize(array.size()); resetIterator(); array.resetIterator(); for (unsigned i = _size; i; i--) (*this)++ = array++; return *this; } template <class Type> Array<Type>& Array<Type>::absorb(Array<Type>& array) { if (this == &array) return *this; if (_contents) delete [] _contents; _size = _maxSize = array._size; _contents = array._contents; array._size = 0; array._contents = 0; return(*this); } template <class Type> Array<Type>& Array<Type>::operator () (const Type *newContents, unsigned size) { if (size > _maxSize) { if (_contents) delete [] _contents; _contents = new Type[_size = _maxSize = size]; assert(_contents); } else _size = size; register const Type *sourcePtr = newContents; register Type *destPtr = _contents; for (register unsigned i = _size; i != 0; i--) *destPtr++ = *sourcePtr++; return(*this); } template <class Type> Type * Array<Type>::asCarray(Type *destPtr) const { if (!_size) return 0; if (!destPtr) destPtr = new Type[_size]; if (destPtr) { const Type *sourcePtr = _contents; for (register unsigned i = _size; i; i--) *destPtr++ = *sourcePtr++; } return destPtr; } template <class Type> Array<Type>& Array<Type>::append(const Type value) { if (_maxSize<=_size)_grow(SIZE_INCREMENT); _contents[_size++]=value; return *this; } template <class Type> Array<Type>& Array<Type>::append(const Array<Type>& array) { unsigned nToAdd = array._size; if (!nToAdd) return *this; unsigned oldSize = _size; newSize(_size + nToAdd); const Type *sourcePtr = array._contents; Type *destPtr = _contents + oldSize; for (register unsigned i = nToAdd; i != 0; i--) *destPtr++ = *sourcePtr++; return *this; } template <class Type> Array<Type>& Array<Type>::insert(const Type& value, unsigned index) { if (index > _size) { if (_rangeErrorCount) { cerr << "Warning! Attempt to insert element outside range of array" << endl; _rangeErrorCount--; } return *this; } if (index == _size) return append(value); if (_maxSize <= _size) _grow(SIZE_INCREMENT); register Type *sourcePtr = _contents + _size - 1; register Type *destPtr = sourcePtr + 1; for (register unsigned i = _size - index; i != 0; i--) *destPtr-- = *sourcePtr--; *destPtr = value; _size++; return *this; } template <class Type> Array<Type>& Array<Type>::insert(const Array<Type>& array, unsigned index) { if (array._size == 0) return *this; unsigned oldSize = _size; newSize(_size + array._size); unsigned i; Type *sourcePtr = _contents + oldSize - 1; Type *destPtr = sourcePtr + array._size; for (i = oldSize - index; i != 0; i--) *destPtr-- = *sourcePtr--; sourcePtr = array._contents + array._size - 1; for (i = array._size; i != 0; i--) *destPtr-- = *sourcePtr--; return *this; } template <class Type> Array<Type>& Array<Type>::replace(const Array<Type>& array, unsigned index) { if (array._size == 0) return *this; if (index + array._size > _size) newSize(index + array._size); register Type *sourcePtr = array._contents; register Type *destPtr = _contents + index; for (register unsigned i = array._size; i != 0; i--) *destPtr++ = *sourcePtr++; return *this; } template <class Type> Type Array<Type>::remove(unsigned index) { if (!_size) { if (_rangeErrorCount) { _rangeErrorCount--; cerr << "Warning! Attempt to remove element from empty array" << endl; } return _contents[0]; } if (index >= _size) _rangeError(index); if (index == _size - 1) { _size--; return _contents[index]; } Type value(_contents[index]); register Type *destPtr = _contents + index; register Type *sourcePtr = destPtr + 1; for (unsigned i = _size - index - 1; i != 0; i--) *destPtr++ = *sourcePtr++; _size--; return value; } template <class Type> Type Array<Type>::removeLast() { if (!_size) { if (_rangeErrorCount) { _rangeErrorCount--; cerr << "Warning! Attempt to remove element from empty array" << endl; } return _contents[0]; } _size--; return _contents[_size]; } template <class Type> Array<Type>& Array<Type>::reorder(const Array<unsigned>& indices) { Array<Type> temp(*this); Type *elPtr = _contents; const unsigned *indexPtr = indices.contents(); unsigned n = min(indices.size(), _size); for (unsigned i = n; i; i--, elPtr++, indexPtr++) if (*indexPtr < _size) *elPtr = temp[*indexPtr]; return *this; } template <class Type> Array<Type>& Array<Type>::shuffle() { for (unsigned i = 0; i < _size; i++) { unsigned j = unsigned(drand48()*_size); if (i != j) { Type temp = _contents[i]; _contents[i] = _contents[j]; _contents[j] = temp; } } return *this; } template <class Type> void Array<Type>::clear(const Type& value) { resetIterator(); for (unsigned i = _size; i; i--) (*this)++ = value; } template <class Type> void Array<Type>::newSize(unsigned size) { if (size == _size) return; if (size <= _maxSize) { _size = size; return; } Type *newContents = new Type[size]; assert(newContents); if (_size) { register Type *sourcePtr = _contents; register Type *destPtr = newContents; for (register unsigned i = _size; i != 0; i--) *destPtr++ = *sourcePtr++; } if (_contents) delete [] _contents; _contents = newContents; _size = _maxSize = size; } template <class Type> Array<Type>& Array<Type>::destroy() { if (_contents) { delete [] _contents; _contents = 0; } _size = _maxSize = 0; return *this; } template <class Type> Array<Type>& Array<Type>::operator >> (unsigned n) { if (_size) { n %= _size; Array<Type> temp(n); unsigned i; Type *sourcePtr = _contents + _size - 1; Type *destPtr = temp._contents + n - 1; for (i = n; i; i--) *destPtr-- = *sourcePtr--; destPtr = _contents + _size - 1; for (i = _size - n; i; i--) *destPtr-- = *sourcePtr--; sourcePtr = temp._contents + n - 1; for (i = n; i; i--) *destPtr-- = *sourcePtr--; } return *this; } template <class Type> Array<Type>& Array<Type>::operator << (unsigned n) { if (_size) { n %= _size; Array<Type> temp(n); unsigned i; Type *sourcePtr = _contents; Type *destPtr = temp._contents; for (i = n; i; i--) *destPtr++ = *sourcePtr++; destPtr = _contents; for (i = _size - n; i; i--) *destPtr++ = *sourcePtr++; sourcePtr = temp._contents; for (i = n; i; i--) *destPtr++ = *sourcePtr++; } return *this; } template <class Type> Array<Type> Array<Type>::sample(unsigned maxN) const { double step = double(_size - 1)/(maxN - 1); if (step <= 1.0) return Array<Type>(*this); Array<Type> result(maxN); Type *destPtr = result._contents; double offset = 0; for (unsigned i = maxN; i; i--, offset += step) *destPtr++ = *(_contents + unsigned(floor(offset))); return result; } template <class Type> Array<Type> Array<Type>::applyElementWise(Type (*function) (Type)) const { Array<Type> result(_size); Type *sourcePtr = _contents; Type *destPtr = result._contents; for (unsigned i = _size; i != 0; i--) *destPtr++ = function(*sourcePtr++); return result; } template <class Type> ostream& Array<Type>::print(ostream& os) const { cerr << "Array<Type>::print(): Cannot print an Array" << endl; return os; } // // Private functions // template <class Type> void Array<Type>::_grow(unsigned amount) { unsigned size = _size; newSize(_maxSize + amount); _size = size; } template <class Type> void Array<Type>::_rangeError(unsigned& index) const { if (_rangeErrorCount) { _rangeErrorCount--; cerr << "Corrected: index " << index << " into array of size " << _size << " !" << endl; } index = size() - 1; } template <class Type> void Array<Type>::_notImplementedError() const { cerr << "Array function called but not implemented" << endl; assert(0); } template <class Type> unsigned size(const Array<Type>& array) { return array.size(); } template <class Type> ostream& operator << (ostream& os, const Array<Type>& array) { return array.print(os); } #ifdef __GNUC__ #define _INSTANTIATE_ARRAY(Type) \ template class Array<Type>; \ template<> unsigned Array<Type>::_arrayCtr = 0; \ template<> Boolean Array<Type>::_debug = FALSE; \ template<> unsigned Array<Type>::_rangeErrorCount = 25; \ template<> unsigned size(const Array<Type> &); _INSTANTIATE_ARRAY(char); _INSTANTIATE_ARRAY(unsigned char); _INSTANTIATE_ARRAY(short); _INSTANTIATE_ARRAY(int); _INSTANTIATE_ARRAY(unsigned int); _INSTANTIATE_ARRAY(unsigned short); _INSTANTIATE_ARRAY(float); _INSTANTIATE_ARRAY(double); _INSTANTIATE_ARRAY(dcomplex); #include "Path.h" _INSTANTIATE_ARRAY(Path); #include "ValueMap.h" _INSTANTIATE_ARRAY(LinearMap); #include "SimpleArray.h" _INSTANTIATE_ARRAY(SimpleArray<unsigned> ); _INSTANTIATE_ARRAY(SimpleArray<float> ); #endif <file_sep>/src/dcomplex.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: dcomplex.cc,v $ $Revision: 1.3 $ $Author: bert $ $Date: 2003-04-16 18:44:21 $ $State: Exp $ --------------------------------------------------------------------------*/ #include "dcomplex.h" #include <iostream> // (bert) changed from iostream.h using namespace std; // (bert) added // A few functions that define (bogus) math ops for complex static int _errorCount_dcomplex = 100; int operator < (const dcomplex&, const dcomplex&) { if (_errorCount_dcomplex) { cerr << "Comparison of dcomplex numbers undefined" << endl; _errorCount_dcomplex--; } return 0; } int operator <= (const dcomplex&, const dcomplex&) { if (_errorCount_dcomplex) { cerr << "Comparison of dcomplex numbers undefined" << endl; _errorCount_dcomplex--; } return 0; } int operator > (const dcomplex&, const dcomplex&) { if (_errorCount_dcomplex) { cerr << "Comparison of dcomplex numbers undefined" << endl; _errorCount_dcomplex--; } return 0; } int operator >= (const dcomplex&, const dcomplex&) { if (_errorCount_dcomplex) { cerr << "Comparison of dcomplex numbers undefined" << endl; _errorCount_dcomplex--; } return 0; } int operator && (const dcomplex&, const dcomplex&) { if (_errorCount_dcomplex) { cerr << "Comparison of dcomplex numbers undefined" << endl; _errorCount_dcomplex--; } return 0; } int operator || (const dcomplex&, const dcomplex&) { if (_errorCount_dcomplex) { cerr << "Comparison of dcomplex numbers undefined" << endl; _errorCount_dcomplex--; } return 0; } <file_sep>/clapack/blaswrap.h /* CLAPACK 3.0 BLAS wrapper macros * Feb 5, 2000 */ #ifndef __BLASWRAP_H #define __BLASWRAP_H #ifndef NO_BLAS_WRAP #define dsytrf_ EBTKS_dsytrf #define dsytrs_ EBTKS_dsytrs #define xerbla_ EBTKS_xerbla #define lsame_ EBTKS_lsame #define ilaenv_ EBTKS_ilaenv #define dsytf2_ EBTKS_dsytf2 #define dlasyf_ EBTKS_dlasyf #define ieeeck_ EBTKS_ieeeck #define s_cmp EBTKS_s_cmp #define s_copy EBTKS_s_copy #define dswap_ EBTKS_dswap #define dscal_ EBTKS_dscal #define dcopy_ EBTKS_dcopy #define idamax_ EBTKS_idamax /* BLAS2 routines */ #define dgemv_ EBTKS_dgemv #define dger_ EBTKS_dger #define dsyr_ EBTKS_dsyr /* BLAS3 routines */ #define dgemm_ EBTKS_dgemm #define dsyrk_ EBTKS_dsyrk #define dsyr2k_ EBTKS_dsyr2k #define dtrmm_ EBTKS_dtrmm #define dtrsm_ EBTKS_dtrsm #endif /* NO_BLAS_WRAP */ #endif /* __BLASWRAP_H */ <file_sep>/src/backProp.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: backProp.cc,v $ $Revision: 1.4 $ $Author: jason $ $Date: 2004-01-19 15:38:15 $ $State: Exp $ --------------------------------------------------------------------------*/ #include <config.h> #include "backProp.h" #include <assert.h> #ifdef HAVE_MALLOC_H #include <malloc.h> #endif #include <math.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "MString.h" using namespace std; const int BP_ANN::_LUT_LENGTH = 1001; // Should be odd, as it will be used for a range of values centered around 0 const long BP_ANN::_SEED = 7366498; const int BP_ANN::_N_CYCLES = 500; const float BP_ANN::_LEARNING_RATE = 0.8; const float BP_ANN::_MOMENTUM = 0.3; const float BP_ANN::_TEMPERATURE = 1.0; const float BP_ANN::_MAX_ERROR = 0.0; const float BP_ANN::_MAX_D_ERROR = 1e-6; const unsigned BP_ANN::_SHUFFLE_INTERVAL = 2*unsigned(MAXINT); //const unsigned BP_ANN::_SHUFFLE_INTERVAL = 25; BP_ANN::BP_ANN(const UnsignedArray& topology, Boolean verbose) { _nLayers = _nInputNodes = _nOutputNodes = 0; _nNodesInLayer = NULL; _nWeightsForLayer = NULL; _node = NULL; _weight = NULL; _verbose = verbose; // Create network _create(topology); // Randomize network randomize(_SEED); // Set default parameters setDefaults(); if (_verbose) save(cout, FALSE); } BP_ANN::BP_ANN(istream& IS, Boolean verbose) { _nLayers = _nInputNodes = _nOutputNodes = 0; _nNodesInLayer = NULL; _nWeightsForLayer = NULL; _node = NULL; _weight = NULL; _verbose = verbose; load(IS); if (_verbose) save(cout, FALSE); } BP_ANN::~BP_ANN() { _destroy(); } Boolean BP_ANN::nInputNodes(unsigned n) { if (n == _nInputNodes) return SUCCESS; if (!_nLayers) { cerr << "#Layers: " << _nLayers << endl; return FAILURE; } UnsignedArray topology(_nNodesInLayer, _nLayers); topology[(unsigned int)0] = n; _create(topology); randomize(_SEED); if (_verbose) save(cout, FALSE); return SUCCESS; } Boolean BP_ANN::nOutputNodes(unsigned n) { if (n == _nOutputNodes) return SUCCESS; if (!_nLayers) { cerr << "#Layers: " << _nLayers << endl; return FAILURE; } UnsignedArray topology(_nNodesInLayer, _nLayers); topology[_nLayers - 1] = n; _create(topology); randomize(_SEED); if (_verbose) save(cout, FALSE); return SUCCESS; } Boolean BP_ANN::topology(const UnsignedArray& topology) { _create(topology); randomize(_SEED); if (_verbose) save(cout, FALSE); return SUCCESS; } void BP_ANN::randomize(long seed) { srand48(seed ? seed : time(0)); unsigned layerCtr, i; unsigned nNodes; unsigned nWeights; WEIGHT *weightPtr; BPNODE *nodePtr; for (layerCtr = 0; layerCtr < _nLayers; layerCtr++) { nodePtr = _node[layerCtr]; nNodes = _nNodesInLayer[layerCtr]; for (i = 0; i < nNodes; i++) { nodePtr->out = 0.0; nodePtr->bias = drand48() - 0.5; nodePtr->dBias = 0.0; nodePtr->delta = 0.0; nodePtr++; } } for (layerCtr = 1; layerCtr < _nLayers; layerCtr++) { weightPtr = _weight[layerCtr]; nWeights = _nWeightsForLayer[layerCtr]; for (i = 0; i < nWeights; i++) { weightPtr->value = drand48() - 0.5; weightPtr->delta = 0.0; weightPtr++; } } } void BP_ANN::setDefaults() { _stopRequest = FALSE; _learningRate = _LEARNING_RATE; _momentum = _MOMENTUM; _nCycles = _N_CYCLES; _cycleCtr = 0; _nSamples = 0; _maxError = _MAX_ERROR; _maxDerror = _MAX_D_ERROR; _shuffleInterval = _SHUFFLE_INTERVAL; _sigmoidAtOutputLayer = TRUE; _softmaxAtOutputLayer = FALSE; _createLut(_TEMPERATURE); } void BP_ANN::set(double alpha, double beta, double T, unsigned nCycles, double maxError, double maxDerror, unsigned shuffleInterval, Boolean sigmoid, Boolean softmax) { _learningRate = alpha; _momentum = beta; _nCycles = nCycles; _maxError = maxError; _maxDerror = maxDerror; _shuffleInterval = shuffleInterval; _sigmoidAtOutputLayer = sigmoid; _softmaxAtOutputLayer = softmax; _createLut(T); } /* int BP_ANN::train(TrainingSet& trainingSet, ErrorMonitor errorMonitor) { if (initTraining(trainingSet.size()) != SUCCESS) { cerr << "Couldn't initialize training" << endl; return(FAILURE); } unsigned nOutputNodes = _nNodesInLayer[_nLayers - 1]; unsigned totalOutputs = _nSamples*nOutputNodes; double previousMSE = MAXDOUBLE; unsigned shuffleInterval = _shuffleInterval; if (shuffleInterval) { cout << "Shuffling training set (" << trainingSet.size() << ")..." << flush; trainingSet.shuffle(); cout << "Done" << endl; } TrainingSetIterator examplesIt(trainingSet); Example *example; for (unsigned cycleCtr = 0; !_stopRequest; cycleCtr++) { examplesIt.first(); unsigned exampleCtr = 0; double MSE = 0; while (example = examplesIt++) { train(example->input, example->target); MSE += _outputError.sum2(); exampleCtr++; } MSE /= totalOutputs; double dError = previousMSE - MSE; _stopRequest = ((cycleCtr >= _nCycles) || ((dError >= 0) && (dError <= _maxDerror)) || (MSE <= _maxError)); previousMSE = MSE; if (errorMonitor) (errorMonitor)(cycleCtr, MSE); if (shuffleInterval && !--shuffleInterval) { cout << "Shuffling training set..." << flush; trainingSet.shuffle(); cout << "Done" << endl; shuffleInterval = _shuffleInterval; previousMSE = MAXDOUBLE; } } return(SUCCESS); } */ int BP_ANN::train(TrainingSet& trainingSet, ErrorMonitor errorMonitor) { if (initTraining(trainingSet.size()) != SUCCESS) { cerr << "Couldn't initialize training" << endl; return(FAILURE); } int nextSample = 0; const Example *sample = &trainingSet[nextSample]; while ((nextSample = train(sample->input, sample->target, errorMonitor)) >= 0) sample = &trainingSet[nextSample]; return(SUCCESS); } int BP_ANN::initTraining(unsigned nSamples) { if (!_lut.size()) { cerr << "Error: LUT not created!" << endl; return(FAILURE); } if (_nLayers <= 0) { cerr << "Error: Invalid # layers (" << _nLayers << ")" << endl; return(FAILURE); } if (!nSamples) { cerr << "Error: #samples: " << nSamples << endl; return(FAILURE); } _cycleCtr = 0; _nSamples = nSamples; _sampleCtr = 0; _stopRequest = FALSE; return SUCCESS; } int BP_ANN::train(const double *input, const double *target, ErrorMonitor errorMonitor) { if (!_nSamples) { cerr << "Error: #samples: " << _nSamples << endl; return -1; } static double previousMSE, MSE; static SimpleArray<unsigned> sampleList; static unsigned shuffleInterval; static unsigned totalOutputs; if (!_sampleCtr) { if (!_cycleCtr) { // Starting first cycle totalOutputs = _nSamples*_nOutputNodes; shuffleInterval = 0; // Force shuffle at first cycle sampleList = SimpleArray<unsigned>(0, 1, _nSamples - 1); MSE = 0; } else { MSE /= totalOutputs; double dError = previousMSE - MSE; if (errorMonitor) (errorMonitor)(_cycleCtr, MSE); if (_stopRequest || (_cycleCtr >= _nCycles) || ((dError >= 0) && (dError <= _maxDerror)) || (MSE <= _maxError)) return -1; previousMSE = MSE; MSE = 0; } if (!shuffleInterval--) { if (_verbose) cout << "Shuffling training set..." << flush; sampleList.shuffle(); if (_verbose) cout << "Done" << endl; shuffleInterval = _shuffleInterval - 1; previousMSE = MAXDOUBLE; } _sampleCtr = _nSamples; _cycleCtr++; } _forward(input); _calculateDeltas(target); _adjustWeights(); MSE += _outputError.sum2(); /* cout << sampleList << "; " << _sampleCtr << ", " << _cycleCtr << ", " << shuffleInterval << endl; */ return int(sampleList[--_sampleCtr]); } void BP_ANN::evaluate(const double *input, double *output) { BPNODE *nodePtr = _node[_nLayers - 1]; _forward(input); for (register unsigned i = _nOutputNodes; i; i--) *output++ = (nodePtr++)->out; } unsigned BP_ANN::classify(const double *input, double *output) { BPNODE *nodePtr = _node[_nLayers - 1]; _forward(input); double maxVal = -MAXDOUBLE; unsigned node = 0; for (register unsigned i = 0; i < _nOutputNodes; i++, nodePtr++) { if (nodePtr->out > maxVal) { maxVal = nodePtr->out; node = i; } if (output) *output++ = nodePtr->out; } return node; } ostream& BP_ANN::printWeights(ostream& theStream) { for (unsigned i = 1; i < _nLayers; i++) { for (unsigned j = 0; j < _nWeightsForLayer[i]; j++) theStream << _weight[i][j].value << " "; theStream << endl; } return theStream; } ostream& BP_ANN::printNodes(ostream& theStream) { for (unsigned i = 0; i < _nLayers; i++) { for (unsigned j = 0; j < _nNodesInLayer[i]; j++) theStream << _node[i][j].out << " "; theStream << endl; } return theStream; } int BP_ANN::save(ostream& OS, Boolean includeContents) { if (!OS) return FAILURE; unsigned layerCtr; OS << "learning_rate: " << _learningRate << endl << "momentum: " << _momentum << endl << "temperature: " << _temperature << endl << "num_of_cycles: " << _nCycles << endl << "max_error: " << _maxError << endl << "max_d_error: " << _maxDerror << endl << "shuffle_interval: " << _shuffleInterval << endl << "layers: " << _nLayers; for (layerCtr = 0; layerCtr < _nLayers; layerCtr++) OS << " " << _nNodesInLayer[layerCtr]; OS << endl; if (includeContents) { OS << "contents:" << endl; for (layerCtr = 1; layerCtr < _nLayers; layerCtr++) { for (unsigned i = 0; i < _nNodesInLayer[layerCtr]; i++) OS << _node[layerCtr][i].bias << " " << _node[layerCtr][i].dBias << " " << _node[layerCtr][i].delta << " " << _node[layerCtr][i].out << endl; OS << endl; } for (layerCtr = 1; layerCtr < _nLayers; layerCtr++) { for (unsigned i = 0; i < _nWeightsForLayer[layerCtr]; i++) OS << _weight[layerCtr][i].value << " " << _weight[layerCtr][i].delta << endl; OS << endl; } } return SUCCESS; } int BP_ANN::load(istream& IS) { // Initialize with default values setDefaults(); double temperature = _TEMPERATURE; long seed = _SEED; UnsignedArray tplgy; Boolean contentsRead = FALSE; MString key; while (IS >> key) { if (key.contains("randomize")) IS >> seed; else if (key.contains("learning_rate")) IS >> _learningRate; else if (key.contains("momentum")) IS >> _momentum; else if (key.contains("temperature")) IS >> temperature; else if (key.contains("num_of_cycles")) IS >> _nCycles; else if (key.contains("max_error")) IS >> _maxError; else if (key.contains("max_d_error")) IS >> _maxDerror; else if (key.contains("shuffle_interval")) IS >> _shuffleInterval; else if (key.contains("layers")) { unsigned nLayers; IS >> nLayers; tplgy.newSize(nLayers); for (unsigned layerCtr = 0; layerCtr < nLayers; layerCtr++) IS >> tplgy[layerCtr]; _create(tplgy); } else if (key.contains("contents")) { unsigned i, layerCtr; // Read node values for (layerCtr = 1; layerCtr < _nLayers; layerCtr++) for (i = 0; i < _nNodesInLayer[layerCtr]; i++) IS >> _node[layerCtr][i].bias >> _node[layerCtr][i].dBias >> _node[layerCtr][i].delta >> _node[layerCtr][i].out; // Read weights for (layerCtr = 1; layerCtr < _nLayers; layerCtr++) for (i = 0; i < _nWeightsForLayer[layerCtr]; i++) IS >> _weight[layerCtr][i].value >> _weight[layerCtr][i].delta; contentsRead = TRUE; } } _createLut(temperature); if (!contentsRead) randomize(seed); return(SUCCESS); } void BP_ANN::_forward(const double *input) { BPNODE *nodePtr, *prevLayerNodePtr; BPNODE *layerPtr, *prevLayerPtr; WEIGHT *weightPtr; double sum; int layerCtr; unsigned nNodes, nNodesInPrevLayer, nodeCtr; unsigned i; nNodes = _nNodesInLayer[0]; nodePtr = _node[0]; const double *inputPtr = input; for (i = 0; i < nNodes; i++) (nodePtr++)->out = *inputPtr++; prevLayerPtr = _node[0]; nNodesInPrevLayer = _nNodesInLayer[0]; double *lut = _lut.contents(); int lastLutIndex = _lut.size() - 1; // Hidden layers int lastHiddenLayer = _nLayers - 1; for (layerCtr = 1; layerCtr < lastHiddenLayer; layerCtr++) { weightPtr = _weight[layerCtr]; nodePtr = layerPtr = _node[layerCtr]; nNodes = _nNodesInLayer[layerCtr]; for (nodeCtr = 0; nodeCtr < nNodes; nodeCtr++) { prevLayerNodePtr = prevLayerPtr; sum = 0.0; for (i = 0; i < nNodesInPrevLayer; i++) sum += (weightPtr++)->value * (prevLayerNodePtr++)->out; int lutIndex = (int) rint((sum + nodePtr->bias + 5)/_lutStep); if (lutIndex < 0) lutIndex = 0; else if (lutIndex > lastLutIndex) lutIndex = lastLutIndex; (nodePtr++)->out = lut[lutIndex]; } prevLayerPtr = layerPtr; nNodesInPrevLayer = nNodes; } // Output layer layerCtr = _nLayers - 1; weightPtr = _weight[layerCtr]; nodePtr = _node[layerCtr]; nNodes = _nNodesInLayer[layerCtr]; double outputSum = 0.0; for (nodeCtr = 0; nodeCtr < nNodes; nodeCtr++, nodePtr++) { prevLayerNodePtr = prevLayerPtr; sum = 0.0; // Disconnect one node if softmax is used if (!_softmaxAtOutputLayer || nodeCtr) for (i = 0; i < nNodesInPrevLayer; i++) { sum += (weightPtr++)->value * (prevLayerNodePtr++)->out; } if (_sigmoidAtOutputLayer) { int lutIndex = (int) rint((sum + nodePtr->bias + 5)/_lutStep); if (lutIndex < 0) lutIndex = 0; else if (lutIndex > lastLutIndex) lutIndex = lastLutIndex; nodePtr->out = lut[lutIndex]; } else nodePtr->out = sum + nodePtr->bias; if (_softmaxAtOutputLayer) { outputSum += (nodePtr->out = exp(nodePtr->out)); // if (*input) // cout << nodePtr->out << ":" << outputSum << " " << flush; } } if (_softmaxAtOutputLayer) { nodePtr = _node[layerCtr]; for (nodeCtr = 0; nodeCtr < nNodes; nodeCtr++, nodePtr++) nodePtr->out /= outputSum; } } void BP_ANN::_calculateDeltas(const double *target) { BPNODE *nextLayerNodePtr; BPNODE *layerPtr, *nextLayerPtr; WEIGHT *weightLayerPtr; WEIGHT *weightPtr; double nodeValue; double sum; int outputLayerIndex; int layerCtr; int nNodesInNextLayer; /* * Calculate deltas for the output layer */ outputLayerIndex = _nLayers - 1; double *outputErrorPtr = _outputError.contents(); BPNODE *nodePtr = _node[outputLayerIndex]; int nNodes = _nNodesInLayer[outputLayerIndex]; unsigned i; if (_sigmoidAtOutputLayer) for (i = nNodes; i != 0; i--) { nodeValue = nodePtr->out; *outputErrorPtr = *target++ - nodeValue; (nodePtr++)->delta = (*outputErrorPtr++)*nodeValue*(1.0 - nodeValue); } else for (i = nNodes; i != 0; i--) (nodePtr++)->delta = *outputErrorPtr++ = *target++ - nodePtr->out; /* * Calculate deltas for the hidden layer(s) */ nextLayerPtr = _node[outputLayerIndex]; nNodesInNextLayer = _nNodesInLayer[outputLayerIndex]; for (layerCtr = outputLayerIndex - 1; layerCtr > 0; layerCtr--) { nodePtr = layerPtr = _node[layerCtr]; weightLayerPtr = _weight[layerCtr + 1]; nNodes = _nNodesInLayer[layerCtr]; for (register unsigned i = nNodes; i != 0; i--) { weightPtr = weightLayerPtr++; nextLayerNodePtr = nextLayerPtr; sum = 0.0; for (register unsigned j = nNodesInNextLayer; j != 0; j--) { sum += weightPtr->value * nextLayerNodePtr->delta; nextLayerNodePtr++; weightPtr += nNodes; } nodePtr->delta = nodePtr->out * (1 - nodePtr->out) * sum; nodePtr++; } nNodesInNextLayer = nNodes; nextLayerPtr = layerPtr; } } void BP_ANN::_create(const UnsignedArray& topology) { _destroy(); _nLayers = topology.size(); if (!_nLayers) { cerr << "# network layers is zero!" << endl; exit(EXIT_FAILURE); } if ((_nNodesInLayer = (unsigned *) malloc(_nLayers*sizeof(unsigned))) == NULL) assert(0); unsigned i; for (i = 0; i < _nLayers; i++) _nNodesInLayer[i] = topology[i]; _nInputNodes = topology[(unsigned int)0]; _nOutputNodes = topology[_nLayers - 1]; if ((_nWeightsForLayer = (unsigned *) malloc(_nLayers*sizeof(unsigned))) == NULL) assert(0); for (i = 1; i < _nLayers; i++) _nWeightsForLayer[i] = _nNodesInLayer[i - 1]*_nNodesInLayer[i]; /* * Allocate node outputs for all layers */ if ((_node = (BPNODE **) malloc(_nLayers*sizeof(BPNODE *))) == NULL) assert(0); for (i = 0; i < _nLayers; i++) if ((_node[i] = (BPNODE *) calloc(_nNodesInLayer[i], sizeof(BPNODE))) == NULL) assert(0); /* * Allocate weights for all layers except the input layer */ if ((_weight = (WEIGHT **) malloc(_nLayers*sizeof(WEIGHT *))) == NULL) assert(0); for (i = 1; i < _nLayers; i++) if ((_weight[i] = (WEIGHT *) calloc(_nWeightsForLayer[i], sizeof(WEIGHT))) == NULL) assert(0); /* * Allocate memory for the outputErrors */ _outputError.newSize(_nOutputNodes); } void BP_ANN::_destroy() { if (_nNodesInLayer != NULL) { free((unsigned *) _nNodesInLayer); _nNodesInLayer = NULL; } if (_nWeightsForLayer != NULL) { free((unsigned *) _nWeightsForLayer); _nWeightsForLayer = NULL; } if (_node != NULL) { for (unsigned i = 0; i < _nLayers; i++) free((BPNODE *) _node[i]); free((BPNODE **) _node); _node = NULL; } if (_weight != NULL) { for (unsigned i = 1; i < _nLayers; i++) free((WEIGHT *) _weight[i]); free((WEIGHT **) _weight); _weight = NULL; } _nLayers = 0; } void BP_ANN::_createLut(double T) { if ((_lut.size() == _LUT_LENGTH) && (_temperature == T)) return; _lut.newSize(_LUT_LENGTH); _lutStep = 10.0/(_LUT_LENGTH - 1); for (register unsigned i = 0; i < _LUT_LENGTH; i++) _lut[i] = 1.0/(1.0 + exp(-(_lutStep*i - 5.0)/T)); _temperature = T; } void BP_ANN::_adjustWeights() { BPNODE *layerPtr, *prevLayerPtr; BPNODE *nodePtr, *prevLayerNodePtr; WEIGHT *weightPtr; unsigned layerCtr; unsigned nNodes, nNodesInPrevLayer; unsigned nodeCtr; unsigned i; prevLayerPtr = _node[0]; nNodesInPrevLayer = _nNodesInLayer[0]; for (layerCtr = 1; layerCtr < _nLayers; layerCtr++) { weightPtr = _weight[layerCtr]; nodePtr = layerPtr = _node[layerCtr]; nNodes = _nNodesInLayer[layerCtr]; for (nodeCtr = 0; nodeCtr < nNodes; nodeCtr++) { prevLayerNodePtr = prevLayerPtr; for (i = 0; i < nNodesInPrevLayer; i++) { weightPtr->delta = _learningRate * nodePtr->delta * prevLayerNodePtr->out + _momentum * weightPtr->delta; weightPtr->value += weightPtr->delta; weightPtr++; prevLayerNodePtr++; } nodePtr->dBias = _learningRate*nodePtr->delta + _momentum*nodePtr->dBias; nodePtr->bias += nodePtr->dBias; nodePtr++; } prevLayerPtr = layerPtr; nNodesInPrevLayer = nNodes; } } <file_sep>/src/OpTimer.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: OpTimer.cc,v $ $Revision: 1.4 $ $Author: stever $ $Date: 2003-11-17 04:07:52 $ $State: Exp $ --------------------------------------------------------------------------*/ #include "OpTimer.h" #include "trivials.h" #include <assert.h> #include <string.h> #include <sys/time.h> #include <sys/resource.h> using namespace std; const char *OpTimer::_TIME_STRINGS[] = { "CPU", "SYS", "USR" }; const int OpTimer::CPU = 0; const int OpTimer::SYS = 1; const int OpTimer::USR = 2; OpTimer::OpTimer(int timeType, const char *operation, unsigned N, unsigned reportInterval) { _os = &cout; this->timeType(timeType); _operation = 0; _verbose = TRUE; _newOperation(operation); tic(N, reportInterval); } OpTimer::OpTimer(const char *operation, unsigned N, unsigned reportInterval) { _os = &cout; timeType(USR); _operation = 0; _verbose = TRUE; _newOperation(operation); tic(N, reportInterval); } OpTimer::~OpTimer() { if (!_NN) toc(); if (_verbose) *_os << flush; } double OpTimer::operator () (int timeType, const char *operation, unsigned N, unsigned reportInterval) { this->timeType(timeType); _newOperation(operation); return tic(N, reportInterval); } double OpTimer::operator () (const char *operation, unsigned N, unsigned reportInterval) { _newOperation(operation); return tic(N, reportInterval); } void OpTimer::timeType(int time) { _timeType = time; switch (time) { case CPU: timeFunction(_CPUtime); break; case SYS: timeFunction(_SYStime); break; case USR: timeFunction(_USRtime); break; default: cerr << "Warning! Unknown time; reporting USR" << endl; timeFunction(_USRtime); break; } } double OpTimer::tic(unsigned N, unsigned reportInterval) { _NN = N; _interval = reportInterval; _i = 0; return (_start = _time()); } double OpTimer::toc(unsigned i) { double dt = _time() - _start; _i += i; if (_verbose && _operation && !(_i % _interval)) { _os->setf(ios::fixed); int p = _os->precision(3); *_os << _TIME_STRINGS[_timeType] << " time elapsed in " << _operation << ": "; _printTime(dt); if (_NN) { double fraction = double(_i)/_NN; *_os << " (" << ROUND(fraction*100) << "% of "; _printTime(dt/fraction) << ")"; } *_os << endl; _os->precision(p); _os->unsetf(ios::fixed); } return dt; } double OpTimer::_CPUtime() { struct rusage usage; getrusage(RUSAGE_SELF, &usage); return (double) usage.ru_utime.tv_sec + (usage.ru_utime.tv_usec / 1.0e6); } double OpTimer::_SYStime() { struct rusage usage; getrusage(RUSAGE_SELF, &usage); return (double) usage.ru_stime.tv_sec + (usage.ru_stime.tv_usec / 1.0e6); } double OpTimer::_USRtime() { struct timeval T; struct timezone TZ; gettimeofday(&T, &TZ); return (double) T.tv_sec + (T.tv_usec / 1.0e6); } void OpTimer::_newOperation(const char *operation) { if (_operation) { delete [] _operation; _operation = 0; } if (operation) { _operation = new char [strlen(operation) + 1]; assert(operation); strcpy(_operation, operation); } } ostream& OpTimer::_printTime(double sec) const { if (_verbose) { unsigned hrs = 0; if (sec >= 3600) { hrs = unsigned(sec) / 3600; *_os << hrs << ":"; sec -= hrs * 3600; } if (hrs || (sec >= 60)) { unsigned min = unsigned(sec) / 60; *_os << min << ":"; sec -= min * 60; } *_os << sec; } return *_os; } <file_sep>/src/FileIO.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: FileIO.cc,v $ $Revision: 1.4 $ $Author: bert $ $Date: 2006-03-02 13:22:17 $ $State: Exp $ --------------------------------------------------------------------------*/ #include <config.h> #include "FileIO.h" #include <assert.h> #include <stdlib.h> // #include <stream.h> - (bert) removed unnecessary header #include <sys/types.h> #include <unistd.h> #ifdef HAVE_MATLAB #include "Dictionary.h" #endif using namespace std; // (bert) added // // Constructors/destructor // InputFile::InputFile() { _ipipe = 0; } InputFile::operator void *() const { if (_ipipe) return *_ipipe; return 0; } // // Set functions // Boolean InputFile::attach(const Path& path) { close(); Path fullPath(path.expanded().removeCompressedExtension()); Path testPath(fullPath); Boolean compressed = FALSE; if (!testPath.exists()) { testPath = fullPath + ".gz"; if (!testPath.exists()) { testPath = fullPath + ".z"; if (!testPath.exists()) { testPath = fullPath + ".Z"; if (!testPath.exists()) return FALSE; } } compressed = TRUE; MString tmpPath(256); assert(get_temp_filename((char *)tmpPath)); int status = system("gunzip -c " + testPath + " > " + tmpPath); if (status) return FALSE; testPath = tmpPath; } _ipipe = new ifstream((const char *) testPath); if (compressed) unlink(testPath); if (_ipipe && *_ipipe) return TRUE; return FALSE; } istream& InputFile::skip(unsigned nBytes) { // Dummy read function, as seekg doesn't seem to work on ipopen if (!nBytes || !*_ipipe) return *_ipipe; char *dummy = new char[nBytes]; assert(dummy); _ipipe->read(dummy, nBytes); delete [] dummy; return *_ipipe; } Boolean InputFile::close() { if (_ipipe) { // _ipipe->exit(); delete _ipipe; _ipipe = 0; return TRUE; } return FALSE; } /****************** * OutputFile class ******************/ const Boolean OutputFile::NO_COMPRESS = 0; const Boolean OutputFile::COMPRESS = 1; OutputFile::OutputFile(const Path& path, int mode, int compress) : _path(path.expanded().removeCompressedExtension()), _compress(compress) { Boolean isCompressed = FALSE; Path tempPath(_path); if (!tempPath.exists()) { tempPath = _path + ".gz"; if (!tempPath.exists()) { tempPath = _path + ".z"; if (!tempPath.exists()) tempPath = _path + ".Z"; } isCompressed = TRUE; } if (tempPath.exists()) { if (isCompressed && ((mode == ios::app) || (mode == ios::ate))) { MString command("gunzip " + tempPath); system(command); } if (mode == ios::out) { MString command("mv " + tempPath + " " + tempPath + "~"); system(command); } } open(_path, openmode(mode)); // (bert) made this standard(?) } OutputFile::~OutputFile() { Boolean good = this->good(); close(); if (good && (_compress == COMPRESS)) { MString command("gzip -f " + _path); // Compress fast system(command); } } // // Set functions // void OutputFile::compress(Boolean status) { _compress = (status) ? COMPRESS : NO_COMPRESS; } /*************************** * C file handling functions ***************************/ FILE * openFile(const Path& path, const char *mode) { Path expandedPath(path.expanded()); Path tempPath(expandedPath); Boolean isCompressed = FALSE; if (!tempPath.exists()) { tempPath = expandedPath + ".gz"; if (!tempPath.exists()) { tempPath = expandedPath + ".z"; if (!tempPath.exists()) tempPath = expandedPath + ".Z"; } isCompressed = TRUE; } if (tempPath.exists()) { if (isCompressed) { if (strcmp(mode, "a") == 0) { MString command("gunzip " + expandedPath); system(command); FILE *file = fopen(expandedPath, mode); return file; } else if (strcmp(mode, "r") == 0) { MString command("gunzip -c " + expandedPath); FILE *file = popen(command, mode); return file; } } if (strcmp(mode, "w") == 0) { MString command("mv " + tempPath + " " + tempPath + "~"); system(command); FILE *file = fopen(tempPath, mode); return file; } } FILE *file = fopen(expandedPath, mode); return file; } void closeFile(FILE *file) { if (file != NULL) if (pclose(file) == -1) fclose(file); } #ifdef HAVE_MATLAB static Dictionary<MATFile *, MString> matFileDict; MATFile * openMatlabFile(const Path& path, const char *mode) { Path expandedPath(path.expanded()); Path tempPath(expandedPath); Boolean isCompressed = FALSE; if (!tempPath.exists()) { tempPath = expandedPath + ".gz"; if (!tempPath.exists()) { tempPath = expandedPath + ".z"; if (!tempPath.exists()) tempPath = expandedPath + ".Z"; } isCompressed = TRUE; } if (tempPath.exists()) { if (isCompressed) { if (strcmp(mode, "r") == 0) { MString tempName("/tmp/midas."); tempName += (int) getpid(); MString command("gunzip -c " + expandedPath + "> " + tempName); MATFile *file = matOpen(tempName, (char *) mode); if (file) matFileDict[file] = tempName; return file; } } if (strcmp(mode, "w") == 0) { MString command("mv " + tempPath + " " + tempPath + "~"); system(command); MATFile *file = matOpen(tempPath, (char *) mode); return file; } } MATFile *file = matOpen(expandedPath, (char *) mode); if (file) { char **dir; int nDirEntries = 0; dir = matGetDir(file, &nDirEntries); matClose(file); // Close and reopen to make sure matGetNextMatrix can be used if (!dir || (nDirEntries <= 0)) file = 0; else file = matOpen(expandedPath, (char *) mode); if (dir) mxFree(dir); } return file; } void closeMatlabFile(MATFile *file) { if (!file) return; matClose(file); if (matFileDict.containsKey(file)) unlink(matFileDict[file]); } #endif int get_temp_filename(char *pathname) { #ifdef HAVE_MKSTEMP char *tmp_dir = getenv("TMPDIR"); if (tmp_dir == NULL) { #ifdef P_tmpdir tmp_dir = P_tmpdir; #else tmp_dir = "/tmp"; #endif } sprintf(pathname, "%s/EBTKSXXXXXX", tmp_dir); int fd = mkstemp(pathname); if (fd < 0) { return (0); } close(fd); #else char *tmp_ptr = tempnam(NULL, "EBTKS"); if (tmp_ptr == NULL) { return (0); // Error } strcpy(pathname, tmp_ptr); free(tmp_ptr); // Free result from tempnam() #endif return (1); } // // FORCED INSTANTIATIONS // // Needed for SGI, but won't compile under GCC!! // #if !defined(__GNUC__) && defined(__sgi) #include "Array.h" #include "SimpleArray.h" #include "ValueMap.h" #include "CachedArray.h" // From Array.h template Array<double>& Array<double>::absorb(Array<double>& array); template class Array<Path>; template class Array<LinearMap>; template unsigned Array<float>::debug(Boolean); template Array<float>& Array<float>::append(float); template int *Array<int>::asCarray(int *) const; template double *Array<double>::asCarray(double *) const; // From SimpleArray.h template SimpleArray<double> SimpleArray<double>::operator() (unsigned) const; template SimpleArray<double> SimpleArray<double>::operator() (unsigned, unsigned) const; template SimpleArray<double>& map(SimpleArray<double>&,const Array<LinearMap>&); template int SimpleArray<int>::min(unsigned *) const; template SimpleArray<int>::SimpleArray(int, double, int); template SimpleArray<float>& SimpleArray<float>::operator/=(const SimpleArray<float> &); template SimpleArray<float>& SimpleArray<float>::prune(); template SimpleArray<float> SimpleArray<float>::log() const; template unsigned SimpleArray<char>::occurrencesOf(char, unsigned, unsigned) const; template double SimpleArray<float>::sum() const; // From CachedArray.h template class CachedArray<float>; #endif // __sgi <file_sep>/src/test.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: test.cc,v $ $Revision: 1.1 $ $Author: jason $ $Date: 2001-11-09 16:37:24 $ $State: Exp $ --------------------------------------------------------------------------*/ #include "CachedArray.h" #include <sys/time.h> #include <sys/resource.h> #include <assert.h> void printContents(const SimpleArray<float>& A); /* * Little utility functions not necessary for median-finding. */ float current_cpu_usage (void) { struct rusage usage; getrusage (RUSAGE_SELF, &usage); return (float) usage.ru_utime.tv_sec + (usage.ru_utime.tv_usec / 1e6); } float prev_tic; void tic (char *msg) { if (msg != NULL) { cout << "timing operation: " << msg << endl; } prev_tic = current_cpu_usage (); } void toc (void) { cout << "time elapsed = " << current_cpu_usage() - prev_tic << " sec" << endl; } void main(int argc, char **argv) { unsigned size = 20; unsigned nBlocks = 2; unsigned blockSize = 7; if (argc > 3) blockSize = atoi(argv[3]); if (argc > 2) nBlocks = atoi(argv[2]); if (argc > 1) size = atoi(argv[1]); SimpleArray<float> *array = new CachedArray<float>(size, nBlocks, blockSize); //SimpleArray<float> *array = new SimpleArray<float>(size); assert(array); SimpleArray<float>& A = *array; for (unsigned i = 0; i < size; i++) A[i] = SQR(gauss(10, 10)); printContents(A); CachedArray<float> B; fstream stream("test.ar", ios::in|ios::out); A.saveBinary(stream); stream.seekg(0); B.loadBinary(stream, size); cout << "A: " << A << endl; cout << "B: " << B << endl; stream.seekg(0); A.saveAscii(stream); stream.seekg(0); B.clear(9); B.loadAscii(stream, size); cout << "A: " << A << endl; cout << "B: " << B << endl; A.clear(10); printContents(A); A.newSize(10); A.newSize(50); A.clear(8); B = A; A.clear(15); B += A; printContents(B); B /= 0.4; B += 3; B -= 3; B *= 0.4; printContents(B); } void printContents(const SimpleArray<float>& A) { // cout << endl << "Contents: " << A << endl; cout << endl << "Size: " << A.size() << endl; unsigned i; cout << "Min: " << A.min(&i) << " at " << i << endl; cout << "Max: " << A.max(&i) << " at " << i << endl; cout << "Sum: " << A.sum() << endl; cout << "Sum2: " << A.sumSqr() << endl; cout << "Mean: " << A.mean() << endl; cout << "Prod: " << A.prod() << endl; cout << "Prod2: " << A.prodSqr() << endl; cout << "Var: " << A.var() << endl; //A.resetHitRate(); cout << "Std: " << A.std() << endl; //" HR: " << A.hitRate() << endl; //A.resetHitRate(); tic("median"); cout << "Median: " << A.median() << endl; //" HR: " << A.hitRate() << endl; toc(); } <file_sep>/templates/Dictionary.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: Dictionary.cc,v $ $Revision: 1.2 $ $Author: bert $ $Date: 2003-04-16 15:03:14 $ $State: Exp $ --------------------------------------------------------------------------*/ #include "Dictionary.h" #include <assert.h> #include <iostream> // (bert) changed from iostream.h using namespace std; // (bert) added /****************** * Dictionary class ******************/ // // Constructors // template <class Key, class Value> Dictionary<Key, Value>::Dictionary(const Dictionary<Key, Value>& dict) : _defaultKey(dict._defaultKey), _defaultValue(dict._defaultValue) { _initialize(); DictIterator<Key, Value> entryIt(dict); DictEntry<Key, Value> *entry; while (entry = entryIt++) (*this)[entry->key] = entry->value; } // // Copy operator // template <class Key, class Value> Dictionary<Key, Value>& Dictionary<Key, Value>::operator = (const Dictionary<Key, Value>& dict) { delete _head; _initialize(); _defaultKey = dict._defaultKey; _defaultValue = dict._defaultValue; DictIterator<Key, Value> entryIt(dict); DictEntry<Key, Value> *entry; while (entry = entryIt++) (*this)[entry->key] = entry->value; return *this; } // // Get functions // template <class Key, class Value> Value * Dictionary<Key, Value>::at(const Key& requestedKey) { if (!_head) return 0; // Locate key DictEntry<Key, Value> *dictEntry = _head; while(1) { if (requestedKey != dictEntry->key) { if (!(dictEntry = dictEntry->_next)) return 0; } else return &dictEntry->value; } } template <class Key, class Value> Value& Dictionary<Key, Value>::operator [] (const Key& requestedKey) { // Empty dictionary, create a new entry if (!_head) { _current = new DictEntry<Key, Value>(requestedKey, _defaultValue); assert(_current); _size++; _current->_next = _current->_previous = 0; _head = _tail = _current; return _current->value; } // Locate key DictEntry<Key, Value> *dictEntry = _current; if (requestedKey < dictEntry->key) // Search backward while(1) { if (requestedKey != dictEntry->key) { if (requestedKey > dictEntry->key) { // Insert after dictEntry _current = new DictEntry<Key, Value>(requestedKey, _defaultValue); assert(_current); _size++; _current->_next = dictEntry->_next; _current->_previous = dictEntry; if (dictEntry != _tail) dictEntry->_next->_previous = _current; else _tail = _current; dictEntry->_next = _current; return _current->value; } DictEntry<Key, Value> *previous = dictEntry->_previous; if (!previous) { // Insert at the beginning _current = new DictEntry<Key, Value>(requestedKey, _defaultValue); assert(_current); _size++; _current->_next = dictEntry; _current->_previous = 0; dictEntry->_previous = _current; _head = _current; return _current->value; } dictEntry = previous; } else return dictEntry->value; // Key found; return value } else // Search forward while(1) { if (requestedKey != dictEntry->key) { if (requestedKey < dictEntry->key) { // Insert before dictEntry _current = new DictEntry<Key, Value>(requestedKey, _defaultValue); assert(_current); _size++; _current->_previous = dictEntry->_previous; _current->_next = dictEntry; if (dictEntry != _head) dictEntry->_previous->_next = _current; else _head = _current; dictEntry->_previous = _current; return _current->value; } DictEntry<Key, Value> *next = dictEntry->_next; if (!next) { // Append at the end _current = new DictEntry<Key, Value>(requestedKey, _defaultValue); assert(_current); _size++; _current->_previous = dictEntry; _current->_next = 0; dictEntry->_next = _current; _tail = _current; return _current->value; } dictEntry = next; } else return dictEntry->value; // Key found; return value } } template <class Key, class Value> Value Dictionary<Key, Value>::operator [] (const Key& requestedKey) const { // Empty dictionary, create a new entry if (!_head) { cerr << "Warning! Requested key " << requestedKey << " not in dictionary; returning default value" << endl; return _defaultValue; } // Locate key DictEntry<Key, Value> *dictEntry = _current; if (requestedKey < dictEntry->key) // Search backward while(1) { if (requestedKey != dictEntry->key) { if (!(dictEntry = dictEntry->_previous)) { cerr << "Warning! Requested key not in dictionary; returning default value" << endl; return _defaultValue; } } else return dictEntry->value; } else // Search forward while(1) { if (requestedKey == dictEntry->key) // Key found; return value return dictEntry->value; dictEntry = dictEntry->_next; if (!dictEntry) { cerr << "Warning! Requested key not in dictionary; returning default value" << endl; return _defaultValue; } } } template <class Key, class Value> const Key& Dictionary<Key, Value>::keyOf(const Value& value) { if (!_head) { cerr << "Warning! Requested value not in dictionary; returning default key" << endl; return _defaultKey; } // Locate key DictEntry<Key, Value> *dictEntry = _head; while(1) { if (dictEntry->value == value) return dictEntry->key; dictEntry = dictEntry->_next; if (!dictEntry) { cerr << "Warning! Requested value not in dictionary; returning default key" << endl; return _defaultKey; } } } template <class Key, class Value> Boolean Dictionary<Key, Value>::containsKey(const Key& key) const { if (!_head) return FALSE; DictEntry<Key, Value> *dictEntry = _head; while(1) { if (dictEntry->key == key) return TRUE; dictEntry = dictEntry->_next; if (!dictEntry) return FALSE; } } template <class Key, class Value> Boolean Dictionary<Key, Value>::containsValue(const Value& value) const { if (!_head) return FALSE; DictEntry<Key, Value> *dictEntry = _head; while(1) { if (dictEntry->value == value) return TRUE; dictEntry = dictEntry->_next; if (!dictEntry) return FALSE; } } // // Entry removing functions // template <class Key, class Value> void Dictionary<Key, Value>::remove(const Key& requestedKey) { if (!_head) return; // Locate key DictEntry<Key, Value> *dictEntry = _head; while(1) { if (requestedKey == dictEntry->key) { // Key found; delete it dictEntry->_previous->_next = dictEntry->_next; dictEntry->_next->_previous = dictEntry->_previous; delete dictEntry; _size--; } dictEntry = dictEntry->_next; if (!dictEntry) return; } } // // Operators // /* template <class Key, class Value> Dictionary<Key, Value>& Dictionary<Key, Value>::operator += (const Dictionary<Key, Value>& dict) { DictIterator<Key, Value> dictIt(dict); DictEntry<Key, Value> *dictEntry; while (dictEntry = dictIt++) (*this)[dictEntry->key] += dictEntry->value; return *this; } Dictionary<void *, void *>& Dictionary<void *, void *>::operator += (const Dictionary<void *, void *>& dict) { DictIterator<Key, Value> dictIt(dict); DictEntry<Key, Value> *dictEntry; while (dictEntry = dictIt++) os << dictEntry->key << ": " << dictEntry->value << endl; return *this; } */ template <class Key, class Value> Boolean Dictionary<Key, Value>::operator == (const Dictionary<Key, Value>& dict) const { if (_size != dict._size) return FALSE; if (!_head) return TRUE; DictIterator<Key, Value> entry1it(*this); DictIterator<Key, Value> entry2it(dict); DictEntry<Key, Value> *entry1, *entry2; while ((entry1 = entry1it++) && (entry2 = entry2it++) && (entry1->key == entry2->key) && (entry1->value == entry2->value)); if (entry1 || entry2) return FALSE; return TRUE; } // // Private functions // template <class Key, class Value> void Dictionary<Key, Value>::_notImplementedError() { cerr << "Not implemented Dictionary function called" << endl; } template <class Key, class Value> ostream& operator << (ostream& os, const Dictionary<Key, Value>&) { cerr << "Dictionary::operator << not implemented" << endl; return os; } /*************************** * Dictionary iterator class ***************************/ template <class Key, class Value> DictEntry<Key, Value> * DictIterator<Key, Value>::operator ++ () // Prefix increment operator { if (!_dictEntry) return 0; return _dictEntry = _dictEntry->_next; } template <class Key, class Value> DictEntry<Key, Value> * DictIterator<Key, Value>::operator ++ (int) // Postfix increment operator { if (!_dictEntry) return 0; DictEntry<Key, Value> *previous = _dictEntry; _dictEntry = _dictEntry->_next; return previous; } template <class Key, class Value> DictEntry<Key, Value> * DictIterator<Key, Value>::operator -- () // Prefix decrement operator { if (!_dictEntry) return 0; return _dictEntry = _dictEntry->_previous; } template <class Key, class Value> DictEntry<Key, Value> * DictIterator<Key, Value>::operator -- (int) // Postfix decrement operator { if (!_dictEntry) return 0; DictEntry<Key, Value> *next = _dictEntry; _dictEntry = _dictEntry->_previous; return next; } // g++ wants these declarations.... aargh. Supposedly this will be fixed in v2.8 #ifdef __GNUC__ #define _INSTANTIATE_DICTIONARY(keytype, valuetype) \ template class DictEntry<keytype, valuetype>; \ template class DictIterator<keytype, valuetype>; \ template class Dictionary<keytype, valuetype>; #ifdef HAVE_MATLAB #include "mat.h" #include "MString.h" _INSTANTIATE_DICTIONARY(matfile *, MString); #endif #endif <file_sep>/templates/Pool.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: Pool.cc,v $ $Revision: 1.2 $ $Author: bert $ $Date: 2003-04-16 16:57:23 $ $State: Exp $ --------------------------------------------------------------------------*/ #include <config.h> #include "Pool.h" #include <assert.h> #include <iostream> // (bert) changed from iostream.h using namespace std; // (bert) added template <class Type> Pool<Type>::Pool(unsigned nElements) : _elementSize(sizeof(Type)), _expansionSize(nElements), _blocks(_POOL_N_BLOCKS) { assert(_elementSize >= sizeof(_Link *)); assert(nElements); _head = 0; } template <class Type> Pool<Type>::~Pool() { ocIterator blockIt(_blocks); Type *block; while (block = (Type *) blockIt++) delete [] block; } template <class Type> void Pool<Type>::_grow() { Type *newBlock = new Type[_expansionSize]; assert(newBlock); _blocks.add(newBlock); Type *elementPtr = newBlock; for (unsigned i = _expansionSize - 1; i; i--, elementPtr++) ((_Link *) elementPtr)->next = (_Link *) (elementPtr + 1); // This will also do the trick; the _Link struct is really not necessary // *(Type **) elementPtr = elementPtr + 1; ((_Link *) elementPtr)->next = 0; _head = (_Link *) newBlock; } #ifdef __GNUC__ #define _INSTANTIATE_POOL(Type) \ template class Pool<Type>; #include "MPoint.h" _INSTANTIATE_POOL(MPoint); _INSTANTIATE_POOL(MPoint3D); _INSTANTIATE_POOL(MWorldPoint); #endif <file_sep>/templates/SimpleArraySpec.cc /* From SimpleArray.cc */ #if HAVE_FINITE #ifndef finite extern "C" int finite(double); #endif /* finite() not defined (as macro) */ #define FINITE(x) finite(x) #elif HAVE_ISFINITE #ifndef isfinite extern "C" int isfinite(double); #endif /* isfinite() not defined (as macro) */ #define FINITE(x) isfinite(x) #else #error "Neither finite() nor isfinite() is defined on your system" #endif /* HAVE_ISFINITE */ #ifdef USE_COMPMAT template <> SimpleArray<dcomplex>& SimpleArray<dcomplex>::prune() { unsigned i, j; for (i = 0, j = 0; i < _size; i++) { dcomplex value = getElConst(i); if (FINITE(real(value)) && FINITE(imag(value))) { if (i != j) setEl(j, value); j++; } } newSize(j); return *this; } #endif /* USE_COMPMAT */ #ifdef USE_FCOMPMAT template<> SimpleArray<fcomplex>& SimpleArray<fcomplex>::prune() { for (unsigned i = 0, j = 0; i < _size; i++) { fcomplex value = getElConst(i); if (FINITE(real(value)) && FINITE(imag(value))) { if (i != j) setEl(j, value); j++; } } newSize(j); return *this; } #endif #ifdef USE_COMPMAT template <> SimpleArray<dcomplex> SimpleArray<dcomplex>::round(unsigned n) const { SimpleArray<dcomplex> result(_size); const dcomplex *sourcePtr = _contents; dcomplex *destPtr = result.contents(); if (n) { unsigned factor = (unsigned) pow(10.0, double(n)); for (unsigned i = _size; i; i--) { *destPtr++ = dcomplex(ROUND(factor*(real(*sourcePtr)))/factor, ROUND(factor*(imag(*sourcePtr)))/factor); sourcePtr++; } } else for (unsigned i = _size; i; i--) { *destPtr++ = dcomplex(ROUND(real(*sourcePtr)), ROUND(imag(*sourcePtr))); sourcePtr++; } return result; } #endif /* USE_COMPMAT */ #ifdef USE_FCOMPMAT template <> SimpleArray<fcomplex> SimpleArray<fcomplex>::round(unsigned n) const { SimpleArray<fcomplex> result(_size); const fcomplex *sourcePtr = _contents; fcomplex *destPtr = result.contents(); if (n) { unsigned factor = (unsigned) pow(10.0, double(n)); for (unsigned i = _size; i; i--) { *destPtr++ = fcomplex(ROUND(factor*(real(*sourcePtr)))/factor, ROUND(factor*(imag(*sourcePtr)))/factor); sourcePtr++; } } else for (unsigned i = _size; i; i--) { *destPtr++ = fcomplex(ROUND(real(*sourcePtr)), ROUND(imag(*sourcePtr))); sourcePtr++; } return result; } #endif #ifdef USE_COMPMAT template <> SimpleArray<dcomplex> operator ^ (double base, const SimpleArray<dcomplex>& array) { unsigned N = array.size(); SimpleArray<dcomplex> result(N); const dcomplex *sourcePtr = array.contents(); dcomplex *resultPtr = result.contents(); for (unsigned i = N; i != 0; i--) *resultPtr++ = dcomplex(pow(base, *sourcePtr++)); return result; } #endif #ifdef USE_FCOMPMAT template <> SimpleArray<fcomplex> operator ^ (double base, const SimpleArray<fcomplex>& array) { unsigned N = array.size(); SimpleArray<fcomplex> result(N); const fcomplex *sourcePtr = array.contents(); fcomplex *resultPtr = result.contents(); for (unsigned i = N; i != 0; i--) *resultPtr++ = fcomplex(pow(base, *sourcePtr++)); return result; } #endif // Explicit specializations of the "abs" function for unsigned types // (Yes, they're just identity operations.) // template <> SimpleArray<unsigned int> SimpleArray<unsigned int>::abs() const { return *this; } template <> SimpleArray<char> SimpleArray<char>::abs() const { return *this; } template <> SimpleArray<unsigned char> SimpleArray<unsigned char>::abs() const { return *this; } template <> SimpleArray<unsigned short> SimpleArray<unsigned short>::abs() const { return *this; } <file_sep>/src/MPoint.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: MPoint.cc,v $ $Revision: 1.2 $ $Author: stever $ $Date: 2003-11-17 04:07:52 $ $State: Exp $ --------------------------------------------------------------------------*/ #include <config.h> #include "MPoint.h" #include <assert.h> //#include "MRegion.h" using namespace std; Pool<MPoint> MPoint::_pool; // = Pool<MPoint>(); //Pool<MPoint3D> MPoint3D::_pool = Pool<MPoint3D>(); Pool<MWorldPoint> MWorldPoint::_pool; // = Pool<MWorldPoint>(); MPoint& MPoint::magnify(int mag) { if (mag) if (mag > 0) { x *= mag; y *= mag; } else { x /= -mag; y /= -mag; } return *this; } istream& operator >> (istream& is, MPoint *&point) { if (!point) { int x, y; is >> x >> y; point = new MPoint(x, y); assert(point); } else is >> point->x >> point->y; return is; } istream& operator >> (istream& is, MPoint& point) { is >> point.x >> point.y; return is; } ostream& operator << (ostream& os, const MPoint& point) { os << point.x << " " << point.y; return os; } <file_sep>/templates/miscTemplateFunc.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: miscTemplateFunc.cc,v $ $Revision: 1.3 $ $Author: bert $ $Date: 2003-04-16 17:56:57 $ $State: Exp $ --------------------------------------------------------------------------*/ #include "miscTemplateFunc.h" #include "Histogram.h" #include "dcomplex.h" #include "fcomplex.h" <file_sep>/Makefile.am AUTOMAKE_OPTIONS = check-news ACLOCAL_AMFLAGS = -I m4 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/templates -DUSE_COMPMAT -DUSE_DBLMAT lib_LTLIBRARIES = libEBTKS.la EXTRA_DIST = $(m4_files) \ epm-header.in # Some #include'd C++ sources which are not independently compiled. # noinst_HEADERS = \ templates/SimpleArraySpec.cc \ templates/MatrixSpec.cc \ clapack/f2c.h \ clapack/blaswrap.h # Headers which are installed. # include_ebtksdir = $(includedir)/EBTKS include_ebtks_HEADERS = \ include/amoeba.h \ include/assert.h \ include/backProp.h \ include/Complex.h \ include/dcomplex.h \ include/fcomplex.h \ include/FileIO.h \ include/Histogram.h \ include/matlabSupport.h \ include/Minc.h \ include/MPoint.h \ include/MString.h \ include/MTypes.h \ include/OpTimer.h \ include/OrderedCltn.h \ include/Path.h \ include/Polynomial.h \ include/popen.h \ include/TrainingSet.h \ include/trivials.h \ templates/Array.h \ templates/CachedArray.h \ templates/Dictionary.h \ templates/Matrix3D.h \ templates/Matrix.h \ templates/MatrixSupport.h \ templates/MatrixTest.h \ templates/miscTemplateFunc.h \ templates/Pool.h \ templates/SimpleArray.h \ templates/Stack.h \ templates/ValueMap.h # Source files # libEBTKS_la_SOURCES = version.cc \ src/FileIO.cc \ src/Histogram.cc \ src/MPoint.cc \ src/MString.cc \ src/OpTimer.cc \ src/OrderedCltn.cc \ src/Path.cc \ src/Polynomial.cc \ src/TrainingSet.cc \ src/amoeba.cc \ src/backProp.cc \ src/fcomplex.cc \ src/dcomplex.cc \ templates/Array.cc \ templates/CachedArray.cc \ templates/Dictionary.cc \ templates/Matrix.cc \ templates/MatrixSupport.cc \ templates/Pool.cc \ templates/SimpleArray.cc \ templates/ValueMap.cc \ templates/miscTemplateFunc.cc \ templates/MatrixConv.cc \ clapack/dcopy.c \ clapack/dgemm.c \ clapack/dgemv.c \ clapack/dger.c \ clapack/dlasyf.c \ clapack/dscal.c \ clapack/dswap.c \ clapack/dsyr.c \ clapack/dsysv.c \ clapack/dsytf2.c \ clapack/dsytrf.c \ clapack/dsytrs.c \ clapack/idamax.c \ clapack/ieeeck.c \ clapack/ilaenv.c \ clapack/lsame.c \ clapack/s_cmp.c \ clapack/s_copy.c \ clapack/xerbla.c m4_files = m4/mni_REQUIRE_LIB.m4 \ m4/mni_REQUIRE_MNILIBS.m4 \ m4/mni_REQUIRE_OPENINVENTOR.m4 \ m4/mni_cxx_have_koenig_lookup.m4 \ m4/smr_CGAL_MAKEFILE.m4 \ m4/smr_OPTIONAL_LIB.m4 \ m4/smr_REQUIRED_LIB.m4 \ m4/smr_WITH_BUILD_PATH.m4 <file_sep>/templates/Makefile.am AM_CPPFLAGS = -I$(top_srcdir)/include pkginclude_HEADERS = \ Array.h \ CachedArray.h \ Dictionary.h \ Matrix3D.h \ Matrix.h \ MatrixSupport.h \ MatrixTest.h \ miscTemplateFunc.h \ Pool.h \ SimpleArray.h \ Stack.h \ ValueMap.h noinst_LTLIBRARIES = libAZgen_t.la libAZgen_t_la_SOURCES = \ Array.cc \ CachedArray.cc \ Dictionary.cc \ Matrix.cc \ MatrixSupport.cc \ Pool.cc \ SimpleArray.cc \ ValueMap.cc \ miscTemplateFunc.cc \ MatrixConv.cc <file_sep>/templates/MatrixSupport.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: MatrixSupport.cc,v $ $Revision: 1.4 $ $Author: bert $ $Date: 2004-01-29 19:42:19 $ $State: Exp $ --------------------------------------------------------------------------*/ #include "config.h" #ifdef HAVE_MALLOC_H #include <malloc.h> #endif #include <math.h> #include <stdio.h> #include <iostream> // (bert) changed from iostream.h using namespace std; // (bert) added #include "dcomplex.h" #include "MatrixSupport.h" /* ** FFT and FHT routines ** Copyright 1988, 1993; <NAME> ** ** fht(fz,n); ** Does a hartley transform of "n" points in the array "fz". ** fft(n,real,imag) ** Does a fourier transform of "n" points of the "real" and ** "imag" arrays. ** ifft(n,real,imag) ** Does an inverse fourier transform of "n" points of the "real" ** and "imag" arrays. ** realfft(n,real) ** Does a real-valued fourier transform of "n" points of the ** "real" and "imag" arrays. The real part of the transform ends ** up in the first half of the array and the imaginary part of the ** transform ends up in the second half of the array. ** realifft(n,real) ** The inverse of the realfft() routine above. ** ** ** NOTE: This routine uses at least 2 patented algorithms, and may be ** under the restrictions of a bunch of different organizations. ** Although I wrote it completely myself; it is kind of a derivative ** of a routine I once authored and released under the GPL, so it ** may fall under the free software foundation's restrictions; ** it was worked on as a Stanford Univ project, so they claim ** some rights to it; it was further optimized at work here, so ** I think this company claims parts of it. The patents are ** held by <NAME> (the FHT algorithm) and <NAME> (the ** trig generator), both at Stanford Univ. ** If it were up to me, I'd say go do whatever you want with it; ** but it would be polite to give credit to the following people ** if you use this anywhere: ** Euler - probable inventor of the fourier transform. ** Gauss - probable inventor of the FFT. ** Hartley - probable inventor of the hartley transform. ** Buneman - for a really cool trig generator ** Mayer(me) - for authoring this particular version and ** including all the optimizations in one package. ** Thanks, ** <NAME>; <EMAIL> ** */ #define GOOD_TRIG char fht_version[] = "Brcwl-Hrtly-Ron-dbld"; #define SQRT2_2 0.70710678118654752440084436210484 #define SQRT2 2*0.70710678118654752440084436210484 void fht(double *fz, int n) { // double c1,s1,s2,c2,s3,c3,s4,c4; // double f0,g0,f1,g1,f2,g2,f3,g3; int i,k,k1,k2,k3,k4,kx; double *fi,*fn,*gi; TRIG_VARS; for (k1=1,k2=0;k1<n;k1++) { double a; for (k=n>>1; (!((k2^=k)&k)); k>>=1); if (k1>k2) { a=fz[k1];fz[k1]=fz[k2];fz[k2]=a; } } for ( k=0 ; (1<<k)<n ; k++ ); k &= 1; if (k==0) { for (fi=fz,fn=fz+n;fi<fn;fi+=4) { double f0,f1,f2,f3; f1 = fi[0 ]-fi[1 ]; f0 = fi[0 ]+fi[1 ]; f3 = fi[2 ]-fi[3 ]; f2 = fi[2 ]+fi[3 ]; fi[2 ] = (f0-f2); fi[0 ] = (f0+f2); fi[3 ] = (f1-f3); fi[1 ] = (f1+f3); } } else { for (fi=fz,fn=fz+n,gi=fi+1;fi<fn;fi+=8,gi+=8) { double s1,c1,s2,c2,s3,c3,s4,c4,g0,f0,f1,g1,f2,g2,f3,g3; c1 = fi[0 ] - gi[0 ]; s1 = fi[0 ] + gi[0 ]; c2 = fi[2 ] - gi[2 ]; s2 = fi[2 ] + gi[2 ]; c3 = fi[4 ] - gi[4 ]; s3 = fi[4 ] + gi[4 ]; c4 = fi[6 ] - gi[6 ]; s4 = fi[6 ] + gi[6 ]; f1 = (s1 - s2); f0 = (s1 + s2); g1 = (c1 - c2); g0 = (c1 + c2); f3 = (s3 - s4); f2 = (s3 + s4); g3 = SQRT2*c4; g2 = SQRT2*c3; fi[4 ] = f0 - f2; fi[0 ] = f0 + f2; fi[6 ] = f1 - f3; fi[2 ] = f1 + f3; gi[4 ] = g0 - g2; gi[0 ] = g0 + g2; gi[6 ] = g1 - g3; gi[2 ] = g1 + g3; } } if (n<16) return; do { double s1,c1; k += 2; k1 = 1 << k; k2 = k1 << 1; k4 = k2 << 1; k3 = k2 + k1; kx = k1 >> 1; fi = fz; gi = fi + kx; fn = fz + n; do { double g0,f0,f1,g1,f2,g2,f3,g3; f1 = fi[0 ] - fi[k1]; f0 = fi[0 ] + fi[k1]; f3 = fi[k2] - fi[k3]; f2 = fi[k2] + fi[k3]; fi[k2] = f0 - f2; fi[0 ] = f0 + f2; fi[k3] = f1 - f3; fi[k1] = f1 + f3; g1 = gi[0 ] - gi[k1]; g0 = gi[0 ] + gi[k1]; g3 = SQRT2 * gi[k3]; g2 = SQRT2 * gi[k2]; gi[k2] = g0 - g2; gi[0 ] = g0 + g2; gi[k3] = g1 - g3; gi[k1] = g1 + g3; gi += k4; fi += k4; } while (fi<fn); TRIG_INIT(k,c1,s1); for (i=1;i<kx;i++) { double c2,s2; TRIG_NEXT(k,c1,s1); c2 = c1*c1 - s1*s1; s2 = 2*(c1*s1); fn = fz + n; fi = fz +i; gi = fz +k1-i; do { double a,b,g0,f0,f1,g1,f2,g2,f3,g3; b = s2*fi[k1] - c2*gi[k1]; a = c2*fi[k1] + s2*gi[k1]; f1 = fi[0 ] - a; f0 = fi[0 ] + a; g1 = gi[0 ] - b; g0 = gi[0 ] + b; b = s2*fi[k3] - c2*gi[k3]; a = c2*fi[k3] + s2*gi[k3]; f3 = fi[k2] - a; f2 = fi[k2] + a; g3 = gi[k2] - b; g2 = gi[k2] + b; b = s1*f2 - c1*g3; a = c1*f2 + s1*g3; fi[k2] = f0 - a; fi[0 ] = f0 + a; gi[k3] = g1 - b; gi[k1] = g1 + b; b = c1*g2 - s1*f3; a = s1*g2 + c1*f3; gi[k2] = g0 - a; gi[0 ] = g0 + a; fi[k3] = f1 - b; fi[k1] = f1 + b; gi += k4; fi += k4; } while (fi<fn); } TRIG_RESET(k,c1,s1); } while (k4<n); } void ifft(int n, double *real, double *imag) { double a,b,c,d; double q,r,s,t; int i,j,k; fht(real,n); fht(imag,n); for (i=1,j=n-1,k=n/2;i<k;i++,j--) { a = real[i]; b = real[j]; q=a+b; r=a-b; c = imag[i]; d = imag[j]; s=c+d; t=c-d; imag[i] = (s+r)*0.5; imag[j] = (s-r)*0.5; real[i] = (q-t)*0.5; real[j] = (q+t)*0.5; } } void realfft(int n, double *real) { double a,b; int i,j,k; fht(real,n); for (i=1,j=n-1,k=n/2;i<k;i++,j--) { a = real[i]; b = real[j]; real[j] = (a-b)*0.5; real[i] = (a+b)*0.5; } } void fft(int n, double *real, double *imag) { double a,b,c,d; double q,r,s,t; int i,j,k; for (i=1,j=n-1,k=n/2;i<k;i++,j--) { a = real[i]; b = real[j]; q=a+b; r=a-b; c = imag[i]; d = imag[j]; s=c+d; t=c-d; real[i] = (q+t)*.5; real[j] = (q-t)*.5; imag[i] = (s-r)*.5; imag[j] = (s+r)*.5; } fht(real,n); fht(imag,n); } void realifft(int n, double *real) { double a,b; int i,j,k; for (i=1,j=n-1,k=n/2;i<k;i++,j--) { a = real[i]; b = real[j]; real[j] = (a-b); real[i] = (a+b); } fht(real,n); } /* ** End of <NAME>'s code */ /* This function is removed because it exists in trivial.h called from FileIO.h double gauss(double mean, double std_dev) { double v1 = 2.0*drand48() - 1.0; double v2 = 2.0*drand48() - 1.0; double s = v1*v1 + v2*v2; while (s >= 1.0) { v1 = 2.0*drand48() - 1.0; v2 = 2.0*drand48() - 1.0; s = v1*v1 + v2*v2; } return mean + std_dev*v1*(::sqrt(-2.0*log(s)/s)); } */ void jacobi(double **a, unsigned n, double *d, double **v) { unsigned nrot; int j,iq,ip,i; double tresh,theta,tau,t,sm,s,h,g,c; double *b, *z; b = (double *) malloc((n+1)*sizeof(double)); z = (double *) malloc((n+1)*sizeof(double)); for( ip = 1 ; ip <= n ; ip++) { for( iq = 1 ; iq <= n ; iq++) { v[ip][iq] = 0.0; } v[ip][ip] = 1.0; } for( ip = 1 ; ip <= n ; ip++) { b[ip] = a[ip][ip]; d[ip] = b[ip]; z[ip] = 0.0; } nrot = 0; for( i = 1 ; i <= 50 ; i++) { sm = 0.0; for( ip = 1 ; ip <= n-1 ; ip++ ) { for( iq = ip+1 ; iq <= n ; iq++ ) { sm = sm+fabs(a[ip][iq]); } } if (sm == 0.0) goto position99; if (i < 4) { tresh = 0.2*sm/(n*n);} else { tresh = 0.0;} for( ip = 1 ; ip <= n-1 ; ip++) { for( iq = ip+1 ; iq <= n ; iq++) { g = 100.0*fabs(a[ip][iq]); if ( (i > 4) && ( (fabs(d[ip])+g) == fabs(d[ip]) ) && ( (fabs(d[iq])+g) == fabs(d[iq]) ) ) a[ip][iq] = 0.0; else if (fabs(a[ip][iq]) > tresh) { h = d[iq]-d[ip]; if ((fabs(h)+g) == fabs(h)) t = a[ip][iq]/h; else { theta = 0.5*h/a[ip][iq]; t = 1.0/(fabs(theta)+::sqrt(1.0+theta*theta)); if (theta < 0.0) t = -t; } c = 1.0/(::sqrt(1+ t*t )); s = t*c; tau = s/(1.0+c); h = t*a[ip][iq]; z[ip] = z[ip]-h; z[iq] = z[iq]+h; d[ip] = d[ip]-h; d[iq] = d[iq]+h; a[ip][iq] = 0.0; for( j = 1 ; j <= ip-1 ; j++) { g = a[j][ip]; h = a[j][iq]; a[j][ip] = g-s*(h+g*tau); a[j][iq] = h+s*(g-h*tau); } for( j = ip+1 ; j <= iq-1 ; j++) { g = a[ip][j]; h = a[j][iq]; a[ip][j] = g-s*(h+g*tau); a[j][iq] = h+s*(g-h*tau); } for( j = iq+1 ; j <= n ; j++) { g = a[ip][j]; h = a[iq][j]; a[ip][j] = g-s*(h+g*tau); a[iq][j] = h+s*(g-h*tau); } for( j = 1 ; j <= n ; j++) { g = v[j][ip]; h = v[j][iq]; v[j][ip] = g-s*(h+g*tau); v[j][iq] = h+s*(g-h*tau); } nrot = nrot+1; } } } } for( ip = 1 ; ip <= n ; ip++) { b[ip] = b[ip]+z[ip]; d[ip] = b[ip]; z[ip] = 0.0; } printf("pause in routine JACOBI\n"); printf("50 iterations should not happen\n"); getchar(); position99: free((char *)b); free((char *)z); return; } //fft functions: //-------------- /***************************************************************************** * * void fft_basic(cbuffer,sintab,buflog,direct) * This function should not be called directly. It is called by * the fft(cbuffer,len) or the ifft(cbuffer,len). * * Input: Takes input directly from fft(cbuffer,len) or ifft(cbuffer,len). * Output: No output. * p******************************************************************************/ /* Do not touch this!!! */ #ifdef USE_COMPMAT void fft_basic(dcomplex *cbuffer,double *sintab, int buflog, int direct) { int bufflen,halflen,quadlen; register int blknum,blkctr,offset,sinarg; double wsin,wcos,remult,immult; register dcomplex *bufpt0,*bufpt1; bufflen = 1 << buflog; halflen = bufflen >> 1; quadlen = halflen >> 1; for(blknum = bufflen; (blkctr = --blknum) >= 0; ) { for(offset = 0,sinarg = buflog; --sinarg >= 0; ) { offset <<= 1; offset += blkctr & 1; blkctr >>= 1; } if(blknum < offset) { bufpt0 = cbuffer + blknum; bufpt1 = cbuffer + offset; remult = real(*bufpt0); immult = imag(*bufpt0); *bufpt0 = dcomplex(real(*bufpt1),imag(*bufpt1)); *bufpt1 = dcomplex(remult,immult); } } offset = 1; blknum = halflen; while(--buflog >= 0) { sinarg = halflen; bufpt0 = cbuffer + (bufflen + offset); bufpt1 = bufpt0 + offset; offset <<= 1; while((sinarg -= blknum) >= 0) { if(sinarg <= quadlen) { wsin = sintab[sinarg]; wcos = sintab[quadlen - sinarg]; } else { wsin = sintab[halflen - sinarg]; wcos = -(sintab[sinarg - quadlen]); } if(direct == 0) wsin = (-wsin); blkctr = blknum; bufpt0 -= (bufflen + 1); bufpt1 -= (bufflen + 1); while(--blkctr >= 0) { remult = wcos * real(*bufpt1) - wsin * imag(*bufpt1); immult = wcos * imag(*bufpt1) + wsin * real(*bufpt1); *bufpt1 = *bufpt0 - dcomplex(remult,immult); *bufpt0 = *bufpt0 + dcomplex(remult,immult); bufpt0 += offset; bufpt1 += offset; } } blknum >>= 1; } } #endif /// #ifdef USE_FCOMPMAT void fft_basic_float(fcomplex *cbuffer,float *sintab, int buflog, int direct) { int bufflen,halflen,quadlen; register int blknum,blkctr,offset,sinarg; float wsin,wcos,remult,immult; register fcomplex *bufpt0,*bufpt1; bufflen = 1 << buflog; halflen = bufflen >> 1; quadlen = halflen >> 1; for(blknum = bufflen; (blkctr = --blknum) >= 0; ) { for(offset = 0,sinarg = buflog; --sinarg >= 0; ) { offset <<= 1; offset += blkctr & 1; blkctr >>= 1; } if(blknum < offset) { bufpt0 = cbuffer + blknum; bufpt1 = cbuffer + offset; remult = real(*bufpt0); immult = imag(*bufpt0); *bufpt0 = fcomplex(real(*bufpt1),imag(*bufpt1)); *bufpt1 = fcomplex(remult,immult); } } offset = 1; blknum = halflen; while(--buflog >= 0) { sinarg = halflen; bufpt0 = cbuffer + (bufflen + offset); bufpt1 = bufpt0 + offset; offset <<= 1; while((sinarg -= blknum) >= 0) { if(sinarg <= quadlen) { wsin = sintab[sinarg]; wcos = sintab[quadlen - sinarg]; } else { wsin = sintab[halflen - sinarg]; wcos = -(sintab[sinarg - quadlen]); } if(direct == 0) wsin = (-wsin); blkctr = blknum; bufpt0 -= (bufflen + 1); bufpt1 -= (bufflen + 1); while(--blkctr >= 0) { remult = wcos * real(*bufpt1) - wsin * imag(*bufpt1); immult = wcos * imag(*bufpt1) + wsin * real(*bufpt1); *bufpt1 = *bufpt0 - fcomplex(remult,immult); *bufpt0 = *bufpt0 + fcomplex(remult,immult); bufpt0 += offset; bufpt1 += offset; } } blknum >>= 1; } } #endif // End of C code void inferDimensions(unsigned long nElements, unsigned& nrows, unsigned& ncols) { // Both nrows and ncols or only ncols supplied; (re)calculate nrows if (ncols) { nrows = nElements/ncols; return; } // Only nrows supplied; calculate ncols if (nrows) { ncols = nElements/nrows; return; } // Neither nrows nor ncols supplied; start with a square matrix, and // reduce nrows until a match is found. nrows = ncols = unsigned(::sqrt(double(nElements))); while (nrows * ncols != nElements) { nrows--; ncols = nElements/nrows; } } void inferDimensions(unsigned long nElements, unsigned& nslis, unsigned& nrows, unsigned& ncols) { if (nslis) { inferDimensions(nElements/nslis, nrows, ncols); return; } if (nrows) { inferDimensions(nElements/nrows, nslis, ncols); return; } if (ncols) { inferDimensions(nElements/ncols, nslis, nrows); return; } // No dimension supplied; start with a cubical matrix, and // reduce slis/nrows until a match is found. nslis = nrows = ncols = unsigned(pow(double(nElements), 1.0/3)); while (nslis * nrows * ncols != nElements) { nslis--; inferDimensions(nElements/nslis, nrows, ncols); } } <file_sep>/src/Makefile.am AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/templates noinst_LTLIBRARIES = libAZgen_s.la libAZgen_s_la_SOURCES = \ FileIO.cc \ Histogram.cc \ MPoint.cc \ MString.cc \ OpTimer.cc \ OrderedCltn.cc \ Path.cc \ Polynomial.cc \ Spline.cc \ TBSpline.cc \ TrainingSet.cc \ amoeba.cc \ backProp.cc \ fcomplex.cc \ dcomplex.cc <file_sep>/src/OrderedCltn.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: OrderedCltn.cc,v $ $Revision: 1.3 $ $Author: jason $ $Date: 2004-01-19 15:38:15 $ $State: Exp $ --------------------------------------------------------------------------*/ #include <iostream> // (bert) changed from iostream.h using namespace std; // (bert) added #ifdef HAVE_MALLOC_H #include <malloc.h> #endif #include "OrderedCltn.h" /* * ordered collection iterator class functions */ void * ocIterator::operator ++() { // Prefix if (!pOC || (++uCurIndex >= pOC->uEndIndex)) return 0; return pOC->Contents[uCurIndex]; } void * ocIterator::operator ++(int) { // Postfix if (!pOC || (uCurIndex >= pOC->uEndIndex)) return 0; return pOC->Contents[uCurIndex++]; } void * ocIterator::operator --() { // Prefix if (!pOC || ((int) --uCurIndex < 0)) // typecasting because of unsigned return 0; return pOC->Contents[uCurIndex]; } void * ocIterator::operator --(int) { // Postfix if (!pOC || ((int) uCurIndex < 0)) // typecasting because of unsigned return 0; return pOC->Contents[uCurIndex--]; } /* * ordered collection class functions */ // display error and exit routines void OrderedCltn::no_mem_err () const { cerr << "insufficient memory for collection of size " << uCapacity << "\n"; exit (-1); } void OrderedCltn::range_err (unsigned u) const { cerr << "Collection range error (index " << u << ", range [0 - " << uEndIndex-1 << "])\n"; exit (-1); } void OrderedCltn::not_impl_err () const { cerr << "Attempted bogus operation on OrderedCltn" << endl; } // default constructor (NOTE: malloc is called instead of the usual new because // realloc will be called when the array has to resized) OrderedCltn::OrderedCltn ( unsigned uCap ) { if ( uCap == 0 ) uCap = 1; uCapacity = uCap; uEndIndex = 0; Contents = (void **)malloc ( sizeof (void *) * uCap ); if ( Contents == NULL ) no_mem_err (); } OrderedCltn::OrderedCltn ( const OrderedCltn& OC ) { uCapacity = OC.uCapacity; uEndIndex = 0; Contents = (void **)malloc ( sizeof (void *) * uCapacity ); if ( Contents == NULL ) no_mem_err (); ocIterator itOC (OC); void *pv; while ( pv = itOC++ ) add (pv); } OrderedCltn::~OrderedCltn () { free ((char *)Contents); } // increase the capacity of the collection void OrderedCltn::reSize (unsigned uNewCap) { if ( uNewCap <= uCapacity ) return; uCapacity = uNewCap; Contents = (void **)realloc ( (char *)Contents, sizeof (void *) * uNewCap ); if ( Contents == NULL ) no_mem_err (); } /* * find index of a specified pointer */ int OrderedCltn::indexOf (const void* Ptr) const { for (register unsigned i = 0; i < uEndIndex; i++) if (Contents[i] == Ptr) return (int) i; return -1; } /* * return the total number of occurrences of an object */ unsigned OrderedCltn::occurrencesOf (const void* Ptr) const { ocIterator i_OC ( *this ); register unsigned u = 0; register void* p; while ( p = i_OC++ ) if ( Ptr == p ) u++; return u; } /* * add a pointer at the specified index */ unsigned OrderedCltn::add ( const void* Newptr, unsigned uIndex ) { if ( uIndex > uEndIndex ) range_err (uIndex); if ( uEndIndex == uCapacity ) reSize (uCapacity + EXPANSION_INCREMENT); for ( register unsigned u = uEndIndex; u > uIndex; u-- ) Contents[u] = Contents[u-1]; Contents[uIndex] = (void*)Newptr; uEndIndex++; return (uIndex); } /* * add a new pointer after the specified pointer */ unsigned OrderedCltn::addAfter (const void* Ptr, const void *Newptr) { register unsigned uIndex; if ((uIndex = indexOf (Ptr)) >= uEndIndex) return ~0; return add (Newptr, uIndex+1); } /* * add an ordered collection of pointers at the beginning */ const OrderedCltn& OrderedCltn::addAllFirst (const OrderedCltn& cltn) { unsigned n2add = cltn.size(); if (n2add > 0) { if (uEndIndex + n2add >= uCapacity ) reSize(uEndIndex + n2add + EXPANSION_INCREMENT); unsigned i; void **sourcePtr = Contents + uEndIndex - 1; void **destPtr = Contents + uEndIndex + n2add - 1; for (i = uEndIndex; i; i--) *destPtr-- = *sourcePtr--; sourcePtr = cltn.Contents; destPtr = Contents; for (i = n2add; i; i--) *destPtr++ = *sourcePtr++; uEndIndex += n2add; } return cltn; } /* * add an ordered collection of pointers at the end */ const OrderedCltn& OrderedCltn::addAllLast (const OrderedCltn& cltn) { if ( uEndIndex+cltn.size() >= uCapacity ) reSize(uEndIndex+cltn.size()+EXPANSION_INCREMENT); for (register int i=0; i<cltn.size(); i++) Contents[uEndIndex++] = cltn.Contents[i]; return cltn; } // add a new pointer before the specified pointer unsigned OrderedCltn::addBefore (const void* Ptr, const void *Newptr) { register unsigned uIndex; if ((uIndex = indexOf (Ptr)) >= uEndIndex) return ~0; return add (Newptr, uIndex); } // remove the contents at the specified index from the collection void* OrderedCltn::remove (unsigned uIndex) { if (uIndex >= uEndIndex) range_err (uIndex); void* Delptr = Contents[uIndex]; uEndIndex--; for (register unsigned u = uIndex; u < uEndIndex; u++) Contents[u] = Contents[u+1]; return (Delptr); } void * OrderedCltn::remove() { if (uEndIndex != 0) return remove(uEndIndex - 1); return 0; } // remove the specified pointer if it exists unsigned OrderedCltn::remove (const void* Ptr) { register unsigned uIndex; if ((uIndex = indexOf (Ptr)) >= uEndIndex) return 0; remove (uIndex); return 1; } OrderedCltn& OrderedCltn::operator = (const OrderedCltn& OC) { free ((char *)Contents); uCapacity = OC.uCapacity; uEndIndex = 0; Contents = (void **)malloc (sizeof (void *) * uCapacity); if (Contents == 0) no_mem_err(); ocIterator itOC (OC); void *pv; while (pv = itOC++) add (pv); return (*this); } // equivalence (NOTE: all entries must be in the same sequence) int OrderedCltn::operator ==(const OrderedCltn& OC) const { if (uEndIndex != OC.uEndIndex) return 0; ocIterator itThis (*this), itOC (OC); register void* pv; while (pv = itThis++) if (pv != itOC++) return 0; return 1; } OrderedCltn& OrderedCltn::operator &=(const OrderedCltn& OC) { register unsigned uIndex = uEndIndex; while (uIndex--) if (!OC.indexOf ((const void*)Contents[uIndex])) remove (uIndex); // ... remove it from this collection return *this; } <file_sep>/src/Path.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: Path.cc,v $ $Revision: 1.3 $ $Author: bert $ $Date: 2003-04-16 18:42:39 $ $State: Exp $ --------------------------------------------------------------------------*/ #include <config.h> #include "Path.h" #include <assert.h> #include <dirent.h> #include <fstream> // (bert) changed from fstream.h using namespace std; // (bert) added #include <pwd.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> const char *Path::_separator = "."; const char *Path::_imageNumberWildCard = "#"; // // Constructors // Path::Path(const MString& dir, const MString& file) : MString(dir.length() + file.length() + 1) { if ((dir.length() > 0) && (dir.lastChar() != '/') && (file.firstChar() != '/')) { strcpy((char *) string(), dir.string()); (*this)[dir.length()] = '/'; strcpy((char *) string() + dir.length() + 1, file.string()); } else if ((dir.lastChar() == '/') && (file.firstChar() == '/')) { strcpy((char *) string(), dir.string()); (*this)[dir.length() - 1] = '/'; strcpy((char *) string() + dir.length(), file.string()); } else { strcpy((char *) string(), dir.string()); strcpy((char *) string() + dir.length(), file.string()); } } // // Get functions // MString * Path::dir() const { int lastSlashIndex = this->indexOf('/', -1); if (lastSlashIndex >= 0) { MString *dirString = new MString((*this)(0, lastSlashIndex)); assert(dirString); return(dirString); } MString *dirString = new MString; assert(dirString); return(dirString); } MString * Path::file() const { int lastSlashIndex = this->indexOf('/', -1); if ((lastSlashIndex >= 0) && (lastSlashIndex < (int) this->length() - 1)) { MString *fileString = new MString((*this)(lastSlashIndex + 1)); assert(fileString); return(fileString); } MString *fileString = new MString(string()); assert(fileString); return(fileString); } // // Operators // // // Special functions // Path Path::expanded() const { Path newPath(*this); if (firstChar() != '~') { MString *dirString = dir(); if (dirString->isEmpty() || ((*this)[(unsigned int)0] == '.')) { char *pwdPtr = getenv("PWD"); if (pwdPtr == NULL) { cerr << "Couldn't get PWD environment variable!" << endl; assert(0); } MString pwd(pwdPtr); if ((*this)(0, 2) == MString("..")) { // Expand .. to full path (bert) int slashIndex = pwd.indexOf('/', -1); if (slashIndex >= 0) newPath = pwd(0, slashIndex) + (*this)(2); } else if ((*this)[(unsigned int)0] == '.') // Expand . to full path newPath = pwd + (*this)(1); else newPath = Path(pwd, *this); } delete dirString; } else { if ((*this)[(unsigned int)1] == '/') { // Expand ~ to full path char *home; if ((home = getenv("HOME")) != NULL) newPath = Path(MString(home) + (*this)(1)); else { cerr << "Couldn't get HOME environment variable!" << endl; assert(0); } } else { // Expand ~user to full path int slashIndex = this->indexOf('/'); MString userName((*this)(1, slashIndex - 1)); struct passwd *passWordEntry; if ((passWordEntry = getpwnam(userName.string())) != NULL) newPath = Path(MString(passWordEntry->pw_dir) + (*this)(slashIndex)); else { cerr << "Couldn't get password entry!" << endl; assert(0); } } } return(newPath); } Boolean Path::exists() const { return (ifstream((const char *) *this)) ? TRUE : FALSE; /* Changed because the readdir function fails on Sun (truncates two chars from filenames (??) MString *dirString = dir(); MString *fileString = file(); if (dirString->length() == 0) *dirString += _separator; DIR *dirPtr = opendir(dirString->string()); if (!dirPtr) { delete dirString; delete fileString; return FALSE; } struct dirent *dirEntryPtr; Boolean pathFound = FALSE; while (((dirEntryPtr = readdir(dirPtr)) != NULL) && !pathFound) pathFound = (strcmp(dirEntryPtr->d_name, fileString->string()) == 0); delete dirString; delete fileString; closedir(dirPtr); return pathFound; */ } Boolean Path::existsCompressed(MString *extension) const { MString tempExtension; Path tempPath(*this); if (!tempPath.exists()) { tempExtension = ".z"; tempPath += tempExtension; if (!tempPath.exists()) { tempExtension = ".Z"; tempPath = *this + tempExtension; if (!tempPath.exists()) { tempExtension = ".gz"; tempPath = *this + tempExtension; if (!tempPath.exists()) return FALSE; } } } if (extension) *extension = tempExtension; return TRUE; } Boolean Path::hasCompressedExtension(MString *extension) const { unsigned nChars = this->length(); if (nChars < 3) return FALSE; MString tempExtension(".Z"); if ((*this)(nChars - 2) != tempExtension) { tempExtension = ".z"; if ((*this)(nChars - 2) != tempExtension) { tempExtension = ".gz"; if ((*this)(nChars - 3) != tempExtension) return FALSE; } } if (extension) *extension = tempExtension; return TRUE; } Path& Path::removeCompressedExtension() { MString lastChars((*this)(MAX(0, int(length() - 3)))); if (lastChars.contains(".gz")) chop(3); else if (lastChars.contains(".z") || lastChars.contains(".Z")) chop(2); return *this; } Boolean Path::removeExtension(MString *extension) { int period = indexOf('.', -1); // Locate last period in path MString ext; if (period >= 0) ext = chop(length() - period); if (extension) *extension = ext; return (period >= 0) ? TRUE : FALSE; } Boolean Path::isWritable() const { Path fullPath(this->expanded()); Boolean exists = fullPath.exists(); FILE *test = fopen(fullPath, "a"); if (test) { fclose(test); if (!exists) unlink(fullPath); return TRUE; } return FALSE; } void Path::applyTemplate(const Path& templatePath, const char *separator) { MString *dirString = dir(); MString *fileString = file(); MString *templateDirString = templatePath.dir(); MString *templateFileString = templatePath.file(); Path *newPath = new Path(dirString->applyTemplate(*templateDirString, separator), fileString->applyTemplate(*templateFileString, separator)); assert(newPath); delete dirString; delete fileString; delete templateDirString; delete templateFileString; *this = *newPath; } Boolean Path::imageNumber(unsigned *value) const { MString *fileString = file(); if (!fileString) return FALSE; MStringIterator fileNameIt(*fileString, _separator); MString token(fileNameIt++); while (!token.isEmpty()) { if (token.isInteger((int *) value)) { delete fileString; return TRUE; } token = fileNameIt++; } delete fileString; return FALSE; } Boolean Path::replaceImageNumber(unsigned newValue) { char newValueText[500]; sprintf(newValueText, "%d", newValue); return replaceImageNumber(newValueText); } Boolean Path::replaceImageNumber(const char *newString) { MString *fileString = file(); if (!fileString) return FALSE; MStringIterator fileNameIt(*fileString, _separator); MString token(fileNameIt++); MString newFile(token); token = fileNameIt++; Boolean replaced = FALSE; while (!token.isEmpty()) { newFile += _separator; int value; if (!replaced && token.isInteger(&value)) { newFile += newString; replaced = TRUE; } else newFile += token; token = fileNameIt++; } if (replaced) { MString *dirString = dir(); *this = Path(*dirString, newFile); delete dirString; } delete fileString; return replaced; } Boolean Path::replaceImageNumberWildCard(unsigned newValue) { char newValueText[500]; sprintf(newValueText, "%d", newValue); return replaceImageNumberWildCard(newValueText); } Boolean Path::replaceImageNumberWildCard(const char *newString) { MString *fileString = file(); if (!fileString) return FALSE; MStringIterator fileNameIt(*fileString, _separator); MString token(fileNameIt++); MString newFile(token); token = fileNameIt++; Boolean replaced = FALSE; while (!token.isEmpty()) { newFile += _separator; if (!replaced && (token == _imageNumberWildCard)) { newFile += newString; replaced = TRUE; } else newFile += token; token = fileNameIt++; } if (replaced) { MString *dirString = dir(); *this = Path(*dirString, newFile); delete dirString; } delete fileString; return replaced; } // // Private functions // Boolean Path::_locateStringAfterSeparator(const char *string) const { MString *fileString = file(); char *filePtr = (char *) fileString->string(); if (!strtok(filePtr, _separator)) return FALSE; char *token = strtok(NULL, _separator); while (token) { if (strcmp(token, string) == 0) { delete fileString; return TRUE; } token = strtok(NULL, _separator); } delete fileString; return FALSE; } <file_sep>/include/Makefile.am pkginclude_HEADERS = amoeba.h \ assert.h \ backProp.h \ Complex.h \ dcomplex.h \ fcomplex.h \ FileIO.h \ Histogram.h \ matlabSupport.h \ Minc.h \ MPoint.h \ MString.h \ MTypes.h \ OpTimer.h \ OrderedCltn.h \ Path.h \ Polynomial.h \ popen.h \ Spline.h \ TBSpline.h \ TrainingSet.h \ trivials.h <file_sep>/src/Polynomial.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: Polynomial.cc,v $ $Revision: 1.3 $ $Author: stever $ $Date: 2003-11-17 04:07:52 $ $State: Exp $ --------------------------------------------------------------------------*/ #include <config.h> #include "Polynomial.h" using namespace std; // // Constructors // Polynomial::Polynomial(unsigned dim, const DblArray& coef) : _expComb(dim, coef.size()), _coef(coef) { unsigned maxOrder = unsigned(rint(pow(coef.size(), 1.0/dim))); if (intPower(maxOrder, dim) != coef.size()) { cerr << "# polynomial coefficients (" << coef.size() << ") does not match polynomial dimension (" << dim << ")" << endl; exit(EXIT_FAILURE); } _allExpComb(dim, maxOrder - 1); _nDimensions = _expComb.getrows(); _nCoef = _expComb.getcols(); assert(_nDimensions && _nCoef); } Polynomial::Polynomial(const IntMat& expComb, const DblArray& coef) : _expComb(expComb), _coef(coef) { _nDimensions = _expComb.getrows(); _nCoef = _expComb.getcols(); if (coef.size() != _nCoef) { cerr << "Size of the exponent combinations array (" << _nCoef << ") does not match the # coefficients (" << coef.size() << ")" << endl; exit(EXIT_FAILURE); } assert(_nDimensions && _nCoef); } // 1D fitted polynomials Polynomial::Polynomial(unsigned mvo, const FloatArray& x, const DblArray& f) : _expComb(1, mvo + 1) { _nCoef = mvo + 1; for (unsigned i = 0; i < _nCoef; i++) _expComb(0, i) = i; _nDimensions = 1; _fit(FlMat(x, FlMat::COLUMN), f); } Polynomial::Polynomial(unsigned mvo, const IntArray& x, const DblArray& f) : _expComb(1, mvo + 1) { _nCoef = mvo + 1; for (unsigned i = 0; i < _nCoef; i++) _expComb(0, i) = i; _nDimensions = 1; _fit(FlMat(asFloatArray(x), FlMat::COLUMN), f); } // 2D fitted polynomials Polynomial::Polynomial(unsigned mvo, const FloatArray& x, const FloatArray& y, const DblArray& f) { _allExpComb(2, mvo); _pruneExpComb(mvo); _nDimensions = _expComb.getrows(); _nCoef = _expComb.getcols(); assert(_nDimensions && _nCoef); FlMat X(x, FlMat::COLUMN); _fit(X.appendRight(FlMat(y, FlMat::COLUMN)), f); } Polynomial::Polynomial(unsigned mvo, const IntArray& x, const IntArray& y, const DblArray& f) { _allExpComb(2, mvo); _pruneExpComb(mvo); _nDimensions = _expComb.getrows(); _nCoef = _expComb.getcols(); assert(_nDimensions && _nCoef); FlMat X(asFloatArray(x), FlMat::COLUMN); _fit(X.appendRight(FlMat(asFloatArray(y), FlMat::COLUMN)), f); } // n-D fitted polynomials Polynomial::Polynomial(unsigned mvo, const FlMat& x, const DblArray& f) { _allExpComb(x.getcols(), mvo); _pruneExpComb(mvo); _nDimensions = _expComb.getrows(); _nCoef = _expComb.getcols(); assert(_nDimensions && _nCoef); _fit(x, f); } Polynomial::Polynomial(unsigned mvo, const IntMat& x, const DblArray& f) { _nDimensions = x.getcols(); _allExpComb(_nDimensions, mvo); _pruneExpComb(mvo); _nCoef = _expComb.getcols(); assert(_nDimensions && _nCoef); _fit(asFlMat(x), f); } #ifdef HAVE_INTERFACE Polynomial::Polynomial(const MRegion& xy, const DblArray& f) { _allExpComb(2, 1); _pruneExpComb(1); _nDimensions = _expComb.getrows(); _nCoef = _expComb.getcols(); assert(_nDimensions && _nCoef); Array<FloatArray> X(2); X[0] = asFloatArray(xy.xCoord()); X[1] = asFloatArray(xy.yCoord()); _fit(X, f); } Polynomial::Polynomial(unsigned mvo, const MRegion& xy, const DblArray& f) { _allExpComb(2, mvo); _pruneExpComb(mvo); _nDimensions = _expComb.getrows(); _nCoef = _expComb.getcols(); assert(_nDimensions && _nCoef); Array<FloatArray> X(2); X[0] = asFloatArray(xy.xCoord()); X[1] = asFloatArray(xy.yCoord()); _fit(X, f); } #endif // // Evaluation functions // double Polynomial::operator () (float x) const { if (_nDimensions != 1) { cerr << "Polynomial::operator (): Error: cannot evaluate a " << _nDimensions << "-dimensional polynomial with 2 coordinates." << endl; return 0.0; } double result = 0.0; const double *coefPtr = _coef.contents(); const int *powerPtr = _expComb[0]; for (unsigned i = _nCoef; i; i--) result += *coefPtr++ * intPower(x, *powerPtr++); return result; } double Polynomial::operator () (float x, float y) const { if (_nDimensions != 2) { cerr << "Polynomial::operator (): Error: cannot evaluate a " << _nDimensions << "-dimensional polynomial with 2 coordinates." << endl; return 0.0; } double result = 0.0; const double *coefPtr = _coef.contents(); const int *xPwrPtr = _expComb[0]; const int *yPwrPtr = _expComb[1]; for (unsigned i = _nCoef; i; i--) result += *coefPtr++ * intPower(x, *xPwrPtr++) * intPower(y, *yPwrPtr++); return result; } double Polynomial::operator () (float x, float y, float z) const { if (_nDimensions != 3) { cerr << "Polynomial::operator (): Error: cannot evaluate a " << _nDimensions << "-dimensional polynomial with 3 coordinates." << endl; return 0.0; } double result = 0.0; const double *coefPtr = _coef.contents(); const int *xPwrPtr = _expComb[0]; const int *yPwrPtr = _expComb[1]; const int *zPwrPtr = _expComb[2]; for (unsigned i = 0; i < _nCoef; i++) result += *coefPtr++ * intPower(x, *xPwrPtr++) * intPower(y, *yPwrPtr++) * intPower(z, *zPwrPtr++); return result; } double Polynomial::operator () (const FloatArray& X) const { if (_nDimensions != X.size()) { cerr << "Polynomial::operator (): Error: cannot evaluate a " << _nDimensions << "-dimensional polynomial with " << X.size() << " coordinates." << endl; return 0.0; } double result = 0.0; for (unsigned i = 0; i < _nCoef; i++) { double temp = _coef[i]; const float *xPtr = X.contents(); for (unsigned coord = 0; coord < _nDimensions; coord++) temp *= intPower(*xPtr++, _expComb[coord][i]); result += temp; } return result; } // // Private functions // void Polynomial::_allExpComb(unsigned dimension, unsigned maxOrder) { // Set up <_expComb> unsigned nExpComb = (unsigned) intPower(maxOrder + 1, dimension); _expComb = IntMat(dimension, nExpComb); _expComb.fill(0); // Determine all possible combinations of exponents of the variables // (i.e., create a number series with base <maxOrder + 1>) for (unsigned i = 1; i < nExpComb; i++) { Boolean addOne = TRUE; for (unsigned coord = 0; coord < dimension; coord++) { int *coordArray = (int *) _expComb[coord]; if (addOne) { if (coordArray[i-1] == maxOrder) coordArray[i] = 0; else { coordArray[i] = coordArray[i-1] + 1; addOne = FALSE; } } else coordArray[i] = coordArray[i-1]; } } } void Polynomial::_pruneExpComb(unsigned mvo) { unsigned nDimensions = _expComb.getrows(); unsigned nExpComb = _expComb.getcols(); if (!nDimensions || !nExpComb) return; unsigned dim; unsigned col = 0; for (unsigned i = 0; i < nExpComb; i++) { unsigned expSum = 0; for (dim = 0; dim < nDimensions; dim++) expSum += _expComb(dim, i); if (expSum <= mvo) { if (col != i) for (dim = 0; dim < nDimensions; dim++) _expComb(dim, col) = _expComb(dim, i); col++; } } _expComb.resize(nDimensions, col); } void Polynomial::_fit(const FlMat& X, const DblArray& F) { if (X.getcols() != _nDimensions) { cerr << "Error in polynomial::_fit: _expComb and X have different sizes" << endl; return; } typedef Array<DblArray> ArrayOfDblArrays; IntArray nPowers(_nDimensions); Array<ArrayOfDblArrays> powers(_nDimensions); // Determine the maximum exponent of each variable for (unsigned coord = 0; coord < _nDimensions; coord++) { int nPow = nPowers[coord] = 2*_expComb.row(coord).max() + 1; powers[coord] = ArrayOfDblArrays(nPow); // Raise X to all necessary powers for (unsigned power = 0; power < nPow; power++) powers[coord][power] = asDblArray(array(X.col(coord))) ^ power; } DblMat A(_nCoef, _nCoef); DblMat B(_nCoef, 1); for (unsigned row = 0; row < _nCoef; row++) { unsigned exponent = _expComb[0][row]; DblArray XrowPower(powers[(unsigned int)0][exponent]); for (unsigned coord = 1; coord < _nDimensions; coord++) { exponent = _expComb[coord][row]; XrowPower *= powers[coord][exponent]; } for (unsigned col = 0; col <= row; col++) { DblArray Xpower(XrowPower); for (unsigned coord = 0; coord < _nDimensions; coord++) { exponent = _expComb[coord][col]; Xpower *= powers[coord][exponent]; } A(row, col) = sum(Xpower); if (row != col) A(col, row) = A(row, col); } B(row) = sum(XrowPower * F); } DblMat coefMat(inv(A)*B); _coef = DblArray(_nCoef); for (unsigned i = 0; i < _nCoef; i++) _coef[i] = coefMat(i); } <file_sep>/templates/CachedArray.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: CachedArray.cc,v $ $Revision: 1.10 $ $Author: bert $ $Date: 2004-12-08 17:02:18 $ $State: Exp $ --------------------------------------------------------------------------*/ #include <config.h> #include "CachedArray.h" #include "Histogram.h" #include "FileIO.h" #include <assert.h> #include <stdio.h> #include <unistd.h> using namespace std; // // CachedArray class // #ifndef __GNUC__ template <class Type> const unsigned CachedArray<Type>::_DEFAULT_BLOCK_SIZE = 32768; template <class Type> const unsigned CachedArray<Type>::_DEFAULT_N_BLOCKS = 2; template <class Type> unsigned CachedArray<Type>::_rangeErrorCount = 25; #endif // __GNUC__ not defined // // Constructors/destructor // template <class Type> CachedArray<Type>::CachedArray(unsigned size, unsigned nBlocks, unsigned blockSize) : SimpleArray<Type>(0) { _self = this; _head = 0; _blocks = 0; this->_size = 0; _blockSize = 0; _nBlocks = 0; _itBlock = 0; _itBlockPtr = 0; this->_itIndex = 0; _initialize(size, nBlocks, blockSize); _openStream(); resetHitRate(); } template <class Type> CachedArray<Type>::CachedArray(const Type *init, unsigned size, unsigned nBlocks, unsigned blockSize) : SimpleArray<Type>(0) { _self = this; _head = 0; _blocks = 0; this->_size = 0; _blockSize = 0; _nBlocks = 0; _itBlock = 0; _itBlockPtr = 0; this->_itIndex = 0; _initialize(size, nBlocks, blockSize); _openStream(); copyFromCarray(init, size); resetHitRate(); } template <class Type> CachedArray<Type>::CachedArray(const CachedArray<Type>& array) : SimpleArray<Type>(0) { _self = this; _head = 0; _blocks = 0; this->_size = 0; _blockSize = 0; _nBlocks = 0; _itBlock = 0; _itBlockPtr = 0; this->_itIndex = 0; _initialize(array._size, array._nBlocks, array._blockSize); _openStream(); Array<Type>::operator = (array); } template <class Type> CachedArray<Type>::CachedArray(const SimpleArray<Type>& array, unsigned nBlocks, unsigned blockSize) : SimpleArray<Type>(0) { _self = this; _head = 0; _blocks = 0; this->_size = 0; _blockSize = 0; _nBlocks = 0; _itBlock = 0; _itBlockPtr = 0; this->_itIndex = 0; _initialize(array.size(), nBlocks, blockSize); _openStream(); Array<Type>::operator = (array); } template <class Type> CachedArray<Type>::~CachedArray() { _destroy(); } // // Binary I/O functions // template <class Type> ostream& CachedArray<Type>::saveBinary(ostream& os, unsigned n, unsigned start) const { if (start >= this->_size) { if (this->_size) if (_rangeErrorCount) { _rangeErrorCount--; cerr << "CachedArray::saveBinary: start out of range" << endl; } return os; } if (!n) n = this->_size - start; else if (start + n > this->_size) { n = this->_size - start; if (_rangeErrorCount) { _rangeErrorCount--; cerr << "CachedArray::saveBinary: n too large; truncated" << endl; } } unsigned startInBlock = start % _blockSize; for (unsigned b = start / _blockSize; b < _maxNblocks; b++) { const CacheBlock<Type> *block = _read(b); unsigned nInBlock = MIN(n, _blockSize - startInBlock); //cout << "_size:" << _size << " n:" << n << " b:" << b //<< " startInBlock:" << startInBlock << " nInBlock:" << nInBlock << endl; os.write((char *) block->_contents + startInBlock, nInBlock*sizeof(Type)); startInBlock = 0; n -= nInBlock; } _revertIterator(); return os; } template <class Type> istream& CachedArray<Type>::loadBinary(istream& is, unsigned n, unsigned start) { if (!n) n = this->_size; newSize(start + n); if (this->_size) { unsigned startInBlock = start % _blockSize; for (unsigned b = start / _blockSize; b < _maxNblocks; b++) { CacheBlock<Type> *block = _read(b); unsigned nInBlock = MIN(n, _blockSize - startInBlock); is.read((char *) block->_contents + startInBlock, nInBlock*sizeof(Type)); block->_changed = TRUE; startInBlock = 0; n -= nInBlock; } } _revertIterator(); return is; } // // Iterator functions // /* template <class Type> void CachedArray<Type>::resetIterator(unsigned i) { if (!this->_size) return; assert(i < this->_size); _self->_itBlock = i / _blockSize; _self->_itBlockPtr = _read(_itBlock)->_contents; _self->_itIndex = i - _itBlock * _blockSize; _self->_blocks[_itBlock]->_changed = TRUE; } */ template <class Type> void CachedArray<Type>::resetIterator(unsigned i) const { if (!this->_size) return; _self->_itBlock = i / _blockSize; _self->_itBlockPtr = _read(_self->_itBlock)->_contents; _self->_itIndex = i - _itBlock * _blockSize; // This line should be removed, and only be present in the non-const version // iIt is added here because g++ doesn't appear to be able to resolve the // const and non-const versions of resetIterator, _self->_blocks[_itBlock]->_changed = TRUE; assert((i < this->_size) && (_itBlock < _maxNblocks) && _itBlockPtr && (this->_itIndex < _blockSize)); if (this->_debug) cout << "CachedArray::resetIterator:" << endl << " i:" << i << " _itIndex:" << this->_itIndex << " _nBlocks:" << _nBlocks << " _maxNblocks:" << _maxNblocks << " _blockSize:" << _blockSize << " _itBlock:" << _itBlock << endl; } template <class Type> Type& CachedArray<Type>::current() { if (_self->_itIndex >= _blockSize) { _self->_itBlockPtr = _read(++_itBlock)->_contents; _self->_itIndex = 0; _self->_blocks[_itBlock]->_changed = TRUE; } return *(_itBlockPtr + this->_itIndex); } template <class Type> const Type& CachedArray<Type>::current() const { if (_self->_itIndex >= _blockSize) { _self->_itBlockPtr = _read(++_self->_itBlock)->_contents; _self->_itIndex = 0; } return *(_itBlockPtr + this->_itIndex); } // // Ascending operators // template <class Type> Type& CachedArray<Type>::operator ++() { if (++(_self->_itIndex) >= _blockSize) { _self->_itBlockPtr = _read(++_itBlock)->_contents; _self->_itIndex = 0; _self->_blocks[_itBlock]->_changed = TRUE; } return *(_itBlockPtr + this->_itIndex); } template <class Type> const Type& CachedArray<Type>::operator ++() const { if (++(_self->_itIndex) >= _blockSize) { _self->_itBlockPtr = _read(++(_self->_itBlock))->_contents; _self->_itIndex = 0; } return *(_itBlockPtr + this->_itIndex); } template <class Type> Type& CachedArray<Type>::operator ++(int) { if (this->_itIndex >= _blockSize) { _self->_itBlockPtr = _read(++(_self->_itBlock))->_contents; _self->_itIndex = 0; _self->_blocks[_itBlock]->_changed = TRUE; } return *(_itBlockPtr + (_self->_itIndex)++); } template <class Type> const Type& CachedArray<Type>::operator ++(int) const { if (this->_itIndex >= _blockSize) { _self->_itBlockPtr = _read(++(_self->_itBlock))->_contents; _self->_itIndex = 0; } return *(_itBlockPtr + (_self->_itIndex)++); } // // Descending iterators // template <class Type> Type& CachedArray<Type>::operator --() { if (int(--(_self->_itIndex)) < 0) { _self->_itBlockPtr = _read(--_itBlock)->_contents; _self->_itIndex = _blockSize - 1; _self->_blocks[_itBlock]->_changed = TRUE; } return *(_itBlockPtr + this->_itIndex); } template <class Type> const Type& CachedArray<Type>::operator --() const { if (int(--(_self->_itIndex)) < 0) { _self->_itBlockPtr = _read(--(_self->_itBlock))->_contents; _self->_itIndex = _blockSize - 1; } return *(_itBlockPtr + this->_itIndex); } template <class Type> Type& CachedArray<Type>::operator --(int) { if (int(this->_itIndex) < 0) { _self->_itBlockPtr = _read(--(_self->_itBlock))->_contents; _self->_itIndex = _blockSize - 1; _self->_blocks[_itBlock]->_changed = TRUE; } return *(_itBlockPtr + (_self->_itIndex)--); } template <class Type> const Type& CachedArray<Type>::operator --(int) const { if (int(this->_itIndex) < 0) { _self->_itBlockPtr = _read(--(_self->_itBlock))->_contents; _self->_itIndex = _blockSize - 1; } return *(_itBlockPtr + (_self->_itIndex)--); } // // Copy operators // template <class Type> CachedArray<Type>& CachedArray<Type>::copyFromCarray(const Type *init, unsigned size) { cerr << "CachedArray::copyFromCarray() not implemented" << endl; return *this; } // // Set functions // /* template <class Type> CachedArray<Type>::operator SimpleArray<Type> () const { SimpleArray<Type> array(this->_size); Type *destPtr = array.contents(); resetIterator(); for (unsigned i = this->_size; i; i--) *destPtr++ = (*this)++; return array; } */ template <class Type> void CachedArray<Type>::newSize(unsigned size) { if (!size) { _destroy(); return; } if (!this->_size) { _initialize(size, _nBlocks ? _nBlocks : _DEFAULT_N_BLOCKS, _blockSize ? _blockSize : _DEFAULT_BLOCK_SIZE); _openStream(); return; } _flush(); delete [] _blocks; delete _head; this->_size = 0; _initialize(size, _nBlocks, _blockSize); // Create file at requested size _self->_s.seekg(_maxNblocks*_blockSize*sizeof(Type)); _self->_s.put('\0'); assert(_s.is_open()); CacheBlock<Type> *block = _head; for (unsigned i = 0; block; i++, block = block->_next) { assert(block->read(_self->_s, i)); if (this->_debug) cout << "<read block " << i << " at " << long(block) << ">" << flush; } } template <class Type> double CachedArray<Type>::hitRate() const { double hits = _hits; CacheBlock<Type> *block = _head; while (block) { hits += block->_nRead; hits += block->_nWrite; block = block->_next; } return hits/(hits + _misses); } template <class Type> void CachedArray<Type>::qsortAscending() { if (!this->_size) cerr << "Warning: qsort attempted on empty CachedArray" << endl; _qsort(0, this->_size - 1); } template <class Type> Type CachedArray<Type>::median() const { assert(this->_size); if (this->_size <= _blockSize) { if (!_blocks[0]) _read(0); return (*_blocks[0])(this->_size).medianVolatile(); } CachedArray<Type> array(*this); return array.medianVolatile(); } template <class Type> Type CachedArray<Type>::medianVolatile() { assert(this->_size); if (this->_size <= _blockSize) { if (!_blocks[0]) _read(0); return (*_blocks[0])(this->_size).medianVolatile(); } return _histMedian(); } // // Arithmetic operations // /* template <class Type> CachedArray<Type>& CachedArray<Type>::operator += (Type value) { resetIterator(); for (unsigned i = _size; i; i--) (*this)++ += value; return *this; } template <class Type> CachedArray<Type>& CachedArray<Type>::operator += (const CachedArray<Type>& array) { assert(_size == array._size); resetIterator(); array.resetIterator(); for (unsigned i = _size; i; i--) (*this)++ += array++; return *this; } template <class Type> CachedArray<Type>& CachedArray<Type>::operator -= (const CachedArray<Type>& array) { assert(_size == array._size); resetIterator(); array.resetIterator(); for (unsigned i = _size; i; i--) (*this)++ -= array++; return *this; } template <class Type> CachedArray<Type>& CachedArray<Type>::operator *= (double value) { resetIterator(); for (unsigned i = _size; i; i--) (*this)++ *= value; return *this; } template <class Type> CachedArray<Type>& CachedArray<Type>::operator *= (const CachedArray<Type>& array) { assert(_size == array._size); resetIterator(); array.resetIterator(); for (unsigned i = _size; i; i--) (*this)++ *= array++; return *this; } template <class Type> CachedArray<Type>& CachedArray<Type>::operator /= (const CachedArray<Type>& array) { assert(this->_size == array._size); resetIterator(); array.resetIterator(); for (unsigned i = this->_size; i; i--) (*this)++ /= array++; return *this; } */ template <class Type> CachedArray<Type> CachedArray<Type>::ln() const { CachedArray<Type> result(this->_size); resetIterator(); result.resetIterator(); for (unsigned i = this->_size; i; i--) result++ = Type(::log(double((*this)++))); return result; } template <class Type> CachedArray<Type> CachedArray<Type>::log() const { CachedArray<Type> result(this->_size); resetIterator(); result.resetIterator(); for (unsigned i = this->_size; i; i--) result++ = Type(::log10(double((*this)++))); return result; } template <class Type> CachedArray<Type> CachedArray<Type>::exp() const { return ::exp(1.0)^(*this); } template <class Type> CachedArray<Type> CachedArray<Type>::exp10() const { return 10^(*this); } template <class Type> CachedArray<Type> CachedArray<Type>::sample(unsigned maxN) const { double step = double(this->_size - 1)/(maxN - 1); if (step <= 1.0) return CachedArray<Type>(*this); CachedArray<Type> result(maxN); result.resetIterator(); double offset = 0; for (unsigned i = 0; i < maxN; i++, offset += step) result++ = getElConst(unsigned(::floor(offset))); return result; } template <class Type> CachedArray<Type> CachedArray<Type>::applyElementWise(Type (*function) (Type)) const { CachedArray<Type> result(this->_size); resetIterator(); result.resetIterator(); for (unsigned i = this->_size; i; i--) result++ = function((*this)++); return result; } template <class Type> CachedArray<Type> CachedArray<Type>::map(const ValueMap& map) const { CachedArray<Type> result(this->_size); resetIterator(); result.resetIterator(); for (unsigned i = this->_size; i; i--) result++ = Type(map((*this)++)); return result; } // // Private functions // template <class Type> void CachedArray<Type>::_initialize(unsigned size, unsigned nBlocks, unsigned blockSize) { if (size) { assert(nBlocks && blockSize); this->_size = size; _blockSize = blockSize; _nBlocks = nBlocks; _maxNblocks = unsigned(::ceil(double(size)/blockSize)); if (_maxNblocks < nBlocks) _nBlocks = _maxNblocks; typedef CacheBlock<Type> *CBptr; _blocks = new CBptr[_maxNblocks]; assert(_blocks); unsigned i; for (i = 0; i < _maxNblocks; i++) _blocks[i] = 0; _head = _blocks[0] = new CacheBlock<Type>(0, blockSize); assert(_head); for (i = 1; i < _nBlocks; i++) assert(_blocks[i] = _blocks[i-1]->addBlock(i, blockSize)); } if (this->_debug) { cout << endl << "Created blocks:" << endl; for (unsigned i = 0; i < _nBlocks; i++) cout << " " << long(_blocks[i]) << endl; } } template <class Type> void CachedArray<Type>::_openStream() { if (_s.is_open()) _s.close(); if (this->_size) { char path[256]; get_temp_filename(path); // Have to specify 'trunc' for some versions of the libraries, // otherwise the file may not be created. // _s.open(path, ios::in | ios::out | ios::trunc); // Unlink the file so it will be deleted automatically when // closed. // unlink(path); assert(_s.is_open()); // Create file at requested size _s.seekg(_maxNblocks*_blockSize*sizeof(Type)); _s.put('\0'); } } template <class Type> void CachedArray<Type>::_destroy() { if (this->_size) { delete _head; _head = 0; delete [] _blocks; _blocks = 0; _s.close(); _blockSize = 0; _maxNblocks = 0; this->_size = 0; _itBlock = 0; _itBlockPtr = 0; this->_itIndex = 0; } resetHitRate(); } template <class Type> void CachedArray<Type>::_flush() const { CacheBlock<Type> *block = _head; while (block) { block->write(_self->_s); block = block->_next; } } template <class Type> CacheBlock<Type> * CachedArray<Type>::_read(unsigned block) const { if (this->_debug) cout << "<request for block " << block << ">" << flush; if (_blocks[block]) return _blocks[block]; // Locate least accessed block, first by write-access, then by read-access CacheBlock<Type> *readBlock = _head; CacheBlock<Type> *curBlock = _head->_next; if (this->_debug) cout << "(" << long(readBlock) << ",r:" << readBlock->_nRead << ",w:" << readBlock->_nWrite << ")" << flush; while (curBlock) { if (this->_debug) cout << "(" << long(curBlock) << ",r:" << curBlock->_nRead << ",w:" << curBlock->_nWrite << ")" << flush; if ((curBlock->_nWrite && (curBlock->_nWrite < readBlock->_nWrite)) || (!curBlock->_nWrite && (curBlock->_nRead < readBlock->_nRead))) readBlock = curBlock; curBlock = curBlock->_next; } // Reset the read/write counters in all blocks curBlock = _head; while (curBlock) { _self->_hits += curBlock->_nRead + curBlock->_nWrite; curBlock->_nRead = curBlock->_nWrite = 0; curBlock = curBlock->_next; } _self->_misses++; _blocks[readBlock->_ID] = 0; assert(readBlock->read(_self->_s, block)); _blocks[block] = readBlock; if (this->_debug) cout << "<read block " << block << " at " << long(readBlock) << ">" << flush; return readBlock; } // // Median and quicksort support functions // template <class Type> void CachedArray<Type>::_qsort(int p, int r) { if (p < r) { int q = _partition(p, r); _qsort(p, q); _qsort(q + 1, r); } } template <class Type> Type CachedArray<Type>::_histMedian(unsigned nBelow, unsigned nAbove) { assert(this->_size); if (this->_debug) cout << "Begin: " << nBelow << " : " << nAbove << endl; if (this->_size <= _blockSize) { unsigned fullSize = nBelow + this->_size + nAbove; if (fullSize % 2) return _randomizedSelect(0, this->_size - 1, (fullSize+1)/2 - nBelow); else return _randomizedSelect(0, this->_size - 1, fullSize/2 - nBelow); } Type floor, ceil; this->extrema(&floor, &ceil); if (this->_debug) cout << "Floor and Ceiling: " << floor << " : " << ceil << endl; if (floor == ceil) return floor; Histogram hist(floor, ceil, MAX(this->_size/100, 10)); resetIterator(); for (unsigned i = this->_size; i; i--) hist.add((*this)++); if (this->_debug) { // cout << endl << "Contents: " << *this << endl; // cout << "Hist: " << hist << endl; cout << "[" << nBelow << ", " << nAbove << "]" << endl; } unsigned bin; double histMedian = hist.median(&bin, nBelow, nAbove); if (this->_debug) cout << "(" << bin << " : " << hist[bin] << " : " << histMedian << ") " << flush; unsigned nBelow2, nAbove2; this->removeAllNotIn(Type(hist.binStart(bin)), Type(hist.binStart(bin + 1)), &nBelow2, &nAbove2); if (this->_debug) cout << "nBelow2 : nAbove2 " << nBelow2 << " : " << nAbove2 << endl; return _histMedian(nBelow + nBelow2, nAbove + nAbove2); } // Computes the i'th order statistic (the i'th smallest element) of // an array. This is the routine that does the real work, and is // analogous to quicksort. template <class Type> Type CachedArray<Type>::_randomizedSelect(int p, int r, int i) { // If we're only looking at one element of the array, we must have // found the i'th order statistic. if (p == r) return getElConst(p); // Partition the array slice A[p..r]. This rearranges the array so that // all elements of A[p..q] are less than all elements of A[q+1..r]. // (Nothing fancy here, this is just a slight variation on the standard // partition done by quicksort.) int q = _randomizedPartition(p, r); int k = q - p + 1; // Now that we have partitioned A, its i'th order statistic is either // the i'th order statistic of the lower partition A[p..q], or the // (i-k)'th order stat. of the upper partition A[q+1..r] -- so // recursively find it. if (i <= k) return _randomizedSelect(p, q, i); else return _randomizedSelect(q+1, r, i-k); } template <class Type> int CachedArray<Type>::_randomizedPartition(int p, int r) { // Compute a random number between p and r int i = (random() / (MAXINT / (r-p+1))) + p; // Changed because of problems locating random() on a Sun //int i = int(ROUND(drand48() * (r-p+1) + p)); // Swap elements p and i Type temp = getElConst(p); setEl(p, getElConst(i)); setEl(i, temp); return _partition(p, r); } template <class Type> int CachedArray<Type>::_partition(int p, int r) { Type x = getElConst(p); int i = p-1; int j = r+1; while (1) { do { j--; } while (getElConst(j) > x); do { i++; } while (getElConst(i) < x); if (i < j) { Type temp = getElConst(i); setEl(i, getElConst(j)); setEl(j, temp); } else return j; } } template <class Type> CachedArray<Type> operator ^ (double base, const CachedArray<Type>& array) { unsigned N = array.size(); CachedArray<Type> result(N); array.resetIterator(); result.resetIterator(); for (unsigned i = N; i; i--) result++ = Type(pow(base, double(array++))); return result; } // // CacheBlock functions // template <class Type> CacheBlock<Type>::CacheBlock(unsigned ID, unsigned size) : SimpleArray<Type>(size) { _next = 0; _nBytes = size*sizeof(Type); _changed = FALSE; _ID = ID; _nRead = _nWrite = 0; _self = this; } template <class Type> CacheBlock<Type>::~CacheBlock() { if (_next) delete _next; _changed = FALSE; _ID = 0; _nRead = _nWrite = 0; } template <class Type> CacheBlock<Type> * CacheBlock<Type>::addBlock(unsigned ID, unsigned size) { CacheBlock *previous = this; CacheBlock *block = _next; while (block) { previous = block; block = block->_next; } block = new CacheBlock(ID, size); if (block) previous->_next = block; return block; } template <class Type> Boolean CacheBlock<Type>::read(fstream& s, unsigned ID) { if (_changed) { if (this->_debug) cout << "<w" << _ID << ">" << flush; write(s); } if (this->_debug) cout << "<x" << _ID << "><r" << ID << ">" << flush; _ID = ID; _nRead = _nWrite = 0; _changed = FALSE; s.seekg(_ID*_nBytes); s.read((char *) this->_contents, _nBytes); return s ? TRUE : FALSE; } template <class Type> Boolean CacheBlock<Type>::write(fstream& s) const { s.seekg(_ID*_nBytes); s.write((char *) this->_contents, _nBytes); return s ? TRUE : FALSE; } #ifdef __GNUC__ #define _INSTANTIATE_CACHEDARRAY(Type) \ template class CachedArray<Type>; \ template<> const unsigned CachedArray<Type>::_DEFAULT_BLOCK_SIZE = 32768; \ template<> const unsigned CachedArray<Type>::_DEFAULT_N_BLOCKS = 2; \ template CachedArray<Type> operator ^ (double, CachedArray<Type> const &); \ template class CacheBlock<Type>; \ template<> unsigned CachedArray<Type>::_rangeErrorCount = 25; _INSTANTIATE_CACHEDARRAY(char); _INSTANTIATE_CACHEDARRAY(float); #endif // __GNUC__ defined <file_sep>/templates/MatrixTest.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: MatrixTest.cc,v $ $Revision: 1.1 $ $Author: jason $ $Date: 2001-11-09 16:37:26 $ $State: Exp $ --------------------------------------------------------------------------*/ #include "Matrix.h" #include "MatrixSupport.h" //#include "FileIO.h" //included to load compressed data /********************************************************* template <class Type> const Mat<Type>::MATLAB = 0; template <class Type> const Mat<Type>::RAW = 1; template <class Type> const Mat<Type>::ASCII = 2; //template <class Type> tells belong to template class *********************************************************/ //Template /********************************* Mat class definitions and member functions **********************************/ // //-------------------------// // template <class Type> Mat<Type>::Mat(const Mat<Type>& A) { rows = A.rows; _cols = A._cols; maxrows = A.maxrows; _maxcols = A._maxcols; _el = 0; allocateEl(); memcpy(*_el, *A._el, maxrows*_maxcols*sizeof(Type)); } // //-------------------------// // template <class Type> Mat<Type>::Mat(unsigned nrows, unsigned ncols, Type) { _rows = _maxrows = nrows; _cols = _maxcols = ncols; _el = 0; _allocateEl(); } // //-------------------------// // template <class Type> Mat<Type>::~Mat() { clear(); } // //-------------------------// // template <class Type> void Mat<Type>::clear() { if (_el) { #ifdef DEBUG cout << "Freeing allocated memory at " << _el << endl; #endif delete ((char *) _el); //free((char *) _el); _el = 0; } _rows = _maxrows = _cols = _maxcols = 0; } template <class Type> void Mat<Type>::_allocateEl() { if (_el) { #ifdef DEBUG cout << "Freeing allocated memory at " << _el << endl; #endif delete( (char *) _el); // free((char *) _el); } unsigned int nBytes = _maxrows*sizeof(Type *) + _maxrows*_maxcols*sizeof(Type); // _el = (Type **) calloc(nBytes, 1); _el = (Type **) new char [nBytes]; if (!_el) { cerr << endl << "Error making pointer for " << _maxrows << " x " << _maxcols << " matrix" << endl; exit(1); } memset(_el, 0, nBytes); //set all elements to zero #ifdef DEBUG cout << "Allocated " << nBytes << " bytes at " << _el << endl; #endif _el[0] = (Type *)(&(_el[_maxrows])); for (unsigned i=1 ; i < _maxrows ; i++) _el[i] = (Type *)(&(_el[i-1][_maxcols])); } /*******************************************/ /*******************************************/ /*******************************************/ /*******************************************/ /*******************************************/ /*******************************************/ Mat<complex>::Mat(const Mat<complex>& A) { _rows = A._rows; _cols = A._cols; _maxrows = A._maxrows; _maxcols = A._maxcols; _el = 0; _allocateEl(); memcpy(*_el, *A._el, _maxrows*_maxcols*sizeof(complex)); } // //-------------------------// // Mat<complex>::Mat(unsigned nrows, unsigned ncols, complex) { _rows = _maxrows = nrows; _cols = _maxcols = ncols; _el = 0; _allocateEl(); } // //-------------------------// // Mat<complex>::~Mat() { clear(); } // //-------------------------// // void Mat<complex>::clear() { if (_el) { #ifdef DEBUG cout << "Freeing allocated memory at " << _el << endl; #endif delete ((char *) _el); //free((char *) _el); _el = 0; } _rows = _maxrows = _cols = _maxcols = 0; } void Mat<complex>::_allocateEl() { if (_el) { #ifdef DEBUG cout << "Freeing allocated memory at " << _el << endl; #endif delete( (char *) _el); // free((char *) _el); } unsigned int nBytes = _maxrows*sizeof(complex *) + _maxrows*_maxcols*sizeof(complex); // _el = (complex **) calloc(nBytes, 1); _el = (complex **) new char [nBytes]; if (!_el) { cerr << endl << "Error making pointer for " << _maxrows << " x " << _maxcols << " matrix" << endl; exit(1); } memset(_el, 0, nBytes); //set all elements to zero #ifdef DEBUG cout << "Allocated " << nBytes << " bytes at " << _el << endl; #endif _el[0] = (complex *)(&(_el[_maxrows])); for (unsigned i=1 ; i < _maxrows ; i++) _el[i] = (complex *)(&(_el[i-1][_maxcols])); } <file_sep>/src/TrainingSet.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: TrainingSet.cc,v $ $Revision: 1.3 $ $Author: stever $ $Date: 2003-11-17 04:07:52 $ $State: Exp $ --------------------------------------------------------------------------*/ #include <config.h> #include "TrainingSet.h" #include <assert.h> #include <stdlib.h> using namespace std; const int DEFAULT_TRAINING_SET_SIZE = 250; /*************** * Example class ***************/ // // Constructors/destructor // Example::Example(unsigned nInputs, unsigned nTargets) : input(0.0, nInputs), target(0.0, nTargets) {} Example::Example(unsigned lbl, const DblArray& inpt, const DblArray& trgt) : input(inpt), target(trgt) { label = lbl; } Example::~Example() {} ostream& operator << (ostream& theStream, Example& example) { theStream << example.label << ": " << example.input << " -> " << example.target; return theStream; } /******************* * TrainingSet class *******************/ TrainingSet::TrainingSet() : OrderedCltn(DEFAULT_TRAINING_SET_SIZE) {} TrainingSet::TrainingSet(unsigned nExamples, unsigned nInputs, unsigned nTargets, double minTarget, double maxTarget) : OrderedCltn(nExamples) { set(nInputs, nTargets, minTarget, maxTarget); } TrainingSet::~TrainingSet() { removeAll(); } // // Set functions // void TrainingSet::set(unsigned nInputs, unsigned nTargets, double minTarget, double maxTarget) { _nInputs = nInputs; _nTargets = nTargets; _minTarget = minTarget; _maxTarget = maxTarget; } // // Adding examples // void TrainingSet::add(unsigned node, const double *inputValues) { DblArray targetValues(_minTarget, _nTargets); targetValues[node] = _maxTarget; Example *newExample = new Example(node, DblArray(inputValues, _nInputs), targetValues); assert(newExample); //cout << "Adding example: " << *newExample << endl; OrderedCltn::add(newExample); } void TrainingSet::add(const double *iValues, const double *tValues) { DblArray inputValues(iValues, _nInputs); DblArray targetValues(tValues, _nTargets); unsigned node; targetValues.max(&node); Example *newExample = new Example(node, inputValues, targetValues); assert(newExample); //cout << "Adding example: " << *newExample << endl; OrderedCltn::add(newExample); } void TrainingSet::add(unsigned class1, const double *inputValues1, unsigned class2, const double *inputValues2, double pct) { double targetRange = _maxTarget - _minTarget; double pctComplement = 1.0 - pct; DblArray targetValues(_minTarget, _nTargets); targetValues[class1] = pct*targetRange + _minTarget; targetValues[class2] = pctComplement*targetRange + _minTarget; DblArray inputValues(_nInputs); for (unsigned i = 0; i < _nInputs; i++) inputValues[i] = pct*inputValues1[i] + pctComplement*inputValues2[i]; Example *newExample = new Example((pct < 0.5) ? class1 : class2, inputValues, targetValues); assert(newExample); //cout << "Adding example: " << *newExample << endl; OrderedCltn::add(newExample); } void TrainingSet::add(const Array<SimpleArray<unsigned> >& mixtures, unsigned nMixtures) { if (!nMixtures) return; // Setup mixture percentiles DblArray mixturePct(nMixtures); for (unsigned m = 0; m < nMixtures; m++) mixturePct[m] = double(m + 1)/(nMixtures + 1); // Create a separate TrainingSet for the new examples TrainingSet newExamples(uEndIndex, _nInputs, _nTargets, _minTarget, _maxTarget); // Cycle through all mixtures TrainingSetIterator class1it(*this); TrainingSetIterator class2it(*this); unsigned nMixedClasses = mixtures.size(); for (unsigned class1 = 0; class1 < nMixedClasses; class1++) { const SimpleArray<unsigned>& combArray = mixtures[class1]; unsigned nCombinations = combArray.size(); for (unsigned comb = 0; comb < nCombinations; comb++) { unsigned class2 = combArray[comb]; class1it.first(); class2it.first(); Example *class1ex, *class2ex; Boolean done = FALSE; while (!done) { // Search for next example of class 1 while ((class1ex = class1it++) && (class1ex->label != class1)); if (!class1ex) done = TRUE; else { // Search for next example of class 2 while ((class2ex = class2it++) && (class2ex->label != class2)); if (!class2ex) done = TRUE; else { //cout << "Creating mixture for " << class1 << " and " << class2 << endl; // Create new examples from the class1 and class2 examples for (unsigned m = 0; m < nMixtures; m++) newExamples.add(class1, class1ex->input, class2, class2ex->input, mixturePct[m]); } } } } } this->addAllLast(newExamples); newExamples.uEndIndex = 0; // Prevent all added examples from being deleted } void TrainingSet::add(const Array<SimpleArray<unsigned> >& mixtures, unsigned nMixtures, unsigned nCopies) { if (!nMixtures) return; // Setup mixture percentiles DblArray mixturePct(nMixtures); for (unsigned m = 0; m < nMixtures; m++) mixturePct[m] = double(m + 1)/(nMixtures + 1); // Create a separate TrainingSet for the new examples TrainingSet newExamples(uEndIndex, _nInputs, _nTargets, _minTarget, _maxTarget); // Cycle through all mixtures TrainingSetIterator classIt(*this); unsigned nMixedClasses = mixtures.size(); for (unsigned class1 = 0; class1 < nMixedClasses; class1++) { DblArray class1mean(0.0, _nInputs); unsigned exampleCtr = 0; classIt.first(); Example *classEx; while (classEx = classIt++) if (classEx->label == class1) { class1mean += classEx->input; exampleCtr++; } if (exampleCtr > 0) { class1mean /= exampleCtr; const SimpleArray<unsigned>& combArray = mixtures[class1]; unsigned nCombinations = combArray.size(); for (unsigned comb = 0; comb < nCombinations; comb++) { unsigned class2 = combArray[comb]; DblArray class2mean(0.0, _nInputs); unsigned exampleCtr = 0; classIt.first(); Example *classEx; while (classEx = classIt++) if (classEx->label == class2) { class2mean += classEx->input; exampleCtr++; } if (exampleCtr > 0) { class2mean /= exampleCtr; for (unsigned n = nCopies; n != 0; n--) for (unsigned m = 0; m < nMixtures; m++) newExamples.add(class1, class1mean, class2, class2mean, mixturePct[m]); } } } } this->addAllLast(newExamples); newExamples.uEndIndex = 0; // Prevent all added examples from being deleted } // // Removing examples // void TrainingSet::removeAll() { ocIterator exampleIt(*this); Example *example; while (example = (Example *) exampleIt++) delete example; uEndIndex = 0; } // // Misc functions // void TrainingSet::shuffle() { for (unsigned i = 0; i < uEndIndex; i++) { unsigned j = unsigned(drand48()*uEndIndex); if (i != j) { void *tempPtr = Contents[i]; Contents[i] = Contents[j]; Contents[j] = tempPtr; } } } ostream& TrainingSet::print(ostream& OS) const { TrainingSetIterator theIt(*this); Example *example; while (example = theIt++) OS << example->label << ": " << example->input << " -> " << example->target << endl; return OS; } /**************************** * TrainingSet iterator class ****************************/ Example * TrainingSetIterator::operator ++() { if (++_exampleIndex >= _trainingSet->uEndIndex) return(0); return (Example *) _trainingSet->Contents[_exampleIndex]; } Example * TrainingSetIterator::operator ++(int) { if (_exampleIndex >= _trainingSet->uEndIndex) return(0); return (Example *) _trainingSet->Contents[_exampleIndex++]; } Example * TrainingSetIterator::operator --() { if ((int) --_exampleIndex < 0) return(0); return (Example *) _trainingSet->Contents[_exampleIndex]; } Example * TrainingSetIterator::operator --(int) { if ((int) _exampleIndex < 0) return(0); return (Example *) _trainingSet->Contents[_exampleIndex--]; } <file_sep>/configure.ac dnl Process this file with autoconf to produce a configure script. AC_INIT([ebtks],[1.6.4],[<NAME> <<EMAIL>>]) AC_CONFIG_SRCDIR([src/FileIO.cc]) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS([config.h]) AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_CC AC_PROG_CXX dnl The values.h and malloc.h files are not available on OS 10.3 AC_CHECK_HEADERS(values.h malloc.h) dnl Build only static libs by default AC_DISABLE_SHARED AC_PROG_LIBTOOL smr_WITH_BUILD_PATH AC_CHECK_FUNCS(finite isfinite mkstemp) AC_CONFIG_FILES([Makefile]) AC_OUTPUT(epm-header ) <file_sep>/clapack/test.c typedef long int _integer; typedef float _real; typedef double _doublereal; extern int dsysv_(char *uplo, _integer *n, _integer *nrhs, _doublereal *a, _integer *lda, _integer *ipiv, _doublereal *b, _integer *ldb, _doublereal *work, _integer *lwork, _integer *info); main() { char uplo = 'u'; _integer n = 10; _integer nrhs = 1; _integer lda = n; _integer ldb = n; _integer *ipiv = (_integer *) malloc(n * sizeof( _integer)); _doublereal work; _integer lwork = 1; _doublereal *A; _doublereal *b; _integer info; dsysv_(&uplo, &n, &nrhs, (_doublereal *) A, &lda, ipiv, (_doublereal *) b, &ldb, &work, &lwork, (_integer *)info); free(ipiv); return(b); } <file_sep>/templates/Matrix.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: Matrix.cc,v $ $Revision: 1.7 $ $Author: rotor $ $Date: 2010-05-18 23:01:21 $ $State: Exp $ --------------------------------------------------------------------------*/ #include <config.h> #include "Matrix.h" #include "FileIO.h" //included to load compressed data #include <sys/stat.h> #include "unistd.h" #ifdef HAVE_MATLAB #include "matlabSupport.h" #endif #include "miscTemplateFunc.h" using namespace std; #ifdef USE_COMPMAT #ifdef __GNUC__ #pragma do_not_instantiate Mat<dcomplex>::array #pragma do_not_instantiate Mat<dcomplex>::applyIndexFunction #endif #endif #ifdef USE_FCOMPMAT #ifdef __GNUC__ #pragma do_not_instantiate Mat<fcomplex>::array #endif #endif /********************************************************* template <class Type> const Mat<Type>::MATLAB = 0; template <class Type> const Mat<Type>::RAW = 1; template <class Type> const Mat<Type>::ASCII = 2; //template <class Type> tells belong to template class *********************************************************/ #ifndef __GNUC__ template <class Type> unsigned Mat<Type>::_rangeErrorCount = 25; template <class Type> Boolean Mat<Type>::flushToDisk = FALSE; #endif // // Some mathematical operations // template <class T1, class T2> Mat<T1> operator * (const Mat<T1>& A, const Mat<T2>& B) { unsigned arows = A.getrows(); unsigned acols = A.getcols(); unsigned brows = B.getrows(); unsigned bcols = B.getcols(); unsigned bmaxcols = B.getmaxcols(); Mat<T1> Temp(arows, bcols); if (acols != brows) { cerr << "Mat sizes incompatible for *" << endl; return Temp; } T1 *tempPtr = (T1 *) Temp.getEl()[0]; const T1 **rowPtr = A.getEl(); for (unsigned i = arows; i; i--) { const T2 *argColPtr = B.getEl()[0]; for (unsigned j = bcols; j; j--) { const T1 *ptr = *rowPtr; const T2 *argPtr = argColPtr++; *tempPtr = (T1) 0; for (unsigned k = acols; k; k--) { *tempPtr += *ptr++ * (T1) *argPtr; argPtr += bmaxcols; } tempPtr++; } rowPtr++; } return Temp; } template <class T1, class T2> Mat<T1>& pmultEquals(Mat<T1>& A, const Mat<T2>& B) { unsigned nrows = A.getrows(); unsigned ncols = A.getcols(); if (!(A.isvector() && B.isvector() && (A.length() == B.length())) && ((B.getrows() != nrows) || (B.getcols() != ncols))) { cerr << "Matrices of incompatible sizes for pmultEquals" << endl; return A; } T1 *aPtr = (T1 *) A.getEl()[0]; const T2 *bPtr = B.getEl()[0]; for (unsigned i = nrows; i; i--) for (unsigned j = ncols; j; j--) *aPtr++ *= (T1) *bPtr++; return A; } template <class T1, class T2> Mat<T1>& pdivEquals(Mat<T1>& A, const Mat<T2>& B) { unsigned nrows = A.getrows(); unsigned ncols = A.getcols(); if (!(A.isvector() && B.isvector() && (A.length() == B.length())) && ((B.getrows() != nrows) || (B.getcols() != ncols))) { cerr << "Matrices of incompatible sizes for pdivEquals" << endl; return A; } T1 *aPtr = (T1 *) A.getEl()[0]; const T2 *bPtr = B.getEl()[0]; for (unsigned i = nrows; i; i--) for (unsigned j = ncols; j; j--) *aPtr++ /= (T1) *bPtr++; return A; } /********************************* Mat class definitions and member functions **********************************/ // //-------------------------// // template <class Type> Mat<Type>::Mat(const Mat<Type>& A) { _rows = A._rows; _cols = A._cols; _maxrows = A._maxrows; _maxcols = A._maxcols; _el = 0; _allocateEl(); if (_maxrows && _maxcols && _el) memcpy(*_el, *A._el, _maxrows*_maxcols*sizeof(Type)); } // //-------------------------// // template <class Type> Mat<Type>::Mat(const SimpleArray<Type>& A, char dir) { unsigned N = A.size(); if (dir == Mat<Type>::ROW) { _rows = _maxrows = 1; _cols = _maxcols = N; _el = 0; _allocateEl(); } else { _rows = _maxrows = N; _cols = _maxcols = 1; _el = 0; _allocateEl(); } Type *elPtr = *_el; for (unsigned i = 0; i < N; i++) *elPtr++ = A[i]; } // //-------------------------// // template <class Type> Mat<Type>::Mat(unsigned nrows, unsigned ncols, Type value) { _rows = _maxrows = nrows; _cols = _maxcols = ncols; _el = 0; _allocateEl(); if (value != 0.0) fill(value); } // //-------------------------// // template <class Type> Mat<Type>::Mat(unsigned nrows, unsigned ncols) { _rows = _maxrows = nrows; _cols = _maxcols = ncols; _el = 0; _allocateEl(); } // //-------------------------// // template <class Type> Mat<Type>::Mat(unsigned nrows, unsigned ncols, const Type *data) { _rows = _maxrows = nrows; _cols = _maxcols = ncols; _el = 0; _allocateEl(); size_t nBytesInRow = ncols*sizeof(Type); const Type *dataPtr = data; for (unsigned row = 0; row < nrows; row++) { memcpy(_el[row], dataPtr, nBytesInRow); dataPtr += ncols; } } // //-------------------------// // template <class Type> Mat<Type>::Mat(const char *filename, int type, const char *varname) { _rows = _maxrows = 0; _cols = _maxcols = 0; _el = 0; load(filename, type, varname); } // //-------------------------// // template <class Type> Mat<Type>::~Mat() { clear(); } // //-------------------------// // template <class Type> void Mat<Type>::clear() { if (_el) { #ifdef DEBUG cout << "Freeing allocated memory at " << _el << endl; #endif if( _el[0] ) { delete [] _el[0]; } delete [] _el; // delete row of pointers _el = 0; } _rows = _maxrows = _cols = _maxcols = 0; } /**************************************************************************** These overloaded operators allow accessing of individual elements within the matrix. By convention, the first element of the matrix is labeled element zero. Since the matrix is stored in row major format, The element numbers increase going to the right and at the following row. The element at the last row and last column corresponds to the largest possible value of the input argument. *****************************************************************************/ /**************************************************************************** This accessing operator allows modification of individual elements of the matrix. A seperate function is used for accessing elements within complex matrices. *****************************************************************************/ template <class Type> Type& Mat<Type>::operator () (unsigned n) { if (n >= _rows*_cols) { if (_rangeErrorCount) { cerr << "Error: index " << n << " exceeds matrix dimensions. "; cerr << "Changed to " << _rows*_cols - 1 << endl; _rangeErrorCount--; } n = _rows*_cols - 1; } unsigned int rowindex; unsigned int colindex; rowindex= (n/_cols); colindex= (n%_cols); return _el[rowindex][colindex]; } /**************************************************************************** This accessing operator prevents accidental modification by having a constant output argument. A seperate function is used for accessing elements within complex matrices. *****************************************************************************/ template <class Type> Type Mat<Type>::operator () (unsigned n) const { if (n >= _rows*_cols) { if (_rangeErrorCount) { cerr << "Error: index " << n << " exceeds matrix dimensions. "; cerr << "Changed to " << _rows*_cols - 1 << endl; _rangeErrorCount--; } n = _rows*_cols - 1; } unsigned int rowindex; unsigned int colindex; rowindex= (n/_cols); colindex= (n%_cols); return _el[rowindex][colindex]; } // //-------------------------// // template <class Type> Type& Mat<Type>::operator () (unsigned r, unsigned c) { using std::min; // (bert) force it to find the right min() if ((r >= _rows) || (c >= _cols)) { if (_rangeErrorCount) { cerr << "Error: indices (" << r << ", " << c << ") exceed matrix dimensions. " << "Changed to (" << min(r, _rows - 1) << ", " << min(c, _cols - 1) << ")" << endl; _rangeErrorCount--; } r = min(r, _rows - 1); c = min(c, _cols - 1); } return(_el[r][c]); } // // // template <class Type> Type Mat<Type>::operator () (unsigned r, unsigned c) const { using std::min; // (bert) force it to find the right min(). if ((r >= _rows) || (c >= _cols)) { if (_rangeErrorCount) { cerr << "Error: indices (" << r << ", " << c << ") exceed matrix dimensions. " << "Changed to (" << min(r, _rows - 1) << ", " << min(c, _cols - 1) << ")" << endl; _rangeErrorCount--; } r = min(r, _rows - 1); c = min(c, _cols - 1); } return(_el[r][c]); } // //------------------// // //cropt a section of the matrix template <class Type> Mat<Type> Mat<Type>::operator () (unsigned r1, unsigned r2, unsigned c1, unsigned c2) const { if ((r1 > r2) || (c1 > c2) || (r2 >= _rows) || (c2>= _cols)){ cerr << "Error in cropping: improper row or column sizes." << endl; cerr << r1 << " to " << r2 << " and" << endl; cerr << c1 << " to " << c2 << endl; exit(1); } Mat<Type> A(r2-r1+1,c2-c1+1); Type *Aptr = A._el[0]; for (unsigned i=r1; i<=r2 ; i++){ for (unsigned j=c1; j<=c2; j++) *Aptr++=_el[i][j]; } return(A); } // //-------------------------// // template <class Type> const Type * Mat<Type>::operator [] (unsigned index) const { if (index >= _rows) { if (_rangeErrorCount) { cerr << "Error: index " << index << " exceeds matrix dimensions. "; cerr << "Changed to " << _rows - 1 << endl; _rangeErrorCount--; } index = _rows - 1; } return _el[index]; } // //-------------------------// // template <class Type> void Mat<Type>::operator () (const Mat<Type>& A) { if ((A._maxrows != _maxrows) || (A._maxcols != _maxcols)) { _maxrows = A._maxrows; _maxcols = A._maxcols; _allocateEl(); } _rows = A._rows; _cols = A._cols; if (_maxrows && _maxcols && _el) memcpy(*_el, *A._el, _maxrows*_maxcols*sizeof(Type)); } // //-------------------------// // /********************************************************************** Assignment operators for two dimensional matrix objects ***********************************************************************/ template <class Type> Mat<Type>& Mat<Type>::operator = (const Mat<Type>& A) { if (this == &A) return *this; if ((A._maxrows != _maxrows) || (A._maxcols != _maxcols)) { _maxrows = A._maxrows; _maxcols = A._maxcols; _allocateEl(); } _rows = A._rows; _cols = A._cols; if (_maxrows && _maxcols && _el) memcpy(*_el,*A._el, _maxrows*_maxcols*sizeof(Type)); return *this; } template <class Type> Mat<Type>& Mat<Type>::absorb(Mat<Type>& A) { if (this == &A) return *this; // Delete current contents; if (_el) { if( _el[0] ) { delete [] _el[0]; // delete data block } delete [] _el; // delete row of pointers } // Copy all from A _maxrows = A._maxrows; _maxcols = A._maxcols; _rows = A._rows; _cols = A._cols; _el = A._el; // Empty A A._maxrows = A._maxcols = A._rows = A._cols = 0; A._el = 0; return *this; } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::pad(unsigned nrows, unsigned ncols, int row, int col, Type value) { if ((nrows == _rows) && (ncols == _cols) && !row && !col) return *this; char tempFile[256]; get_temp_filename(tempFile); // Save the current matrix to disk if (flushToDisk && saveRaw(tempFile)) { unsigned argRows = _rows; unsigned argCols = _cols; clear(); _rows = _maxrows = nrows; _cols = _maxcols = ncols; _allocateEl(); fill(value); insert(tempFile, argRows, argCols, row, col); } else { // Saving fails, create a new matrix Mat<Type> result(nrows, ncols, value); result.insert(*this, row, col); this->absorb(result); } unlink(tempFile); return *this; } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::resize(unsigned nrows, unsigned ncols, int row, int col) { if ((nrows == _rows) && (ncols == _cols)) return *this; // Origin maintained, shrinking: no reallocation necessary if (!row && !col && (nrows <= _maxrows) && (ncols <= _maxcols)) { _rows = nrows; _cols = ncols; cerr << "This type of resizing is insecure!! Should be fixed..." << endl; return *this; } // This could be done by flushing to disk in order to save memory Mat<Type> T(nrows, ncols); Type *elPtr = T._el[0]; for (int i = 0, i0 = row; i < nrows; i++, i0++) { Boolean valid = (i0 >= 0) && (i0 < _rows); for (int j = 0, j0 = col; j < ncols; j++, j0++) *elPtr++ = (valid && (j0 >= 0) && (j0 < _cols)) ? _el[i0][j0] : Type(0); } absorb(T); return *this; } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::resize() { _rows = _maxrows; _cols = _maxcols; cerr << "This type of resizing is insecure!! Should be fixed..." << endl; return *this; } // //-------------------------// // template <class Type> Mat<Type> Mat<Type>::appendRight(const Mat<Type>& A) const { using std::max; // (bert) force it to find the right max(). Mat<Type> Temp(max(_rows, A._rows), _cols + A._cols); Temp.insert(*this); Temp.insert(A, 0, _cols); return Temp; } // //-------------------------// // template <class Type> Mat<Type> Mat<Type>::appendBelow(const Mat<Type>& A) const { using std::max; // (bert) force it to use the right max() Mat<Type> Temp(_rows + A._rows, max(_cols, A._cols)); Temp.insert(*this); Temp.insert(A, _rows, 0); return Temp; } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::swapRows(unsigned r1, unsigned r2) { if (r1 == r2) return *this; if ((r1 >= _rows) || (r2 >= _rows)) { cerr << "Error in swapRows: improper row indices " << r1 << "," << r2 << " for matrix with " << _rows << " rows" << endl; return *this; } Type *r1ptr = _el[r1]; Type *r2ptr = _el[r2]; for (unsigned i = _cols; i; i--, r1ptr++, r2ptr++) swap(*r1ptr, *r2ptr); return *this; } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::swapCols(unsigned c1, unsigned c2) { if (c1 == c2) return *this; if ((c1 >= _cols) || (c2 >= _cols)) { cerr << "Error in swapCols: improper column indices " << c1 << "," << c2 << " for matrix with " << _cols << " cols" << endl; return *this; } for (unsigned r = 0; r < _rows; r++) swap(_el[r][c1], _el[r][c2]); return *this; } // //-------------------------// // template <class Type> Mat<Type> Mat<Type>::residual(unsigned row, unsigned col) const { if ((_rows <= 1) || (_cols <= 1) || (row >= _rows) || (col >= _cols)) { cerr << "Error: residual(" << row << ", " << col << ") of " << _rows << "x" << _cols << " matrix." << endl; return *this; } Mat<Type> result(_rows - 1, _cols - 1); Type **rowPtr = _el; Type **resultRowPtr = result._el; for (unsigned i = 0; i < _rows; i++) { Type *elPtr = *rowPtr++; if (i != row) { Type *resultElPtr = *resultRowPtr++; for (unsigned j = 0; j < _cols; j++) { if (j != col) *resultElPtr++ = *elPtr; elPtr++; } } } return result; } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::insert(const Mat<Type>& A, int row, int col) { // This could be written more CPU-efficient const Type **ArowPtr = (const Type **) A._el; int destRow = row; for (unsigned i = 0; i < A._rows; i++, destRow++) { Boolean valid = (destRow >= 0) && (destRow < _rows); const Type *AelPtr = *ArowPtr++; int destCol = col; for (unsigned j = 0; j < A._cols; j++, destCol++, AelPtr++) if (valid && (destCol >= 0) && (destCol < _cols)) _el[destRow][destCol] = *AelPtr; } return *this; } template <class Type> Mat<Type>& Mat<Type>::insert(const char *path, unsigned nrows, unsigned ncols, int row, int col) { InputFile argFile(path); if (!argFile) { cerr << "Couldn't open file " << path << endl; return *this; } _checkMatrixDimensions(path, nrows, ncols); // Create a row-sized buffer Type *buffer = 0; allocateArray(ncols, buffer); if (!buffer) { cerr << "Couldn't allocate buffer" << endl; return *this; } int destRow = row; for (unsigned i = 0; i < nrows; i++, destRow++) { if (!(argFile.stream().read((char *) buffer, ncols*sizeof(Type)))) { cerr << "Error while reading file " << path << endl; freeArray(buffer); return *this; } Boolean valid = (destRow >= 0) && (destRow < _rows); const Type *bufferPtr = buffer; int destCol = col; for (unsigned j = 0; j < ncols; j++, destCol++, bufferPtr++) { if (valid && (destCol >= 0) && (destCol < _cols)) _el[destRow][destCol] = *bufferPtr; } } freeArray(buffer); return *this; } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::fill(Type value) { Type *elPtr = _el[0]; for (unsigned i = _rows ; i ; i--) for (unsigned j = _cols ; j ; j--) *elPtr++ = value ; return *this; } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::fill(Type value, unsigned r1, unsigned r2, unsigned c1, unsigned c2) { if ((r2 < r1) || (r2 >= _rows) || (c2 < c1) || (c2 >= _cols)) { cerr << "Error in Mat::fill: invalid row or column arguments." << endl; cerr << r1 << " to " << r2 << " and" << endl; cerr << c1 << " to " << c2 << endl; exit(1); } Type **rowPtr = _el + r1; for (unsigned i = r2 - r1 + 1 ; i ; i--) { Type *elPtr = *rowPtr++ + c1; for (unsigned j = c2 - c1 + 1 ; j ; j--) *elPtr++ = value ; } return *this; } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::fillEllips(Type value, double rowDiameter, double colDiameter) { double row = double(_rows - 1)/2; double col = double(_cols - 1)/2; if (rowDiameter <= 0) rowDiameter = _rows; if (colDiameter <= 0) colDiameter = _cols; double rowRadiusSqr = SQR(rowDiameter/2); double colRadiusSqr = SQR(colDiameter/2); Type *elPtr = _el[0]; for (unsigned i = 0; i < _rows; i++) { double rowDist = SQR(i - row)/rowRadiusSqr; for (unsigned j = 0; j < _cols; j++, elPtr++) if (rowDist + SQR(j - col)/colRadiusSqr <= 1) *elPtr = value; } return *this; } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::fillEllips(Type value, double row, double col, double rowDiameter, double colDiameter) { if (rowDiameter <= 0) rowDiameter = 2*MIN(row + 0.5, _rows - row - 0.5); if (colDiameter <= 0) colDiameter = 2*MIN(col + 0.5, _cols - col - 0.5); double rowRadiusSqr = SQR(rowDiameter/2); double colRadiusSqr = SQR(colDiameter/2); Type *elPtr = _el[0]; for (unsigned i = 0; i < _rows; i++) { double rowDist = SQR(i - row)/rowRadiusSqr; for (unsigned j = 0; j < _cols; j++, elPtr++) if (rowDist + SQR(j - col)/colRadiusSqr <= 1) *elPtr = value; } return *this; } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::eye() { unsigned mindim = (_rows > _cols) ? _cols : _rows; Type **dataPtr = _el; for(unsigned j=0; j< _rows;j++) for(unsigned k=0;k<_cols;k++) dataPtr[j][k]=(Type) 0; for (unsigned i=0 ; i < mindim ; i++) dataPtr[i][i] = (Type)1.0; return *this; } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::randuniform(double min, double max) { double range = max - min; Type *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--) *elPtr++ = Type(drand48() * range + min); return *this; } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::randnormal(double mean, double std) { Type *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols ; j; j--) *elPtr++ = Type(gauss(mean, std)); return *this; } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::hamming() { //note len = _rows unsigned len=_rows; double alphaIncrement = 8.0*atan(1.0)/(len - 1); double alpha = 0; for(unsigned i=0 ; i < len ; i++){ _el[i][0] = (Type)(0.54 - 0.46*::cos(alpha)); alpha += alphaIncrement; } return *this; } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::hanning() { unsigned len=_rows; double alphaIncrement = 8.0*atan(1.0)/(len-1); double alpha = 0; for(unsigned i=0 ; i < len; i++) { _el[i][0] = (Type)(0.5 - 0.5*::cos(alpha)); alpha += alphaIncrement; } return *this; } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::blackman() { unsigned len=_rows; double alphaIncrement = 8.0*atan(1.0)/(len - 1); double alpha = 0.0; for(unsigned i=0 ; i < len ; i++) { _el[i][0] = (Type)(0.42 - 0.5*::cos(alpha) + 0.08*::cos((2*alpha))); alpha += alphaIncrement; } return *this; } //This function creates a diagnonal matrix from the existing row or column //vector object template <class Type> Mat<Type> Mat<Type>::diag() const { //Ensure that calling object is a vector unsigned dimensions=0; if(this->isvector()) { //Size of new square matrix will equal the size of the vector dimensions=this->length(); } else { cerr<<"Error:calling object is not a row or column vector"<<endl; exit(1); } Mat<Type> Diagonalized_Matrix(dimensions,dimensions,(Type)0); for(unsigned i=0 ; i < dimensions ; i++) //The () operator for the calling object is used to access each element in order Diagonalized_Matrix(i,i)=this->operator() (i); return(Diagonalized_Matrix); } //This function creates a diagnonal matrix from the existing row or column //vector object /**************************************************************************** This function creates a toeplitz matrix from the two input vectors ie. if c=[a b c] and r=[A B C], the result would be a B C b a B c b a *****************************************************************************/ template<class Type> Mat<Type> Mat<Type>::toeplitz(const Mat<Type>& r) const { //Make sure that both input arguments are vectors if(!(r.isvector() && this->isvector() )) { cerr<<"Error:One or both of the input arguments is/are not a vector"<<endl; exit(1); } //temporarily store all the lengths so we can safely and quickly use them in //math unsigned c_length= this->length(); unsigned r_length=r.length(); unsigned Row_Buffer_length=(r_length - 1 + c_length); Mat<Type> Row_Buffer(1,Row_Buffer_length,(Type)0); //Fill the row buffer with the two vectors concatenated //The vector (calling object) c is concatenated backwards to the front of //the row buffer for(unsigned i=0;i < c_length;i++) Row_Buffer(i)= this->operator () (c_length - 1 - i); for(unsigned j=1; j < r_length; j++) Row_Buffer(c_length - 1 + j)=r(j); Mat<Type> Toeplitz_M(1,r_length,(Type)0); //Get first row of toeplitz matrix Toeplitz_M=Row_Buffer(0,0,c_length -1,Row_Buffer_length -1); //Construct the matrix by rolling and appending sections of Row_Buffer for(unsigned k=2;k <= c_length;k++) Toeplitz_M = Toeplitz_M.appendBelow(Row_Buffer(0,0,c_length-k,Row_Buffer_length-k)); return(Toeplitz_M); } /*********************************************************************/ //Display functions for two dimensional matrix objects /*********************************************************************/ /****************************************************/ //This function displays the entire matrice //This one does not work for <type> complex elements /***************************************************/ template <class Type> ostream& Mat<Type>::display(ostream& os) const { for (unsigned i=0 ; i < _rows ; i++) { for (unsigned j=0 ; j < _cols ; j++) os << _el[i][j] << " "; os << endl; } return os; } /********************************************************************** This function will display a subsection of the matrix determined by input arguments. The first argument is the starting row(the first row is row 0) followed by the ending row. The third and fourth argument are analagous for the start and end columns. A seperate function is used to display matrices with complex elements ***********************************************************************/ template <class Type> ostream& Mat<Type>::display(ostream& os, unsigned r1, unsigned r2, unsigned c1, unsigned c2) const { //Make sure that the stop row and stop column are greater than the //start row and start column if ((r1 > r2) || (c1 > c2)){ cerr << "Error in display: improper row or column sizes." << endl; cerr << r1 << " to " << r2 << " and" << endl; cerr << c1 << " to " << c2 << endl; exit(1); } //Check to see if the stop row and stop column are exclusively less than //the actual number of rows and columns in the matrix. This //prevents accidental access to an undefined memory location if ((r2 >=_rows) || (c2 >=_cols)) { cerr<<"The requested _rows or columns are not defined for this "; cerr<<"matrix"<<endl; exit(1); } for (unsigned i=r1 ; i <= r2 ; i++) { for (unsigned j=c1 ; j <= c2 ; j++) os << _el[i][j] << " "; os << endl; } return os; } /********************************************************************** This function will display a subsection of the matrix determined by input arguments. The first argument is the starting row(the first row is row 0) followed by the ending row. The third and fourth argument are analagous for the start and end columns. This works or only matrices with complex elements. ***********************************************************************/ // //------------ // template <class Type> int Mat<Type>::operator != (const Mat<Type>& Arg) const { if ((_rows != Arg._rows) || (_cols != Arg._cols)) return 1; Type **argRowPtr = Arg._el; Type **rowPtr = _el; for (unsigned i=_rows ; i != 0 ; i--) { Type *argColPtr = *argRowPtr++; Type *colPtr = *rowPtr++; for (unsigned j=_cols ; j != 0 ; j--) if (*colPtr++ != *argColPtr++) return 1; } return 0; } template <class Type> Mat<Type>& Mat<Type>::operator += (dcomplex x) { Type addend = Type(real(x)); Type *elPtr = _el[0]; for (unsigned i=_rows ; i != 0 ; i--) for (unsigned j=_cols ; j != 0 ; j--, elPtr++) *elPtr += addend; return *this; } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::operator *= (dcomplex x) { double scale = real(x); Type *elPtr = _el[0]; for (unsigned i=_rows ; i != 0 ; i--) for (unsigned j=_cols ; j != 0 ; j--, elPtr++) *elPtr = Type(scale * *elPtr); return *this; } // //-------------------------// // template <class Type> Mat<Type> Mat<Type>::t() const // Transpose operation { Mat<Type> Temp(_cols, _rows); Type **tempDataRowPtr = Temp._el; for (unsigned i=0 ; i < _cols ; i++) { Type *tempDataColPtr = *tempDataRowPtr++; for (unsigned j=0 ; j < _rows ; j++) *tempDataColPtr++ = _el[j][i]; } return Temp; } //************************ //reverse the filter or rotate by 180 //used for convolution and morphology //-------------------------// // template <class Type> Mat<Type> Mat<Type>::rotate180() const { Mat<Type> Temp(_rows,_cols); unsigned kr,kc; for (unsigned i=0 ; i < _rows ; i++) { kr = _rows -i -1; for (unsigned j=0 ; j < _cols ; j++){ kc = _cols -j -1; Temp(kr,kc) = _el[i][j]; } } return Temp; } /************************** inv - matrix inversion - Gauss-Jordan elimination with full pivoting. The returned matrix is always a Type matrix. Exits and prints error message with singular matrices or bad MATRIX structures. ***************************/ template <class Type> Mat<Type> Mat<Type>::inv() const { //Good results if used on float or double only // check for square matrix if(_rows != _cols) { cerr << endl << "Mat inversion ERROR: non-square, size = " << _rows << " x " << _cols << endl; return Mat<Type>(); } // check pointer if(!_el) { cerr << endl << "ERROR: No matrix for matrix invert" << endl; return Mat<Type>(); } // size of square matrix unsigned n = _rows; Mat<Type> Ai(*this); Type **a = Ai._el; // allocate index arrays and set to zero unsigned *pivot_flag = (unsigned *) calloc(n,sizeof(unsigned)); unsigned *swap_row = (unsigned *) calloc(n,sizeof(unsigned)); unsigned *swap_col = (unsigned *) calloc(n,sizeof(unsigned)); if(!pivot_flag || !swap_row || !swap_col) { cerr << "Allocation error in matrix invert" << endl; return Mat<Type>(); } for(unsigned i = 0 ; i < n ; i++) { // n iterations of pivoting // find the biggest pivot element unsigned irow,icol; unsigned row, col; Type big = (Type)0; for(row = 0 ; row < n ; row++) { if(!pivot_flag[row]) { // only unused pivots for(col = 0 ; col < n ; col++) { if(!pivot_flag[col]) { Type abs_element = (Type)fabs((double)a[row][col]); if(abs_element >= big) { big = abs_element; irow = row; icol = col; } } } } } pivot_flag[icol]++; // mark this pivot as used // swap rows to make this diagonal the biggest absolute pivot Ai.swapRows(irow, icol); /* Old code for row swap if(irow != icol) { for(unsigned col = 0 ; col < n ; col++) { Type temp = a[irow][col]; a[irow][col] = a[icol][col]; a[icol][col] = temp; } } */ // store what we swaped swap_row[i] = irow; swap_col[i] = icol; // bad news if the pivot is zero if(a[icol][icol] == (Type) 0) { cerr << "ERROR: matrix invert: SINGULAR MATRIX" << endl; return Mat<Type>(); } // divide the row by the pivot //note here if the opreration is integer results are bad Type pivot_inverse = (Type)1/a[icol][icol]; a[icol][icol] = (Type) 1; // pivot = 1 to avoid round off for(col = 0 ; col < n ; col++) a[icol][col] = a[icol][col]*pivot_inverse; // fix the other _rows by subtracting for(row = 0 ; row < n ; row++) { if(row != icol) { Type temp = a[row][icol]; a[row][icol] = (Type) 0; for( col = 0 ; col < n ; col++) a[row][col] = a[row][col]-a[icol][col]*temp; } } } // fix the affect of all the swaps for final answer for(int swap = n-1 ; swap >= 0 ; swap--) { Ai.swapCols(swap_row[swap], swap_col[swap]); /* Old code for column swap if(swap_row[swap] != swap_col[swap]) { for(unsigned row = 0 ; row < n ; row++) { Type temp = a[row][swap_row[swap]]; a[row][swap_row[swap]] = a[row][swap_col[swap]]; a[row][swap_col[swap]] = temp; } } */ } // free up all the index arrays free((char *)pivot_flag); free((char *)swap_row); free((char *)swap_col); return Ai; } // //-------------------------// // template <class Type> Mat<Type> Mat<Type>::h() const // Hermitian Transpose operation { Mat<Type> Temp(_cols, _rows); Type **tempDataRowPtr = Temp._el; for (unsigned i=0 ; i < _cols ; i++) { Type *tempDataColPtr = *tempDataRowPtr++; for (unsigned j=0 ; j < _rows ; j++) *tempDataColPtr++ = _el[j][i]; } return Temp; } // //-------------------------// // template <class Type> Type Mat<Type>::min(unsigned *row, unsigned *col) const { Type min = **_el; unsigned rowOfMin = 0, colOfMin = 0; unsigned rowindx = 0, colindx = 0; Type **rowPtr = _el; for(unsigned i = _rows ; i != 0 ; i--) { Type *colPtr = *rowPtr++; colindx = 0; for(unsigned j = _cols ; j != 0 ; j--){ if (*colPtr < min) { min = *colPtr; rowOfMin = rowindx; colOfMin = colindx; } colPtr++; colindx++; } rowindx++; } if (row) *row = rowOfMin; if (col) *col = colOfMin; return(min); } // //-------------------------// // template <class Type> Type Mat<Type>::max(unsigned *row, unsigned *col) const { Type max = **_el; unsigned rowOfMax = 0, colOfMax = 0; unsigned rowindx = 0, colindx = 0; Type **rowPtr = _el; for(unsigned i = _rows ; i != 0 ; i--) { Type *colPtr = *rowPtr++; colindx = 0; for(unsigned j = _cols ; j != 0 ; j--){ if (*colPtr > max) { max = *colPtr; rowOfMax = rowindx; colOfMax = colindx; } colPtr++; colindx++; } rowindx++; } if (row) *row = rowOfMax; if (col) *col = colOfMax; return(max); } // //-------------------------// // template <class Type> Type Mat<Type>::median(Type minVal, Type maxVal) const { return array(minVal, maxVal).medianVolatile(); } // //-------------------------// // template <class Type> dcomplex Mat<Type>::csum() const { dcomplex result = 0; Type **rowPtr = _el; for(unsigned i = _rows ; i != 0 ; i--) { Type *colPtr = *rowPtr++; for(unsigned j = _cols ; j != 0 ; j--) result += *colPtr++; } return result; } // //-------------------------// // template <class Type> dcomplex Mat<Type>::csum2() const { dcomplex result = 0; Type **rowPtr = _el; for(unsigned i = _rows ; i != 0 ; i--) { Type *colPtr = *rowPtr++; for(unsigned j = _cols ; j != 0 ; j--, colPtr++) result += dcomplex(*colPtr * *colPtr); } return result; } // //-------------------------// // template <class Type> dcomplex Mat<Type>::ctrace() const { unsigned mindim = (_rows >= _cols) ? _cols : _rows; Type **dataPtr = _el; dcomplex temp = 0; for (unsigned i=0 ; i < mindim ; i++) temp += dataPtr[i][i]; return(temp); } // //-------------------------// // template <class Type> dcomplex Mat<Type>::cdet() const { dcomplex determinant = 0; if (!_rows || (_rows != _cols)) { cerr << "Error: determinant of non-square or empty matrix" << endl; return determinant; } if (_cols > 1) { int factor = 1; Type *elPtr = *_el; for(unsigned col = 0; col < _cols; col++, factor *= -1) determinant += dcomplex(*elPtr++) * (residual(0, col).det() * factor); } else determinant = **_el; return determinant; } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::applyElementWise(double (*function)(double)) { Type *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = (Type) function((double) *elPtr); return(*this); } template <class Type> Mat<Type>& Mat<Type>::applyElementWiseC2D(double (*function)(dcomplex)) { Type *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = (Type) function((dcomplex) *elPtr); return(*this); } template <class Type> Mat<Type>& Mat<Type>::applyElementWiseC2C(dcomplex (*function)(dcomplex)) { Type *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = Type(real(function((dcomplex) *elPtr))); return(*this); } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::applyIndexFunction(IndexFunction F) { Type *elPtr = *_el; for (unsigned r = 0; r < _rows; r++) for (unsigned c = 0; c < _rows; c++) *elPtr++ = Type(F(r, c)); return(*this); } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::applyIndexFunction(ComplexIndexFunction F) { Type *elPtr = *_el; for (unsigned r = 0; r < _rows; r++) for (unsigned c = 0; c < _rows; c++) *elPtr++ = Type(asDouble(F(r, c))); return(*this); } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::exp() { return applyElementWise(::exp); } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::log() { return applyElementWise(::log); } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::cos() { return applyElementWise(::cos); } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::sin() { Type *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = (Type) ::sin(double(*elPtr)); return(*this); } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::round() { return applyElementWise(::rint); } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::abs() { return applyElementWise(::fabs); } // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::sqrt() { return applyElementWise(::sqrt); } template <class Type> Mat<Type>& Mat<Type>::pow(double exponent) { Type *elPtr = _el[0]; for(unsigned i=_rows ; i != 0 ; i--) for(unsigned j=_cols ; j != 0 ; j--, elPtr++) *elPtr = (Type)(::pow((double)*elPtr, exponent)); return *this; } template <class Type> Mat<Type>& Mat<Type>::conj() { return *this; } // //-------------------------// // template <class Type> Mat<Type> Mat<Type>::transposeXself() const { Mat<Type> result(_cols, _cols); Type **resultEl = result._el; for (unsigned i = 0; i < _cols; i++) { Type *resultPtr = resultEl[i]; for (unsigned j = 0; j < i; j++) { Type& value = *resultPtr++; value = Type(0); for (unsigned k = 0; k < _rows; k++) value += _el[k][i] * _el[k][j]; resultEl[j][i] = value; } Type& value = *resultPtr++; value = Type(0); for (unsigned k = 0; k < _rows; k++) value += _el[k][i] * _el[k][i]; } return result; } // //-------------------------// // template <class Type> void Mat<Type>::eig(Mat<Type>& D, Mat<Type>& V) const { //Mat<double> Ad = (DblMat) (this); double *d; unsigned np1; unsigned *positions, itemp; double temp; // if (!Ad.getEl()) { if (!_el) { printf("eig: invalid input matrix pointer\n"); exit(1); } if (_rows != _cols) { cerr << "eig: matrix is not square -- " << _rows << " x " << _cols << endl; exit(1); } np1 = _rows + 1; Mat<double> A(np1,np1); Mat<double> v(np1,np1); d = (double *) malloc((np1)*sizeof(double)); unsigned i, j; for (i=1 ; i <= _rows ; i++) for (j=1 ; j <= _cols ; j++) A(i,j) = (double)_el[i-1][j-1]; //A(i,j) = Ad.getEl[i-1][j-1]; jacobi((double **) A.getEl(), _rows, d,(double **) v.getEl()); // sort eigenvalues in descending order positions = (unsigned *) malloc( (_rows + 1) * sizeof(unsigned)); for (i=1 ; i <= _rows ; i++) positions[i] = i; for (i=1 ; i <= _rows ; i++) for (j=1 ; j < _rows ; j++){ if (d[j] < d[j+1]) { temp = d[j]; d[j] = d[j+1]; d[j+1] = temp; itemp = positions[j]; positions[j] = positions[j+1]; // Keep track of original positions positions[j+1] = itemp; } } for (i=0 ; i < _rows ; i++) for (j=0 ; j < _cols ; j++) { V(i,j) = (Type)v(i+1,positions[j+1]); D(i,j) = (Type)0.0; } for (i=0 ; i < _rows ; i++) D(i,i) = (Type)d[i+1]; free((char *)d); free((char *)positions); } // //-------------------------// // template <class Type> Mat<Type> Mat<Type>::house() const { if (_cols != 1) { cerr << "Error: input to house is not a column vector." << endl; exit(1); } unsigned n = _rows; Type mu = (Type) 0.0; Type **rowPtr = _el; for(unsigned i=n ; i != 0 ; i--, rowPtr++) { mu += (**rowPtr) * (**rowPtr); } mu = (Type)(::sqrt((double)mu)); Mat<Type> v(*this); if (mu != (Type) 0.0){ Type xFirst = **_el; Type beta = (xFirst > (Type) 0.0) ? xFirst + mu : xFirst - mu; Type **rowPtr = _el + 1; Type **vRowPtr = v._el + 1; for(unsigned i=n-1 ; i != 0 ; i--, rowPtr++, vRowPtr++){ **vRowPtr = **rowPtr / beta; } } **v._el = (Type) 1.0; return(v); } // //-------------------------//Not sure // template <class Type> Mat<Type> Mat<Type>::rowhouse(const Mat<Type>& V) const { Type beta; if (V._cols != 1) { cerr << "Error: input to rowhouse is not a column vector." << endl; exit(1); } if (V._rows != _rows) { cerr << "Error: vector input to rowhouse is wrong length." << endl; exit(1); } Type nv = (Type) 0.0; Type **vRowPtr = V._el; for (unsigned i=V._rows ; i != 0 ; i--, vRowPtr++) nv += (**vRowPtr) * (**vRowPtr); if (nv == (Type) 0.0){ cerr << "Error: vector input to rowhouse is all Zeros." << endl; exit(1); } beta = (Type)(-2.0)/nv; Mat <Type> w(_cols,1); w = (*this).t(); w = w * V; w = w * beta; return ( *this + V * w.t() ); } // //-------------------------// // template <class Type> Mat<Type> Mat<Type>::convolv2d(const Mat<Type>& filter) const { unsigned row,column, i, j; unsigned dead_rows, dead_cols, kernel_rows, kernel_cols, l_cols, l_rows; Type *outptr, *inptr, *filterptr; Mat<Type> out(_rows,_cols); Mat<Type> filterrev = filter.rotate180(); kernel_rows = filter.getrows(); kernel_cols = filter.getcols(); dead_rows = kernel_rows/2; dead_cols = kernel_cols/2; l_rows = 2*dead_rows + _rows; l_cols = 2*dead_cols +_cols; Mat<Type> large(l_rows, l_cols); Mat<Type> outlarge(l_rows, l_cols); /*copy in into center of large*/ for(i=0; i < _rows ; i++){ for(j=0; j < _cols ; j++) large._el[i+dead_rows][j+dead_cols] = _el[i][j]; } for(row=0; row < large._rows -kernel_rows+1; row++){ outptr = outlarge._el[row+dead_rows]; for (column=0; column<large._cols-kernel_cols+1; column++){ Type sumval = 0; for (i=0; i< kernel_rows; i++){ inptr = large._el[i+row]; inptr = inptr + column; filterptr = (Type *) filterrev._el[i]; for (j=0; j< kernel_cols; j++) sumval += (*inptr++) * (*filterptr++); } outptr[column+dead_cols] = sumval; } } for(i=0; i < _rows ; i++){ for(j=0; j < _cols ; j++) out._el[i][j] = outlarge._el[i+dead_rows][j+dead_cols]; } return(out); } /***************/ template <class Type> Histogram Mat<Type>::histogram(double minin, double maxin, unsigned n) const { if (maxin <= minin) { minin = min(); maxin = max(); } Histogram histogram(minin, maxin, n); const Type **rowPtr = (const Type **) _el; for (unsigned i = _rows; i; i--) { const Type *elPtr = *rowPtr++; for (unsigned j = _cols; j; j--) histogram.add(*elPtr++); } return histogram; } /* //this histogram works in the following way //if there is no input in the histogram ex: histogram(), then //it takes the defaults 0,0 and does the histogram from the smallest //value in the image to the largest value. //if the input is histogram(0,255) it will give the histogram //between 0 and 255. If the input is 10,20 it will give only 10,20 //values template <class Type> Mat<Type> Mat<Type>::histogram(int minin, int maxin) const { if(minin == maxin){ minin=(int)min(); maxin=(int)max(); } int range = maxin - minin + 1; Mat<Type> histogram1; histogram1 = Zeros<Type>(1, range); Type *histPtr = histogram1._el[0]; Type **rowPtr = _el; for (int i = _rows; i != 0; i--) { Type *colPtr = *rowPtr++; for (int j = _cols; j != 0; j--, colPtr++) { if ((*colPtr >= minin) && (*colPtr <= maxin)) { int roundedEl = (int) rint((double)*colPtr); (*(histPtr + roundedEl))++; } } } return(histogram1); } */ // //-------------------------// // template <class Type> Mat<Type>& Mat<Type>::histmod(const Histogram& hist1, const Histogram& hist2) { return map(equalize(hist1, hist2)); } // //-------------------------// // template <class Type> SimpleArray<Type> Mat<Type>::array(Type minVal, Type maxVal) const { unsigned N = 0; Type **rowPtr; Type *elPtr; if (maxVal <= minVal) { minVal = min(); maxVal = max(); N = nElements(); } else { // Scan matrix to determine # elements in the range rowPtr = _el; for (unsigned i = _rows; i; i--) { elPtr = *rowPtr++; for (unsigned j = _cols; j; j--, elPtr++) if ((*elPtr >= minVal) && (*elPtr <= maxVal)) N++; } } SimpleArray<Type> array(N); if (N) { Type *arrayPtr = array.contents(); rowPtr = _el; for (unsigned i = _rows; i; i--) { elPtr = *rowPtr++; for (unsigned j = _cols; j; j--) if ((*elPtr >= minVal) && (*elPtr <= maxVal)) *arrayPtr++ = *elPtr++; } } return array; } // //-------------------------// // template <class Type> void Mat<Type>::qr(Mat<Type>& R, Mat<Type>& Q) const { /*****************Don't need this because R and Q get reassigned later if ((_rows != R._rows) && (_cols != R._cols)) { cerr << "Error: R matrix of incompatible size for QR." << endl; exit(1); } if ((_rows != Q._rows) && (_rows != Q._cols)) { cerr << "Error: Q matrix of incompatible size for QR." << endl; exit(1); } ***********************************************************************/ Mat<Type> Atmp(*this); //Mat<Type> vtmp(Zeros<Type>(_rows,1)); //This vector vtmp should automatically be initialized to zero Mat<Type> vtmp(_rows,1); Mat<Type> QTemp(_rows,_rows); //This below instantiation used to be at position 12345 Mat<Type> Temp(*this); unsigned mindim = (_rows > _cols) ? _cols : _rows; // This can be made more efficient -- Alex, 2/4/94 unsigned i, k; int j; for(j=0 ; j < mindim ; j++){ vtmp.resize(_rows-j,1); for(i=j ; i < _rows ; i++) vtmp(i-j,0) = Atmp(i,j); vtmp = vtmp.house(); //Position 12345 Temp(Temp.rowhouse(vtmp)); for(i=j ; i < _rows ; i++) for(k=j ; k < _cols ; k++) Atmp(i,k) = Temp(i-j,k-j); if (j < (_rows-1)){ for(i=j+1 ; i < _rows ; i++) Atmp(i,j) = vtmp(i-j,0); } Temp.resize(_rows-j-1,_cols-j-1); for(i=0 ; i < _rows-j-1 ; i++) for(k=0 ; k < _cols-j-1 ; k++) Temp(i,k) = Atmp(i+j+1,k+j+1); } R = Mat<Type>(_rows,_cols); for(i=0 ; i < mindim ; i++) for(k=i ; k < mindim ; k++) R(i,k) = Atmp(i,k); vtmp.resize(); Q = Mat<Type>(_rows,_rows); Q.eye(); for(j = mindim - 1 ; j >= 0 ; j--){ vtmp.resize(_rows-j,1); QTemp.resize(_rows-j,_rows-j); vtmp(0,0) = (Type) 1; for(i=1 ; i < _rows-j ; i++) vtmp(i,0) = Atmp(i+j,j); for(i=0 ; i < _rows-j ; i++) for(k=0 ; k < _rows-j ; k++) QTemp(i,k) = Q(i+j,k+j); QTemp = QTemp.rowhouse(vtmp); for( i=0 ; i < _rows-j ; i++) for(k=0 ; k < _rows-j ; k++) Q(i+j,k+j) = QTemp(i,k); } vtmp.resize(); if (_rows < _cols){ for(j=_rows ; j < _cols ; j++){ for(i=0 ; i < _rows ; i++){ vtmp(i,0) = _el[i][j]; } vtmp = Q.t() * vtmp; for(i=0 ; i < _rows ; i++){ R(i,j) = vtmp(i,0); } } } } /********************************************************* template <class Type> void Mat<Type>::qrtwo(Mat<Type>& R, Mat<Type>& Q) const { cerr << "Dcomplex 3 qr not implemented" << endl; } **********************************************************/ // //-------------------------// // /***************************************************************************** This qr function only works with the _rows greater than or equal to the number of columns. It may be possible to modify this so that it works with any size matrix. ******************************************************************************/ template <class Type> void Mat<Type>::qr(Mat<Type>& R, Mat<Type>& Q, Mat<Type>& P) const { // This can be made more efficient -- Alex, 2/4/94 int i, j, k, r, *piv, mindim; unsigned rloc, cloc; Type tau, dtmp; Mat<Type> Atmp(*this); /*********changed 6/17/94****************** P = Eye<Type>(_cols); R = Zeros<Type>(_rows,_cols); *******************************************/ if(_cols>_rows){ cerr<<"_Rows must be greater than or equal to columns"<<endl; exit(1); } P=Mat<Type>(_cols,_cols); P.eye(); R=Mat<Type>(_rows,_cols); piv = (int *)malloc(_cols * sizeof(int)); if (!piv){ cerr << "Error forming piv integer vector in qr." << endl; cerr << "_rows = " << _rows << " _cols = " << _cols << endl; exit(1); } Mat<Type> c(_cols,1); Mat<Type> v(_rows,1); Mat<Type> tmp(_cols,1); Mat<Type> Temp(_rows,_cols); Mat<Type> QTemp(_rows,_rows); Mat<Type> PTemp(_cols,_cols); for(j=0 ; j < _cols ; j++){ c(j) = (Type)0.0; piv[j] = 0; for(i=0 ; i < _rows ; i++) c(j) = c(j) + Atmp(i,j)*Atmp(i,j); } r = -1; tau = c.max(&rloc, &cloc); k = rloc; while(tau > 0){ r++; piv[r] = k; //Swap the rth and kth columns of A for(i=0 ; i < _rows ; i++){ dtmp=Atmp(i,r); Atmp(i,r)=Atmp(i,k); Atmp(i,k)=dtmp; } //Swap c(r) and c(k) dtmp=c(r); c(r)=c(k); c(k)=dtmp; /**********changed 6/17/94****************** PTemp = Eye<Type>(_cols); ********************************************/ //Obtain an identity matrix to perform swaps to calulate the Pth permutation //matrix PTemp=Mat<Type> (_cols,_cols); PTemp.eye(); //swap row j=r and piv[j]=k of PTemp to create the jth permutation matrix PTemp(r,r)=(Type)0.0; PTemp(k,k)=(Type)0.0; PTemp(r,k)=(Type)1.0; PTemp(k,r)=(Type)1.0; //Accumulate the Permutation matrix initially, P is an identity matrix P = P*PTemp; //Resize Temp and v to prepare for the rth householder Temp.resize(_rows-r,1); v.resize(_rows-r,1); //Temp gets elements A(r:m,r) for(i=r ; i < _rows ; i++) Temp(i-r,0) = Atmp(i,r); //v gets house(A(r:m,r)) v = Temp.house(); //Resize Temp to allow the rowhouse Temp.resize(_rows-r,_cols-r); //Temp=A(r:m,r:n) for(i=r ; i < _rows ; i++) for(j=r ; j < _cols ; j++) Temp(i-r,j-r) = Atmp(i,j); //Temp=rowhouse(A(r:m,r:n),v(r:m)) Temp = Temp.rowhouse(v); //A(r:m,r:n)=Temp for(i=r ; i < _rows ; i++) for(j=r ; j < _cols ; j++) Atmp(i,j) = Temp(i-r,j-r); //A(r+1:m,r)=v(r+1:n) for(i=r+1 ; i < _rows ; i++) Atmp(i,r) = v(i-r); for(i=r+1 ; i < _cols ; i++) c(i) = c(i) - Atmp(r,i)*Atmp(r,i); if ( r < (_cols -1)) { /******************changed 6/21/94************************* tmp.resize(_cols-1-r,1); for(i=r+1 ; i < _cols ; i++) tmp(i-r-1,0) = c(i); tau = tmp.max(&rloc, &cloc); ***********************************************************/ //tau gets max(c(r+1:n)) tau = (c(r+1,_cols-1,0,0)).max(&rloc,&cloc); k = rloc + r + 1; } else tau = (Type) 0; } //end while //R gets upper triangular part of A for(i=0 ; i < _rows ; i++) for(j=i ; j < _cols ; j++) R(i,j) = Atmp(i,j); mindim = r+1; v.resize(); /**************changed 6/17/94****************** Q = Eye<Type>(_rows); ***********************************************/ Q=Mat<Type>(_rows,_rows); Q.eye(); for( j = mindim - 1 ; j >= 0 ; j--){ v.resize(_rows-j,1); QTemp.resize(_rows-j,_rows-j); v(0,0) = (Type) 1; for(i=1 ; i < _rows-j ; i++) v(i,0) = Atmp(i+j,j); for(i=0 ; i < _rows-j ; i++) for(k=0 ; k < _rows-j ; k++) QTemp(i,k) = Q(i+j,k+j); QTemp = QTemp.rowhouse(v); for(i=0 ; i < _rows-j ; i++) for(k=0 ; k < _rows-j ; k++) Q(i+j,k+j) = QTemp(i,k); } v.resize(); if (_rows < _cols){ for(j=_rows ; j < _cols ; j++){ for(i=0 ; i < _rows ; i++){ v(i,0) = _el[i][j]; } v = Q.t() * v; for(i=0 ; i < _rows ; i++){ R(i,j) = v(i,0); } } } free((char *)piv); } // //-------------------------// // /***************************************************************************** This svd function only works with the _rows greater than or equal to the number of columns. It may be possible to modify this so that it works with any size matrix. ******************************************************************************/ template <class Type> void Mat<Type>::svd(Mat<Type>& U, Mat<Type>& S, Mat<Type>& V) const { // This can be made more efficient -- Alex, 2/4/94 /************************changed 6/27/94************************************* if ((U._rows != _rows) || (U._cols != _rows)){ cerr << "Error in svd: left eigenvector input matrix of wrong size." << endl; cerr << _rows << "x" << _rows << endl; exit(1); } if ((S._rows != _rows) || (S._cols != _cols)){ cerr << "Error in svd: singular value input matrix of wrong size." << endl; cerr << _rows << "x" << _rows << endl; exit(1); } if ((V._rows != _cols) || (V._cols != _cols)){ cerr << "Error in svd: right eigenvector input matrix of wrong size." << endl; cerr << _rows << "x" << _cols << endl; exit(1); } ******************************************************************************/ if(_cols>_rows){ cerr<<"_Rows must be greater than or equal to columns"<<endl; exit(1); } U=Mat<Type> (_rows,_rows); S=Mat<Type> (_rows,_cols); V=Mat<Type> (_cols,_cols); Mat<Type> C(_cols,_cols); Mat<Type> D(_cols,_cols); Mat<Type> R(_rows,_cols); Mat<Type> P(_cols,_cols); C = t() * (*this); C.eig(D, V); ((*this)*V).qr(R,U,P); unsigned mindim = (_rows > _cols) ? _cols : _rows; S = U.t()*(*this)*V*P; unsigned i, j; for(i=0 ; i < mindim ; i++){ Type& sii = S(i, i); if (double(sii) < 0.0) { sii = int(fabs(double(sii))); for(j=0 ; j < _rows ; j++) U(j,i) = -U(j,i); } } V = V*P; for(i=0 ; i < _rows ; i++) for(j=0 ; j < _cols ; j++){ if ( i != j) S(i,j) = (Type)0.0; } } // //-------------------------// // template < class Type> Mat<Type>& Mat<Type>::clip(Type minVal, Type maxVal, Type minFill, Type maxFill) { Type **rowPtr = _el; for(unsigned i = _rows; i; i--) { Type *elPtr = *rowPtr++; for (unsigned j = _cols; j; j--, elPtr++) { if (*elPtr < minVal) *elPtr = minFill; if (*elPtr > maxVal) *elPtr = maxFill; } } return(*this); } // //-------------------------// // template < class Type> Mat<Type>& Mat<Type>::map(const ValueMap& valueMap) { Type **rowPtr = _el; for(unsigned i = _rows; i; i--) { Type *elPtr = *rowPtr++; for (unsigned j = _cols; j; j--, elPtr++) *elPtr = Type(valueMap(double(*elPtr))); } return(*this); } // //-------------------------// // //The scale function will scale the image between 0 and 255 //unless given a range with a minimum and maximum value //then it finds 256 levels and adds the minimum to all values //note that: ((x-min)*(Max-Min)/(max-min))+Min // = x*((Max-Min)/(max-min)) + ((Minmax - Maxmin)/(max-min)) template < class Type> Mat<Type>& Mat<Type>::scale(double minout, double maxout, double minin, double maxin) { if (minin >= maxin) { minin = asDouble(min()); maxin = asDouble(max()); } map(LinearMap(minin, maxin, minout, maxout)); clip(Type(minout), Type(maxout), Type(minout), Type(maxout)); return *this; } template <class Type> void Mat<Type>::linearinterpolate(unsigned Urow, unsigned Drow, unsigned Ucol, unsigned Dcol, Mat<Type>& y) const { unsigned i, nrows, ncols, out_rows, out_cols; unsigned n, m; nrows = _rows; ncols = _cols; out_cols = ((ncols-1)*Urow+1)/Drow; out_rows = ((nrows-1)*Ucol+1)/Dcol; /**************changed 6/23/94********************** remake(y, out_rows, out_cols); y.fill((Type)0); y = Zeros<Type>(out_rows, out_cols); yi.fill((Type)0); yi = Zeros<Type>(nrows, out_cols); ****************************************************/ y=Mat<Type> (out_rows,out_cols); Mat<Type> yi(nrows,out_cols); Mat<Type> tempr(1,ncols*Urow+1); for(i=0 ; i < nrows ; i++){ tempr.fill((Type)0); /************************* tempr = Zeros<Type>(1,ncols*Urow + 1); **************************/ tempr(0) = _el[i][0]; for(n=1 ; n < ncols ; n++){ tempr(n*Urow) = _el[i][n]; for(m=1 ; m < Urow ; m++){ tempr((n-1)*Urow + m) = tempr((n-1)*Urow) + (tempr(n*Urow)-tempr((n-1)*Urow))*m/Urow; } } for(n=0 ; n < out_cols ; n++) yi(i,n) = tempr(n*Drow); } Mat<Type> tempc(1,nrows*Ucol + 1); for(i=0 ; i < out_cols ; i++){ /***************changed 6/23/94**************** tempc = Zeros<Type>(1,nrows*Ucol + 1); **********************************************/ tempc.fill((Type)0); tempc(0) = yi(0,i); for(n=1 ; n < nrows ; n++){ tempc(n*Ucol) = yi(n, i); for(m=1 ; m < Ucol ; m++){ tempc((n-1)*Ucol + m) = tempc((n-1)*Ucol) + (tempc(n*Ucol)-tempc((n-1)*Ucol))*m/Ucol; } } for(n=0 ; n < out_rows ; n++) y(n,i) = tempc(n*Dcol); } } // //-------------------------// // template <class Type> Mat<Type> Mat<Type>::filter(Mat<Type>& B,Mat<Type>& A) const { unsigned n, i, P, Q, N; Type temp; if ((B._rows != 1) && (B._cols != 1)){ cerr << "error in filter: numerator not a vector." << endl; cerr << B._rows << "x" << B._cols << endl; exit(1); } if ((A._rows != 1) && (A._cols != 1)){ cerr << "error in filter: denominator not a vector." << endl; cerr << A._rows << "x" << A._cols << endl; exit(1); } if ((_rows != 1) && (_cols != 1)){ cerr << "error in filter: input not a vector." << endl; cerr << _rows << "x" << _cols << endl; exit(1); } if (A(0) == 0){ cerr << "error in filter: first element in the denominator" << endl; cerr << " must be non-zero." << endl; exit(1); } P = A.length(); P=P-1; Q = B.length(); Q=Q-1; N = this->length(); temp = A(0); if (A(0) != 1.0){ for (i=0 ; i <= Q ; i++) B(i) = B(i)/temp; for (i=0 ; i <= P ; i++) A(i) = A(i)/temp; } Mat<Type> y(_rows,_cols); Mat<Type> pastx(1,Q+1); Mat<Type> pasty(1,P+1); for(n=0 ; n < N ; n++){ y(n) = 0; pastx(0) = this->operator () (n); for (i=1 ; i <= P ; i++) y(n) = y(n) - A(i)*pasty(i); for (i=0 ; i <= Q ; i++) y(n) = y(n) + B(i)*pastx(i); pasty(0) = y(n); for(i=P ; i > 0 ; i--) pasty(i) = pasty(i-1); for(i=Q ; i > 0 ; i--) pastx(i) = pastx(i-1); } return(y); } /***************************morphology functions*******************************/ #ifdef USE_DBLMAT template <class Type> Mat<Type> Mat<Type>::erode(const Mat<double>& strel) const { unsigned strelHeight = strel.getrows(); unsigned strelWidth = strel.getcols(); if (((strelHeight == 1) && (strelWidth == 1)) || !strelHeight || !strelWidth) return Mat<Type>(*this); Mat<Type> padMatrix(pad(strelHeight/2, strelWidth/2)); Mat<Type> result(_rows, _cols); Type *padMatrixPtr1 = padMatrix._el[0]; const double *strelStart = strel.getEl()[0]; Type *resultPtr = result._el[0]; unsigned padMatrixPtr2incr = padMatrix._cols - strelWidth; unsigned padMatrixPtr1incr = (strelWidth/2) * 2; for (unsigned y = _rows; y != 0; y--) { for (unsigned x = _cols; x != 0; x--) { Type *padMatrixPtr2 = padMatrixPtr1; double minimum = MAXDOUBLE; const double *strelPtr = strelStart; for (register unsigned j = strelHeight; j != 0; j--) { for (register unsigned i = strelWidth; i != 0; i--) { if (*strelPtr >= 0) minimum = MIN(minimum, (double) *padMatrixPtr2 - *strelPtr); strelPtr++; padMatrixPtr2++; } padMatrixPtr2 += padMatrixPtr2incr; } *resultPtr = Type(minimum); resultPtr++; padMatrixPtr1++; } padMatrixPtr1 += padMatrixPtr1incr; } return result; } template <class Type> Mat<Type> Mat<Type>::dilate(const Mat<double>& strel) const { unsigned strelHeight = strel.getrows(); unsigned strelWidth = strel.getcols(); if (((strelHeight == 1) && (strelWidth == 1)) || !strelHeight || !strelWidth) return Mat<Type>(*this); unsigned r=0; unsigned c=0; if ((strelHeight % 2) == 0) { strelHeight++; r++; } if ((strelWidth % 2) == 0) { strelWidth++; c++; } Mat<double> newStrel(strelHeight, strelWidth, -1); newStrel.insert(strel.rotate180(), r, c); Mat<Type> padMatrix(pad(strelHeight/2, strelWidth/2)); Mat<Type> result(_rows, _cols); Type *padMatrixPtr1 = padMatrix._el[0]; const double *strelStart = newStrel.getEl()[0]; Type *resultPtr = result._el[0]; unsigned padMatrixPtr2incr = padMatrix._cols - strelWidth; unsigned padMatrixPtr1incr = (strelWidth/2) * 2; for (unsigned y = _rows; y != 0; y--) { for (unsigned x = _cols; x != 0; x--) { Type *padMatrixPtr2 = padMatrixPtr1; double maximum = -MAXDOUBLE; const double *strelPtr = strelStart; for (register unsigned j = strelHeight; j != 0; j--) { for (register unsigned i = strelWidth; i != 0; i--) { if (*strelPtr >= 0) maximum = MAX(maximum, (double) *padMatrixPtr2 + *strelPtr); strelPtr++; padMatrixPtr2++; } padMatrixPtr2 += padMatrixPtr2incr; } *resultPtr = Type(maximum); resultPtr++; padMatrixPtr1++; } padMatrixPtr1 += padMatrixPtr1incr; } return result; } #endif // USE_DBLMAT /******************************Old code*************************************** template <class Type> Mat<Type> Mat<Type>::filter(Mat<Type>& B, Mat<Type>& A, Mat<Type>& x) { unsigned n, i, P, Q, N; Type temp; if ((B._rows != 1) && (B._cols != 1)){ cerr << "error in filter: numerator not a vector." << endl; cerr << B._rows << "x" << B._cols << endl; exit(1); } if ((A._rows != 1) && (A._cols != 1)){ cerr << "error in filter: denominator not a vector." << endl; cerr << A._rows << "x" << A._cols << endl; exit(1); } if ((x._rows != 1) && (x._cols != 1)){ cerr << "error in filter: input not a vector." << endl; cerr << x._rows << "x" << x._cols << endl; exit(1); } if (A(0) == 0){ cerr << "error in filter: first element in the denominator" << endl; cerr << " must be non-zero." << endl; exit(1); } P = length(A) - 1; Q = length(B) - 1; N = length(x); temp = A(0); if (A(0) != 1.0){ for (i=0 ; i <= Q ; i++) B(i) = B(i)/temp; for (i=0 ; i <= P ; i++) A(i) = A(i)/temp; } Mat<Type> y(x._rows, x._cols); Mat<Type> pastx(1,Q+1); Mat<Type> pasty(1,P+1); pastx = Zeros<Type>(1,Q+1); pasty = Zeros<Type>(1,P+1); for(n=0 ; n < N ; n++){ y(n) = 0; pastx(0) = x(n); for (i=1 ; i <= P ; i++) y(n) = y(n) - A(i)*pasty(i); for (i=0 ; i <= Q ; i++) y(n) = y(n) + B(i)*pastx(i); pasty(0) = y(n); for(i=P ; i > 0 ; i--) pasty(i) = pasty(i-1); for(i=Q ; i > 0 ; i--) pastx(i) = pastx(i-1); } return(y); } ****************************************************************************/ //Need to be modified // //-------------------------// // /**************************************************************** template <class Type> void Mat<Type>::radialscale(Mat<Type>& scale, Mat<Type>& y) const { //To recover old code look in rmold.c unsigned slen, out_rows, out_cols, nrows, ncols; unsigned i, j; Type smax, smin, fPI; Type xrc, xcc, yrc, ycc; Type xang, yang, xrad, yrad, xr, xc; unsigned rloc,cloc; fPI = 4.0*atan(1.0); slen = 360; nrows = _rows; ncols = _cols; smin = min(scale); smax = max(scale); out_rows = (unsigned)(floor(smax*nrows + 0.5)); out_cols = (unsigned)(floor(smax*ncols + 0.5)); y=Mat<Type>(out_rows,out_cols); xrc = (Type)(nrows)/2.0; xcc = (Type)(ncols)/2.0; yrc = (Type)(out_rows)/2.0; ycc = (Type)(out_cols)/2.0; for(i=0 ; i < out_rows ; i++) for(j=0 ; j < out_cols ; j++){ yrad = (Type)(::sqrt((i-yrc)*(i-yrc) + (j-ycc)*(j-ycc))); yang = (Type)floor(atan2((j-ycc) , (i-yrc))*180/fPI); if (yang < (Type)0) yang = yang + (Type)360; xrad = yrad/scale((int)(yang)); xang = yang; xr = (Type)floor(xrc + xrad*(Type)cos(xang*fPI/(Type)180) ); xc = (Type)floor(xcc + xrad*(Type)sin(xang*fPI/(Type)180)); if ((xr<(Type)0) || (xr>=(Type)nrows) || (xc<(Type)0) || (xc>=(Type)ncols)) y(i,j) = (Type)0; else y(i,j) = _el[(unsigned)xr][(unsigned)xc]; } } ******************************************************************************/ // //-------------------------// // // //------------------------/ // #ifdef HAVE_MATLAB /*****************************************************************************/ //This function goes to the named mat file and searches for the given variable //Next, if possible, it reinitializes the calling object to represent the //same matrix as that defined by the Matlab variable. The Matlab matrix //is stored in double format. The function Matlab2Mat will convert the //Matlab data to the type of its calling object (this). This may mean a loss //of precision. template <class Type> Boolean Mat<Type>::loadMatlab(const char *filename, const char *varname) { if (!filename || !varname) { cerr << "Mat<Type>::loadMatlab(): no filename or variable name specified" << endl; return FALSE; } //Check to ensure that the file can be opened successfully for reading MATFile *infile = matOpen((char *) filename,"r"); if(infile==NULL) { cerr << "Mat<Type>::loadMatlab(): Can't open file: " << filename << endl; return FALSE; } //Assign pointer to the Matrix object allocated from the file and ensure that //the named variable was found Matrix *MatlabMatrix = matGetMatrix(infile, (char *) varname); if(MatlabMatrix==NULL) { cerr << "Mat<Type>::loadMatlab(): Could not find: " << varname << " in file: " << filename << endl; //close the file and quit matClose(infile); return FALSE; } //Check to see if the Matlab Matrix was full or sparse, dcomplex or real //if (mxIsDcomplex(MatlabMatrix) == 0) if (mxIsComplex(MatlabMatrix) == 0) *this = matlab2Mat(MatlabMatrix); else { cerr<<"Mat<Type>::loadMatlab(): The variable: "<<varname<<" in the file: "<<filename; cerr<<" is dcomplex. Create a dcomplex Mat object and call its"; cerr<<" loadMatlab function."<<endl; matClose(infile); mxFreeMatrix(MatlabMatrix); return FALSE; } //We were successful matClose(infile); mxFreeMatrix(MatlabMatrix); return TRUE; } #endif // HAVE_MATLAB // //-------------------------// // template <class Type> Boolean Mat<Type>::loadRaw(const char *filename, unsigned nrows, unsigned ncols) { InputFile matrixFile(filename); if (!matrixFile) { cerr << "Error in loadRaw: error opening file." << endl; return FALSE; } _checkMatrixDimensions(filename, nrows, ncols); if ((nrows && (nrows != _rows)) || (_cols && (ncols != _cols))) { _rows = _maxrows = nrows; _cols = _maxcols = ncols; _allocateEl(); } if (!matrixFile.stream().read((char *)_el + _maxrows*sizeof(Type *), _maxrows*_maxcols*sizeof(Type))) return FALSE; return TRUE; } // //-------------------------// // template <class Type> Boolean Mat<Type>::loadAscii(const char *filename) { InputFile infile(filename); if (!infile){ cerr << "Error in loadAsccii: error opening file." << endl; return FALSE; } if (!(infile >> _rows >> _cols)) return FALSE; _maxrows = _rows; _maxcols = _cols; _allocateEl(); for(unsigned i=0; i < _rows; i++) { for(unsigned j=0; j < _cols ; j++) if (!(infile >> _el[i][j])) return FALSE; } return TRUE; } // //-------------------------// // template <class Type> Boolean Mat<Type>::load(const char *filename, int type, const char *varname) { Boolean status = FALSE; switch(type) { case RAW: status = loadRaw(filename); break; case ASCII: status = loadAscii(filename); break; case MATLAB: #ifdef HAVE_MATLAB status = loadMatlab(filename, varname); #else cerr << "Can't load MATLAB files. Please compile with -DHAVE_MATLAB" << endl; #endif break; default: cerr << "Unrecognized type for loading" << endl; break; } return status; } // //-------------------------// // template <class Type> Boolean Mat<Type>::save(const char *filename, int type, const char *varname) const { Boolean result; // bert - added switch(type) { case RAW: result = saveRaw(filename); break; case ASCII: result = saveAscii(filename); break; case MATLAB: #ifdef HAVE_MATLAB result = saveMatlab(filename, varname); #else cerr << "Can't save MATLAB files. Please compile with -DHAVE_MATLAB" << endl; #endif break; default: cerr << "Unrecognized type for saving" << endl; result = 0; break; } return (result); // bert - return a value. } // //-------------------------// // #ifdef HAVE_MATLAB /*****************************************************************************/ // Saves the calling object as a Matlab readable matrix to the named file with the // given variable name. Since Matlab stores in double format, the calling object is // first converted to a temporary double array. The third argument lets the user // update a file("u") or rewrite an existing file or create a new one("w") template <class Type> Boolean Mat<Type>::saveMatlab(const char *filename, const char *varname, const char *option) const { if (!_rows || !_cols) { cerr << "Attempt to save empty matrix as matlab file. Not saved" << endl; return FALSE; } //Create a temporary double array double *temp = 0; allocateArray(_rows*_cols, temp); if (!temp) { cerr << "Couldn't allocate temp array; matrix not saved" << endl; return FALSE; } // Fill temp array columnwise (this is Matlab's storage convention) double *tempPtr = temp; for (unsigned col = 0; col < _cols; col++) for (unsigned row = 0; row < _rows; row++) *tempPtr++ = _el[row][col]; // Write the matrix out Boolean status = ::saveMatlab(filename, varname, option, _rows, _cols, temp); // Free temporary array freeArray(temp); return status; } #endif // HAVE_MATLAB // //-------------------------// // template <class Type> Boolean Mat<Type>::saveRaw(const char *filename) const { ofstream outfile(filename); if (!outfile){ cerr << "Error in saveRaw: error opening file." << endl; return FALSE; } //outfile.write((unsigned char *) &nrows, sizeof(unsigned)); //outfile.write((unsigned char *) &ncols, sizeof(unsigned)); outfile.write((char *)_el + _maxrows*sizeof(Type *) , _maxrows*_maxcols*sizeof(Type)); outfile.close(); return (outfile) ? TRUE : FALSE; } // //-------------------------// // template <class Type> Boolean Mat<Type>::saveAscii(const char *filename) const { unsigned i, j; ofstream outfile(filename); if (!outfile){ cerr << "Error in saveAscciifile: error opening file." << endl; return FALSE; } outfile << _rows << " " << _cols << endl; for(i=0; i < _rows; i++) { for(j=0; j < _cols ; j++) outfile << _el[i][j] << " "; outfile << endl; } outfile.close(); return (outfile) ? TRUE : FALSE; } // //-------------------------// // // //-------------------------// // // // Private functions start // template <class Type> void Mat<Type>::_allocateEl() { if (_el) { #ifdef DEBUG cout << "Freeing allocated memory at " << _el << endl; #endif if( _el[0] ) { delete [] _el[0]; // delete data block } delete [] _el; // delete row of pointers } _el = 0; unsigned int nBytes = _maxrows*_maxcols*sizeof(Type); if (nBytes) { typedef Type * TypePtr; _el = (Type **) new TypePtr[_maxrows]; assert(_el); _el[0] = (Type *) new Type[_maxrows*_maxcols]; assert(_el[0]); memset(_el[0], 0, nBytes); //set all elements to zero #ifdef DEBUG cout << "Allocated " << nBytes << " bytes at " << _el << endl; #endif for (unsigned i=1 ; i < _maxrows ; i++) _el[i] = (Type *)(&(_el[i-1][_maxcols])); } } /************************************************************************* This function will actually copy another matrix to a subsection of the calling matrix Since it modifies data internally, it has been declared private **************************************************************************/ template <class Type> void Mat<Type>::_modify_sub_section(unsigned r1,unsigned r2,unsigned c1,unsigned c2,const Mat<Type>& B) { if ((r1 > r2) || (c1 > c2) || (r2 >= _rows) || (c2>= _cols)) { // (bert) cerr << "Error in cropting: improper row or column sizes." << endl; cerr << r1 << " to " << r2 << " and" << endl; cerr << c1 << " to " << c2 << endl; exit(1); } //If the selected subsection and B object are not the same size, then done if((B.getrows() != (r2-r1+1)) || (B.getcols() != (c2-c1+1))) { cerr<<"Error:Input Matrix and subsection selections don't argree in size"; cerr<<endl; } for (unsigned i=r1; i<=r2 ; i++) for (unsigned j=c1; j<=c2; j++) _el[i][j] = B(i-r1,j-c1); } template <class Type> void Mat<Type>::_checkMatrixDimensions(const char *path, unsigned& nrows, unsigned& ncols) const { if (Path(path).hasCompressedExtension()) return; struct stat buf; stat(path, &buf); inferDimensions(buf.st_size/sizeof(Type), nrows, ncols); } template <class Type> Mat<Type>& Mat<Type>::_fft(unsigned nrows, unsigned ncols, FFTFUNC fftFunc) { using std::max; // (bert) force it to use the right max() using std::abs; // (bert) and force the right abs()! // Verify dimensions of FFT if ((nrows > 1) && ((nrows < _rows) || !isPowerOf2(nrows))) { cerr << "Warning! Mat<Type>::fft():" << endl << " Requested # _rows for FFT (" << nrows << ") invalid;" << endl; nrows = max(unsigned(4), nextPowerOf2(max(nrows, _rows))); cerr << " increased to " << nrows << endl; } if ((ncols > 1) && ((ncols < _cols) || !isPowerOf2(ncols))) { cerr << "Warning! Mat<Type>::fft():" << endl << " Requested # _cols for FFT (" << ncols << ") invalid;" << endl; ncols = max(unsigned(4), nextPowerOf2(max(ncols, _cols))); cerr << " increased to " << ncols << endl; } Boolean doX = (ncols != 1) && (_cols > 1) ? TRUE : FALSE; Boolean doY = (nrows != 1) && (_rows > 1) ? TRUE : FALSE; if (!nrows) nrows = max(unsigned(4), nextPowerOf2(_rows)); else if (nrows == 1) nrows = _rows; if (!ncols) ncols = max(unsigned(4), nextPowerOf2(_cols)); else if (ncols == 1) ncols = _cols; // Pad matrix to the final FFT dimensions pad(nrows, ncols, (nrows - _rows)/2, (ncols - _cols)/2, 0); // Allocate temporary arrays double *real = 0; double *imag = 0; unsigned maxDim = max(doX ? _cols : 1, doY ? _rows : 1); allocateArray(maxDim, real); allocateArray(maxDim, imag); assert(real && imag); unsigned row, col; // Take 1D FFT in X (row) direction if (doX) for(row = 0; row < _rows; row++) { // Fill temporary FFT array double *realPtr = real; double *imagPtr = imag; Type *sourcePtr = _el[row]; for(col = _cols; col != 0; col--) { dcomplex value(*sourcePtr++); *realPtr++ = value.real(); *imagPtr++ = value.imag(); } // Calculate 1D FFT fftFunc(_cols, real, imag); // Put results back realPtr = real; imagPtr = imag; sourcePtr = _el[row]; for(col = _cols; col != 0; col--) *sourcePtr++ = Type(abs(dcomplex(*realPtr++, *imagPtr++))); } // Take 1D FFT in Y (column) direction if (doY) for(col = 0; col < _cols; col++) { // Fill temporary FFT array double *realPtr = real; double *imagPtr = imag; Type *sourcePtr = _el[0] + col; for(row = _rows; row != 0; row--) { dcomplex value(*sourcePtr); *realPtr++ = value.real(); *imagPtr++ = value.imag(); sourcePtr += _cols; } // Calculate 1D FFT fftFunc(_rows, real, imag); // Put results back realPtr = real; imagPtr = imag; sourcePtr = _el[0] + col; for(row = _rows; row != 0; row--) { *sourcePtr = Type(abs(dcomplex(*realPtr++, *imagPtr++))); sourcePtr += _cols; } } // Free temporary arrays freeArray(real); freeArray(imag); return *this; } template <class Type> Mat<Type>& Mat<Type>::ifft(unsigned nrows, unsigned ncols) { _fft(nrows, ncols, ::ifft); unsigned factor = 1; if (nrows != 1) factor *= _rows; if (ncols != 1) factor *= _cols; return *this /= factor; } #ifdef HAVE_MATLAB //This function converts a Matlab matrix object to a Mat object //The first argument is a pointer to a Matlab matrix object //This function checks the storage format of the Matlab object //(Full or Sparse) and does the appropriate conversions to return a Mat //object of the calling object's type. template <class Type> Mat<Type> Mat<Type>::matlab2Mat(Matrix *MatlabMatrix) const { //Make sure that pointer is not NULL if(MatlabMatrix==NULL) { cerr<<"The input argument points to a non existent object(NULL)"<<endl; exit(1); } //See if the object is real or dcomplex //if(mxIsDcomplex(MatlabMatrix)) if(mxIsComplex(MatlabMatrix)) { cerr<<"The Matlab matrix object is dcomplex. Create a dcomplex Mat "; cerr<<"object first then repeat the call"<<endl; exit(1); } unsigned Matlab_rows=mxGetM(MatlabMatrix); unsigned Matlab_cols=mxGetN(MatlabMatrix); Mat<Type> Temp(Matlab_rows,Matlab_cols); double *MatlabDATA=mxGetPr(MatlabMatrix); //See if the object is Full or Sparse and do corresponding action if(mxIsFull(MatlabMatrix)) { //Since the Matlab storage representation of the object //is exactly the transpose of the Mat representation, The object //is initialized with its indices reversed. for(unsigned i=0;i<Matlab_cols;i++) for(unsigned j=0;j<Matlab_rows;j++) { Temp._el[j][i]= (Type) *MatlabDATA; MatlabDATA++; } return(Temp); } else if(mxIsSparse(MatlabMatrix)) { //This code was derived from code form the external interface guide for // Matlab pg. 7 (Copyright Math Works) int *ir=mxGetIr(MatlabMatrix); int *jc=mxGetJc(MatlabMatrix); int temp_index; for(int j=0; j<Matlab_cols;j++) { temp_index=jc[j+1]; for(int k=jc[j];k<temp_index;k++) Temp._el[ir[k]][j] = (Type) MatlabDATA[k]; } return(Temp); } return(NULL); } template <class Type> Matrix * Mat<Type>::mat2Matlab(const char *name) const { Matrix *CopyofThis; //Allocate the memory for the Matlab matrix and set its name CopyofThis=mxCreateFull(_rows,_cols,0); mxSetName(CopyofThis,name); double *MatlabData=mxGetPr(CopyofThis); for(unsigned i=0;i< _cols;i++) for(unsigned j=0;j<_rows;j++) { *MatlabData= (double) _el[j][i]; MatlabData++; } return(CopyofThis); } #endif // HAVE_MATLAB // // Private functions end // template <class Type> ostream& operator << (ostream& os, const Mat<Type>& A) { return A.display(os); } // // Type conversions // #ifdef USE_DBLMAT template <class Type> Mat<double> asDblMat(const Mat<Type>& A) { Mat<double> cast(A.getrows(), A.getcols()); double *castPtr = (double *) cast.getEl()[0]; const Type *aPtr = A.getEl()[0]; for (unsigned i=A.nElements(); i; i--) *castPtr++ = asDouble(*aPtr++); return cast; } #endif // USE_DBLMAT // //-------------------------// // #ifdef USE_FLMAT template <class Type> Mat<float> asFlMat(const Mat<Type>& A) { Mat<float> cast(A.getrows(), A.getcols()); float *castPtr = (float *) cast.getEl()[0]; const Type *aPtr = A.getEl()[0]; for (unsigned i=A.nElements(); i; i--) *castPtr++ = (float) asDouble(*aPtr++); return cast; } #endif // //-------------------------// // #ifdef USE_INTMAT template <class Type> Mat<int> asIntMat(const Mat<Type>& A) { Mat<int> cast(A.getrows(), A.getcols()); int *castPtr = (int *) cast.getEl()[0]; const Type *aPtr = A.getEl()[0]; for (unsigned i=A.nElements(); i; i--) *castPtr++ = (int) asDouble(*aPtr++); return cast; } #endif // //-------------------------// // #ifdef USE_UINTMAT template <class Type> Mat<unsigned int> asUIntMat(const Mat<Type>& A) { Mat<unsigned int> cast(A.getrows(), A.getcols()); unsigned *castPtr = (unsigned *) cast.getEl()[0]; const Type *aPtr = A.getEl()[0]; for (unsigned i=A.nElements(); i; i--) *castPtr++ = (unsigned) asDouble(*aPtr++); return cast; } #endif // //-------------------------// // #ifdef USE_SHMAT template <class Type> Mat<short> asShMat(const Mat<Type>& A) { Mat<short> cast(A.getrows(), A.getcols()); short *castPtr = (short *) cast.getEl()[0]; const Type *aPtr = A.getEl()[0]; for (unsigned i=A.nElements(); i; i--) *castPtr++ = (short) asDouble(*aPtr++); return cast; } #endif // //-------------------------// // #ifdef USE_USHMAT template <class Type> Mat<unsigned short> asUShMat(const Mat<Type>& A) { Mat<unsigned short> cast(A.getrows(), A.getcols()); unsigned short *castPtr = (unsigned short *) cast.getEl()[0]; const Type *aPtr = A.getEl()[0]; for (unsigned i=A.nElements(); i; i--) *castPtr++ = (unsigned short) asDouble(*aPtr++); return cast; } #endif // //-------------------------// // #ifdef USE_CHRMAT template <class Type> Mat<char> asChrMat(const Mat<Type>& A) { Mat<char> cast(A.getrows(), A.getcols()); char *castPtr = (char *) cast.getEl()[0]; const Type *aPtr = A.getEl()[0]; for (unsigned i=A.nElements(); i; i--) *castPtr++ = (char) asDouble(*aPtr++); return cast; } #endif // //-------------------------// // #ifdef USE_UCHRMAT template <class Type> Mat<unsigned char> asUChrMat(const Mat<Type>& A) { Mat<unsigned char> cast(A.getrows(), A.getcols()); unsigned char *castPtr = (unsigned char *) cast.getEl()[0]; const Type *aPtr = A.getEl()[0]; for (unsigned i=A.nElements(); i; i--) *castPtr++ = (unsigned char) asDouble(*aPtr++); return cast; } #endif // (bert) added this declaration here to make the compiler happier. This // way it doesn't see the default parameters as being listed as part of // the function definition. I think this was causing a compilation problem // Jason found. // template<class Type> SimpleArray<Type> array(const Mat<Type>& A, Type minVal, Type maxVal) { return A.array(minVal, maxVal); } ////////////////////////////////////////////////////////////////////// #ifdef __GNUC__ /* For the GNU compiler, include the explicit specializations in this file, * so they can be seen during class instantiation. */ #include "MatrixSpec.cc" #define _INSTANTIATE_MAT(Type) \ template class Mat<Type>; \ template Mat<Type>& pmultEquals(Mat<Type>&, const Mat<Type> &); \ template Mat<Type>& pdivEquals(Mat<Type>&, const Mat<Type> &); \ template Mat<Type> inv(const Mat<Type> &); \ template Mat<Type> operator*<Type>(double, const Mat<Type> &); \ template<> unsigned Mat<Type>::_rangeErrorCount = 25; \ template<> Boolean Mat<Type>::flushToDisk = FALSE; _INSTANTIATE_MAT(int); _INSTANTIATE_MAT(float); _INSTANTIATE_MAT(double); template class Zeros<double>; template class Ones<double>; template class Eye<double>; template ostream & operator<<(ostream &, Mat<double> const &); template SimpleArray<double> array(Mat<double> const &, double, double); #ifdef USE_COMPMAT _INSTANTIATE_MAT(dcomplex); template Mat<dcomplex> fft(const Mat<double> &, unsigned, unsigned); template Mat<dcomplex> fft(const Mat<dcomplex> &, unsigned, unsigned); template Mat<dcomplex> ifft(const Mat<double> &, unsigned, unsigned); template Mat<dcomplex> ifft(const Mat<dcomplex> &, unsigned, unsigned); #endif // USE_COMPMAT #else #ifdef USE_COMPMAT template Mat<dcomplex>& pmultEquals(Mat<dcomplex>&, const Mat<dcomplex> &); template Mat<dcomplex>& pdivEquals(Mat<dcomplex>&, const Mat<dcomplex> &); #endif // USE_COMPMAT template Mat<double>& pmultEquals(Mat<double>&, const Mat<double> &); template Mat<double>& pdivEquals(Mat<double>&, const Mat<double> &); #endif // __GNUC__ not defined <file_sep>/templates/MatrixSpec.cc /* MatrixSpec.cc - Explicit specializations for the "Mat" template class. * * This file is not intended to be compiled separately, but rather to * be included in an "appropriate" file. What "appropriate" means * seems to depend upon the compiler you're using. */ #include <complex.h> using namespace std; #ifdef USE_COMPMAT template <> Mat<dcomplex>& Mat<dcomplex>::operator += (dcomplex addend) { dcomplex *elPtr = _el[0]; for (unsigned i=_rows ; i != 0 ; i--) for (unsigned j=_cols ; j != 0 ; j--, elPtr++) *elPtr += addend; return *this; } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex>& Mat<fcomplex>::operator += (dcomplex addend) { fcomplex *elPtr = _el[0]; for (unsigned i=_rows ; i != 0 ; i--) for (unsigned j=_cols ; j != 0 ; j--, elPtr++) *elPtr += addend; return *this; } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> Mat<dcomplex>& Mat<dcomplex>::operator *= (dcomplex scale) { dcomplex *elPtr = _el[0]; for (unsigned i=_rows ; i != 0 ; i--) for (unsigned j=_cols ; j != 0 ; j--, elPtr++) *elPtr *= scale; return *this; } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex>& Mat<fcomplex>::operator *= (dcomplex scale) { fcomplex *elPtr = _el[0]; for (unsigned i=_rows ; i != 0 ; i--) for (unsigned j=_cols ; j != 0 ; j--, elPtr++) *elPtr *= scale; return *this; } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> Mat<dcomplex> Mat<dcomplex>::inv() const { cerr << "Mat<dcomplex>::inv() called but not implemented" << endl; return Mat<dcomplex>(*this); } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex> Mat<fcomplex>::inv() const { cerr << "Mat<fcomplex>::inv() called but not implemented" << endl; return Mat<fcomplex>(*this); } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> dcomplex Mat<dcomplex>::min(unsigned *, unsigned *) const { cerr << "Mat<dcomplex>::min() called but not implemented" << endl; return 0; } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> fcomplex Mat<fcomplex>::min(unsigned *, unsigned *) const { cerr << "Mat<fcomplex>::min() called but not implemented" << endl; return 0; } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> dcomplex Mat<dcomplex>::max(unsigned *, unsigned *) const { cerr << "Mat<dcomplex>::max() called but not implemented" << endl; return 0; } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> fcomplex Mat<fcomplex>::max(unsigned *, unsigned *) const { cerr << "Mat<fcomplex>::max() called but not implemented" << endl; return 0; } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> dcomplex Mat<dcomplex>::median(dcomplex, dcomplex) const { cerr << "Mat<dcomplex>::median() called but not implemented" << endl; return 0; } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> fcomplex Mat<fcomplex>::median(fcomplex, fcomplex) const { cerr << "Mat<fcomplex>::median() called but not implemented" << endl; return 0; } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> Mat<dcomplex>& Mat<dcomplex>::applyElementWise(double (*function)(double)) { dcomplex *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = (dcomplex) function(real(*elPtr)); return(*this); } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex>& Mat<fcomplex>::applyElementWise(double (*function)(double)) { fcomplex *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = (fcomplex) function(real(*elPtr)); return(*this); } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> Mat<dcomplex>& Mat<dcomplex>::applyElementWiseC2C(dcomplex (*function)(dcomplex)) { dcomplex *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = function(*elPtr); return(*this); } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex>& Mat<fcomplex>::applyElementWiseC2C(dcomplex (*function)(dcomplex)) { fcomplex *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = fcomplex(function(*elPtr)); return(*this); } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> Mat<dcomplex>& Mat<dcomplex>::applyIndexFunction(ComplexIndexFunction F) { dcomplex *elPtr = *_el; for (unsigned r = 0; r < _rows; r++) for (unsigned c = 0; c < _rows; c++) *elPtr++ = dcomplex(F(r, c)); return(*this); } #endif // USE_COMPMAT #ifdef USE_COMPMAT template <> Mat<dcomplex>& Mat<dcomplex>::log() { using std::log; dcomplex *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = log(*elPtr); return(*this); } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex>& Mat<fcomplex>::log() { using std::log; fcomplex *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = log(*elPtr); return(*this); } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> Mat<dcomplex>& Mat<dcomplex>::cos() { using std::cos; dcomplex *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = cos(*elPtr); return(*this); } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex>& Mat<fcomplex>::cos() { using std::cos; fcomplex *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = cos(*elPtr); return(*this); } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> Mat<dcomplex>& Mat<dcomplex>::sin() { using std::sin; dcomplex *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = sin(*elPtr); return(*this); } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex>& Mat<fcomplex>::sin() { using std::cos; fcomplex *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = sin(*elPtr); return(*this); } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> Mat<dcomplex>& Mat<dcomplex>::round() { dcomplex *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = dcomplex(rint(real(*elPtr)), rint(real(*elPtr))); return(*this); } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex>& Mat<fcomplex>::round() { fcomplex *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = fcomplex(rint(real(*elPtr)), rint(real(*elPtr))); return(*this); } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> Mat<dcomplex>& Mat<dcomplex>::abs() { dcomplex *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = dcomplex( std::abs(*elPtr) ); return(*this); } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex>& Mat<fcomplex>::abs() { fcomplex *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = (fcomplex) ::abs(*elPtr); return(*this); } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> Mat<dcomplex>& Mat<dcomplex>::pow(double) { cerr << "Mat<dcomplex>::pow() called but not implemented" << endl; return *this; } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex>& Mat<fcomplex>::pow(double) { cerr << "Mat<fcomplex>::pow() called but not implemented" << endl; return *this; } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> Mat<dcomplex>& Mat<dcomplex>::conj() { dcomplex *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = std::conj(*elPtr); return(*this); } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex>& Mat<fcomplex>::conj() { fcomplex *elPtr = _el[0]; for(unsigned i = _rows; i; i--) for(unsigned j = _cols; j; j--, elPtr++) *elPtr = std::conj(*elPtr); return(*this); } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> void Mat<dcomplex>::eig(Mat<dcomplex>&, Mat<dcomplex>&) const { cerr << "Mat<dcomplex>::eig() called but not implemented" << endl; } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> void Mat<fcomplex>::eig(Mat<fcomplex>&, Mat<fcomplex>&) const { cerr << "Mat<fcomplex>::eig() called but not implemented" << endl; } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> Mat<dcomplex> Mat<dcomplex>::house() const { cerr << "Mat<dcomplex>::house() called but not implemented" << endl; return Mat<dcomplex>(*this); } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex> Mat<fcomplex>::house() const { cerr << "Mat<fcomplex>::house() called but not implemented" << endl; return Mat<fcomplex>(*this); } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> Histogram Mat<dcomplex>::histogram(double, double, unsigned) const { cerr << "Mat<dcomplex>::histogram() called but not implemented" << endl; return Histogram(0); } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Histogram Mat<fcomplex>::histogram(double, double, unsigned) const { cerr << "Mat<fcomplex>::histogram() called but not implemented" << endl; return Histogram(0); } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> void Mat<dcomplex>::qr(Mat<dcomplex>&, Mat<dcomplex>&, Mat<dcomplex>&) const { cerr << "Mat<dcomplex>::qr() called but not implemented" << endl; } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> void Mat<fcomplex>::qr(Mat<fcomplex>&, Mat<fcomplex>&, Mat<fcomplex>&) const { cerr << "Mat<fcomplex>::qr() called but not implemented" << endl; } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> void Mat<dcomplex>::svd(Mat<dcomplex>&, Mat<dcomplex>&, Mat<dcomplex>&) const { cerr << "Mat<dcomplex>::svd() called but not implemented" << endl; } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> void Mat<fcomplex>::svd(Mat<fcomplex>&, Mat<fcomplex>&, Mat<fcomplex>&) const { cerr << "Mat<fcomplex>::svd() called but not implemented" << endl; } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> Mat<dcomplex>& Mat<dcomplex>::clip(dcomplex, dcomplex, dcomplex, dcomplex) { cerr << "Mat<dcomplex>::clip called but not implemented" << endl; return *this; } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex>& Mat<fcomplex>::clip(fcomplex, fcomplex, fcomplex, fcomplex) { cerr << "Mat<fcomplex>::clip called but not implemented" << endl; return *this; } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> Mat<dcomplex>& Mat<dcomplex>::map(const ValueMap&) { cerr << "Mat<dcomplex>::map called but not implemented" << endl; return *this; } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex>& Mat<fcomplex>::map(const ValueMap&) { cerr << "Mat<fcomplex>::map called but not implemented" << endl; return *this; } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> void Mat<dcomplex>::linearinterpolate(unsigned Urow, unsigned Drow, unsigned Ucol, unsigned Dcol, Mat<dcomplex>& y) const { cerr << "Mat<dcomplex>::linearinterpolate not implemented" << endl; } #endif // USE_COMPMAT #ifdef USE_COMPMAT template <> Mat<dcomplex> Mat<dcomplex>::filter(Mat<dcomplex>& B,Mat<dcomplex>& A) const { cerr << "Mat<dcomplex>::filter not implemented" << endl; return B; } #endif // USE_COMPMAT #ifdef USE_DBLMAT #ifdef USE_COMPMAT template <> Mat<dcomplex> Mat<dcomplex>::erode(const Mat<double>&) const { cerr << "Mat<dcomplex>::erode() called but not implemented" << endl; return Mat<dcomplex>(*this); } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex> Mat<fcomplex>::erode(const Mat<double>&) const { cerr << "Mat<fcomplex>::erode() called but not implemented" << endl; return Mat<fcomplex>(*this); } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> Mat<dcomplex> Mat<dcomplex>::dilate(const Mat<double>&) const { cerr << "Mat<dcomplex>::dilate() called but not implemented" << endl; return Mat<dcomplex>(*this); } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex> Mat<fcomplex>::dilate(const Mat<double>&) const { cerr << "Mat<fcomplex>::dilate() called but not implemented" << endl; return Mat<fcomplex>(*this); } #endif // USE_FCOMPMAT #endif // USE_DBLMAT #ifdef HAVE_MATLAB #ifdef USE_COMPMAT Boolean Mat<dcomplex>::loadMatlab(const char *filename, const char *varname) { if (!filename || !varname) { cerr << "Mat<dcomplex>::loadMatlab(): no filename or variable name specified" << endl; return FALSE; } //Check to ensure that the file can be opened successfully for reading MATFile *infile = matOpen((char *) filename,"r"); if(infile==NULL) { cerr << "Mat<dcomplex>::loadMatlab(): Can't open file: "<<filename<<endl; return FALSE; } //Assign pointer to the Matrix object allocated from the file and ensure that //the named variable was found Matrix *MatlabMatrix = matGetMatrix(infile, (char *) varname); if(MatlabMatrix==NULL) { cerr << "Mat<dcomplex>::loadMatlab(): Could not find: " << varname << " in file: " << filename << endl; //close the file and quit matClose(infile); return FALSE; } //Check to see if the Matlab Matrix was full or sparse, dcomplex or real //if (mxIsDcomplex(MatlabMatrix) == 0) { if (mxIsComplex(MatlabMatrix) == 0) { Mat<double> Temp(_rows,_cols); Temp.loadMatlab(filename,varname); } else *this = matlab2Mat(MatlabMatrix); //We were successful matClose(infile); mxFreeMatrix(MatlabMatrix); return TRUE; } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT Boolean Mat<fcomplex>::loadMatlab(const char *, const char *) { cerr << "Mat<fcomplex>::loadMatlab() called but not implemented" << endl; return(0); } #endif // USE_FCOMPMAT #endif // HAVE_MATLAB #ifdef USE_COMPMAT template <> Boolean Mat<dcomplex>::loadAscii(const char *) { cerr << "Mat<dcomplex>::loadAscii() not implemented" << endl; return FALSE; } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Boolean Mat<fcomplex>::loadAscii(const char *) { cerr << "Mat<fcomplex>::loadAscii() not implemented" << endl; return FALSE; } #endif // USE_FCOMPMAT #ifdef HAVE_MATLAB #ifdef USE_COMPMAT template <> Boolean Mat<dcomplex>::saveMatlab(const char *filename, const char *varname, const char *option) const { if (!_rows || !_cols) { cerr << "Attempt to save empty matrix as matlab file. Not saved" << endl; return FALSE; } //Create a temporary double arrays for the real and imaginary parts double *real = 0; allocateArray(_rows*_cols, real); if (!real) { cerr << "Couldn't allocate real array; matrix not saved" << endl; return FALSE; } double *imag = 0; allocateArray(_rows*_cols, imag); if (!imag) { cerr << "Couldn't allocate imag array; matrix not saved" << endl; freeArray(real); return FALSE; } // Fill real and imag arrays columnwise (this is Matlab's storage convention) double *realPtr = real; double *imagPtr = imag; for (unsigned col = 0; col < _cols; col++) for (unsigned row = 0; row < _rows; row++) { dcomplex value = _el[row][col]; *realPtr++ = value.real(); *imagPtr++ = value.imag(); } // Write the matrix out Boolean status = ::saveMatlab(filename, varname, option, _rows, _cols, real, imag); // Free temporary arrays freeArray(real); freeArray(imag); return status; } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Boolean Mat<fcomplex>::saveMatlab(const char *filename, const char *varname, const char *option) const { if (!_rows || !_cols) { cerr << "Attempt to save empty matrix as matlab file. Not saved" << endl; return FALSE; } //Create a temporary double arrays for the real and imaginary parts double *real = 0; allocateArray(_rows*_cols, real); if (!real) { cerr << "Couldn't allocate real array; matrix not saved" << endl; return FALSE; } double *imag = 0; allocateArray(_rows*_cols, imag); if (!imag) { cerr << "Couldn't allocate imag array; matrix not saved" << endl; freeArray(real); return FALSE; } // Fill real and imag arrays columnwise (this is Matlab's storage convention) double *realPtr = real; double *imagPtr = imag; for (unsigned col = 0; col < _cols; col++) for (unsigned row = 0; row < _rows; row++) { fcomplex value = _el[row][col]; *realPtr++ = value.real(); *imagPtr++ = value.imag(); } // Write the matrix out Boolean status = ::saveMatlab(filename, varname, option, _rows, _cols, real, imag); // Free temporary arrays freeArray(real); freeArray(imag); return status; } #endif // USE_FCOMPMAT #endif // HAVE_MATLAB #ifdef USE_COMPMAT template <> Boolean Mat<dcomplex>::saveAscii(const char *) const { cerr << "Mat<dcomplex>::saveAscii() not implemented" << endl; return FALSE; } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Boolean Mat<fcomplex>::saveAscii(const char *) const { cerr << "Mat<fcomplex>::saveAscii() not implemented" << endl; return FALSE; } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> Mat<dcomplex>& Mat<dcomplex>::_fft(unsigned nrows, unsigned ncols, FFTFUNC fftFunc) { using std::max; // (bert) force it to use the right max() // Verify dimensions of FFT if ((nrows > 1) && ((nrows < _rows) || !isPowerOf2(nrows))) { cerr << "Warning! Mat<dcomplex>::fft():" << endl << " Requested # _rows for FFT (" << nrows << ") invalid;" << endl; nrows = max(unsigned(4), nextPowerOf2(max(nrows, _rows))); cerr << " increased to " << nrows << endl; } if ((ncols > 1) && ((ncols < _cols) || !isPowerOf2(ncols))) { cerr << "Warning! Mat<dcomplex>::fft():" << endl << " Requested # _cols for FFT (" << ncols << ") invalid;" << endl; ncols = max(unsigned(4), nextPowerOf2(max(ncols, _cols))); cerr << " increased to " << ncols << endl; } Boolean doX = (ncols != 1) && (_cols > 1) ? TRUE : FALSE; Boolean doY = (nrows != 1) && (_rows > 1) ? TRUE : FALSE; if (!nrows) nrows = max(unsigned(4), nextPowerOf2(_rows)); else if (nrows == 1) nrows = _rows; if (!ncols) ncols = max(unsigned(4), nextPowerOf2(_cols)); else if (ncols == 1) ncols = _cols; // Pad matrix to the final FFT dimensions pad(nrows, ncols, (nrows - _rows)/2, (ncols - _cols)/2, 0); // Allocate temporary arrays double *real = 0; double *imag = 0; unsigned maxDim = max(doX ? _cols : 1, doY ? _rows : 1); allocateArray(maxDim, real); allocateArray(maxDim, imag); assert(real && imag); unsigned row, col; // Take 1D FFT in X (row) direction if (doX) for(row = 0; row < _rows; row++) { // Fill temporary FFT array double *realPtr = real; double *imagPtr = imag; dcomplex *sourcePtr = _el[row]; for(col = _cols; col != 0; col--) { dcomplex value(*sourcePtr++); *realPtr++ = value.real(); *imagPtr++ = value.imag(); } // Calculate 1D FFT fftFunc(_cols, real, imag); // Put results back realPtr = real; imagPtr = imag; sourcePtr = _el[row]; for(col = _cols; col != 0; col--) *sourcePtr++ = dcomplex(*realPtr++, *imagPtr++); } // Take 1D FFT in Y (column) direction if (doY) for(col = 0; col < _cols; col++) { // Fill temporary FFT array double *realPtr = real; double *imagPtr = imag; dcomplex *sourcePtr = _el[0] + col; for(row = _rows; row != 0; row--) { dcomplex value(*sourcePtr); *realPtr++ = value.real(); *imagPtr++ = value.imag(); sourcePtr += _cols; } // Calculate 1D FFT fftFunc(_rows, real, imag); // Put results back realPtr = real; imagPtr = imag; sourcePtr = _el[0] + col; for(row = _rows; row != 0; row--) { *sourcePtr = dcomplex(*realPtr++, *imagPtr++); sourcePtr += _cols; } } // Free temporary arrays freeArray(real); freeArray(imag); return *this; } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex>& Mat<fcomplex>::_fft(unsigned nrows, unsigned ncols, FFTFUNC fftFunc) { using std::max; // (bert) force it to use the right max() // Verify dimensions of FFT if ((nrows > 1) && ((nrows < _rows) || !isPowerOf2(nrows))) { cerr << "Warning! Mat<fcomplex>::fft():" << endl << " Requested # _rows for FFT (" << nrows << ") invalid;" << endl; nrows = max(unsigned(4), nextPowerOf2(max(nrows, _rows))); cerr << " increased to " << nrows << endl; } if ((ncols > 1) && ((ncols < _cols) || !isPowerOf2(ncols))) { cerr << "Warning! Mat<fcomplex>::fft():" << endl << " Requested # _cols for FFT (" << ncols << ") invalid;" << endl; ncols = max(unsigned(4), nextPowerOf2(max(ncols, _cols))); cerr << " increased to " << ncols << endl; } Boolean doX = (ncols != 1) && (_cols > 1) ? TRUE : FALSE; Boolean doY = (nrows != 1) && (_rows > 1) ? TRUE : FALSE; if (!nrows) nrows = max(unsigned(4), nextPowerOf2(_rows)); else if (nrows == 1) nrows = _rows; if (!ncols) ncols = max(unsigned(4), nextPowerOf2(_cols)); else if (ncols == 1) ncols = _cols; // Pad matrix to the final FFT dimensions pad(nrows, ncols, (nrows - _rows)/2, (ncols - _cols)/2, 0); // Allocate temporary arrays double *real = 0; double *imag = 0; unsigned maxDim = ::max(doX ? _cols : 1, doY ? _rows : 1); allocateArray(maxDim, real); allocateArray(maxDim, imag); assert(real && imag); unsigned row, col; // Take 1D FFT in X (row) direction if (doX) for(row = 0; row < _rows; row++) { // Fill temporary FFT array double *realPtr = real; double *imagPtr = imag; fcomplex *sourcePtr = _el[row]; for(col = _cols; col != 0; col--) { fcomplex value(*sourcePtr++); *realPtr++ = value.real(); *imagPtr++ = value.imag(); } // Calculate 1D FFT fftFunc(_cols, real, imag); // Put results back realPtr = real; imagPtr = imag; sourcePtr = _el[row]; for(col = _cols; col != 0; col--) *sourcePtr++ = fcomplex(*realPtr++, *imagPtr++); } // Take 1D FFT in Y (column) direction if (doY) for(col = 0; col < _cols; col++) { // Fill temporary FFT array double *realPtr = real; double *imagPtr = imag; fcomplex *sourcePtr = _el[0] + col; for(row = _rows; row != 0; row--) { fcomplex value(*sourcePtr); *realPtr++ = value.real(); *imagPtr++ = value.imag(); sourcePtr += _cols; } // Calculate 1D FFT fftFunc(_rows, real, imag); // Put results back realPtr = real; imagPtr = imag; sourcePtr = _el[0] + col; for(row = _rows; row != 0; row--) { *sourcePtr = fcomplex(*realPtr++, *imagPtr++); sourcePtr += _cols; } } // Free temporary arrays freeArray(real); freeArray(imag); return *this; } #endif // USE_FCOMPMAT #ifdef HAVE_MATLAB #ifdef USE_COMPMAT template <> Mat<dcomplex> Mat<dcomplex>::matlab2Mat(Matrix *MatlabMatrix) const { //Make sure that pointer is not NULL if(MatlabMatrix==NULL) { cerr<<"The input argument points to a non existent object(NULL)"<<endl; exit(1); } unsigned Matlab_rows=mxGetM(MatlabMatrix); unsigned Matlab_cols=mxGetN(MatlabMatrix); Mat<dcomplex> Temp(Matlab_rows,Matlab_cols); double *MatlabRealDATA=mxGetPr(MatlabMatrix); double *MatlabImagDATA=mxGetPi(MatlabMatrix); //See if the object is Full or Sparse and do corresponding action if(mxIsFull(MatlabMatrix)) { //Since the Matlab storage representation of the object //is exactly the transpose of the Mat representation, The object //is initialized with its indices reversed. for(unsigned i=0;i<Matlab_cols;i++) for(unsigned j=0;j<Matlab_rows;j++) { Temp._el[j][i]= dcomplex( *MatlabRealDATA, *MatlabImagDATA); MatlabRealDATA++; MatlabImagDATA++; } return(Temp); } else if(mxIsSparse(MatlabMatrix)) { //This code was derived from code form the external interface guide for // Matlab pg. 7 (Copyright Math Works) int *ir=mxGetIr(MatlabMatrix); int *jc=mxGetJc(MatlabMatrix); int temp_index; for(unsigned j=0; j<Matlab_cols;j++) { temp_index=jc[j+1]; for(int k=jc[j];k<temp_index;k++) Temp._el[ir[k]][j] = dcomplex(MatlabRealDATA[k],MatlabImagDATA[k]); } return(Temp); } return(Temp); } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Mat<fcomplex> Mat<fcomplex>::matlab2Mat(Matrix *) const { cerr << "Mat<fcomplex>::_Matlab2Mat() called but not implemented" << endl; return Mat<fcomplex>(*this); } #endif // USE_FCOMPMAT #ifdef USE_COMPMAT template <> Matrix * Mat<dcomplex>::mat2Matlab(const char *name) const { Matrix *CopyofThis; //Allocate the memory for the Matlab matrix and set its name CopyofThis=mxCreateFull(_rows,_cols,1); mxSetName(CopyofThis,name); double *MatlabPrData=mxGetPr(CopyofThis); double *MatlabPiData=mxGetPi(CopyofThis); for(unsigned i=0;i< _cols;i++) for(unsigned j=0;j<_rows;j++) { *MatlabPrData= _el[j][i].real(); MatlabPrData++; *MatlabPiData= _el[j][i].imag(); MatlabPiData++; } return(CopyofThis); } #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <> Matrix * Mat<fcomplex>::mat2Matlab(const char *) const { cerr << "Mat<fcomplex>::_Mat2Matlab() called but not implemented" << endl; return 0; } #endif // USE_FCOMPMAT #endif // HAVE_MATLAB #ifdef USE_COMPMAT template <class Type> Mat<dcomplex> fft(const Mat<Type>& A, unsigned nrows, unsigned ncols) { return asCompMat(A).fft(nrows, ncols); } template <class Type> Mat<dcomplex> ifft(const Mat<Type>& A, unsigned nrows, unsigned ncols) { return asCompMat(A).ifft(nrows, ncols); } #ifdef USE_DBLMAT Mat<double> applyElementWiseC2D(const Mat<dcomplex>& A, double (*function)(const dcomplex&)) { unsigned nrows = A.getrows(); unsigned ncols = A.getcols(); Mat<double> T(nrows, ncols); double *TelPtr = (double *) T.getEl()[0]; dcomplex *AelPtr = (dcomplex *) A.getEl()[0]; for(unsigned i = nrows; i; i--) for(unsigned j = ncols ; j != 0 ; j--) *TelPtr++ = function(*AelPtr++); return T; } Mat<double> arg(const Mat<dcomplex>& A) { unsigned nrows = A.getrows(); unsigned ncols = A.getcols(); Mat<double> T(nrows, ncols); double *TelPtr = (double *) T.getEl()[0]; dcomplex *AelPtr = (dcomplex *) A.getEl()[0]; for(unsigned i = nrows; i; i--) for(unsigned j = ncols ; j != 0 ; j--) *TelPtr++ = arg(*AelPtr++); return T; } static double real(const dcomplex& d) { return d.real(); } static double imag(const dcomplex& d) { return d.imag(); } Mat<double> real(const Mat<dcomplex>& A) { return applyElementWiseC2D(A, &real); } Mat<double> imag(const Mat<dcomplex>& A) { return applyElementWiseC2D(A, &imag); } #endif // USE_DBLMAT #endif // USE_COMPMAT #ifdef USE_FCOMPMAT template <class Type> Mat<fcomplex> ffft(const Mat<Type>& A, unsigned nrows, unsigned ncols) { return asFcompMat(A).fft(nrows, ncols); } template <class Type> Mat<fcomplex> fifft(const Mat<Type>& A, unsigned nrows, unsigned ncols) { return asFcompMat(A).ifft(nrows, ncols); } #ifdef USE_FLMAT Mat<float> applyElementWiseC2D(const Mat<fcomplex>& A, double (*function)(const dcomplex&)) { unsigned nrows = A.getrows(); unsigned ncols = A.getcols(); Mat<float> T(nrows, ncols); float *TelPtr = (float *) T.getEl()[0]; fcomplex *AelPtr = (fcomplex *) A.getEl()[0]; for(unsigned i = nrows; i; i--) for(unsigned j = ncols ; j != 0 ; j--) *TelPtr++ = function(*AelPtr++); return T; } Mat<float> arg(const Mat<fcomplex>& A) { unsigned nrows = A.getrows(); unsigned ncols = A.getcols(); Mat<float> T(nrows, ncols); float *TelPtr = (float *) T.getEl()[0]; fcomplex *AelPtr = (fcomplex *) A.getEl()[0]; for(unsigned i = nrows; i; i--) for(unsigned j = ncols ; j != 0 ; j--) *TelPtr++ = arg(*AelPtr++); return T; } Mat<float> real(const Mat<fcomplex>& A) { return applyElementWiseC2D(A, &dcomplex::real); } Mat<float> imag(const Mat<fcomplex>& A) { return applyElementWiseC2D(A, &dcomplex::imag); } #endif // USE_FLMAT #endif // USE_FCOMPMAT <file_sep>/src/Makefile # Makefile.in generated by automake 1.6.1 from Makefile.am. # src/Makefile. Generated from Makefile.in by configure. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. SHELL = /bin/sh srcdir = . top_srcdir = .. prefix = /home/bic/jason/testbed exec_prefix = ${prefix} bindir = ${exec_prefix}/bin sbindir = ${exec_prefix}/sbin libexecdir = ${exec_prefix}/libexec datadir = ${prefix}/share sysconfdir = ${prefix}/etc sharedstatedir = ${prefix}/com localstatedir = ${prefix}/var libdir = ${exec_prefix}/lib infodir = ${prefix}/info mandir = ${prefix}/man includedir = ${prefix}/include oldincludedir = /usr/include pkgdatadir = $(datadir)/EBTKS pkglibdir = $(libdir)/EBTKS pkgincludedir = $(includedir)/EBTKS top_builddir = .. ACLOCAL = ${SHELL} /home/bic/jason/sandbox/libraries/EBTKS/missing --run aclocal-1.6 AUTOCONF = ${SHELL} /home/bic/jason/sandbox/libraries/EBTKS/missing --run autoconf AUTOMAKE = ${SHELL} /home/bic/jason/sandbox/libraries/EBTKS/missing --run automake-1.6 AUTOHEADER = ${SHELL} /home/bic/jason/sandbox/libraries/EBTKS/missing --run autoheader am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = .././install-sh -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c INSTALL_SCRIPT = ${INSTALL} INSTALL_HEADER = $(INSTALL_DATA) transform = s,x,x, NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_alias = host_triplet = mips-sgi-irix6.5 EXEEXT = OBJEXT = o PATH_SEPARATOR = : AMTAR = ${SHELL} /home/bic/jason/sandbox/libraries/EBTKS/missing --run tar AS = @AS@ AWK = gawk CC = gcc CXX = g++ CXXCPP = g++ -E DEPDIR = .deps DLLTOOL = @DLLTOOL@ ECHO = print -r GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s LIBTOOL = $(SHELL) $(top_builddir)/libtool LN_S = ln -s MOC = @MOC@ OBJDUMP = @OBJDUMP@ PACKAGE = EBTKS RANLIB = ranlib RC = @RC@ STRIP = strip UIC = @UIC@ VERSION = 0.99 X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ am__include = include am__quote = install_sh = /home/bic/jason/sandbox/libraries/EBTKS/install-sh AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/templates noinst_LTLIBRARIES = libAZgen_s.la libAZgen_s_la_SOURCES = \ FileIO.cc \ Histogram.cc \ MPoint.cc \ MString.cc \ OpTimer.cc \ OrderedCltn.cc \ Path.cc \ Polynomial.cc \ Spline.cc \ TBSpline.cc \ TrainingSet.cc \ amoeba.cc \ backProp.cc \ fcomplex.cc \ dcomplex.cc subdir = src mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libAZgen_s_la_LDFLAGS = libAZgen_s_la_LIBADD = am_libAZgen_s_la_OBJECTS = FileIO.lo Histogram.lo MPoint.lo MString.lo \ OpTimer.lo OrderedCltn.lo Path.lo Polynomial.lo Spline.lo \ TBSpline.lo TrainingSet.lo amoeba.lo backProp.lo fcomplex.lo \ dcomplex.lo libAZgen_s_la_OBJECTS = $(am_libAZgen_s_la_OBJECTS) DEFS = -DHAVE_CONFIG_H DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = -I/usr/local/unstable/include -I/usr/local/unstable/mni/include LDFLAGS = -L/usr/local/unstable/lib -L/usr/local/unstable/lib/c++-gcc -L/usr/local/unstable/mni/lib -L/usr/local/unstable/mni/lib/c++-gcc LIBS = -lvolume_io -lminc -lnetcdf -lm depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles DEP_FILES = ./$(DEPDIR)/FileIO.Plo ./$(DEPDIR)/Histogram.Plo \ ./$(DEPDIR)/MPoint.Plo ./$(DEPDIR)/MString.Plo \ ./$(DEPDIR)/OpTimer.Plo ./$(DEPDIR)/OrderedCltn.Plo \ ./$(DEPDIR)/Path.Plo ./$(DEPDIR)/Polynomial.Plo \ ./$(DEPDIR)/Spline.Plo ./$(DEPDIR)/TBSpline.Plo \ ./$(DEPDIR)/TrainingSet.Plo ./$(DEPDIR)/amoeba.Plo \ ./$(DEPDIR)/backProp.Plo ./$(DEPDIR)/dcomplex.Plo \ ./$(DEPDIR)/fcomplex.Plo CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ CXXFLAGS = -g -O2 DIST_SOURCES = $(libAZgen_s_la_SOURCES) DIST_COMMON = Makefile.am Makefile.in SOURCES = $(libAZgen_s_la_SOURCES) all: all-am .SUFFIXES: .SUFFIXES: .cc .lo .o .obj $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) libAZgen_s.la: $(libAZgen_s_la_OBJECTS) $(libAZgen_s_la_DEPENDENCIES) $(CXXLINK) $(libAZgen_s_la_LDFLAGS) $(libAZgen_s_la_OBJECTS) $(libAZgen_s_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c include ./$(DEPDIR)/FileIO.Plo include ./$(DEPDIR)/Histogram.Plo include ./$(DEPDIR)/MPoint.Plo include ./$(DEPDIR)/MString.Plo include ./$(DEPDIR)/OpTimer.Plo include ./$(DEPDIR)/OrderedCltn.Plo include ./$(DEPDIR)/Path.Plo include ./$(DEPDIR)/Polynomial.Plo include ./$(DEPDIR)/Spline.Plo include ./$(DEPDIR)/TBSpline.Plo include ./$(DEPDIR)/TrainingSet.Plo include ./$(DEPDIR)/amoeba.Plo include ./$(DEPDIR)/backProp.Plo include ./$(DEPDIR)/dcomplex.Plo include ./$(DEPDIR)/fcomplex.Plo distclean-depend: -rm -rf ./$(DEPDIR) .cc.o: source='$<' object='$@' libtool=no \ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \ $(CXXDEPMODE) $(depcomp) \ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< .cc.obj: source='$<' object='$@' libtool=no \ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \ $(CXXDEPMODE) $(depcomp) \ $(CXXCOMPILE) -c -o $@ `cygpath -w $<` .cc.lo: source='$<' object='$@' libtool=yes \ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' \ $(CXXDEPMODE) $(depcomp) \ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< CXXDEPMODE = depmode=gcc3 mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: ETAGS = etags ETAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-compile distclean-depend \ distclean-generic distclean-libtool distclean-tags dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool uninstall-am: uninstall-info-am .PHONY: GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES distclean \ distclean-compile distclean-depend distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am info \ info-am install install-am install-data install-data-am \ install-exec install-exec-am install-info install-info-am \ install-man install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool tags uninstall uninstall-am \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: <file_sep>/autogen.sh #! /bin/sh set -e if [ ! -r m4/mni_REQUIRE_LIB.m4 ]; then cat <<EOF The required m4 files were not found. You need to check these out from their repository using cvs -d /software/source checkout -d m4 libraries/mni-acmacros (yes, two '-d' options) Then re-run autogen.sh. EOF exit 1 fi cat <<EOF Messages of the following type may be safely ignored. Any other diagnostics may be a sign of trouble. automake: configure.in: installing [...] warning: AC_TRY_RUN called without default to allow cross compiling Let me (<EMAIL>) know if something goes wrong! EOF test -d ac_config_aux || mkdir ac_config_aux aclocal -I m4 autoheader libtoolize --automake automake --add-missing --copy autoconf <file_sep>/src/popen.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: popen.cc,v $ $Revision: 1.1 $ $Author: jason $ $Date: 2001-11-09 16:37:25 $ $State: Exp $ --------------------------------------------------------------------------*/ #include "popen.h" #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <iostream.h> #include <osfcn.h> #include <signal.h> #if SVR4 || __STDC__ || sun extern "C" pid_t waitpid(pid_t, int*, int); #define App(x) inline pid_t Wait(pid_t p, int *x=0) { return waitpid(p, x, 0); } #else extern "C" pid_t wait(int*); #define App(p) plist.append(new Pid(p)) // unsecure wait, solved by linked list administration of child pids #include <tlist.h> class Pid{ public: Pid(pid_t p) : pd(p), rg(1), extcod(-1){} pid_t pid() { return pd; } int exitcode() { return extcod; } void notrunning(int x) { rg = 0; extcod = x ;} int running() { return rg;} private: pid_t pd; int extcod; int rg; }; static tlist<Pid> plist; // Wait() does not check for stopped processes. pid_t Wait(pid_t p, int *fx=0) { // look up p, remember place: int lx; Pid *pq; int cq; for (cq = 0; (pq = plist.get(cq)) && (pq->pid() != p); ++cq) ; // void if (!pq){ errno = ESRCH; return -1; } // stopped before ? if (!pq->running()){ if (fx) *fx = pq->exitcode(); plist.remove(cq); delete pq; return p; } // look up the proces by waiting until found while (1){ pid_t rp = wait(&lx); if (rp == -1){ errno = ECHILD; return -1; } if (p == rp){ // got a match, remove from plist if (fx) *fx = lx; plist.remove(cq); delete pq; return p; } // not the proces wanted, continue, but mark as // being removed; look up the proces Pid *rq; int rc; for (rc = 0; (rq = plist.get(rc)) && (rq->pid() != rp); ++rc) ; // void if (!rq){ errno = ESRCH; return -1; } rq->notrunning(lx); } } #endif int psystem(const char *command) { long pid; int ex; switch (pid = ::fork()){ case 0: // child ::putenv("IFS="); ::setuid(getuid()); ::setgid(getgid()); ::execl("/bin/sh", "sh", "-c", command, 0); ::kill(getpid(), SIGUSR1); //inform parent case -1: return -1; default: // parent App(pid); if (Wait(pid, &ex) != pid) return -1; if ((ex&255) == SIGUSR1){ errno = EACCES; return -1; } return ex; } } int popenbuf::overflow(int c) { int df = pptr()-pbase(); int n = c; if (df > 0 && write(pfdout, pbuf, df) != df) n = -1; if (c != EOF && n != -1){ char _c = c; if (write(pfdout, &_c, 1) != 1) n = -1; } setp(base(), ebuf()); return n == -1 ? -1 : zapeof(c); } int popenbuf::underflow() { // flush output if (pfdout >= 0) overflow(); int n = read(pfdin, gbuf, bufsize); if (n < 0){ setg(0, 0, 0); return EOF; } if (n == 0) setg(gbuf, gbuf, gbuf+1); else setg(gbuf, gbuf, gbuf+n); return n == 0 ? EOF : zapeof(*gbuf); } //static char *getb(int n){ return new char[n];} popenbuf::popenbuf(const char *command, ios::open_mode om) : pbuf(new char[bufsize*2]), gbuf(pbuf+bufsize), running(0), opm(om), pfdin(-1), pfdout(-1), pid(-1) { setbuf(pbuf, bufsize), pbuf = base(); assert(pbuf); setp(base(), ebuf()); setg(0, 0, 0); switch(opm){ case ios::in: case ios::out: popen1(command); return; case ios::in|ios::out: popen2(command); return; default: return; // throw..... }; } void popenbuf::popen1(const char *command) { // one way pipe int pip[2]; // set up pipe for child if (::pipe(pip) < 0){ return ; // throw } switch (pid=::fork()){ case 0: // child if (opm == ios::in){ ::close(1); ::dup(pip[1]); } else { ::close(0); ::dup(pip[0]); } ::close(pip[0]); ::close(pip[1]); ::putenv("IFS="); ::setuid(getuid()); ::setgid(getgid()); ::execl("/bin/sh", "sh", "-c", command, 0); ::kill(getpid(), SIGUSR1); //inform parent case -1: // failed return; // throw default: // parent running = 1; App(pid); if (opm == ios::in){ ::close(pip[1]); pfdin = pip[0]; } else { ::close(pip[0]); pfdout = pip[1]; } } } void popenbuf::popen2(const char *command) { // set up 2 pipes int pws[2]; int prs[2]; if (::pipe(pws) < 0){ return ; // throw } if (::pipe(prs) < 0){ ::close(pws[0]); ::close(pws[1]); return ; // throw } switch (pid=::fork()){ case 0: cout << "0 " << flush; // child ::close(0); ::dup(pws[0]); ::close(pws[0]); ::close(pws[1]); ::close(1); ::dup(prs[1]); ::close(prs[0]); ::close(prs[1]); ::putenv("IFS="); ::setuid(getuid()); ::setgid(getgid()); ::execl("/bin/sh", "sh", "-c", command, 0); ::kill(getpid(), SIGUSR1); //inform parent case -1: cout << "-1 " << flush; // failed return; // throw default: cout << "default " << flush; // parent running = 1; App(pid); ::close(pws[0]); ::close(prs[1]); pfdout = pws[1]; pfdin = prs[0]; } } popenbuf::~popenbuf() { exit(); delete pbuf; pbuf = gbuf = 0; } int popenbuf::exit() { int ex; if (!running){ errno = ESRCH; return -1; } if ((opm&ios::out) && pfdout >= 0) overflow(); if (pfdout >= 0) ::close(pfdout); if (pfdin >= 0) ::close(pfdin); if (::Wait(pid, &ex) != pid) return -1; running = 0; pid = -1; opm=ios::open_mode(0); pfdin = pfdout = -1; if ((ex&255) == SIGUSR1){ errno = EACCES; return -1; } return ex; } void popenbuf::closewriteside() { if (!running) return; if (opm != (ios::in|ios::out)) return; if (pfdout >= 0) overflow(); ::close(pfdout); pfdout = -1; } pstreambase::pstreambase(const char *c, ios::open_mode om) : buf(c, om){ init(&buf);} int pstreambase::exit() { return buf.exit(); } void pstreambase::closewriteside() { buf.closewriteside(); } opopen::opopen(const char *c) : pstreambase(c, ios::out) { } int opopen::exit() { return pstreambase::exit(); } ipopen::ipopen(const char *c) : pstreambase(c, ios::in) { } int ipopen::exit() { return pstreambase::exit(); } iopopen::iopopen(const char *c) : pstreambase(c, ios::open_mode(ios::in|ios::out)){} int iopopen::exit() { return pstreambase::exit(); } void iopopen::closewriteside() { pstreambase::closewriteside(); } <file_sep>/templates/ValueMap.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: ValueMap.cc,v $ $Revision: 1.4 $ $Author: stever $ $Date: 2003-11-17 04:07:52 $ $State: Exp $ --------------------------------------------------------------------------*/ #include "ValueMap.h" using namespace std; #ifdef __GNUC__ #define _INSTANTIATE_VALUEMAP(Type) \ template class LUT<Type>; \ template SimpleArray<Type>& map(SimpleArray<Type>&, const ValueMap&); \ template SimpleArray<Type> mapConst(const SimpleArray<Type>&, const ValueMap&); \ template SimpleArray<Type>& map(SimpleArray<Type>&, const Array<LinearMap>&); \ template SimpleArray<Type> mapConst(const SimpleArray<Type>&,const Array<LinearMap>&); #endif #if 0 // moved to header file /************************* * Abstract ValueMap class *************************/ ValueMap& ValueMap::operator () (const ValueMap& map) { return concat(map); } ostream& operator << (ostream& os, const ValueMap& map) { return map.print(os); } #endif /* 0 */ /****************** * Linear map class ******************/ #if 0 // moved to header file ValueMap& LinearMap::inv() { _factor = 1.0/_factor; _offset = -_offset; return *this; } ValueMap& LinearMap::concat(const ValueMap&) { cerr << "LinearMap::concat() called but not implemented" << endl; return *this; } ValueMap& LinearMap::concat(const LinearMap& map) { _offset += _factor*map._offset; _factor *= map._factor; return *this; } LinearMap& LinearMap::operator () (double factor, double offset) { _factor = factor; _offset = offset; return *this; } LinearMap& LinearMap::operator () (double sourceMin, double sourceMax, double destMin, double destMax) { _factor = (destMax - destMin)/(sourceMax - sourceMin); _offset = destMin - _factor*sourceMin; return *this; } ostream& LinearMap::print(ostream& os) const { os << "(" << _factor << ", " << _offset << ")"; return os; } #endif /* 0 */ /******************** * Lookup table class ********************/ template <class Type> LUT<Type>::LUT(unsigned length) : _source(length), _dest(length) { _source.newSize(0); _dest.newSize(0); } template <class Type> LUT<Type>::LUT(const SimpleArray<Type>& source, const SimpleArray<Type>& dest) : _source(source), _dest(dest) { if (size(_source) != size(_dest)) { cerr << "Warning! LUT created with different array sizes. Truncating..." << endl; unsigned newSize = min(size(_source), size(_dest)); _source.newSize(newSize); _dest.newSize(newSize); } _sort(); } template <class Type> LUT<Type>::LUT(const LUT<Type>& map) : _source(map._source), _dest(map._dest) {} template <class Type> LUT<Type>::~LUT() { _source.destroy(); _dest.destroy(); } template <class Type> LUT<Type>& LUT<Type>::add(Type source, Type dest) { unsigned len = size(_source); if (!len) { _source.append(source); _dest.append(dest); return *this; } const Type *sourcePtr = _source.contents(); unsigned i = 0; while ((i < len) && (*sourcePtr < source)) { i++; sourcePtr++; } if (*sourcePtr != source) { _source.insert(source, i); _dest.insert(dest, i); } return *this; } template <class Type> LUT<Type>& LUT<Type>::operator = (const LUT<Type>& map) { _source = map._source; _dest = map._dest; return *this; } template <class Type> ValueMap& LUT<Type>::inv() { SimpleArray<Type> temp(_source); _source = _dest; _dest = temp; _sort(); return *this; } template <class Type> ValueMap& LUT<Type>::concat(const ValueMap&) { cerr << "LUT<Type>::concat() called but not implemented" << endl; return *this; } template <class Type> ValueMap& LUT<Type>::concat(const LUT<Type>& map) { Type *destPtr = _dest.contents(); for (unsigned i = size(_source); i; i--, destPtr++) *destPtr = Type(map(double(*destPtr))); return *this; } template <class Type> double LUT<Type>::operator () (double sourceValue) const { unsigned length = size(_source); const Type *sourcePtr = _source.contents(); for (unsigned i = 0; i < length; i++, sourcePtr++) if (*sourcePtr >= sourceValue) if (!i || (double(*sourcePtr) - sourceValue) < (sourceValue - *(sourcePtr - 1))) return double(_dest[i]); else return double(_dest[i - 1]); return double(_dest[length - 1]); } template <class Type> double LUT<Type>::reverse(double destValue) const { unsigned length = size(_dest); if (!length) return 0; if (length < 2) return _source[(unsigned int)0]; unsigned index = 0; const Type *destPtr = _dest.contents(); double minDiff = fabs(destValue - *destPtr++); for (unsigned i = 1; i < length; i++) { double diff = fabs(destValue - *destPtr++); if (diff < minDiff) { index = i; minDiff = diff; } } return double(_source[index]); } template <class Type> ostream& LUT<Type>::print(ostream& os) const { unsigned length = size(_source); for (unsigned i = 0; i < length; i++) os << _source[i] << " " << _dest[i] << endl; return os; } template <class Type> void LUT<Type>::_sort() { SimpleArray<unsigned> indexArray(_source.qsortIndexAscending()); _source.reorder(indexArray); _dest.reorder(indexArray); } /************************** * Mapping of other objects **************************/ template <class Type> SimpleArray<Type>& map(SimpleArray<Type>& array, const ValueMap& map) { Type *elPtr = array.contents(); unsigned N = array.size(); for (unsigned i = N; i; i--, elPtr++) *elPtr = Type(map(double(*elPtr))); return array; } template <class Type> SimpleArray<Type> mapConst(const SimpleArray<Type>& array, const ValueMap& valueMap) { SimpleArray<Type> A(array); return map(A, valueMap); } template <class Type> SimpleArray<Type>& map(SimpleArray<Type>& array, const Array<LinearMap>& maps) { unsigned N = array.size(); if (maps.size() != N) { cerr << "SimpleArray::map(): bad size of maps array" << endl; return array; } Type *elPtr = array.contents(); const LinearMap *mapPtr = maps.contents(); for (unsigned i = N; i; i--, elPtr++) *elPtr = Type((*mapPtr++)(double(*elPtr))); return array; } template <class Type> SimpleArray<Type> mapConst(const SimpleArray<Type>& array,const Array<LinearMap>& maps) { SimpleArray<Type> A(array); return mapConst(A, maps); } #ifdef __GNUC__ _INSTANTIATE_VALUEMAP(double); #endif <file_sep>/templates/MatrixConv.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: MatrixConv.cc,v $ $Revision: 1.4 $ $Author: bert $ $Date: 2004-12-08 17:06:56 $ $State: Exp $ --------------------------------------------------------------------------*/ #include <config.h> #include <iostream> using namespace std; #include "Matrix.h" //#include "miscTemplateFunc.h" // //-------------------------// // #ifdef USE_COMPMAT template <class Type> Mat<dcomplex> asCompMat(const Mat<Type>& Re, const Mat<Type>& Im) { if ((Im.getcols() != Re.getcols()) || (Im.getrows() != Re.getrows())) { cerr << "asCompMat: Re and Im matrices don't have the same dimensions; using Re only" << endl; return asCompMat(Re); } Mat<dcomplex> cast(Re.getrows(), Re.getcols()); dcomplex *castPtr = (dcomplex *) cast.getEl()[0]; const Type *rePtr = Re.getEl()[0]; const Type *imPtr = Im.getEl()[0]; for (unsigned i=Re.nElements(); i; i--) *castPtr++ = dcomplex(*rePtr++, *imPtr++); return cast; } template <class Type> Mat<dcomplex> asCompMat(const Mat<Type>& A) { Mat<dcomplex> cast(A.getrows(), A.getcols()); dcomplex *castPtr = (dcomplex *) cast.getEl()[0]; Type *aPtr = (Type *) A.getEl()[0]; for (unsigned i=A.nElements(); i; i--) *castPtr++ = dcomplex(*aPtr++); return cast; } #endif #ifdef USE_FCOMPMAT template <class Type> Mat<fcomplex> asFcompMat(const Mat<Type>& A) { Mat<fcomplex> cast(A.getrows(), A.getcols()); fcomplex *castPtr = (fcomplex *) cast.getEl()[0]; const Type *aPtr = A.getEl()[0]; for (unsigned i=A.nElements(); i; i--) *castPtr++ = fcomplex(*aPtr++); return cast; } template <class Type> Mat<fcomplex> asFcompMat(const Mat<Type>& Re, const Mat<Type>& Im) { if ((Im.getcols() != Re.getcols()) || (Im.getrows() != Re.getrows())) { cerr << "asCompMat: Re and Im matrices don't have the same dimensions; using Re only" << endl; return asFcompMat(Re); } Mat<fcomplex> cast(Re.getrows(), Re.getcols()); fcomplex *castPtr = (fcomplex *) cast.getEl()[0]; const Type *rePtr = Re.getEl()[0]; const Type *imPtr = Im.getEl()[0]; for (unsigned i=Re.nElements(); i; i--) *castPtr++ = fcomplex(*rePtr++, *imPtr++); return cast; } #endif template Mat<dcomplex> asCompMat(Mat<double> const &); template Mat<dcomplex> asCompMat(Mat<dcomplex> const &); #if !defined(__GNUC__) && defined(__sgi) #include "MatrixSpec.cc" #include "SimpleArraySpec.cc" #ifdef USE_COMPMAT template class Mat<dcomplex>; template Mat<dcomplex> inv(const Mat<dcomplex> &); template Mat<dcomplex> fft(const Mat<double> &, unsigned, unsigned); template Mat<dcomplex> fft(const Mat<dcomplex> &, unsigned, unsigned); template Mat<dcomplex> ifft(const Mat<double> &, unsigned, unsigned); template Mat<dcomplex> ifft(const Mat<dcomplex> &, unsigned, unsigned); template class SimpleArray<dcomplex>; template class IndexStruct<dcomplex>; #endif // USE_COMPMAT #endif // !defined(__GNUC__) && defined(__sgi) <file_sep>/src/MString.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: MString.cc,v $ $Revision: 1.2 $ $Author: stever $ $Date: 2003-11-17 04:07:52 $ $State: Exp $ --------------------------------------------------------------------------*/ #include <config.h> #include "MString.h" #include <assert.h> #include <ctype.h> #include <stdio.h> #include "OrderedCltn.h" using namespace std; unsigned MString::_MAX_LOAD_LENGTH = 512; // // Constructors/destructor // MString::MString(int length) : SimpleArray<char>((unsigned) length + 1) { _contents[0] = '\0'; } MString::MString(const char *string) : SimpleArray<char>(strlen(string) + 1) { strcpy(_contents, string); } MString::MString(const MString& mString) : SimpleArray<char>(mString._size) { strcpy(_contents, mString._contents); } MString::MString(char c, unsigned n) : SimpleArray<char>(n + 1) { for (unsigned i = 0; i < n; i++) _contents[i] = c; _contents[n] = '\0'; } MString::~MString() {} // // Get functions // Boolean MString::isInteger(int *value) const { if (_size <= 1) return FALSE; unsigned nChars = _size; char *charPtr = _contents; if (*charPtr == '-') { if (_size == 2) return FALSE; // A dash by itself is no integer else { charPtr++; nChars--; } } for (unsigned i = nChars - 1; i != 0; i--, charPtr++) if (!isdigit(*charPtr)) return FALSE; if (value) return sscanf(_contents, "%d", value); return TRUE; } Boolean MString::isDouble(double *value) const { if (_size <= 1) return FALSE; char *charPtr = _contents; for (unsigned i = _size - 1; i != 0; i--, charPtr++) if (!isdigit(*charPtr) && (*charPtr != '-') && (*charPtr != '.')) return FALSE; if (value) return sscanf(_contents, "%lf", value); return TRUE; } Boolean MString::contains(const MString& subString) const { return (strstr(_contents, subString._contents) != 0); } Boolean MString::contains(const char *charPtr) const { return (strstr(_contents, charPtr) != 0); } // // Conversion operators // MString::operator unsigned() const { unsigned value = 0; if (!sscanf(_contents, "%u", &value)) cerr << "Warning! Couldn't convert " << *this << " to unsigned" << endl; return value; } MString::operator int() const { int value = 0; if (!sscanf(_contents, "%d", &value)) cerr << "Warning! Couldn't convert " << *this << " to int" << endl; return value; } MString::operator float() const { float value = 0; if (!sscanf(_contents, "%f", &value)) cerr << "Warning! Couldn't convert " << *this << " to float" << endl; return value; } MString::operator double() const { double value = 0; if (!sscanf(_contents, "%lf", &value)) cerr << "Warning! Couldn't convert " << *this << " to double" << endl; return value; } MString& MString::pad(char c, int n) { if (n > 0) *this += MString(c, n); else if (n < 0) { n = ::abs(n); *this = MString(c, n) + *this; } return *this; } MString& MString::pad(const MString& str, int n) { if (!str) { cerr << "MString::pad: attempt to pad with empty string" << endl; return *this; } if (n > 0) for (unsigned i = 0; i < n; i++) *this += str; else if (n < 0) { MString temp(str); n = ::abs(n); for (unsigned i = 1; i < n; i++) temp += str; temp += *this; *this = temp; } return *this; } Boolean MString::operator < (const MString& string) const { // return length() < string.length(); return (strcmp(_contents, string._contents) < 0); } Boolean MString::operator > (const MString& string) const { // return length() > string.length(); return (strcmp(_contents, string._contents) > 0); } // // Operators // MString& MString::operator = (const char *string) { if (!string) return *this; newSize(strlen(string) + 1); strcpy(_contents, string); return *this; } MString& MString::operator = (const MString& mString) { if (this == &mString) return *this; newSize(mString.length() + 1); strcpy(_contents, mString._contents); return *this; } MString& MString::operator = (int value) { char temp[200]; sprintf(temp, "%d", value); return operator = (temp); } MString& MString::operator = (char value) { newSize(2); _contents[0] = value; _contents[1] = '\0'; return *this; } MString& MString::operator = (double value) { char temp[200]; sprintf(temp, "%.8g", value); return operator = (temp); } MString& MString::operator += (const char *string) { if (!string) return *this; newSize(length() + strlen(string) + 1); strcat(_contents, string); return *this; } MString& MString::operator += (const MString& mString) { if (mString.isEmpty()) return *this; newSize(length() + mString.length() + 1); strcat(_contents, mString._contents); return *this; } MString& MString::operator += (char extraChar) { newSize(length() + 2); _contents[_size - 2] = extraChar; _contents[_size - 1] = '\0'; return *this; } MString& MString::operator += (int value) { char temp[200]; sprintf(temp, "%d", value); return operator += (temp); } MString& MString::operator += (double value) { char temp[200]; sprintf(temp, "%.8g", value); return operator += (temp); } MString MString::operator + (const char *string) const { MString resultString(*this); resultString += string; return resultString; } MString MString::operator + (const MString& mString) const { MString resultString(*this); resultString += mString; return resultString; } MString MString::operator () (unsigned index) const { if (index >= length()) return MString(0); MString newString(length() - index); for (register int i = index, j = 0; i < _size; i++, j++) newString._contents[j] = _contents[i]; return newString; } MString MString::operator () (unsigned index, unsigned nChar) const { if (!nChar) return MString(0); if (index + nChar + 1 > _size) nChar = _size - index + 1; MString newString(nChar); for (register int i = index, j = 0; j < nChar; i++, j++) newString._contents[j] = _contents[i]; newString._contents[nChar] = '\0'; return newString; } // // Special functions // // // Force a string template onto the string. Both strings will be broken // up into tokens seperated by <separator>. The template tokens will replace // the corresponding tokens in the original string, except when the template // token is a '*'. // MString& MString::applyTemplate(const MString& templateString, const char *separator) { if (this->isEmpty() || templateString.isEmpty()) { delete [] _contents; _maxSize = _size = templateString._size; _contents = new char[_size]; assert(_contents); strcpy(_contents, templateString._contents); return *this; } MString templateCopy(templateString); char *tokenPtr; OrderedCltn sourceTokens, templateTokens; // Store pointers to template tokens in <templateTokens> // (strtok replaces the separators with NULL characters in <templateCopy>) tokenPtr = strtok(templateCopy._contents, separator); while (tokenPtr) { templateTokens.add((void *) tokenPtr); tokenPtr = strtok(NULL, separator); } // Same for <sourceTokens>. Don't need to copy the source string, as it will // be destroyed anyway. tokenPtr = strtok(_contents, separator); while (tokenPtr) { sourceTokens.add((void *) tokenPtr); tokenPtr = strtok(NULL, separator); } // Store template tokens in the target string; replace * by the coresponding // tokens of the source string int nExtraSourceTokens = sourceTokens.size() - templateTokens.size(); char *sourceToken, *templateToken; MString targetString; ocIterator templateTokenIt(templateTokens); ocIterator sourceTokenIt(sourceTokens); while (templateToken = (char *) templateTokenIt++) { if (sourceToken = (char *) sourceTokenIt++) { int templateTokenLength = strlen(templateToken); for (int j = 0; j < templateTokenLength; j++) { char character = templateToken[j]; if (character == '*') { targetString += sourceToken; for (int k = 1; k <= nExtraSourceTokens; k++) { targetString += separator; targetString += (char *) sourceTokenIt++; } } else targetString += character; } } else targetString += templateToken; targetString += separator; } // Store targetString as final result; cut off the last added separator. delete [] _contents; _maxSize = _size = targetString._size - 1; _contents = new char [_size]; assert(_contents); strncpy(_contents, targetString._contents, _size - 1); _contents[_size - 1] = '\0'; return *this; } MString MString::chop(unsigned n) { unsigned strLength = length(); strLength -= MIN(n, strLength); MString tail((*this)(strLength)); newSize(strLength + 1); _contents[strLength] = '\0'; return tail; } ostream& operator << (ostream& os, const MString& mString) { return (os << mString._contents); } istream& operator >> (istream& is, MString& mString) { if (mString._maxSize < MString::_MAX_LOAD_LENGTH) { if (mString._maxSize) delete [] mString._contents; mString._size = mString._maxSize = MString::_MAX_LOAD_LENGTH; mString._contents = new char[mString._size]; assert(mString._contents); } else mString._size = mString._maxSize; mString._contents[0] = '\0'; is.width(mString._size); is >> mString._contents; mString._size = strlen(mString._contents) + 1; return is; } /*********************** * MStringIterator class ***********************/ MStringIterator::MStringIterator(const MString& mString, unsigned start) : _separator(0) { _mString = &mString; _index = start; } MStringIterator::MStringIterator(const MString& mString, const MString& separator, unsigned start) : _separator(separator) { _mString = &mString; _index = start; } MStringIterator::~MStringIterator() { } MString MStringIterator::first() { _index = 0; if (!_separator) { MString firstChar(1); firstChar += _mString->_contents[_index]; return firstChar; } MString token(_nextToken()); _index = 0; return token; } MString MStringIterator::start(unsigned index) { if (_index >= _mString->_size) return MString(0); _index = index; if (!_separator) { MString firstChar(1); firstChar += _mString->_contents[_index]; return firstChar; } MString token(_nextToken()); _index = index; return token; } char MStringIterator::character() { if (_index >= _mString->_size) return '\0'; return _mString->_contents[_index++]; } MString MStringIterator::operator ++ () { if (!_separator) { if (_index >= _mString->_size) return MString(0); else { MString character(1); character += _mString->_contents[_index++]; return character; } } return _nextToken(); } MString MStringIterator::_nextToken() { if (_index >= _mString->_size) return MString(0); char character = _mString->_contents[_index++]; // Skip leading separators while ((character != '\0') && _separator.contains(character)) character = _mString->_contents[_index++]; if (character == '\0') return MString(0); _index--; MString token; Boolean gotToken = FALSE; // Extract the token while (!gotToken) { char character = _mString->_contents[_index++]; gotToken = ((character == '\0') || _separator.contains(character)); if (!gotToken) token += character; } return token; } <file_sep>/src/Histogram.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: Histogram.cc,v $ $Revision: 1.3 $ $Author: stever $ $Date: 2003-11-17 04:07:52 $ $State: Exp $ --------------------------------------------------------------------------*/ #include <config.h> #include "Histogram.h" #include <assert.h> #ifdef HAVE_MATLAB extern "C" { #include"mat.h" } #endif using namespace std; // // Constructors/desctructor // Histogram::Histogram() : SimpleArray<unsigned>(0) { _min = _max = 0; _binWidth = 0; } Histogram::Histogram(double min, double max, unsigned nBins) : SimpleArray<unsigned>(nBins) { if (max < min) swap(min, max); // Hm. These exception handlers may lead to unexpected results in some cases... if (!nBins) { nBins = unsigned(::ceil(max - min + 1)); newSize(nBins); _binWidth = 1.0; } else { if (max == min) _binWidth = 1.0/nBins; else if (nBins <= 1) _binWidth = max - min; else _binWidth = (max - min)/(nBins - 1); } _min = min - _binWidth/2; _max = max + _binWidth/2; _valueToBinMap(_min, _max, 0, nBins); clear(0); } Histogram::Histogram(double min, double max, double binWidth) : SimpleArray<unsigned>((unsigned) ::ceil((max - min)/binWidth + 1)) { _binWidth = binWidth; _min = min - _binWidth/2; _max = max + _binWidth/2; _valueToBinMap(_min, _max, 0, _size); clear(0); } Histogram::Histogram(unsigned nBins, double min, double binWidth) : SimpleArray<unsigned>(nBins) { _binWidth = binWidth; _min = min - _binWidth/2; _max = _min + _binWidth*nBins; _valueToBinMap(_min, _max, 0, nBins); clear(0); } Histogram::Histogram(const Histogram& hist) { *this = hist; } Histogram& Histogram::operator = (const Histogram& hist) { if (this == &hist) return *this; newSize(hist._size); unsigned *sourcePtr = hist._contents; unsigned *destPtr = _contents; for (unsigned i = _size; i; i--) *destPtr++ = *sourcePtr++; _min = hist._min; _max = hist._max; _binWidth = hist._binWidth; _valueToBinMap = hist._valueToBinMap; return *this; } Histogram& Histogram::newRange(double min, double max) { if (!_binWidth) { cerr << "Error: Histogram::newRange() called but bin width not set" << endl; return *this; } _min = min - _binWidth/2; _max = max + _binWidth/2; unsigned nBins = unsigned(::ceil((max - min)/_binWidth + 1)); int firstBin = (int) _valueToBinMap(min); int lastBin = (int) _valueToBinMap(max); UnsignedArray newHist(nBins); newHist.clear(0); unsigned *sourcePtr = _contents; unsigned *destPtr = newHist.contents(); if (firstBin < 0) { destPtr -= firstBin; nBins += firstBin; } else sourcePtr += firstBin; if (lastBin < 0) nBins = 0; else if (lastBin > _size - 1) nBins -= lastBin - _size + 1; for (unsigned i = nBins; i; i--) *destPtr++ = *sourcePtr++; this->absorb(newHist); return *this; } // // Get functions // DblArray Histogram::binStarts() const { DblArray starts(_size); double *startPtr = starts.contents(); double binStart = _min; for (unsigned i = _size; i; i--) { *startPtr++ = binStart; binStart += _binWidth; } return starts; } unsigned Histogram::bin(double value) const { if (!_size) { cerr << "Histogram::bin() called on empty histogram" << endl; return 0; } if (value <= _min) return 0; if (value >= _max) return _size - 1; unsigned index = (unsigned) _valueToBinMap(value); if (index >= _size) index = _size - 1; return index; } unsigned Histogram::max(unsigned *) const { cerr << "Histogram::max invalid; should use Histogram::majority" << endl; return 0; } double Histogram::mean() const { if (!_size) { cerr << "Warning! Histogram::mean() called on empty Histogram" << endl; return 0.0; } double meanValue = 0.0; unsigned *binPtr = _contents; double offset = _binWidth/2; for (unsigned i = 0; i < _size; i++){ meanValue += (*binPtr++)*(_valueToBinMap.reverse(i) + offset); } return (meanValue/n()); } double Histogram::median(unsigned *bin, unsigned nBelow, unsigned nAbove) const { if (!_size) { cerr << "Warning! Histogram::median() called on empty Histogram" << endl; return 0.0; } double N = double(n() + nBelow + nAbove)/2; unsigned i; unsigned *binPtr = _contents; unsigned sum = nBelow + *binPtr++; for (i = 0; (i < _size) && (sum < N); i++, sum += *binPtr++); assert(sum >= N); if (bin) *bin = i; return binStart(i + 1) - double(sum - N)/_contents[i]*_binWidth; } double Histogram::majority(unsigned *bin) const { if (!_size) { cerr << "Warning! Histogram::majority() called on empty Histogram" << endl; return 0.0; } unsigned i; SimpleArray<unsigned>::max(&i); if (bin) *bin = i; return binCenter(i); } // function which is used to find the threshold of a histogram // the function takes the histogram (greylevel), double Histogram::biModalThreshold() const { if (!_size) { cerr << "Warning! Histogram::biModalThreshold() called on empty Histogram" << endl; return 0.0; } unsigned N = n(); double meanValue = mean(); double varMax = 0.0; unsigned i = 0; double offset = _binWidth/2; double zeroMoment0 = double(_contents[0])/N; double firstMoment0 = (_valueToBinMap.reverse(0) + offset)*_contents[0]/N; for (unsigned k = 1; k < _size; k++) { // 0th and 1st cumulative moments of the histogram up to the kth level double zeroMoment1 = zeroMoment0 + double(_contents[k])/N; double firstMoment1 = firstMoment0 + (_valueToBinMap.reverse(k) + offset)*_contents[k]/N; if ((zeroMoment1 > 0.0) && (zeroMoment1 < 1.0)) { double var = SQR(meanValue*zeroMoment1 - firstMoment1)/(zeroMoment1*(1 - zeroMoment1)); if (var > varMax) { i = k; varMax = var; } } zeroMoment0 = zeroMoment1; firstMoment0 = firstMoment1; } return _valueToBinMap.reverse(i) + offset; } // function which is used to find the threshold of a histogram // based on minimum variance threshold obtained from Haralick and Shapiro book double Histogram::varianceThreshold() const { if (!_size) { cerr << "Warning! Histogram::varianceThreshold() called on empty Histogram" << endl; return 0.0; } double var = 0; double varMin = MAXDOUBLE; unsigned N = n(); double mean1; double mean2; double var1; double var2; double q1; double q2; double offset = _binWidth/2; int i = 0; int t = 0; for (unsigned k = 0 ; k < _size ; k++) { mean1 = mean2 = var1 = var2 = q1 = q2 = 0; for ( i=0 ; i<=k ; i++) q1 += double(_contents[i])/N; for ( i=k+1; i<_size ; i++) q2 += double(_contents[i])/N; if (q1 != 0) { for ( i=0; i<=k ; i++) mean1 += _valueToBinMap.reverse(i) * (double(_contents[i])/N) / q1; for ( i=0; i<=k ; i++) var1 += SQR(_valueToBinMap.reverse(i)-mean1)*(double(_contents[i])/N) / q1; } if (q2 != 0){ for ( i=k+1; i<_size ; i++) mean2 += _valueToBinMap.reverse(i) * (double(_contents[i])/N) / q2; for ( i=k+1; i<_size ; i++) var2 += SQR(_valueToBinMap.reverse(i)-mean2)*(double(_contents[i])/N) / q2; } var = q1 * var1 + q2 * var2; if (var < varMin) { t = k; varMin = var; } } return _valueToBinMap.reverse(t) + offset; } // function which is used to find the threshold of a histogram // based on minimum kullback function obtained from Haralick and Shapiro book double Histogram::kullbackThreshold() const { if (!_size) { cerr << "Warning! Histogram::kullbackThreshold() called on empty Histogram" << endl; return 0.0; } double H = 0; double HMin = MAXDOUBLE; unsigned N = n(); double mean1; double mean2; double var1; double var2; double q1; double q2; double offset = _binWidth/2; double pi=4*atan(1.0); /* constant, 3.14159.... */ int i = 0; int t = 0; for (unsigned k = 0 ; k < _size ; k++) { mean1 = mean2 = var1 = var2 = q1 = q2 = 0; for ( i=0 ; i<=k ; i++) q1 += double(_contents[i])/N; for ( i=k+1; i<_size ; i++) q2 += double(_contents[i])/N; if (q1 != 0){ for ( i=0; i<=k ; i++) mean1 += _valueToBinMap.reverse(i) * (double(_contents[i])/N) / q1; for ( i=0; i<=k ; i++) var1 += SQR(_valueToBinMap.reverse(i)-mean1)*(double(_contents[i])/N) / q1; } if (q2 != 0){ for ( i=k+1; i<_size ; i++) mean2 += _valueToBinMap.reverse(i) * (double(_contents[i])/N) / q2; for ( i=k+1; i<_size ; i++) var2 += SQR(_valueToBinMap.reverse(i)-mean2)*(double(_contents[i])/N) / q2; } if (var1 > 0 && var2 > 0 && q1 > 0 && q2 > 0) { H = (1+log10(2*pi))/2; H += ( - q1*log10(q1) - (q2*log10(q2)) ); H += (q1*log10(var1) + q2*log10(var2) )/2; } else if (var1 == 0 && var2 == 0) H = -MAXDOUBLE; else H = MAXDOUBLE; if (H < HMin) { t = k; HMin = H; } } return _valueToBinMap.reverse(t) + offset; } double Histogram::pctThreshold(double pct) const { if (!_size) { cerr << "Warning! Histogram::pctThreshold() called on empty Histogram" << endl; return 0.0; } double fraction = pct / 100; DblArray cdf = this->cdf(); if (fraction < 0.5) { for (unsigned i = 0; i < _size; i++) if (cdf[i] > fraction) return binStart(i); return binStart(_size); } else { for (int i = _size - 1; i >= 0; i--) if (cdf[(unsigned int)i] <= fraction) return binStart(i + 1); return binStart(0); } } double Histogram::entropy() const { unsigned *binPtr = _contents; unsigned N = n(); double entropy = 0; double log2 = ::log(2.0); for (unsigned i = _size; i; i--, binPtr++) { double p = double(*binPtr) / N; if (p) entropy += p * ::log(p)/log2; } return -entropy; } DblArray Histogram::pdf() const { return asDblArray(*this)/n(); } DblArray Histogram::cdf() const { return pdf().cumSum(); } // // Other operators // Histogram& Histogram::operator += (const Histogram& hist) { //printHeadAndTail(cout); //hist.printHeadAndTail(cout); if ((_min != hist._min) || (_max != hist._max) || (_size != hist._size)) cerr << "Histogram::operator +=() : cannot merge histograms with different mappings" << endl; else this->SimpleArray<unsigned>::operator += (hist); //printHeadAndTail(cout); return *this; } LUT<double> Histogram::equalize(const Histogram& hist) const { DblArray wx(pdf().cumSum()); DblArray wy(hist.pdf().cumSum()); LUT<double> lut(_size); int len = hist.nBins() - 1; int j = 0; for (unsigned i = 0; i < _size; i++) { double wxi = wx[i]; while ((wy[(unsigned int)j] < wxi) && (j < len)) j++; lut.add(binCenter(i), hist.binCenter(j)); } return lut; } // // I/O // ostream& Histogram::printHeadAndTail(ostream& os, unsigned n) const { os << "Hist size: " << _size << " min: " << _min << " max: " << _max << endl; n = MIN(n, _size/2); SimpleArray<unsigned> temp((*this)(n)); temp.print(os); if (_size > 2*n) os << " ... "; else os << " "; temp = (*this)(_size - n - 1, _size - 1); temp.print(os) << endl; return os; } #ifdef HAVE_MATLAB Boolean Histogram::saveMatlab(const char *fileName, const char *binVarName, const char *countVarName, const char *option) const { if ((option[0] != 'u') && (option[0] != 'w')) { cerr<<"Incorrect file write option, use u for update or w to"; cerr<<" create a new file or overwrite the existing one."<<endl; return FALSE; } //open a Matfile for the object, the selected file option is update //This creates a new file if necessary or updates an existing one without //erasing its previous contents. MATFile *outFile = matOpen((char *) fileName, (char *) option); if (!outFile) { cerr << "Couldn't open file" << fileName << endl; return FALSE; } if (matPutFull(outFile, (char *) binVarName, _size, 1, binCenters(), NULL)) { cerr << "Error in writing bins array to file"<<endl; matClose(outFile); return FALSE; } if (matPutFull(outFile, (char *) countVarName, _size, 1, asDblArray(*this), NULL)) { cerr<<"Error in writing counts array to file"<<endl; matClose(outFile); return FALSE; } if (matClose(outFile)==EOF) { cerr<<"Error in file write"<<endl; return FALSE; } return TRUE; } #endif // // Friends // ostream& operator << (ostream& os, const Histogram& hist) { if (hist._size) hist.print(os); return os; } SimpleArray<double> asDblArray(const Histogram& hist) { DblArray bins(hist._size); const unsigned *histPtr = hist._contents; double *binPtr = bins.contents(); for (register unsigned i = hist._size; i; i--) *binPtr++ = (double) *histPtr++; return bins; } // // Private functions // <file_sep>/clapack/Makefile CFLAGS = -O2 OBJS = dsysv.o dsytf2.o dsytrf.o dsytrs.o dlasyf.o \ idamax.o dcopy.o dgemm.o dgemv.o dger.o dscal.o dswap.o dsyr.o \ ieeeck.o ilaenv.o lsame.o xerbla.o \ s_cmp.o s_copy.o all: libdsysv.a libdsysv.a: $(OBJS) ar r libdsysv.a $(OBJS) ranlib libdsysv.a $(OBJS): f2c.h blaswrap.h <file_sep>/templates/SimpleArray.cc /*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, <NAME>, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: SimpleArray.cc,v $ $Revision: 1.9 $ $Author: bert $ $Date: 2004-12-08 17:05:18 $ $State: Exp $ --------------------------------------------------------------------------*/ #include <config.h> #include "SimpleArray.h" #include "ValueMap.h" #include <assert.h> #ifdef HAVE_MATLAB #include "matlabSupport.h" #endif #include "trivials.h" using namespace std; #ifdef USE_COMPMAT #include "dcomplex.h" #pragma do_not_instantiate SimpleArray<dcomplex>::log #endif #ifdef USE_FCOMPMAT #include "fcomplex.h" #pragma do_not_instantiate SimpleArray<fcomplex>::log #endif /******************* * SimpleArray class *******************/ #ifndef __GNUC__ template <class Type> unsigned SimpleArray<Type>::_rangeErrorCount = 25; #endif template <class Type> int IndexStruct<Type>::compareAscending(const void *struct1, const void *struct2) { const Type& element1 = ((IndexStruct<Type> *) struct1)->element; const Type& element2 = ((IndexStruct<Type> *) struct2)->element; if (element1 > element2) return 1; if (element1 < element2) return -1; return 0; } template <class Type> int IndexStruct<Type>::compareDescending(const void *struct1, const void *struct2) { const Type& element1 = ((IndexStruct<Type> *) struct1)->element; const Type& element2 = ((IndexStruct<Type> *) struct2)->element; if (element1 < element2) return 1; if (element1 > element2) return -1; return 0; } template <class Type> int SimpleArray<Type>::compareAscending(const void *ptr1, const void *ptr2) { const Type& element1 = *(Type *) ptr1; const Type& element2 = *(Type *) ptr2; if (element1 > element2) return 1; if (element1 < element2) return -1; return 0; } template <class Type> int SimpleArray<Type>::compareDescending(const void *ptr1, const void *ptr2) { const Type& element1 = *(Type *) ptr1; const Type& element2 = *(Type *) ptr2; if (element1 < element2) return 1; if (element1 > element2) return -1; return 0; } template <class Type> SimpleArray<Type>::SimpleArray(Type minVal, double step, Type maxVal) : Array<Type>(unsigned(fabs((asDouble(maxVal) - asDouble(minVal))/step)) + 1) { register Type *elementPtr = this->_contents; Type value = minVal; for (register unsigned i = this->_size; i; i--) { *elementPtr++ = value; value = Type(step + value); } } // // Binary I/O functions // template <class Type> ostream& SimpleArray<Type>::saveBinary(ostream& os, unsigned n, unsigned start) const { if (start >= this->_size) { if (this->_size) if (_rangeErrorCount) { _rangeErrorCount--; cerr << "SimpleArray::saveBinary: start out of range" << endl; } return os; } if (!n) n = this->_size - start; else if (start + n > this->_size) { n = this->_size - start; if (_rangeErrorCount) { _rangeErrorCount--; cerr << "SimpleArray::saveBinary: n too large; truncated" << endl; } } os.write((char *) this->_contents + start, n*sizeof(Type)); return os; } template <class Type> istream& SimpleArray<Type>::loadBinary(istream& is, unsigned n, unsigned start) { if (!n) n = this->_size; this->newSize(start + n); if (this->_size) is.read((char *) this->_contents + start, n*sizeof(Type)); return is; } // // Ascii I/O functions // template <class Type> ostream& SimpleArray<Type>::saveAscii(ostream& os, unsigned n, unsigned start) const { if (start >= this->_size) { if (this->_size) if (_rangeErrorCount) { _rangeErrorCount--; cerr << "SimpleArray::saveAscii: start out of range" << endl; } return os; } if (!n) n = this->_size - start; else if (start + n > this->_size) { n = this->_size - start; if (_rangeErrorCount) { _rangeErrorCount--; cerr << "SimpleArray::saveAscii: n too large; truncated" << endl; } } this->resetIterator(start); for (unsigned i = n; i && os; i--) { os << (*this)++; if (i > 1) os << " "; } return os; } template <class Type> istream& SimpleArray<Type>::loadAscii(istream& is, unsigned n, unsigned start) { if (!n) n = this->_size; this->newSize(start + n); this->resetIterator(start); for (unsigned i = n; i && is; i--) is >> (*this)++; return is; } #ifdef HAVE_MATLAB Boolean SimpleArray<double>::saveMatlab(const char *fileName, const char *varName, const char *option) const { return ::saveMatlab(fileName, varName, option, _size, 1, this->_contents); } #ifdef USE_COMPMAT Boolean SimpleArray<dcomplex>::saveMatlab(const char *fileName, const char *varName, const char *option) const { double *real = 0; double *imag = 0; if (_size) { real = new double[_size]; if (!real) { cerr << "Couldn't allocate temporary real array for MATLAB conversion" << endl; return FALSE; } imag = new double[_size]; if (!imag) { cerr << "Couldn't allocate temporary imag array for MATLAB conversion" << endl; return FALSE; } double *realPtr = real; double *imagPtr = imag; const dcomplex *contentsPtr = this->_contents; for (unsigned i = _size; i; i--) { *realPtr++ = ::real(*contentsPtr); *imagPtr++ = ::imag(*contentsPtr); contentsPtr++; } } Boolean status = ::saveMatlab(fileName, varName, option, _size, 1, real, imag); if (real) delete [] real; if (imag) delete [] imag; return status; } #endif template <class Type> Boolean SimpleArray<Type>::saveMatlab(const char *fileName, const char *varName, const char *option) const { double *temp = 0; if (_size) { temp = new double[_size]; if (!temp) { cerr << "Couldn't allocate temporary double array for MATLAB conversion" << endl; return FALSE; } double *tempPtr = temp; const Type *contentsPtr = this->_contents; for (unsigned i = _size; i; i--) *tempPtr++ = asDouble(*contentsPtr++); } Boolean status = ::saveMatlab(fileName, varName, option, _size, 1, temp); if (temp) delete [] temp; return status; } #endif // // Get functions // template <class Type> SimpleArray<Type> SimpleArray<Type>::operator () (unsigned nElements) const { if (nElements > this->_size) { cerr << "Warning! Array::operator(" << nElements << ") called with on array of size " << this->_size << ". Value truncated!" << endl; nElements = this->_size; } SimpleArray<Type> subArray(nElements); Type *sourcePtr = this->_contents; Type *destPtr = subArray._contents; for (register unsigned i = nElements; i != 0; i--) *destPtr++ = *sourcePtr++; return(subArray); } template <class Type> SimpleArray<Type> SimpleArray<Type>::operator () (unsigned start, unsigned end) const { unsigned n = end - start + 1; if (start + n > this->_size) { cerr << "Warning! Array::operator(" << start << ", " << end << ") called with on array of size " << this->_size << ". Truncated!" << endl; n = this->_size - start; } SimpleArray<Type> subArray(n); Type *sourcePtr = this->_contents + start; Type *destPtr = subArray._contents; for (register unsigned i = n; i != 0; i--) *destPtr++ = *sourcePtr++; return(subArray); } template <class Type> SimpleArray<Type> SimpleArray<Type>::operator () (const BoolArray& boolArray) const { unsigned i; unsigned size = MIN(this->_size, boolArray.size()); unsigned newSize = 0; const Boolean *boolPtr = boolArray.contents(); for (i = size; i; i--) if (*boolPtr++) newSize++; SimpleArray<Type> array(newSize); boolPtr = boolArray.contents(); Type *sourcePtr = this->_contents; Type *destPtr = array._contents; for (i = size; i; i--) { if (*boolPtr++) *destPtr++ = *sourcePtr; sourcePtr++; } return array; } template <class Type> SimpleArray<Type> SimpleArray<Type>::operator () (const UnsignedArray& indices) const { unsigned trueN = 0; unsigned N = indices.size(); SimpleArray<Type> array(N); Type *destPtr = array.contents(); const unsigned *index = indices.contents(); for (unsigned i = N; i; i--, index++) { if (*index >= this->_size) { if (_rangeErrorCount) { _rangeErrorCount--; cerr << "Warning! SimpleArray::operator(): index " << *index << "out of range!" << endl; } } else { *destPtr++ = this->_contents[*index]; trueN++; } } array.newSize(trueN); return array; } template <class Type> Boolean SimpleArray<Type>::contains(Type value) const { register Type *contentsPtr = this->_contents; for (register unsigned i = this->_size; i; i--) if (*contentsPtr++ == value) return TRUE; return FALSE; } template <class Type> Boolean SimpleArray<Type>::contains(Type value, unsigned start, unsigned end) const { if ((end < start) || (end >= this->_size) || (start >= this->_size)) { cerr << "SimpleArray::contains called with invalid start (" << start << ") and end (" << end << ") arguments (array size: " << this->_size << ")" << endl; return FALSE; } register Type *contentsPtr = this->_contents + start; for (register unsigned i = end - start + 1; i; i--) if (*contentsPtr++ == value) return TRUE; return FALSE; } template <class Type> Boolean SimpleArray<Type>::containsOnly(Type value) const { register Type *contentsPtr = this->_contents; for (register unsigned i = this->_size; i; i--) if (*contentsPtr++ != value) return FALSE; return TRUE; } template <class Type> Boolean SimpleArray<Type>::containsOnly(Type value, unsigned start, unsigned end) const { if ((end < start) || (end >= this->_size) || (start >= this->_size)) { cerr << "SimpleArray::containsOnly called with invalid start (" << start << ") and end (" << end << ") arguments (array size: " << this->_size << ")" << endl; return FALSE; } register Type *contentsPtr = this->_contents + start; for (register unsigned i = end - start + 1; i; i--) if (*contentsPtr++ != value) return FALSE; return TRUE; } template <class Type> unsigned SimpleArray<Type>::occurrencesOf(Type value, unsigned start, unsigned end) const { if (end > this->_size - 1) { cerr << "Warning! SimpleArray::occurrencesOf() called with end=" << end << " on array of size " << this->_size << ". Truncated!" << endl; end = this->_size - 1; } if (start > end) { cerr << "Warning! SimpleArray::occurrencesOf() called with start > end" << endl; return 0; } unsigned N = 0; this->resetIterator(start); for (unsigned i = end - start + 1; i; i--) if ((*this)++ == value) N++; return N; } template <class Type> int SimpleArray<Type>::indexOf(Type value, int dir, unsigned start) const { this->resetIterator(start); if (dir > 0) { for (register int i = this->_size - start; i; i--) if ((*this)++ == value) return this->_itIndex - 1; } else { for (register int i = start + 1; i; i--) if ((*this)-- == value) return this->_itIndex + 1; } return -1; } template <class Type> void SimpleArray<Type>::removeAll(Type value) { if (!this->_size) return; unsigned i,j; for (i = 0, j = 0; i < this->_size; i++) { Type el = this->getElConst(i); if (el != value) { if (i != j) this->setEl(j, el); j++; } } this->newSize(j); } template <class Type> void SimpleArray<Type>::removeAllIn(Type floor, Type ceil, unsigned *N) { if (!this->_size) return; if (floor == ceil) removeAll(floor); if (floor > ceil) swap(floor, ceil); unsigned i, j; unsigned n = 0; for (i = 0, j = 0; i < this->_size; i++) { Type value = this->getElConst(i); if ((value >= floor) || (value <= ceil)) n++; else { if (i != j) this->setEl(j, value); j++; } } this->newSize(j); if (N) *N = n; } template <class Type> void SimpleArray<Type>::removeAllNotIn(Type floor, Type ceil, unsigned *nBelow, unsigned *nAbove) { if (!this->_size) return; if (floor > ceil) swap(floor, ceil); unsigned belowCtr = 0; unsigned aboveCtr = 0; unsigned i,j; for (i = 0, j = 0; i < this->_size; i++) { Type value = this->getElConst(i); if (value < floor) belowCtr++; else if (value > ceil) aboveCtr++; else { if (i != j) this->setEl(j, value); j++; } } this->newSize(j); if (nAbove) *nAbove = aboveCtr; if (nBelow) *nBelow = belowCtr; } template <class Type> UnsignedArray SimpleArray<Type>::indicesOf(Type value) const { UnsignedArray indices(0); this->resetIterator(); for (unsigned i = 0; i < this->_size; i++) if ((*this)++ == value) indices.append(i); return indices; } template <class Type> SimpleArray<Type> SimpleArray<Type>::common(const SimpleArray<Type>& array) const { SimpleArray<Type> common; Type *elementPtr = this->_contents; for (unsigned i = this->_size; i; i--) { if (array.contains(*elementPtr) && (!common.contains(*elementPtr))) common.append(*elementPtr); elementPtr++; } return common; } #if HAVE_FINITE #ifndef finite extern "C" int finite(double); #endif /* finite() not defined (as macro) */ #define FINITE(x) finite(x) #elif HAVE_ISFINITE #ifndef isfinite extern "C" int isfinite(double); #endif /* isfinite() not defined (as macro) */ #define FINITE(x) isfinite(x) #else #error "Neither finite() nor isfinite() is defined on your system" #endif /* HAVE_ISFINITE */ template <class Type> SimpleArray<Type>& SimpleArray<Type>::prune() { unsigned i,j; for (i = 0, j = 0; i < this->_size; i++) { double value = double(this->getElConst(i)); if (FINITE(value)) { if (i != j) this->setEl(j, Type(value)); j++; } } this->newSize(j); return *this; } template <class Type> SimpleArray<Type>& SimpleArray<Type>::randuniform(double min, double max) { double range = max - min; for (unsigned i = 0; i < this->_size; i++) this->setEl(i, Type(drand48() * range + min)); return *this; } template <class Type> SimpleArray<Type>& SimpleArray<Type>::randnormal(double mean, double std) { for (unsigned i = 0; i < this->_size; i++) this->setEl(i, Type(gauss(mean, std))); return *this; } template <class Type> UnsignedArray SimpleArray<Type>::qsortIndexAscending() const { unsigned i; if (!this->_size) return UnsignedArray(0); Type *elementPtr = this->_contents; IndexStruct<Type> *indexStructArray = new IndexStruct<Type>[this->_size]; IndexStruct<Type> *indexStructPtr = indexStructArray; for (i = 0; i < this->_size; i++) { indexStructPtr->element = *elementPtr++; (indexStructPtr++)->index = i; } ::qsort(indexStructArray, this->_size, sizeof(IndexStruct<Type>), IndexStruct<Type>::compareAscending); UnsignedArray sortedIndices(this->_size); unsigned *sortedIndicesPtr = sortedIndices.contents(); indexStructPtr = indexStructArray; for (i = 0; i < this->_size; i++) *sortedIndicesPtr++ = (indexStructPtr++)->index; delete [] indexStructArray; return sortedIndices; } template <class Type> UnsignedArray SimpleArray<Type>::qsortIndexDescending() const { unsigned i; if (!this->_size) return UnsignedArray(0); Type *elementPtr = this->_contents; IndexStruct<Type> *indexStructArray = new IndexStruct<Type>[this->_size]; IndexStruct<Type> *indexStructPtr = indexStructArray; for (i = 0; i < this->_size; i++) { indexStructPtr->element = *elementPtr++; (indexStructPtr++)->index = i; } ::qsort(indexStructArray, this->_size, sizeof(IndexStruct<Type>), IndexStruct<Type>::compareDescending); UnsignedArray sortedIndices(this->_size); unsigned *sortedIndicesPtr = sortedIndices.contents(); indexStructPtr = indexStructArray; for (i = 0; i < this->_size; i++) *sortedIndicesPtr++ = (indexStructPtr++)->index; delete [] indexStructArray; return sortedIndices; } template <class Type> Type SimpleArray<Type>::min(unsigned *index) const { assert(this->_size); this->resetIterator(); Type min = (*this)++; if (index) *index = 0; for (unsigned i = 1; i < this->_size; i++) { Type value = (*this)++; if (value < min) { min = value; if (index) *index = i; } } return min; } template <class Type> Type SimpleArray<Type>::max(unsigned *index) const { assert(this->_size); this->resetIterator(); Type max = (*this)++; if (index) *index = 0; for (unsigned i = 1; i < this->_size; i++) { Type value = (*this)++; if (value > max) { max = value; if (index) *index = i; } } return max; } template <class Type> void SimpleArray<Type>::extrema(Type *min, Type *max) const { assert(this->_size); this->resetIterator(); *max = *min = (*this)++; if (this->_debug) cout << this->_size << " :: " << *max << " :: " << *min << endl; for (unsigned i = 1; i < this->_size; i++) { Type value = (*this)++; if (value < *min) *min = value; if (value > *max) *max = value; } if (this->_debug) cout << this->_size << " :: " << *max << " :: " << *min << endl; } template <class Type> Type SimpleArray<Type>::range(unsigned *minIndex, unsigned *maxIndex) const { assert(this->_size); this->resetIterator(); Type min = (*this)++; if (minIndex) *minIndex = 0; Type max = min; if (maxIndex) *maxIndex = 0; for (unsigned i = 1; i < this->_size; i++) { Type value = (*this)++; if (value < min) { min = value; if (minIndex) *minIndex = i; } if (value > max) { max = value; if (maxIndex) *maxIndex = i; } } return (max - min); } template <class Type> double SimpleArray<Type>::sum() const { double sum = 0; this->resetIterator(); for (unsigned i = this->_size; i; i--) sum += asDouble((*this)++); return sum; } template <class Type> double SimpleArray<Type>::sum2() const { double sum2 = 0; this->resetIterator(); for (unsigned i = this->_size; i; i--) { double value = asDouble((*this)++); sum2 += value*value; } return sum2; } template <class Type> double SimpleArray<Type>::prod() const { double prod = 0; if (this->_size) { this->resetIterator(); prod = asDouble((*this)++); for (unsigned i = this->_size - 1; i; i--) prod *= asDouble((*this)++); } return prod; } template <class Type> double SimpleArray<Type>::prod2() const { double prod2 = 0; if (this->_size) { this->resetIterator(); prod2 = asDouble((*this)++); prod2 *= prod2; for (unsigned i = this->_size - 1; i; i--) { double value = asDouble((*this)++); prod2 *= value*value; } } return prod2; } template <class Type> double SimpleArray<Type>::var() const { if (!this->_size) return 0; double sum = 0; double sum2 = 0; this->resetIterator(); for (unsigned i = this->_size; i; i--) { double value = asDouble((*this)++); sum += value; sum2 += value*value; } return sum2/this->_size - SQR(sum/this->_size); } template <class Type> Type SimpleArray<Type>::median() const { assert(this->_size); SimpleArray<Type> array(*this); return array.medianVolatile(); } template <class Type> Type SimpleArray<Type>::medianVolatile() { assert(this->_size); return _randomizedSelect(0, this->_size - 1, (this->_size % 2) ? (this->_size + 1) / 2 : this->_size / 2); } template <class Type> Type SimpleArray<Type>::mode(const Type) const { cerr << "Warning! SimpleArray::mode called but not implemented; returning median" << endl; return median(); } template <class Type> DblArray SimpleArray<Type>::cumSum() const { DblArray result(this->_size); if (!this->_size) return result; this->resetIterator(); result.resetIterator(); double value = asDouble((*this)++); result++ = value; for (unsigned i = this->_size - 1; i; i--) { value += asDouble((*this)++); result++ = value; } return result; } template <class Type> DblArray SimpleArray<Type>::cumProd() const { DblArray result(this->_size); if (!this->_size) return result; double value = asDouble((*this)++); result++ = value; for (unsigned i = this->_size - 1; i; i--) { value *= asDouble((*this)++); result++ = value; } return result; } // // Set functions // template <class Type> void SimpleArray<Type>::ceil(Type ceil) { this->resetIterator(); for (register unsigned i = 0; i < this->_size; i++) if ((*this)++ > ceil) this->setEl(i, ceil); } template <class Type> void SimpleArray<Type>::floor(Type floor) { this->resetIterator(); for (register unsigned i = 0; i < this->_size; i++) if ((*this)++ < floor) this->setEl(i, floor); } // // Boolean operations // template <class Type> Boolean SimpleArray<Type>::operator != (const SimpleArray<Type>& array) const { if (this->_size != array._size) return TRUE; this->resetIterator(); array.resetIterator(); for (unsigned i = this->_size; i; i--) if ((*this)++ != array++) return TRUE; return FALSE; } template <class Type> BoolArray SimpleArray<Type>::operator && (const SimpleArray<Type>& array) const { BoolArray boolArray((Boolean) FALSE, this->_size); unsigned nElements = MIN(this->_size, array._size); if (nElements) { Boolean *boolPtr = boolArray.contents(); Type *value1ptr = this->_contents; Type *value2ptr = array._contents; for (register unsigned i = nElements; i; i--, value1ptr++, value2ptr++) *boolPtr++ = *value1ptr && *value2ptr; } return boolArray; } template <class Type> BoolArray SimpleArray<Type>::operator || (const SimpleArray<Type>& array) const { BoolArray boolArray((Boolean) FALSE, this->_size); unsigned nElements = MIN(this->_size, array._size); if (nElements) { Boolean *boolPtr = boolArray.contents(); Type *value1ptr = this->_contents; Type *value2ptr = array._contents; for (register unsigned i = nElements; i; i--, value1ptr++, value2ptr++) *boolPtr++ = *value1ptr || *value2ptr; } return boolArray; } template <class Type> BoolArray SimpleArray<Type>::operator == (double value) const { BoolArray boolArray(this->_size); if (this->_size) { Boolean *boolPtr = boolArray.contents(); Type *valuePtr = this->_contents; for (register unsigned i = this->_size; i; i--) *boolPtr++ = *valuePtr++ == value; } return boolArray; } template <class Type> BoolArray SimpleArray<Type>::operator != (double value) const { BoolArray boolArray(this->_size); if (this->_size) { Boolean *boolPtr = boolArray.contents(); Type *valuePtr = this->_contents; for (register unsigned i = this->_size; i; i--) *boolPtr++ = *valuePtr++ != value; } return boolArray; } template <class Type> BoolArray SimpleArray<Type>::operator >= (double value) const { BoolArray boolArray(this->_size); if (this->_size) { Boolean *boolPtr = boolArray.contents(); Type *valuePtr = this->_contents; for (register unsigned i = this->_size; i; i--) *boolPtr++ = *valuePtr++ >= value; } return boolArray; } template <class Type> BoolArray SimpleArray<Type>::operator > (double value) const { BoolArray boolArray(this->_size); if (this->_size) { Boolean *boolPtr = boolArray.contents(); Type *valuePtr = this->_contents; for (register unsigned i = this->_size; i; i--) *boolPtr++ = *valuePtr++ > value; } return boolArray; } template <class Type> BoolArray SimpleArray<Type>::operator <= (double value) const { BoolArray boolArray(this->_size); if (this->_size) { Boolean *boolPtr = boolArray.contents(); Type *valuePtr = this->_contents; for (register unsigned i = this->_size; i; i--) *boolPtr++ = *valuePtr++ <= value; } return boolArray; } template <class Type> BoolArray SimpleArray<Type>::operator < (double value) const { BoolArray boolArray(this->_size); if (this->_size) { Boolean *boolPtr = boolArray.contents(); Type *valuePtr = this->_contents; for (register unsigned i = this->_size; i; i--) *boolPtr++ = *valuePtr++ < value; } return boolArray; } template <class Type> BoolArray SimpleArray<Type>::operator >= (const SimpleArray<Type>& array) const { BoolArray boolArray((Boolean) FALSE, this->_size); unsigned nElements = MIN(this->_size, array._size); if (nElements) { Boolean *boolPtr = boolArray.contents(); Type *value1ptr = this->_contents; Type *value2ptr = array._contents; for (register unsigned i = nElements; i; i--) *boolPtr++ = *value1ptr++ >= *value2ptr++; } return boolArray; } template <class Type> BoolArray SimpleArray<Type>::operator > (const SimpleArray<Type>& array) const { BoolArray boolArray((Boolean) FALSE, this->_size); unsigned nElements = MIN(this->_size, array._size); if (nElements) { Boolean *boolPtr = boolArray.contents(); Type *value1ptr = this->_contents; Type *value2ptr = array._contents; for (register unsigned i = nElements; i; i--) *boolPtr++ = *value1ptr++ > *value2ptr++; } return boolArray; } template <class Type> BoolArray SimpleArray<Type>::operator <= (const SimpleArray<Type>& array) const { BoolArray boolArray((Boolean) FALSE, this->_size); unsigned nElements = MIN(this->_size, array._size); if (nElements) { Boolean *boolPtr = boolArray.contents(); Type *value1ptr = this->_contents; Type *value2ptr = array._contents; for (register unsigned i = nElements; i; i--) *boolPtr++ = *value1ptr++ <= *value2ptr++; } return boolArray; } template <class Type> BoolArray SimpleArray<Type>::operator < (const SimpleArray<Type>& array) const { BoolArray boolArray((Boolean) FALSE, this->_size); unsigned nElements = MIN(this->_size, array._size); if (nElements) { Boolean *boolPtr = boolArray.contents(); Type *value1ptr = this->_contents; Type *value2ptr = array._contents; for (register unsigned i = nElements; i; i--) *boolPtr++ = *value1ptr++ < *value2ptr++; } return boolArray; } // // Arithmetic operations // template <class Type> SimpleArray<Type>& SimpleArray<Type>::operator += (Type value) { this->resetIterator(); for (unsigned i = this->_size; i; i--) (*this)++ += value; return *this; } template <class Type> SimpleArray<Type>& SimpleArray<Type>::operator += (const SimpleArray<Type>& array) { assert(this->_size == array._size); this->resetIterator(); array.resetIterator(); for (unsigned i = this->_size; i; i--) (*this)++ += array++; return *this; } template <class Type> SimpleArray<Type>& SimpleArray<Type>::operator -= (Type value) { this->resetIterator(); for (unsigned i = this->_size; i; i--) (*this)++ -= value; return *this; } template <class Type> SimpleArray<Type>& SimpleArray<Type>::operator -= (const SimpleArray<Type>& array) { assert(this->_size == array._size); this->resetIterator(); array.resetIterator(); for (unsigned i = this->_size; i; i--) (*this)++ -= array++; return *this; } template <class Type> SimpleArray<Type>& SimpleArray<Type>::operator *= (double value) { this->resetIterator(); for (unsigned i = this->_size; i; i--) (*this)++ *= (Type)value; return *this; } template <class Type> SimpleArray<Type>& SimpleArray<Type>::operator *= (const SimpleArray<Type>& array) { assert(this->_size == array._size); this->resetIterator(); array.resetIterator(); for (unsigned i = this->_size; i; i--) (*this)++ *= array++; return *this; } template <class Type> SimpleArray<Type>& SimpleArray<Type>::operator /= (const SimpleArray<Type>& array) { assert(this->_size == array._size); this->resetIterator(); array.resetIterator(); for (unsigned i = this->_size; i; i--) (*this)++ /= array++; return *this; } template <class Type> SimpleArray<Type> SimpleArray<Type>::abs() const { SimpleArray<Type> result(this->_size); Type *sourcePtr = this->_contents; Type *destPtr = result.contents(); for (unsigned i = this->_size; i; i--) { *destPtr++ = (*sourcePtr < Type(0)) ? Type(0)-(*sourcePtr) : *sourcePtr; sourcePtr++; } return result; } template <class Type> SimpleArray<Type> SimpleArray<Type>::round(unsigned n) const { SimpleArray<Type> result(this->_size); Type *sourcePtr = this->_contents; Type *destPtr = result.contents(); if (n) { unsigned factor = (unsigned) pow(10.0, double(n)); for (unsigned i = this->_size; i; i--) { *destPtr++ = ROUND(factor*double(*sourcePtr))/factor; sourcePtr++; } } else for (unsigned i = this->_size; i; i--) { *destPtr++ = ROUND(double(*sourcePtr)); sourcePtr++; } return result; } template <class Type> SimpleArray<Type> SimpleArray<Type>::sqr() const { SimpleArray<Type> result(this->_size); Type *sourcePtr = this->_contents; Type *resultPtr = result.contents(); for (unsigned i = this->_size; i; i--, sourcePtr++) *resultPtr++ = SQR(*sourcePtr); return result; } template <class Type> SimpleArray<Type> SimpleArray<Type>::sqrt() const { SimpleArray<Type> result(this->_size); Type *sourcePtr = this->_contents; Type *resultPtr = result.contents(); for (unsigned i = this->_size; i; i--, sourcePtr++) *resultPtr++ = Type(::sqrt(asDouble(*sourcePtr))); // (bert) fix casting return result; } template <class Type> SimpleArray<Type> SimpleArray<Type>::operator ^ (int power) const { SimpleArray<Type> result(this->_size); Type *sourcePtr = this->_contents; Type *resultPtr = result.contents(); for (unsigned i = this->_size; i; i--) *resultPtr++ = Type(intPower(int(asDouble(*sourcePtr++)), power)); return result; } template <class Type> SimpleArray<Type> SimpleArray<Type>::ln() const { SimpleArray<Type> result(this->_size); Type *sourcePtr = this->_contents; Type *resultPtr = result.contents(); for (unsigned i = this->_size; i; i--) *resultPtr++ = Type(::log(asDouble(*sourcePtr++))); // (bert) fix casting return result; } template <class Type> SimpleArray<Type> SimpleArray<Type>::log() const { SimpleArray<Type> result(this->_size); Type *sourcePtr = this->_contents; Type *resultPtr = result.contents(); for (unsigned i = this->_size; i; i--) *resultPtr++ = Type(::log10(asDouble(*sourcePtr++))); return result; } template <class Type> SimpleArray<Type> SimpleArray<Type>::exp() const { return ::exp(1.0)^(*this); } template <class Type> SimpleArray<Type> SimpleArray<Type>::exp10() const { return 10^(*this); } template <class Type> SimpleArray<Type> SimpleArray<Type>::sample(unsigned maxN) const { double step = double(this->_size - 1)/(maxN - 1); if (step <= 1.0) return SimpleArray<Type>(*this); SimpleArray<Type> result(maxN); Type *destPtr = result._contents; double offset = 0; for (unsigned i = maxN; i; i--, offset += step) *destPtr++ = *(this->_contents + unsigned(::floor(offset))); return result; } template <class Type> SimpleArray<Type> SimpleArray<Type>::applyElementWise(Type (*function) (Type)) const { SimpleArray<Type> result(this->_size); Type *sourcePtr = this->_contents; Type *destPtr = result._contents; for (unsigned i = this->_size; i; i--) *destPtr++ = function(*sourcePtr++); return result; } template <class Type> SimpleArray<Type> SimpleArray<Type>::map(const ValueMap& map) const { SimpleArray<Type> result(this->_size); Type *sourcePtr = this->_contents; Type *destPtr = result._contents; for (unsigned i = this->_size; i; i--) *destPtr++ = Type(map(asDouble(*sourcePtr++))); return result; } // // Type conversions // template <class Type> SimpleArray<int> asIntArray(const SimpleArray<Type>& array) { IntArray cast(array.size()); const Type *contentsPtr = array.contents(); int *castPtr = cast.contents(); for (register unsigned i = array.size(); i; i--) *castPtr++ = (int) *contentsPtr++; return cast; } template <class Type> SimpleArray<float> asFloatArray(const SimpleArray<Type>& array) { SimpleArray<float> cast(array.size()); const Type *contentsPtr = array.contents(); float *castPtr = cast.contents(); for (register unsigned i = array.size(); i; i--) *castPtr++ = (float) *contentsPtr++; return cast; } template <class Type> SimpleArray<double> asDblArray(const SimpleArray<Type>& array) { DblArray cast(array.size()); const Type *contentsPtr = array.contents(); double *castPtr = cast.contents(); for (register unsigned i = array.size(); i; i--) *castPtr++ = asDouble(*contentsPtr++); return cast; } // // Friends // template <class Type> SimpleArray<Type> max(const SimpleArray<Type>& array1, const SimpleArray<Type>& array2) { unsigned n = size(array1); if (size(array2) != n) { cerr << "max(SimpleArray, SimpleArray): arrays not of equal size" << endl; return SimpleArray<Type>(0); } SimpleArray<Type> result(array1); Type *resultPtr = result.contents(); const Type *array2Ptr = array2.contents(); for (unsigned i = n; i; i--, resultPtr++, array2Ptr++) if (*array2Ptr > *resultPtr) *resultPtr = *array2Ptr; return result; } template <class Type> SimpleArray<Type> min(const SimpleArray<Type>& array1, const SimpleArray<Type>& array2) { unsigned n = size(array1); if (size(array2) != n) { cerr << "min(SimpleArray, SimpleArray): arrays not of equal size" << endl; return SimpleArray<Type>(0); } SimpleArray<Type> result(array1); Type *resultPtr = result.contents(); const Type *array2Ptr = array2.contents(); for (unsigned i = n; i; i--, resultPtr++, array2Ptr++) if (*array2Ptr < *resultPtr) *resultPtr = *array2Ptr; return result; } // // Private functions // // Computes the i'th order statistic (the i'th smallest element) of // an array. This is the routine that does the real work, and is // analogous to quicksort. template <class Type> Type SimpleArray<Type>::_randomizedSelect(int p, int r, int i) { // If we're only looking at one element of the array, we must have // found the i'th order statistic. if (p == r) return this->_contents[p]; // Partition the array slice A[p..r]. This rearranges the array so that // all elements of A[p..q] are less than all elements of A[q+1..r]. // (Nothing fancy here, this is just a slight variation on the standard // partition done by quicksort.) int q = _randomizedPartition(p, r); int k = q - p + 1; // Now that we have partitioned A, its i'th order statistic is either // the i'th order statistic of the lower partition A[p..q], or the // (i-k)'th order stat. of the upper partition A[q+1..r] -- so // recursively find it. if (i <= k) return _randomizedSelect(p, q, i); else return _randomizedSelect(q+1, r, i-k); } template <class Type> int SimpleArray<Type>::_randomizedPartition(int p, int r) { // Compute a random number between p and r //int i = (random() / (MAXINT / (r-p+1))) + p; // Changed because of problems locating random() on a Sun int i = int(ROUND(drand48() * (r-p+1) + p)); // Swap elements p and i swap(this->_contents[p], this->_contents[i]); return _partition(p, r); } template <class Type> int SimpleArray<Type>::_partition(int p, int r) { Type x = this->_contents[p]; int i = p-1; int j = r+1; while (1) { do { j--; } while (this->_contents[j] > x); do { i++; } while (this->_contents[i] < x); if (i < j) swap(this->_contents[i], this->_contents[j]); else return j; } } template <class Type> SimpleArray<Type> operator ^ (double base, const SimpleArray<Type>& array) { unsigned N = array.size(); SimpleArray<Type> result(N); const Type *sourcePtr = array.contents(); Type *resultPtr = result.contents(); for (unsigned i = N; i != 0; i--) *resultPtr++ = Type(pow(base, double(*sourcePtr++))); return result; } #ifdef __GNUC__ #include "SimpleArraySpec.cc" #define _INSTANTIATE_SIMPLEARRAY(Type) \ template class SimpleArray<Type>; \ template class IndexStruct<Type>; \ template ostream& operator << (ostream&, const SimpleArray<Type>&); \ template istream& operator >> (istream&, SimpleArray<Type>&); \ template SimpleArray<double> asDblArray(const SimpleArray<Type>&); \ template<> unsigned SimpleArray<Type>::_rangeErrorCount = 25; _INSTANTIATE_SIMPLEARRAY(char); _INSTANTIATE_SIMPLEARRAY(unsigned char); _INSTANTIATE_SIMPLEARRAY(short); _INSTANTIATE_SIMPLEARRAY(unsigned short); _INSTANTIATE_SIMPLEARRAY(int); _INSTANTIATE_SIMPLEARRAY(unsigned int); _INSTANTIATE_SIMPLEARRAY(float); _INSTANTIATE_SIMPLEARRAY(double); template SimpleArray<char> operator^(double, SimpleArray<char> const&); template SimpleArray<short> operator^(double, SimpleArray<short> const&); template SimpleArray<unsigned short> operator^(double, SimpleArray<unsigned short> const&); template SimpleArray<int> operator^(double, SimpleArray<int> const&); template SimpleArray<unsigned int> operator^(double, SimpleArray<unsigned int> const&); template SimpleArray<float> operator^(double, SimpleArray<float> const&); template SimpleArray<double> operator^(double, SimpleArray<double> const&); #ifdef USE_COMPMAT _INSTANTIATE_SIMPLEARRAY(dcomplex); #endif // USE_COMPMAT #ifdef USE_FCOMPMAT _INSTANTIATE_SIMPLEARRAY(fcomplex); #endif // USE_FCOMPMAT #endif // __GNUC__
c5144dc2c55737237b2d04ee8b36272323cf1ec8
[ "Makefile", "M4Sugar", "C", "C++", "Shell" ]
39
C++
BIC-MNI/EBTKS
87a90dfc0b7cd45375c925e948f8ec10bdeba0cb
ab6b019c5ab79c3f45eed58bf6612987a9c4ce8d
refs/heads/main
<file_sep>from turtle import Turtle p1 = Turtle("square") p2 = Turtle("square") ball = Turtle("circle") ball.color("white") score_p1 = 0 score_p2 = 0 score_board = Turtle() MOVE_UP = 50 MOVE_DOWN = 50 SCREEN_WIDTH = 1080 SCREEN_HEIGHT = 900 BALL_X = 0 BALL_Y = 0 BALL_DX = 0 BALL_DY = 0 BALL_DIRECTION = 1<file_sep>import turtle from random import randint from data import * from math import sqrt, atan2 from random import randint, choice def setup_screen(screen: turtle.Screen) -> None: screen.bgcolor("black") screen.title("Pong") screen.setup(SCREEN_WIDTH, SCREEN_HEIGHT) screen.onkeypress(lambda: p1.sety(p1.ycor() + MOVE_UP), "Up") screen.onkeypress(lambda: p1.sety(p1.ycor() - MOVE_DOWN), "Down") screen.onkeypress(lambda: p2.sety(p2.ycor() + MOVE_UP), "w") screen.onkeypress(lambda: p2.sety(p2.ycor() - MOVE_DOWN), "s") screen.listen() screen.tracer(0) def setup_players() -> None: p1.penup() p2.penup() p1.color("white") p1.shapesize(7,1) p2.color("white") p2.shapesize(7,1) p1.setpos(SCREEN_WIDTH / 2 - 20, 0) p2.setpos(-SCREEN_WIDTH / 2 + 20, 0) ball.penup() def setup_scoreboard() -> None: score_board.penup() score_board.setpos(-10, SCREEN_HEIGHT / 2 - 40) score_board.color("white") score_board.write(f"{score_p2}:{score_p1}", move=False, align="center", font=("Arial", 30, "normal")) score_board.hideturtle() def layout_setup(screen: turtle.Turtle) -> None: setup_screen(screen) setup_players() setup_scoreboard() def handle_ball_bounds() -> None: global score_p1, score_p2, BALL_DY if ball.xcor() > SCREEN_WIDTH / 2 - 20: score_p2 += 1 set_state() elif ball.xcor() < -SCREEN_WIDTH / 2 + 20: score_p1 += 1 set_state() elif ball.ycor() >= SCREEN_HEIGHT / 2 or ball.ycor() <= -SCREEN_HEIGHT / 2: BALL_DY *= -1 def move_ball() -> None: global BALL_X, BALL_DX, BALL_DIRECTION, BALL_Y, BALL_DY BALL_DX += 0.1 * BALL_DIRECTION BALL_DY += 0.1 * BALL_DIRECTION BALL_X += BALL_DX / 60 BALL_Y += BALL_DY / 60 ball.setpos(BALL_X, BALL_Y) turtle.update() def check_collision(player: turtle.Turtle) -> bool: return int(sqrt(pow(player.xcor() - ball.xcor(), 2) + pow(player.ycor() - ball.ycor(), 2))) < 60 def set_state() -> None: global BALL_X, BALL_Y, BALL_DX, BALL_DY, BALL_DIRECTION BALL_DIRECTION = choice((-1, 1)) BALL_DX, BALL_DY = 0, 0 BALL_X, BALL_Y = 0, 0 score_board.clear() score_board.write(f"{score_p2}:{score_p1}", move=False, align="center", font=("Arial", 30, "normal")) ball.setpos(BALL_X, BALL_Y) p1.setpos(SCREEN_WIDTH / 2 - 20, 0) p2.setpos(-SCREEN_WIDTH / 2 + 20, 0) if __name__ == "__main__": screen = turtle.Screen() layout_setup(screen) while True: screen.update() if check_collision(p1) or check_collision(p2): BALL_DX *= -1 BALL_DY *= -1 BALL_DIRECTION *= -1 screen.update() move_ball() handle_ball_bounds()<file_sep># ping_pong Run python main.py
64e78aaf1442249329686ccf6f73e74383c5e8a5
[ "Markdown", "Python" ]
3
Python
BlitzYp/ping_pong
e4a45b41cb33ed24e9c89d2498aeebda61b4dbea
05c7688ec3d6152c16f32cbeb1be8db20b41966e
refs/heads/master
<file_sep>package AddToCartScenario; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import CaseStudy.TestMeApp.UtilityClass; import cucumber.api.java.en.And; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; import junit.framework.Assert; public class AddToCart_setup { WebDriver driver; @Given("User is in the Loginpage") public void user_is_in_the_Loginpage() { System.out.println("user enters into loginpage"); driver=UtilityClass.getDriver("chrome"); driver.get("http://10.232.237.143:443/TestMeApp/fetchcat.htm"); driver.findElement(By.xpath("//*[@id=\'header\']/div[1]/div/div/div[2]/div/ul/li[1]/a")).click(); } @When("User enters the username{string}") public void user_enters_the_username(String string) { driver.findElement(By.id("userName")).sendKeys(string); } @And("user enters the password{string}") public void user_enters_the_password(String string) { driver.findElement(By.id("password")).sendKeys(string); } @And("user clicks the login button") public void user_clicks_the_login_button() { driver.findElement(By.name("Login")).click(); } @Then("User navigate to the home page") public void user_navigate_to_the_home_page() { System.out.println("user navigated to homepage"); Assert.assertEquals("Home", driver.getTitle()); } @When("User enters the string {string} in search box") public void user_enters_the_string_in_search_box(String string) { driver.findElement(By.id("myInput")).sendKeys(string); } @When("User clicks on the find details button") public void user_clicks_on_the_find_details_button() { driver.findElement(By.xpath("/html/body/div[1]/form/input")).click(); } @Then("user enters the AddTo Cart page") public void user_enters_the_AddTo_Cart_page() { Assert.assertEquals("Search", driver.getTitle()); System.out.println("user navigates to AddToCart Page"); } } <file_sep>package Purchase; import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) @CucumberOptions(monochrome=true,tags="@PurchasePass")//plugin={"pretty","junit:DemoPurchaseReport.xml"}) public class PurchaseRunner { } <file_sep>package RegisterScenario; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.ui.Select; import CaseStudy.TestMeApp.UtilityClass; import cucumber.api.java.en.And; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; public class RegisterSetUp { WebDriver driver; @Given("User enters the TestMeApp") public void user_enters_the_TestMeApp() { driver=UtilityClass.getDriver("chrome"); driver.get("http://10.232.237.143:443/TestMeApp/fetchcat.htm"); } @Given("User clicks on the signup link") public void user_clicks_on_the_signup_link() { driver.findElement(By.linkText("SignUp")).click(); } @And("User enters the signUp page") public void user_enters_the_signUp_page() { System.out.println("user entered signup page"); } @And("User enters the UserName {string}") public void user_enters_the_UserName(String string) { driver.findElement(By.id("userName")).sendKeys(string); } @And("User enters the FirstName {string}") public void user_enters_the_FirstName(String string) { driver.findElement(By.name("firstName")).sendKeys(string); } @And("User enters the LastName {string}") public void user_enters_the_LastName(String string) { driver.findElement(By.name("lastName")).sendKeys(string); } @And("User enters the Password {string}") public void user_enters_the_Password(String string) { driver.findElement(By.id("password")).sendKeys(string); } @And("User enters the ConfirmPassword {string}") public void user_enters_the_ConfirmPassword(String string) { driver.findElement(By.id("pass_confirmation")).sendKeys(string); } @And("User enters the Gender {string}") public void user_enters_the_Gender(String string) { driver.findElement(By.xpath("//*[@id='gender']")).click(); } @And("User enters the Email {string}") public void user_enters_the_Email(String string) { driver.findElement(By.id("emailAddress")).sendKeys(string); } @And("User enters the MobileNumber {string}") public void user_enters_the_MobileNumber(String string) { driver.findElement(By.id("mobileNumber")).sendKeys(string); } @And("User enters the DateOfBirth {string}") public void user_enters_the_DateOfBirth(String string) { driver.findElement(By.name("dob")).sendKeys(string); } @And("User enters the Address {string}") public void user_enters_the_Address(String string) { driver.findElement(By.id("address")).sendKeys(string); } @And("User enters the SecurityQuestion {string}") public void user_enters_the_SecurityQuestion(String string) { Select question = new Select(driver.findElement(By.id("securityQuestion"))); question.selectByValue("411010"); } @And("User enters the Answer {string}") public void user_enters_the_Answer(String string) { driver.findElement(By.id("answer")).sendKeys(string); } @And("User clicks on the Register Button") public void user_clicks_on_the_Register_Button() { driver.findElement(By.name("Submit")).click(); } @Then("New user gets Registered") public void new_user_gets_Registered() { System.out.println("User registered"); } }
d65645eb585f4e32111a594d3811b2d8941d4584
[ "Java" ]
3
Java
Meenakshi194/TestMeAppCaseStudy
08547b556540f6ad344dc0d748e314a3f55133ea
05709cc7fccc3e85dc35f9b1262636ae421ffdee
refs/heads/master
<repo_name>ninjadotorg/constant-explorer<file_sep>/src/pages/Tokens.jsx import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { Link } from 'react-router-dom'; import { getTokens } from '@/reducers/constant/action'; class Tokens extends React.Component { static propTypes = { tokens: PropTypes.object.isRequired, actionGetTokens: PropTypes.func.isRequired, } constructor(props) { super(props); const { actionGetTokens, tokens } = props; this.state = { tokens, }; actionGetTokens(); } static getDerivedStateFromProps(nextProps, prevState) { if (nextProps.tokens.updatedAt !== prevState.tokens.updatedAt) { return { tokens: nextProps.tokens }; } return null; } render() { const { tokens } = this.state; console.log(tokens); return ( <div className="c-explorer-page c-explorer-page-tokens"> <div className="container"> <div className="row"> <div className="col-12"> <div className="c-breadcrumb"> <ul> <li><Link to="/">Explorer</Link></li> <li><Link to="/tokens">Tokens</Link></li> </ul> </div> </div> <div className="col-12"> <div className="block content"> <div className="block-heading"> Tokens </div> <table className="c-table"> <thead> <tr> <th>Token id</th> <th>Token name</th> <th>Token symbol</th> <th>Token amount</th> <th>TXs</th> </tr> </thead> <tbody> {tokens.list.length ? tokens.list.map(token => ( <tr key={token.ID}> <td className="c-hash"><Link to={`/token/${token.ID}`}>{token.ID}</Link></td> <td className="c-hash">{token.Name}</td> <td className="c-hash">{token.Symbol}</td> <td className="c-hash">{token.Amount}</td> <td className="c-hash">{token.ListTxs ?.length}</td> </tr> )) : <tr><td style={{ textAlign: 'center' }} colSpan={4}>Empty</td></tr>} </tbody> </table> </div> </div> </div> </div> </div> ); } } export default connect( state => ({ tokens: state.constant.tokens, }), ({ actionGetTokens: getTokens, }), )(Tokens); <file_sep>/README.md # constant-explorer constant-explorer <file_sep>/src/components/Tx.jsx import React from 'react'; import PropTypes from 'prop-types'; class Tx extends React.Component { static propTypes = { tx: PropTypes.object.isRequired, // abcd: PropTypes.func.isRequired, } constructor(props) { super(props); this.state = {}; } render() { const { tx } = this.props; return ( <table className="c-table"> <tbody> <tr> <td>Version</td> <td>{tx.Version}</td> </tr> <tr> <td>Type</td> <td>{tx.Type}</td> </tr> <tr> <td>Fee</td> <td>{tx.Fee}</td> </tr> <tr> <td>Lock time</td> <td>{tx.LockTime}</td> </tr> <tr> <td>JSPubKey</td> <td className="c-hash" style={{ wordWrap: 'break-word', whiteSpace: 'normal' }}>{tx.JSPubKey}</td> </tr> <tr> <td>JSSig</td> <td className="c-hash" style={{ wordWrap: 'break-word', whiteSpace: 'normal' }}>{tx.JSSig}</td> </tr> <tr> <td>AddressLastByte</td> <td>{tx.AddressLastByte}</td> </tr> <tr> <td>Descs</td> <td><pre>{JSON.stringify(tx.Descs, null, 4)}</pre></td> </tr> <tr> <td>Metadata</td> <td><pre>{tx.MetaData}</pre></td> </tr> </tbody> </table> ); } } export default Tx; <file_sep>/src/components/Header.jsx import React from 'react'; // import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { Link } from 'react-router-dom'; import { showDialog } from '@/reducers/app/action'; import logoC from '@/assets/logo-C.svg.raw'; class Header extends React.Component { static propTypes = { } constructor(props) { super(props); this.state = {}; } render() { return ( <header className="c-explorer-header c-shadow-bottom"> <div className="container"> <div className="row"> <div className="col-12"> <div className="logo-container"> <Link to="/"> <div className="logo" dangerouslySetInnerHTML={{ __html: logoC }} /> <div className="title"> <span className="c-color-black">Constant</span> {' '} Explorer </div> </Link> </div> <div className="menu"> <ul className="c-list-inline"> <li><Link to="/live">Live</Link></li> <li><Link to="/chains">Chains</Link></li> <li><Link to="/txs/pending">Pending TXs</Link></li> <li><Link to="/committees">Committees</Link></li> <li><Link to="/tokens">Tokens</Link></li> </ul> </div> </div> </div> </div> </header> ); } } export default connect( state => ({ auth: state.auth }), dispatch => ({ appShowDialog: showDialog, dispatch }), )(Header); <file_sep>/src/pages/Block.jsx import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { Link } from 'react-router-dom'; import { getBlock } from '@/reducers/constant/action'; class Block extends React.Component { static propTypes = { match: PropTypes.object.isRequired, actionGetBlock: PropTypes.func.isRequired, block: PropTypes.object.isRequired, } constructor(props) { super(props); const { match, block } = this.props; const { blockHash } = match.params; this.state = { blockHash, block, isLatest: false, }; this.fetch(); } static getDerivedStateFromProps(nextProps, prevState) { if ( nextProps.block[prevState.blockHash] ?.updatedAt !== prevState.block[prevState.blockHash] ?.updatedAt ) { if (!nextProps.block[prevState.blockHash].data.NextBlockHash) { return { block: nextProps.block, isLatest: true }; } return { block: nextProps.block, isLatest: false }; } if (nextProps.match.params.blockHash !== prevState.blockHash) { return { blockHash: nextProps.match.params.blockHash }; } return null; } componentDidUpdate(prevProps, prevState) { const { blockHash, isLatest } = this.state; if (prevState.blockHash !== blockHash) { this.fetch(); } if (prevState.blockHash === blockHash && isLatest) { // setTimeout(() => this.fetch(), 1000); } } fetch = () => { const { actionGetBlock } = this.props; const { blockHash } = this.state; actionGetBlock(blockHash); } render() { const { blockHash, block } = this.state; const chainId = block[blockHash] ?.data ?.ChainID + 1; if (!block[blockHash] ?.data) { return null; } return ( <div className="c-explorer-page c-explorer-page-chains"> <div className="container"> <div className="row"> <div className="col-12"> <div className="c-breadcrumb"> <ul> <li><Link to="/">Explorer</Link></li> <li><Link to="/chains">Chain list</Link></li> <li><Link to={`/chain/${chainId}`}>{`Chain #${chainId}`}</Link></li> <li><Link className="c-hash" to={`/block/${blockHash}`}>{blockHash}</Link></li> </ul> </div> </div> <div className="col-12"> <div className="block content"> <div className="row"> <div className="col-12"> <h3>Block</h3> <div className="c-hash c-text-cut">{blockHash}</div> </div> </div> </div> </div> <div className="col-12"> <div className="block content"> <table> <tbody className="c-table c-table-list"> <tr> <td>Block number at chain</td> <td className="c-hash">{block[blockHash].data.Height}</td> </tr> <tr> <td>Version</td> <td className="c-hash">{block[blockHash].data.Version}</td> </tr> <tr> <td>Confirmations</td> <td className="c-hash">{block[blockHash].data.confirmations}</td> </tr> <tr> <td>Time</td> <td>{block[blockHash].data.Time}</td> </tr> <tr> <td>Previous block</td> <td className="c-hash"><Link to={`/block/${block[blockHash].data.PreviousBlockHash}`}>{block[blockHash].data.PreviousBlockHash}</Link></td> </tr> <tr> <td>Next block</td> <td className="c-hash"><Link to={`/block/${block[blockHash].data.NextBlockHash}`}>{block[blockHash].data.NextBlockHash}</Link></td> </tr> <tr> <td>Block producer</td> <td className="c-hash">{block[blockHash].data.BlockProducer}</td> </tr> <tr> <td>Block producer sign</td> <td className="c-hash">{block[blockHash].data.BlockProducerSign}</td> </tr> <tr> <td>Block data</td> <td>{block[blockHash].data.Data}</td> </tr> <tr> <td>TXs</td> <td className="c-hash"><Link to={`/block/${blockHash}/txs`}>{`${block[blockHash].data.Txs.length} - View all`}</Link></td> </tr> </tbody> </table> </div> </div> </div> </div> </div> ); } } export default connect( state => ({ block: state.constant.block, }), ({ actionGetBlock: getBlock, }), )(Block); <file_sep>/src/pages/Committees.jsx import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { Link } from 'react-router-dom'; import { isEmpty } from 'lodash'; import cn from '@sindresorhus/class-names'; import { getCommitteeCandidate, getBlockProducer } from '@/reducers/constant/action'; class CommitteeCandidate extends React.Component { static propTypes = { producers: PropTypes.object.isRequired, candidates: PropTypes.object.isRequired, actionGetBlockProducer: PropTypes.func.isRequired, actionGetCommitteeCandidate: PropTypes.func.isRequired, } constructor(props) { super(props); this.state = { producers: props.producers, candidates: props.candidates, }; } componentDidMount() { const { actionGetBlockProducer, actionGetCommitteeCandidate } = this.props; actionGetBlockProducer(); actionGetCommitteeCandidate(); } static getDerivedStateFromProps(nextProps, prevState) { if (nextProps.producers.updatedAt !== prevState.producers.updatedAt) { return { producers: nextProps.producers }; } if (nextProps.candidates.updatedAt !== prevState.candidates.updatedAt) { return { candidates: nextProps.candidates }; } return null; } render() { const { candidates, producers } = this.state; if (isEmpty(producers.list)) return null; return ( <div className="c-explorer-page c-explorer-page-tx"> <div className="container"> <div className="row"> <div className="col-12"> <div className="c-breadcrumb"> <ul> <li><Link to="/">Explorer</Link></li> <li><Link to="/committees">Committees</Link></li> </ul> </div> </div> <div className="col-12"> <div className="block content"> <div className="block-heading">Committees</div> <div className="row"> <div className="col-12 col-md-6"> <div className="block-heading" style={{ fontSize: '15px' }}>Block producers</div> <table className={cn('c-table', { 'c-table-list': !isEmpty(producers.list), })} > <tbody> { !isEmpty(producers.list) ? Object.keys(producers.list).map((key, index) => ( <tr key={key}> <td><Link to={`/chain/${index + 1}`}>{`#${index + 1}`}</Link></td> <td className="c-hash">{producers.list[key]}</td> </tr> )) : ( <tr> <td style={{ textAlign: 'center' }}>Empty</td> </tr> ) } </tbody> </table> </div> <div className="col-12 col-md-6"> <div className="block-heading" style={{ fontSize: '15px' }}>Candidates</div> <table className={cn('c-table', { 'c-table-list': !isEmpty(candidates.list), })} > <tbody> { !isEmpty(candidates.list) ? Object.keys(candidates.list).map((key, index) => ( <tr key={key}> <td>{`#${index + 1}`}</td> <td className="c-hash">{candidates.list[key]}</td> </tr> )) : ( <tr> <td style={{ textAlign: 'center' }}>Empty</td> </tr> ) } </tbody> </table> </div> </div> </div> </div> </div> </div> </div> ); } } export default connect( state => ({ producers: state.constant.producers, candidates: state.constant.candidates, }), ({ actionGetBlockProducer: getBlockProducer, actionGetCommitteeCandidate: getCommitteeCandidate, }), )(CommitteeCandidate); <file_sep>/src/pages/TxsPending.jsx import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { Link } from 'react-router-dom'; import { getMempoolInfo } from '@/reducers/constant/action'; import { isEmpty } from 'lodash'; class TxsPending extends React.Component { static propTypes = { // match: PropTypes.object.isRequired, actionGetMempoolInfo: PropTypes.func.isRequired, mempool: PropTypes.object.isRequired, } constructor(props) { super(props); const { mempool, actionGetMempoolInfo } = this.props; this.state = { mempool, }; actionGetMempoolInfo(); } static getDerivedStateFromProps(nextProps, prevState) { if (nextProps.mempool.updatedAt !== prevState.mempool.updatedAt) { return { mempool: nextProps.mempool }; } return null; } render() { const { mempool } = this.state; if (isEmpty(mempool.info)) return null; return ( <div className="c-explorer-page c-explorer-page-chains"> <div className="container"> <div className="row"> <div className="col-12"> <div className="c-breadcrumb"> <ul> <li><Link to="/">Explorer</Link></li> <li><Link to="/txs/pending">Pending TXs</Link></li> </ul> </div> </div> <div className="col-12"> <div className="block content"> <div className="block-heading"> Pendings TXs </div> <table className="c-table"> <thead> <tr> <th>Tx hash</th> </tr> </thead> <tbody> {mempool.info.ListTxs.length ? mempool.info.ListTxs.map(tx => ( <tr><td className="c-hash">{tx}</td></tr> )) : <tr><td style={{ textAlign: 'center' }}>Empty</td></tr>} </tbody> </table> </div> </div> </div> </div> </div> ); } } export default connect( state => ({ mempool: state.constant.mempool, }), ({ actionGetMempoolInfo: getMempoolInfo, }), )(TxsPending); <file_sep>/.env.example.js module.exports = { internalAPI: 'http://localhost:8000', };
627320104910f19396367ad2db9d6366ff2413c9
[ "JavaScript", "Markdown" ]
8
JavaScript
ninjadotorg/constant-explorer
6649c792120c3bf238b01050db4c824ad4267dba
c6c608d6365d126e95f1081b10e67dba50c824f7
refs/heads/master
<file_sep>// ==UserScript== // @name NoNaMe-Club ModHelper // @namespace NoNaMe-Club.Scripts // @description Замена стандартного варианта (корень Темпа), при переносе, на выбранные форумы // @version 1.94 // @author Kaener // @homepage https://github.com/kaener/noname-club-modhelper // @updateURL https://raw.github.com/kaener/noname-club-modhelper/master/modhelper.meta.js // @include http://*.nnm-club.ru/forum/modcp.php* // @include http://nnm-club.ru/forum/modcp.php* // @include https://*.nnm-club.ru/forum/modcp.php* // @include https://nnm-club.ru/forum/modcp.php* // @match http://*.nnm-club.ru/forum/modcp.php* // @match http://nnm-club.ru/forum/modcp.php* // @match https://*.nnm-club.ru/forum/modcp.php* // @match https://nnm-club.ru/forum/modcp.php* // @run-at document-start // ==/UserScript== // var VERSION = 1.94;
7ae9813c81d87247e50e516310fe407a65a9a8ab
[ "JavaScript" ]
1
JavaScript
kaener/noname-club-modhelper
0b035be0b57b570cff3ec5d3f76a9176a761d799
30369cd925884aefbf507f8bf889eda2d9a32458
refs/heads/master
<repo_name>MaziMuhlari/ekurhuleni-hackathon<file_sep>/web/js/controllers/homeController.js angular.module('ekurhulenihackathon').controller('HomeController', [ '$scope', '$timeout', '$location', '$filter', '$routeParams', 'ApplicationService', function ($scope, $timeout, $location, $filter, $routeParams, ApplicationService) { var socket = io(); $scope.applications = []; $scope.counter = 1; $scope.totalNotifications = 0; socket.on('application create', function (data) { if (data) { $timeout(function () { $scope.totalNotifications++; $scope.applications.unshift(data); }, 2000); } }); $scope.getAllApplications = function () { $scope.error = false; $scope.disabled = true; ApplicationService.getAllApplications() .then(function (response) { if (response.data) { for (var i = 0; i < response.data.length; i++) { response.data[i].counter = $scope.counter + ""; $scope.counter++; $scope.applications.push(response.data[i]); } } }, function (data) { }); }; }]);<file_sep>/README.md # ekurhuleni-hackathon A mix of all the applications created at the Ekurhuleni hackathon in Germiston.<file_sep>/web/js/controllers/unitController.js angular.module('ekurhulenihackathon').controller('UnitController', [ '$scope', '$timeout', '$location', '$filter', '$routeParams', 'UnitService', function ($scope, $timeout, $location, $filter, $routeParams, UnitService) { $scope.unit = {}; $scope.units = []; $scope.counter = 1; var socket = io(); socket.on('unit create', function (data) { if (data) { $timeout(function () { $scope.units.unshift(data); }, 2000); } }); $scope.getAllUnits = function () { $scope.error = false; $scope.disabled = true; UnitService.getAllUnits() .then(function (response) { if (response.data) { for (var i = 0; i < response.data.length; i++) { response.data[i].counter = $scope.counter + ""; $scope.counter++; $scope.units.push(response.data[i]); } } }, function (data) { }); }; $scope.getUnitById = function () { UnitService.getUnitById($routeParams.id) .then(function (response) { if (response.data) { $scope.unit = response.data; } }, function (data) { }); }; $scope.updateUnitById = function () { UnitService.updateUnitById($routeParams.id, $scope.unit) .then(function (response) { alert("Your unit was updated successfully."); }, function (data) { alert("There was an error updating your unit."); }); }; $scope.createUnit = function () { UnitService.createUnit($scope.unit) .then(function (response) { alert("Your unit was created successfully."); $location.path("/units"); }, function (data) { alert("There was an error creating your unit."); }); }; }]);<file_sep>/web/js/controllers/leaseController.js angular.module('ekurhulenihackathon').controller('LeaseController', [ '$scope', '$timeout', '$location', '$filter', '$routeParams', 'LeaseService', 'UnitService', 'ApplicationService', function ($scope, $timeout, $location, $filter, $routeParams, LeaseService, UnitService, ApplicationService) { $scope.lease = { unitId: "Select A Unit", applicantId: "Select An Applicant", }; $scope.leases = []; $scope.units = []; $scope.applications = []; var socket = io(); socket.on('lease create', function (data) { if (data) { $timeout(function () { $scope.leases.unshift(data); }, 2000); } }); $scope.getAllLeases = function () { var counter = 1; LeaseService.getAllLeases() .then(function (response) { if (response.data) { for (var i = 0; i < response.data.length; i++) { response.data[i].counter = counter + ""; counter++; $scope.leases.push(response.data[i]); } } }, function (data) { }); }; $scope.getAllUnits = function () { var counter = 1; UnitService.getAllUnits() .then(function (response) { if (response.data) { for (var i = 0; i < response.data.length; i++) { response.data[i].counter = counter + ""; counter++; $scope.units.push(response.data[i]); } } }, function (data) { }); }; $scope.getAllApplications = function () { var counter = 1; ApplicationService.getAllApplications() .then(function (response) { if (response.data) { for (var i = 0; i < response.data.length; i++) { response.data[i].counter = counter + ""; counter++; $scope.applications.push(response.data[i]); } } }, function (data) { }); }; $scope.allocateLease = function (id) { LeaseService.allocateLease(id) .then(function (response) { alert("Lease allocated successfully!"); }, function (data) { alert("There was an error allocating the lease."); }); }; $scope.getLeaseById = function () { LeaseService.getLeaseById($routeParams.id) .then(function (response) { if (response.data) { $scope.lease = response.data; } }, function (data) { }); }; $scope.updateLeaseById = function () { LeaseService.updateLeaseById($routeParams.id, $scope.lease) .then(function (response) { alert("Your lease was updated successfully."); }, function (data) { alert("There was an error updating your lease."); }); }; $scope.createLease = function () { LeaseService.createLease($scope.lease.unitId, $scope.lease.applicantId) .then(function (response) { $scope.lease.unitId = "Select A Unit"; $scope.lease.applicantId = "Select An Applicant"; $scope.getAllApplications(); $scope.getAllUnits(); alert("Your lease was created successfully."); $location.path("/leasing"); }, function (data) { alert("There was an error creating your lease."); }); }; }]);<file_sep>/web/js/app.js // Application Module var ekurhulenihackathon = angular.module('ekurhulenihackathon', [ 'ngRoute', 'ngCookies' ]); // Configure Application ekurhulenihackathon.config(function ($routeProvider, $locationProvider) { $routeProvider .when('/', { templateUrl: 'views/home.html', controller: 'HomeController', access: { restricted: false } }) .when('/application/update', { templateUrl: 'views/update-application.html', controller: 'ApplicationController', access: { restricted: false } }) .when('/units', { templateUrl: 'views/list-units.html', controller: 'UnitController', access: { restricted: false } }) .when('/unit/create', { templateUrl: 'views/create-unit.html', controller: 'UnitController', access: { restricted: false } }) .when('/unit/update', { templateUrl: 'views/update-unit.html', controller: 'UnitController', access: { restricted: false } }) .when('/leasing', { templateUrl: 'views/list-leases.html', controller: 'LeaseController', access: { restricted: false } }) .when('/pitch', { templateUrl: 'views/pitch.html', controller: 'HomeController', access: { restricted: false } }); $locationProvider.html5Mode(true); });<file_sep>/web/js/services/leaseService.js angular.module('ekurhulenihackathon').factory('LeaseService', [ '$q', '$timeout', '$http', function ($q, $timeout, $http) { return { getAllLeases: function () { return $http.get('/api/lease'); }, getLeaseById: function (id) { return $http.get('/api/lease/' + id); }, updateLeaseById: function (id, data) { return $http.put('/api/lease/' + id, data); }, createLease: function (unitId, applicantId) { return $http.post('/api/lease?unitId=' + unitId + '&applicantId=' + applicantId); }, allocateLease: function(id){ return $http.get('/api/lease/allocate/' + id); } }; }]);<file_sep>/cloud/models/unit.js var mongoose = require('mongoose'); module.exports = mongoose.model('Unit', new mongoose.Schema({ Type: { type: String, default: 'Simple' }, Address: { type: String, default: '' }, Size: { type: Number, default: 0 }, Occupants: { type: Number, default: 0 }, Rent: { type: Number, default: 0 }, Status: { type: String, default: 'Vacant' }, Occupant: { type: mongoose.Schema.Types.ObjectId, ref: 'Application' }, CreatedOn: { type: Date, default: Date.now } }));<file_sep>/cloud/controllers/lease.js var request = require('request'); var util = require('util'); var CRUD = require('../utils/crud'); var Lease = require('../models/lease'); var Application = require('../models/application'); var Unit = require('../models/unit'); module.exports = function (app, io) { /** * Create new Lease */ app.post('/api/lease', function (req, res) { // Object to be persisted to the database var createObject = { Unit: req.query.unitId, Applicant: req.query.applicantId, Status: 'Allocated' }; CRUD().update(Application, { _id: req.query.applicantId }, { Status: 'Allocated' }, function (success) { CRUD().update(Unit, { _id: req.query.unitId }, { Status: 'Occupied' }, function (success) { CRUD().create(Lease, createObject, function (success) { var findObject = { _id: success.Applicant }; CRUD().findOne(Application, findObject, function (success) { request("http://api.panaceamobile.com/json?action=message_send&username=" + process.env.PANACEA_USERNAME + "&password=" + <PASSWORD>.<PASSWORD> + "&to=" + success.MSISDN + "&text=Congratulations you have just been allocated housing by the Ekurhuleni Housing Settlement Initiative. We look forward to your new journey and a beautiful home with your family! One of our representatives will be in contact shortly :)&from=27726422105&auto_detect_encoding=1", function (error, response, body) { if (!error && response.statusCode == 200) { console.log(response); } else { console.log(response); } }); io.emit('lease create', success); res.json(success); }, function (error) { res.json(error); }); }, function (error) { res.json(error); }); }, function (error) { res.json(error); }); }, function (error) { res.json(error); }); }); /** * Retrieve All Leases */ app.get('/api/lease', function (req, res) { CRUD().findAll(Lease, {}, 'asc', req.params.take, req.params.skip, function (success) { res.json(success); }, function (error) { res.json(error); }); }); /** * Retrieve Single Lease */ app.get('/api/lease/:id', function (req, res) { // Find an object based on the following properties var findObject = { _id: req.params.id }; CRUD().findOne(Lease, findObject, function (success) { res.json(success); }, function (error) { res.json(error); }); }); /** * Update Existing Lease */ app.put('/api/lease/:id', function (req, res) { // Details to be updated in the database var updateObject = { Unit: req.body.Unit, Applicant: req.body.Applicant, Status: req.body.Status, LeaseAgreement: req.body.LeaseAgreement }; // The parameters the find will be based on var findObject = { _id: req.params.id }; CRUD().update(Lease, findObject, updateObject, function (success) { res.json(success); }, function (error) { res.json(error); }); }); /** * Update Existing Lease */ app.get('/api/lease/allocate/:id', function (req, res) { // Details to be updated in the database var updateObject = { Status: "Allocated", }; // The parameters the find will be based on var findObject = { _id: req.params.id }; CRUD().update(Lease, findObject, updateObject, function (success) { res.json(success); }, function (error) { res.json(error); }); }); };<file_sep>/web/js/controllers/applicationController.js angular.module('ekurhulenihackathon').controller('ApplicationController', [ '$scope', '$location', '$filter', '$routeParams', 'ApplicationService', function ($scope, $location, $filter, $routeParams, ApplicationService) { $scope.application = {}; $scope.getApplicationById = function () { $scope.error = false; $scope.disabled = true; ApplicationService.getApplicationById($routeParams.id) .then(function (response) { if (response.data) { $scope.application = response.data; } }, function (data) { }); }; $scope.updateApplicationById = function () { ApplicationService.updateApplicationById($routeParams.id, $scope.application) .then(function (response) { alert("Your application was updated successfully."); }, function (data) { alert("There was an error updating your application."); }); }; }]);<file_sep>/cloud/controllers/unit.js var request = require('request'); var util = require('util'); var CRUD = require('../utils/crud'); var Unit = require('../models/unit'); module.exports = function (app, io) { /** * Create new Unit */ app.post('/api/unit', function (req, res) { // Object to be persisted to the database var createObject = { Type: req.body.Type, Address: req.body.Address, Size: req.body.Size, Occupants: req.body.Occupants, Rent: req.body.Rent, ContractExpiration: req.body.ContractExpiration }; CRUD().create(Unit, createObject, function (success) { io.emit('unit create', success); res.json(success); }, function (error) { res.json(error); }); }); /** * Retrieve All Units */ app.get('/api/unit', function (req, res) { CRUD().findAll(Unit, {}, 'asc', req.params.take, req.params.skip, function (success) { res.json(success); }, function (error) { res.json(error); }); }); /** * Retrieve Single Unit */ app.get('/api/unit/:id', function (req, res) { // Find an object based on the following properties var findObject = { _id: req.params.id }; CRUD().findOne(Unit, findObject, function (success) { res.json(success); }, function (error) { res.json(error); }); }); /** * Update Existing Unit */ app.put('/api/unit/:id', function (req, res) { // Details to be updated in the database var updateObject = { Type: req.body.Type, Address: req.body.Address, Size: req.body.Size, Occupants: req.body.Occupants, Rent: req.body.Rent, ContractExpiration: req.body.ContractExpiration, Status: req.body.Status, Occupant: req.body.Occupant, }; // The parameters the find will be based on var findObject = { _id: req.params.id }; CRUD().update(Unit, findObject, updateObject, function (success) { res.json(success); }, function (error) { res.json(error); }); }); };
7b0ab4ac584b3c6ad3b284b59618f787236d1c14
[ "JavaScript", "Markdown" ]
10
JavaScript
MaziMuhlari/ekurhuleni-hackathon
da6bfc40a72107553f5c2564b4cec31d2ed8d292
7df7040cadd8390643c1fa9a0af6ed4b9e52764e
refs/heads/master
<repo_name>AkankshaMishra297/crud-application-using-spring-MVC<file_sep>/springMVC1/src/main/java/form/text/field/ReservationForm.java package form.text.field; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ModelAttribute; @RequestMapping("/reservationForm") @Controller public class ReservationForm { @RequestMapping("/reserveForm") public String book(Model model) { Reservation res=new Reservation(); model.addAttribute("reservation",res); return "ReForm"; } @RequestMapping("/submitForm") public String submitForm(@ModelAttribute("reservation") Reservation res) { return "submitForm"; } } <file_sep>/springMVC1/src/main/java/springJdbc/AppRun.java package springJdbc; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class AppRun { public static void main(String[] args) { // TODO Auto-generated method stub ApplicationContext context=new ClassPathXmlApplicationContext("abcd1.xml"); EmpDAO e=(EmpDAO) context.getBean("dao"); e.create11(); } }
2067773b363d95d073691b5f184ab9f71b052cc6
[ "Java" ]
2
Java
AkankshaMishra297/crud-application-using-spring-MVC
a09e0111e5838feaadd24e0a7c3d963e8b662633
1f512df0a943f717ecd67ff282a8a9ba7231d256
refs/heads/main
<file_sep>using System.Collections; using System.Collections.Generic; using UnityEngine; public class VelocityDamper : MonoBehaviour { private Vector3 ballVel; private float velFactor; // Start is called before the first frame update void Start() { if (CompareTag("UpperDamper")) // adj vel damping depending on location of back panel { velFactor = 0.3f; // upper panel damping } else { velFactor = 0.1f; // sweet spot strike zone damping } } private void OnTriggerEnter(Collider collider) { //GameObject gameObject = collider.gameObject; if (collider.GetComponent<SphereCollider>() != null) // obj must have sphere collider, ie. is a ball { Rigidbody rb = collider.GetComponent<Collider>().attachedRigidbody; // note special method to get rigidbody from collider ballVel = rb.velocity; //Debug.Log("in vel = " + rb.velocity.x + " , " + rb.velocity.y + " , " + rb.velocity.z); //rb.velocity = new Vector3(ballVel.x, ballVel.y * velFactor, (float)ballVel.z * velFactor); rb.velocity = rb.velocity * velFactor; //Debug.Log("out vel = " + rb.velocity.x + " , " + rb.velocity.y + " , " + rb.velocity.z); } } } <file_sep>using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class ScoreManager : MonoBehaviour { public int totalScore; public Text scoreText; private AudioSource cheers; public AudioClip[] clips; // collection of clips for applause private int audioIndex; static int hitCount; // must hit two score areas inside the net before it is a real hit; this prevents ball just hitting one score area from outside net // this var is static so that all(both) score areas share the same var private void Start() { hitCount = 0; totalScore = 0; UpdateScoreText(); //cheers = GetComponent<AudioSource>(); cheers = gameObject.AddComponent<AudioSource>(); //clips = GetComponent<AudioClip>(); //audioIndex = 0; } void OnTriggerEnter(Collider gameObj) { if (gameObj.GetComponent<SphereCollider>()!=null) // obj must have sphere collider, ie. is a ball { if (hitCount >0) // one score area has already been hit; this would be second one, therefore real hit { audioIndex = Random.Range(0, clips.Length); cheers.clip = clips[audioIndex]; //cheers.clip = clips; cheers.Play(); totalScore++; UpdateScoreText(); Debug.Log("hitcount= " + hitCount); hitCount = 0; //Debug.Log("score: "+ totalScore); } else hitCount++; } } void UpdateScoreText() { scoreText.text = "SCORE: " + totalScore; } } <file_sep>using System; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; [Serializable] public class MoveInputEvent : UnityEvent<float, float> { } public class InputController : MonoBehaviour { NewControls newControls; private void Awake() { newControls = new NewControls(); } private void OnEnable() { newControls.Gameplay.Enable(); newControls.Gameplay.Look.performed += OnLookPerformed; } private void OnLookPerformed(InputAction.CallbackContext context) { throw new NotImplementedException(); } } <file_sep>using System.Collections; using System.Collections.Generic; using UnityEngine; public class BackBoardCollide : MonoBehaviour { AudioSource boardHit; // Start is called before the first frame update void Start() { boardHit = GetComponent<AudioSource>(); } private void OnCollisionEnter(Collision collision) { foreach (var contact in collision.contacts) { boardHit.Play(); } } } <file_sep>using System.Collections; using System.Collections.Generic; using UnityEngine; // change wind speed using keyboard public class WindAdjust : MonoBehaviour { public float windSpeed; public Material grassMat; // this references the material to which this shadergraph applies; // note: must define this in Inspector public float delWindSpeed; // incremental change to wind speed //public float minWindSpeed; public float maxWindSpeed; // Start is called before the first frame update void Start() { Debug.Log("start console log"); windSpeed = (float)0.2; grassMat.SetFloat("Vector1_44D5ED92",windSpeed); delWindSpeed = (float)0.1; maxWindSpeed = (float)2.0; } // Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.LeftArrow) && (windSpeed>delWindSpeed)) { windSpeed -= delWindSpeed; grassMat.SetFloat("Vector1_44D5ED92", windSpeed); Debug.Log("speed minus"); } //if (Input.GetKeyDown(KeyCode.RightArrow) && (windSpeed < maxWindSpeed)) if (Input.GetKeyDown(KeyCode.Space) ) { windSpeed += delWindSpeed; grassMat.SetFloat("Vector1_44D5ED92", windSpeed); Debug.Log("speed add"); } } } <file_sep>using System; using System.Collections; using System.Collections.Generic; using System.Runtime.CompilerServices; using UnityEngine; public class CreateGameObj : MonoBehaviour { public KeyCode redKey; // 'S' key : switch to red Material public KeyCode invisKey; // 'H' key : switch to invis Material public KeyCode tiltKey; // 'T' key : tilt the ring public float ringDiameter; public int ringTotal; // total number of cylinders forming the ring of diameter ringDiameter public float cylinderLength; // how long is each cylinder public float cylinderWidth; // the width of the cylinder; cylinder cross secion should be kept to circular, so x and z scale must be kept to same public GameObject parentRing; GameObject cubeObj; Material darkBlue; Material brightRedMat; Material invisMat; // Start is called before the first frame update void Start() { // ****** Note all Materials referenced must be placed in Resources folder, else they will not be found invisMat = Resources.Load("Invisible", typeof(Material)) as Material; brightRedMat = Resources.Load("Bright red", typeof(Material)) as Material; darkBlue = Resources.Load("DarkBlu", typeof(Material)) as Material; CreateCubeObj(); CreateRingSeries(); //cylinderLength = ((float)Math.PI * ringDiameter)/ringTotal; // each cylinder of length 2*Pi*R/ringTotal //cylinderLength *= 100; Debug.Log("cyl length:" + cylinderLength); } private void CreateRingSeries() { float delAng = 2.0f * (float)Math.PI /ringTotal; // divide up 2*PI into ringTotal of slices each of delAng float ringRadius = ringDiameter / 2.0f; float nowAng; float tmpAng; float deg2Rad = 180.0f / (float)Math.PI; // deg to radian for (int i = 0; i < ringTotal; i++) { nowAng = i * delAng; float x = ringRadius * (float)Math.Sin(nowAng); float z = ringRadius * (float)Math.Cos(nowAng); float h = 2.0f; GameObject cyl = GameObject.CreatePrimitive(PrimitiveType.Cylinder); //cyl.transform.parent = parentRing.transform; cyl.transform.localPosition = new Vector3(x, h, z); cyl.transform.localScale = new Vector3(cylinderWidth, cylinderLength, cylinderWidth); tmpAng = 90.0f + nowAng * deg2Rad; /* if (i<=10) { Debug.Log("i =" + i + " x:" + x + " h:" + h + " z:" + z); } */ //Debug.Log(i+" angle:" + tmpAng); /* 1. Cylinder after rotation along x direction is now parallel to ground and aligned with the z-axis 2. We first rotate cylinder by 90 deg to get it to be perpendicular to the radius, then we increment this successivly along the whole circle */ cyl.transform.Rotate(90.0f, tmpAng, 0, Space.World); // rotate 90 deg along x axis so that parallel to plane, then reorient based on current position cyl.GetComponent<Renderer>().material = brightRedMat; cyl.transform.parent = parentRing.transform; // set all the cylinders to have a single parent so that one can just rotate the parent if desired } } private void RotateRing(float angle) { parentRing.transform.Rotate(0, 0, angle, Space.Self); } private void CreateCubeObj() { cubeObj = GameObject.CreatePrimitive(PrimitiveType.Cube); cubeObj.transform.localScale = new Vector3(0.5f, 2.0f, 0.5f); cubeObj.transform.localPosition = new Vector3(0, 3, 0); cubeObj.name = "Script Cube"; cubeObj.GetComponent<MeshRenderer>().material =darkBlue; cubeObj.GetComponent<Renderer>().material.color = new Color(255, 0, 0); } private void FixedUpdate() { if (Input.GetKey(redKey)) { cubeObj.GetComponent<Renderer>().material = brightRedMat; } if (Input.GetKey(invisKey)) { cubeObj.GetComponent<Renderer>().material = invisMat; } if (Input.GetKey(tiltKey)) { RotateRing(30.0f); } } } <file_sep>using System.Collections; using System.Collections.Generic; using UnityEngine; public class NewwBallScript : MonoBehaviour { public GameObject netSupport; private Vector3 pos; private float netPostPosX = 0.9f; // x position of the center post of netSupport public void ResetPos() { transform.GetComponent<Rigidbody>().useGravity = false; // resetball to enable ball to float in air transform.GetComponent<Rigidbody>().velocity = Vector3.zero; // reset to zero velocity as ball might be still rolling transform.GetComponent<Rigidbody>().angularVelocity = Vector3.zero; //Debug.Log("netSupport x = " + netSupport.transform.position.x); pos.x = netPostPosX + Random.Range(-0.9f, 0.9f); //pos.y = netSupport.transform.position.y + Random.Range(-0.5f, 0.5f); // reference netsupport height to set ball height //Debug.Log("ball height rel to net support = " + pos.y); pos.y = Random.Range(2.1f, 2.35f); pos.z = 3.9f; //pos.z = 4.3f; //pos.z = 4.5f; //pos.z = Random.Range(5.0f, 7.5f); //pos.z = 7.5f; transform.position = pos; Debug.Log("ball pos : " + pos.x + " , " + pos.y + " , " + pos.z); } public void ResetPos(Vector3 newPos) { transform.GetComponent<Rigidbody>().useGravity = false; // resetball to enable ball to float in air transform.GetComponent<Rigidbody>().velocity = new Vector3(0, 0, 0); // reset to zero velocity as ball might be still rolling transform.position = newPos; Debug.Log("ball pos : " + pos.x + " , " + pos.y + " , " + pos.z); } } <file_sep>using System.Collections; using System.Collections.Generic; using UnityEngine; public class Testfloormat : MonoBehaviour { //public Material floorMat; // Start is called before the first frame update void Start() { Debug.Log("floor here"); } } <file_sep>using System.Collections; using System.Collections.Generic; using UnityEngine; public class HideShowScript : MonoBehaviour { public GameObject ball; public KeyCode displayBall; // use Key 'D' for display public Vector3 initBallPos; // Start is called before the first frame update void Start() { ball.SetActive(false); // hide the basketball initially ball.transform.localPosition = initBallPos; } void FixedUpdate() { if (Input.GetKey(displayBall)) { ball.SetActive(true); } } } <file_sep>using UnityEngine.Audio; using System; using UnityEngine; public class AudioManager : MonoBehaviour { public Sound[] sounds; // Start is called before the first frame update void Start() { int i = 0; foreach (Sound s in sounds) { s.source = gameObject.GetComponent<AudioSource>(); if (s.source==null) { Debug.LogWarning("no source"); return; } s.source.clip = s.clip; s.source.volume = s.volume; s.source.pitch = s.pitch; Debug.Log("adding sound "+i++); Play("NetHit"); } } private void nnStart() { Play("NetHit"); } public void Play(string name) { Sound s= Array.Find(sounds, sound => sound.name == name); if (s==null) { Debug.LogWarning("Sound name not found"); return; } s.source.Play(); } } <file_sep>using System; using UnityEngine; using UnityEngine.Tilemaps; // This script should be a component of the LineDrawer GameObject public class ForceVector : MonoBehaviour { private LineRenderer lineTracer; // must hv a gameobject that contains a LineRenderer private Vector3 mousePos; // current mouse position in world space private Vector3 nowPos; // current mouse position as mouse is being moved private float lineLength; // how long is the line private float lineAngle = 0; // angle drawn line makes with respect to object clicked private float lineAngleDeg; private Vector3 linePos_1; private Vector3 linePos_0; private float radian2Degree = 180.0f / (float)Math.PI; private float zOffset; // camera is pointing along x axis from +x towards -x direction private RaycastHit hitData; private Ray ray; public GameObject basketBall; // need reference to ball in order to launch, can also search by tag name private Vector3 bBallPos; // location of basketball, needed to get reference to netSupport public GameObject netSupport; // the whole supporting structure for basketball hoop and net private Vector3 supportPos; // location of net support so that basketball will always be thrown at it public float forceFactor; // force is proportional to the length of line drawn, and this is the proportionality factor string tagObjName; private Vector3 ballForce; private float offSetAngle; // angle from ball to hoop panel; this will allow the ball to always be thrown in direction of hoop // Start is called before the first frame update void nnStart() { lineTracer = GetComponent<LineRenderer>(); // Get the LineRenderer component that is part of the LineDrawer gameObject lineTracer.positionCount = 2; // enable only 2 points to define line; thus straight line lineTracer.startWidth = 0.01f; lineTracer.endWidth = 0.0001f; //lineTracer.textureMode zOffset = Camera.main.nearClipPlane; // must shift mouse z position by this offset else nothing will be seen tagObjName = "TestBall"; lineTracer.enabled = false; supportPos = netSupport.transform.position; // net position in world coord //zOffset = Camera.main.farClipPlane; // does not work with far clipPlane } // Update is called once per frame void nnUpdate() { if (Input.GetMouseButtonDown(0)) // when left mouse button is pressed down { mousePos = Input.mousePosition; ray = Camera.main.ScreenPointToRay(mousePos); // check if specific gameObj is hit before allowing line drawing if ((Physics.Raycast(ray, out hitData, 300)) && (hitData.transform.tag == tagObjName)) // ** Raycast distance initially at 1000, now try 300 to make faster { lineTracer.enabled = true; mousePos.z = zOffset; nowPos = Camera.main.ScreenToWorldPoint(mousePos); Debug.Log("start mouse position: " + "x: " + nowPos.x + " y: " + nowPos.y + " z: " + nowPos.z); lineTracer.SetPosition(0, nowPos); } } if ((Input.GetMouseButton(0)) && lineTracer.enabled) // when left mouse remains pressed { mousePos = Input.mousePosition; mousePos.z = zOffset; nowPos = Camera.main.ScreenToWorldPoint(mousePos); lineTracer.SetPosition(1, nowPos); } if ((Input.GetMouseButtonUp(0)) && lineTracer.enabled) { linePos_1 = lineTracer.GetPosition(1); linePos_0 = lineTracer.GetPosition(0); lineLength = (linePos_1 - linePos_0).magnitude; // linelength represents the magniture of the thrown force if (linePos_1.z != linePos_0.z) // make sure we do not divide by zero { lineAngle = Mathf.Atan2((linePos_1.y - linePos_0.y), (linePos_1.z - linePos_0.z)); // line is drawn on y-z plane } else //angle is along +y or -y direction { if ((linePos_1.y - linePos_0.y) >= 0) { lineAngle = (float)Math.PI / 4.0f; } else { lineAngle = -3.0f * (float)Math.PI / 4.0f; } } lineAngleDeg = lineAngle * radian2Degree; lineTracer.enabled = false; // hide drawn line Debug.Log("line length: " + lineLength + " ; line Angle degree:" + lineAngle); // make sure ball is always thrown in direction of the net. Therefore need offset angle between ball and net on the x-z plane // make sure we do not divide by zero bBallPos = basketBall.transform.position; //Debug.Log("lineDrawer ball pos : " + bBallPos.x + " , " + bBallPos.y + " , " + bBallPos.z); if (bBallPos.y != supportPos.y) { offSetAngle = (float)Math.Atan2((bBallPos.y - supportPos.y), (bBallPos.y - supportPos.y)); } else offSetAngle = 0; //now launch ball based on line length and direction Rigidbody rb = basketBall.GetComponent<Rigidbody>(); //ballForce.y = -lineLength * (float)Math.Sin(lineAngle) * forceFactor; ballForce.y = -(lineLength / (float)Math.Cos(offSetAngle))*forceFactor; // this approx force in y direction by taking screen-drawn forceVector as the cosine of the total force vector //following represents Approach A (see LineDrawer documention; this seems to work fine ballForce.x = -lineLength * (float)Math.Cos(lineAngle) * forceFactor; ballForce.z = -lineLength * (float)Math.Sin(lineAngle) * forceFactor; //Debug.Log("ball force:"+" x: "+ ballForce.x +" y: "+ ballForce.y + " z : "+ ballForce.z); rb.useGravity = true; rb.AddForce(ballForce, ForceMode.Impulse); //lineTracer.GetPosition(1) } } } <file_sep>using System; using System.Collections; using System.Collections.Generic; using Unity.Collections.LowLevel.Unsafe; using UnityEditor.Experimental.GraphView; using UnityEngine; using UnityEngine.Tilemaps; // This script should be a component of the LineDrawer GameObject public class LineDrawer : MonoBehaviour { private LineRenderer lineTracer; // must hv a gameobject that contains a LineRenderer private Vector3 mousePos; // current mouse position in world space private Vector3 nowPos; // current mouse position as mouse is being moved private float lineLength; // how long is the line private float lineAngle = 0; // angle drawn line makes with respect to object clicked private float lineAngleDeg; private Vector3 linePos_1; private Vector3 linePos_0; private float radian2Degree = 180.0f / (float)Math.PI; //private float deg2Radian = (float)Math.PI / 180.0f; private float zOffset; private float zOffsetAdj; // further increase zOffset to make actionLine more visible private RaycastHit hitData; private Ray ray; public GameObject basketBall; // need reference to ball in order to launch, can also search by tag name private Vector3 bBallPos; // location of basketball, needed to get reference to netSupport public GameObject netSupport; // the whole supporting structure for basketball hoop and net private Vector3 supportPos; // location of net support so that basketball will always be thrown at it //private float netSupportHeightAdj; // make the net appear taller to make a larger tilt angle public float forceFactor; // force is proportional to the length of line drawn, and this is the proportionality factor private Vector3 forceFactorVector; string tagObjName; private Vector3 ballForce; private float tiltAngle; // angle from ball to hoop panel; this will allow the ball to always be thrown in direction of hoop public float slantAngleDeg; // for testing only; normal use lineAngle instead // Start is called before the first frame update void Start() { lineTracer = GetComponent<LineRenderer>(); // Get the LineRenderer component that is part of the LineDrawer gameObject lineTracer.positionCount = 2; // enable only 2 points to define line; thus straight line lineTracer.startWidth = 0.01f; lineTracer.endWidth = 0.0001f; zOffsetAdj = 0.3f; // adding to camera near clipplane focal length to make lineRenderer draw better //lineTracer.textureMode zOffset= Camera.main.nearClipPlane; // must shift mouse z position by this offset else nothing will be seen zOffset += zOffsetAdj; // Note: z position of the clipping plane determines whether action line can be seen or not, so this must be tuned //netSupportHeightAdj = 0.9f; // adj by trial and error! tagObjName = "TestBall"; lineTracer.enabled = false; supportPos = netSupport.transform.position; bBallPos = basketBall.transform.localPosition; forceFactorVector = new Vector3(1.0f, 2.7f, 0.7f); //Debug.Log("ball Pos(x,y,z)= " + bBallPos.x + " , " + bBallPos.y + " , " + bBallPos.z); //slantAngle = slantAngleDeg * deg2Radian; // angle between ball and hoop //supportPos = netSupport.transform.localPosition; //zOffset = Camera.main.farClipPlane; // does not work with far clipPlane } // Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) // when left mouse button is pressed down { mousePos = Input.mousePosition; ray = Camera.main.ScreenPointToRay(mousePos); // check if specific gameObj is hit before allowing line drawing if ((Physics.Raycast(ray, out hitData, 300)) && (hitData.transform.tag == tagObjName)) // ** Raycast distance initially at 1000, now try 300 to make faster { lineTracer.enabled = true; mousePos.z = zOffset; nowPos = Camera.main.ScreenToWorldPoint(mousePos); Debug.Log("linedrawer startpos: " + "x: " + nowPos.x + " y: " + nowPos.y + " z: " + nowPos.z); lineTracer.SetPosition(0, nowPos); } } if ((Input.GetMouseButton(0))&& lineTracer.enabled) // when left mouse remains pressed { mousePos = Input.mousePosition; mousePos.z = zOffset; nowPos = Camera.main.ScreenToWorldPoint(mousePos); Debug.Log("linedrawer endpos: " + "x: " + nowPos.x + " y: " + nowPos.y + " z: " + nowPos.z); lineTracer.SetPosition(1, nowPos); } if ((Input.GetMouseButtonUp(0)) && lineTracer.enabled) { linePos_1 = lineTracer.GetPosition(1); linePos_0 = lineTracer.GetPosition(0); //Debug.Log("linedrawer endpos: " + "x: " + linePos_1.x + " y: " + linePos_1.y + " z: " + linePos_1.z); lineLength = (linePos_1 - linePos_0).magnitude; // linelength represents the magniture of the thrown force Debug.Log("LineDrawer linelength = " + lineLength); // use bBallPos, specifically center of ball, to calculate angle if (linePos_1.x != linePos_0.x) // make sure we do not divide by zero { //lineAngle = Mathf.Atan2((linePos_1.y - linePos_0.y), (linePos_1.x - linePos_0.x)); //Debug.Log("linePos_1: x,y = " + linePos_1.x + " , " + linePos_1.y); //Debug.Log("linePos_0: x,y = " + linePos_0.x + " , " + linePos_0.y + " ** ballPos: x,y= " + bBallPos.x + " , " + bBallPos.y); //Debug.Log("LINE: arctan of y/x= " + (linePos_0.y - linePos_1.y) + " , " + (linePos_0.x - linePos_1.x)); //Debug.Log("BALL; arctan of y/x= " + (bBallPos.y - linePos_1.y) + " , " + (bBallPos.x - linePos_1.x)); lineAngle = Mathf.Atan2((linePos_0.y - linePos_1.y), (linePos_0.x - linePos_1.x)); // use linePos1 as the reference for angle //Debug.Log("lineAngle relative to line (in deg) = " + lineAngle * radian2Degree); //lineAngle = Mathf.Atan2((Math.Abs(bBallPos.y - linePos_1.y)), (Math.Abs(bBallPos.x - linePos_1.x))); // reference center of ball rather than linePos_1 to get more accurate angle //Debug.Log("lineAngle relative to BALL (in deg) = " + lineAngle * radian2Degree); //lineAngle *= 1.1f; } else //angle is along +y or -y direction { lineAngle = 0; } Debug.Log("LineDrawer lineAngle (in deg) = " + lineAngle * radian2Degree); if (bBallPos.y != supportPos.y) { //supportPos.y += netSupportHeightAdj; // raise the support y arbitrarily to get a bigger tilt angle //tiltAngle = (float)Math.Atan2((bBallPos.x - supportPos.x), (bBallPos.z - supportPos.z)); Debug.Log("ball, support y pos = " + bBallPos.y + " , " + supportPos.y); //tiltAngle = (float)Math.Atan2((bBallPos.y - supportPos.y), (bBallPos.z - supportPos.z)); tiltAngle = (float)Math.Atan2((supportPos.y-bBallPos.y), (supportPos.z- bBallPos.z)); Debug.Log(" tilt angle y/z = " + (supportPos.y - bBallPos.y) + " , " + (supportPos.z - bBallPos.z)); } else tiltAngle = 0; Debug.Log("LineDrawer tiltAngle (in deg) = " + tiltAngle*radian2Degree); /* { if ((linePos_1.y - linePos_0.y)>=0) { lineAngle = (float)Math.PI / 4.0f; }else { lineAngle = -3.0f*(float)Math.PI / 4.0f; } } */ lineAngleDeg = lineAngle*radian2Degree; lineTracer.enabled = false; // hide drawn line //Debug.Log("line length not used : " + lineLength + " ; line Angle degree:" + lineAngle); // make sure ball is always thrown in direction of the net. Therefore need offset angle between ball and net on the x-z plane // make sure we do not divide by zero bBallPos = basketBall.transform.position; //Debug.Log("lineDrawer ball pos : " + bBallPos.x + " , " + bBallPos.y + " , " + bBallPos.z); //now launch ball based on line length and direction Rigidbody rb = basketBall.GetComponent<Rigidbody>(); ballForce.y = lineLength * (float)Math.Sin(tiltAngle) * forceFactor* forceFactorVector.y; /* ballForce.x = lineLength * (float)Math.Cos(slantAngle) * forceFactor; ballForce.z = lineLength * (float)Math.Sin(slantAngle) * forceFactor; */ ballForce.x = lineLength * (float)Math.Cos(lineAngle) * forceFactor*forceFactorVector.x; ballForce.z = lineLength * (float)Math.Sin(lineAngle) * forceFactor * forceFactorVector.z; rb.useGravity = true; rb.AddForce(ballForce, ForceMode.Impulse); //ballForce.x = lineLength * (float)Math.Sin(slantAngle) * forceFactor; //ballForce.z = lineLength * (float)Math.Cos(slantAngle) * forceFactor; /* ballForce.x = lineLength * (float)Math.Sin(lineAngle) * forceFactor; ballForce.z = lineLength * (float)Math.Cos(lineAngle) * forceFactor; */ //ballForce.y = -lineLength * (float)Math.Sin(lineAngle) * forceFactor; /* ballForce.y = -lineLength * (float)Math.Sin(tiltAngle) * forceFactor; ballForce.x = -lineLength * (float)Math.Sin(lineAngle)* forceFactor; ballForce.z = -lineLength * (float)Math.Cos(lineAngle)* forceFactor; */ } } } <file_sep>using UnityEngine.Audio; using UnityEngine; public class BallCollide : MonoBehaviour { //public AudioManager audiioManager; AudioSource netHit; void Start() { netHit = GetComponent<AudioSource>(); } private void OnCollisionEnter(Collision collision) { //int i = 0; //audiioManager.Play("NetHit"); foreach (var contact in collision.contacts) { //sounds.Play(); netHit.Play(); //audiioManager.Play("NetHit"); //Debug.Log("hitch contact hit "); } } } <file_sep>using System.Collections; using System.Collections.Generic; using UnityEngine; public class GamePlayManage : MonoBehaviour { public GameObject ballObj; public KeyCode resetKey; public Camera[] netcams; private Vector3 tmpPos; private Camera activeCam; private int camIndex; private void Start() { foreach (Camera c in netcams) // disable all netcams to start { c.enabled = false; } activeCam = null; ballObj.GetComponent<Rigidbody>().useGravity = false; // ball has no gravity initially } public void TurnOnNetCam() { if (activeCam!=null) { activeCam.enabled = false; // disable previous active cam, else it is still active } camIndex = Random.Range(0, netcams.Length); // now turn on a new active cam //camIndex = 2; // for testing only activeCam = netcams[camIndex]; activeCam.enabled = true; } void Update() { if (Input.GetKeyUp(resetKey)) { if (activeCam != null) { activeCam.enabled = false; // disable previous active cam, else it is still active } //activeCam.enabled = false; ballObj.GetComponent<BallScript>().ResetPos(); // Get ball to reset to a new position //Debug.Log("GameManage ball pos : " + tmpPos.x + " , " + tmpPos.y + " , " + tmpPos.z); } } /* void Update() // for testing purpose, limit the choice of new position to just 3, and feed position to ball's ResetPos { if (Input.GetKeyUp(resetKey)) { posIndex++; if (posIndex == 2) posIndex = 0; ballObj.GetComponent<BallScript>().ResetPos(ballPos[posIndex]); tmpPos = ballObj.transform.position; Debug.Log("GameManage ball pos : " + tmpPos.x + " , " + tmpPos.y + " , " + tmpPos.z); } } */ } <file_sep>using System.Collections; using System.Collections.Generic; using UnityEngine; public class StrikeZoneScript : MonoBehaviour { //public Camera netcam; public GamePlayManage gameManager; void OnTriggerEnter(Collider gameObj) { if (gameObj.GetComponent<SphereCollider>() != null) // obj must have sphere collider, ie. is a ball { //netcam.enabled = true; gameManager.TurnOnNetCam(); //Debug.Log("enter strike zone"); } } } <file_sep>using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; [RequireComponent(typeof(TextMeshPro))] public class TypeWriter : MonoBehaviour { TextMeshPro _textMesh; public string[] _textCharacter; // Start is called before the first frame update void Start() { _textMesh = GetComponent<TextMeshPro>(); _textCharacter = new string[_textMesh.text.Length]; for (int i = 0; i < _textMesh.text.Length; i++) { _textCharacter[i] = _textMesh.text.Substring(i, 1); } _textMesh.text = ""; } // Update is called once per frame void Update() { } }
8d2a1dd925087e4e1840ccdaae38481caccac22f
[ "C#" ]
16
C#
imintsao/NewCityEnviroURP
40cddc187c0040fd04a24e1640335e014ae8cacc
a5aef87aa892685fd0a1db1a8e291785a1220405
refs/heads/main
<repo_name>Benaiah-Varner-LambdaProjects/webtesting-i-challenge<file_sep>/enhancing/enhancer.spec.js const enhancer = require('./enhancer.js'); // test away! it('works', () => { expect(1).toBe(1) }) it('exists', () => { expect(enhancer).toBeDefined() }) describe('enhancer success', () => { let item beforeEach(() => { item = { name: "sword", enhancement: 0, durability: 0 } }) test('item', () => { expect(item.durability).toBe(0) }) test('enhancer has a success function', () => { expect(enhancer.success).toBeDefined() }) test('success function returns items enhancement', () => { const expected = 1 const actual = enhancer.success(item) expect(actual).toBe(expected) }) test('success function adds 1 enhancement to item', () => { expect(item.enhancement).toBe(0) enhancer.success(item) expect(item.enhancement).toBe(1) enhancer.success(item) expect(item.enhancement).toBe(2) }) }) describe('enhancer fail', () => { let item, item2, item3 beforeEach(() => { item = { name: "sword", enhancement: 0, durability: 100} item2 = { name: "gun", enhancement: 15, durability: 100 } item3 = { name: "dragon", enhancement: 20, durability: 100 } }) it('fails exists', () => { expect(enhancer.fail).toBeDefined() }) it('subtracts 5 from durability when enhancement less than 15', () => { expect(item.durability).toBe(100) enhancer.fail(item) expect(item.durability).toBe(95) }) it('subtracts 10 durability if enhancement is greater than or equal to 15', () => { expect(item2.durability).toBe(100) enhancer.fail(item2) expect(item2.durability).toBe(90) }) it('subtracts 1 enhancement when enhancement is greater than 16', () =>{ expect(item3.enhancement).toBe(20) enhancer.fail(item3) expect(item3.enhancement).toBe(19) }) })
0ee70f294d0d34444aff457a872273e1e747363a
[ "JavaScript" ]
1
JavaScript
Benaiah-Varner-LambdaProjects/webtesting-i-challenge
47838819038cbeada9682d8d10fcc6a815733653
af27df06e6d4cff7ff759920031d2a823f4a8c11
refs/heads/master
<repo_name>gitter-badger/SamPRO-CMS<file_sep>/includes/core.php <?php ## ONT INCLUS NOS FICHIERS LES PLUS IMPORTANTS ## require_once('includes/config.php'); require_once('includes/sa-mp/samp_infos.php'); require_once('includes/sa-mp/SampQueryAPI.php'); ################################################# ?><file_sep>/includes/index.php <?php date_default_timezone_set("Europe/Paris"); require_once("libraries/TeamSpeak3/TeamSpeak3.php"); TeamSpeak3::init(); header('Content-Type: text/html; charset=utf8'); $status = "offline"; $count = 0; $max = 0; try { $ts3 = TeamSpeak3::factory("serverquery://serveradmin1:lRNAyClP@192.168.127.12:10011/?server_port=9987&use_offline_as_virtual=1&no_query_clients=1"); $status = $ts3->getProperty("virtualserver_status"); $count = $ts3->getProperty("virtualserver_clientsonline") - $ts3->getProperty("virtualserver_queryclientsonline"); $max = $ts3->getProperty("virtualserver_maxclients"); } catch (Exception $e) { echo '<div style="background-color:red; color:white; display:block; font-weight:bold;">QueryError: ' . $e->getCode() . ' ' . $e->getMessage() . '</div>'; } echo '<span class="ts3status">TS3 Server Status: ' . $status . '</span><br/><span class="ts3_clientcount">Clients online: ' . $count . '/' . $max . '</span>'; ?>
6ba77a82d1bbe5eac6c46d52ea53f2f730c5f3ac
[ "PHP" ]
2
PHP
gitter-badger/SamPRO-CMS
45304c4ec7c7788217e60a2973a9d0d07df7a87f
58dfe91de39ee0c464ea3bda4202e1d33eac750c
refs/heads/master
<repo_name>radhikarani17/chatvoice<file_sep>/voice-chatbot.py #Author <EMAIL> # this code works with python3.5 import random import datetime import webbrowser import pyttsx3 import wikipedia from pygame import mixer import speech_recognition as sr import pyowm #selectOne = 1 #selectTwo = 2 #selectThree = 3 #two = google #three = youtube #one = wikipedia some = 'xxxxx' seme = 'yyyyy' music = 'play' newRate = 110 engine = pyttsx3.init() voices = engine.getProperty('voice') #engine.setProperty('voice', voices[1].id) volume = engine.getProperty('volume') engine.setProperty('volume', 10.0) rate = engine.getProperty('rate') print (rate) print (volume) print (voices) #sample_rate = 48000 #chunk_size = 2048 engine.setProperty('rate', newRate) #print (rate) greetings = ['hello', 'hi', 'Hai', 'hey!', 'hey'] answers = ['hey i am Khan', 'hi i am Khan', 'Hai i am Khan'] question = ['How are you?', 'How are you doing?'] responses = ['Okay', "I'm fine"] var1 = ['who made you', 'who created you'] var2 = ['created by sumeer', 'sumeer'] var3 = ['what time is it', 'what is the time', 'time'] var4 = ['who are you', 'what is your name'] cmd1 = ['open browser', 'open Google'] maps = ['take' and 'me' and 'to'] music = 'play' cmd2 = ['play music', 'open music player'] cmd4 = ['open YouTube', 'I want to watch a video'] cmd5 = ['tell me the weather', 'weather', 'what about the weather'] cmd6 = ['exit', 'close', 'goodbye', 'nothing'] cmd7 = ['facebook', 'Facebook', 'open Facebook', 'Fb', 'fb', 'open FB', 'FB'] cmd8 = ['instagram','Instagram', 'open Instagram'] cmd3 = ['thank you'] repfr9 = ['youre welcome', 'glad i could help you'] #saidData = print(r.recognize_google(audio)) while True: now = datetime.datetime.now() r = sr.Recognizer() with sr.Microphone(device_index = 0, sample_rate = 48000, chunk_size = 2048) as source:#check for python3 -m sounddevices if problem aries in device_index r.adjust_for_ambient_noise(source); print ("Say Something"); audio = r.listen(source); try: print("You said:- " + r.recognize_google(audio)) except sr.UnknownValueError: print("Could not understand audio") engine.say('I didnt get that. Rerun the code') engine.runAndWait() saidData = 'r.recognize_google(audio)'; if r.recognize_google(audio) in greetings: random_greeting = random.choice(answers) print(random_greeting) engine.say(random_greeting) engine.runAndWait() elif r.recognize_google(audio) in question: engine.say('I am fine, how about you?') engine.runAndWait() print('I am fine, how about you?') elif r.recognize_google(audio) in var1: engine.say('I was made by sumeer') engine.runAndWait() reply = random.choice(var2) print(reply) elif r.recognize_google(audio) in cmd3: print(random.choice(repfr9)) engine.say(random.choice(repfr9)) engine.runAndWait() elif r.recognize_google(audio) in cmd2: mixer.init() mixer.music.load("song.wav") mixer.music.play(); elif r.recognize_google(audio) in var4: engine.say('my name is khan , i am a bot') engine.runAndWait() elif r.recognize_google(audio) in cmd7: webbrowser.open('http://www.facebook.com') elif r.recognize_google(audio) in cmd8: webbrowser.open('http://www.instagram.com') elif r.recognize_google(audio) in cmd4: webbrowser.open('http://www.youtube.com') elif r.recognize_google(audio) in cmd6: print('see you later') engine.say('see you later') engine.runAndWait() exit() elif r.recognize_google(audio) in cmd5: owm = pyowm.OWM('601a44c4523a544a4cdc0578cdc6721a') observation = owm.weather_at_place('Chennai, IN') observation_list = owm.weather_around_coords(13.0878, 80.2785) w = observation.get_weather() w.get_wind() w.get_humidity() w.get_temperature('celsius') print(w) print(w.get_wind()) print(w.get_humidity()) print(w.get_temperature('celsius')) engine.say(w.get_wind()) engine.runAndWait() engine.say('humidity') engine.runAndWait() engine.say(w.get_humidity()) engine.runAndWait() engine.say('temperature') engine.runAndWait() engine.say(w.get_temperature('celsius')) engine.runAndWait() elif r.recognize_google(audio) in var3: print("Current date and time : ") print(now.strftime("The time is %H:%M")) engine.say(now.strftime("The time is %H:%M")) engine.runAndWait(); elif r.recognize_google(audio) in cmd1: webbrowser.open('http://www.google.com') elif r.recognize_google(audio) == r.recognize_google(audio): words = r.recognize_google(audio).split(); if music in words: engine.say("opening song in youtube"); engine.runAndWait(); webbrowser.open_new('https://www.youtube.com/results?search_query=' + r.recognize_google(audio).lstrip(music)); elif 'take' and 'me' and 'to' in words: engine.say("opening maps"); engine.runAndWait(); webbrowser.open_new('https://www.google.co.in/maps/dir/13.0642874,80.275344/' + r.recognize_google(audio).split(" ",)[3]); else: engine.say("loading info please wait"); engine.runAndWait(); print(wikipedia.summary(r.recognize_google(audio))); engine.say(wikipedia.summary(r.recognize_google(audio))); engine.runAndWait(); engine.say("opening search in new tab"); engine.runAndWait(); webbrowser.open_new('http://www.google.com/search?q=' + r.recognize_google(audio)); <file_sep>/README.md # Chatbot simple voice chatbot designed for surfing ,play videos,direction purpose and weather.
50245cbf8f23a4ab3cd7af3173392fb4528b7dc6
[ "Markdown", "Python" ]
2
Python
radhikarani17/chatvoice
25e47a5b0c66e81fcd95bc1bce6659df544679a4
6fe8f96f7bc24babd0a4808428fec281071cd9d2
refs/heads/master
<file_sep>module.exports = function(grunt) { require('load-grunt-tasks')(grunt); var config = grunt.file.readYAML('Gruntconfig.yml') grunt.initConfig({ cssmin: { target: { files: [{ expand: true, cwd: config.cssDir, src: ['*.css', '!*.min.css'], dest: config.mincssDir, ext: '.min.css' }] } }, concat: { dist: { src: config.mincssDir+'*.min.css', dest: config.concatmincssDir+'min_concat.css' } }, connect: { server:{ port: 9000, hostname: 'localhost', base: ['.'], livereload: true } }, responsive_images: { dev: { options: { sizes: [{ width: 1600 , suffix: '_large_2x', quality:50 }, { width: 800 , suffix: '_medium_1x', quality:50 }, { aspectratio: false, width: 500, gravity: 'west', suffix: 'c' }] }, /* You don't need to change this part if you don't change the directory structure. */ files: [{ expand: true, src: ['*.{gif,jpg,png}'], cwd: config.imgDir, dest: config.imgReDir }] }, thumb:{ options: { sizes: [{ width: 750, quality:60 }, { width: 550, quality:60 }, { width: 350, quality:60 }] }, /* You don't need to change this part if you don't change the directory structure. */ files: [{ expand: true, src: ['*.{gif,jpg,png}'], cwd: config.imgThumb, dest: config.imgReDir }] } }, /* Clear out the images directory if it exists */ clean: { dev: { src: [config.imgDir], }, }, /* Generate the images directory if it is missing */ mkdir: { dev: { options: { create: [config.imgDir] }, }, }, /* Copy the "fixed" images that don't go through processing into the images/directory */ copy: { dev: { files: [{ expand: true, src: 'images_src/fixed/*.{gif,jpg,png}', dest: 'images/' }] }, }, watch: { options: { livereload: true, }, cssmin: { files: [config.cssDir + '*.css', config.cssDir + '!*.min.css'], tasks: ['cssmin'] }, concat: { files: [config.mincssDir + '*.min.css'], tasks: ['concat'] }, html:{ files: 'index.html', } } }); grunt.registerTask('default', [ 'cssmin', 'concat', 'connect', 'responsive_images', 'watch' ]); }; <file_sep>$('.navbar-nav').on('click','li',function(evt){ $('.active').toggleClass('active'); $(evt.target).parent().toggleClass('active'); }); $(document).on("click", ".navbar", function(e) { if ($(e.target).is("a") && $(e.target).attr("class") != "dropdown-toggle") { $(".navbar-collapse").collapse("hide"); } });
860016d085d72531c5939a7c532763640e509118
[ "JavaScript" ]
2
JavaScript
pranav9056/pranav9056.github.io
efdf984b83d0d4a7fc46f30a78942e9521415805
41e790efb5246ec8237cc931a463c18dad7722d4
refs/heads/master
<repo_name>skmuddamsetty/quiz-app<file_sep>/src/app/question-detail/question-detail.component.ts import { Component, OnInit, Input } from '@angular/core'; import { DataService } from '../data.service'; @Component({ selector: 'app-question-detail', templateUrl: './question-detail.component.html', styleUrls: ['./question-detail.component.css'] }) export class QuestionDetailComponent implements OnInit { @Input() question: string; @Input() options = []; questions = []; constructor(public dataService: DataService) {} ngOnInit() { console.log(this.options); } } <file_sep>/src/app/app.module.ts import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { HomeComponent } from './home/home.component'; import { HomeSignInComponent } from './home-sign-in/home-sign-in.component'; import { FormsModule } from '@angular/forms'; import { QuetionsComponent } from './quetions/quetions.component'; import { QuestionDetailComponent } from './question-detail/question-detail.component'; import { QuestionPaperComponent } from './question-paper/question-paper.component'; import { DataService } from './data.service'; import { WelcomeComponent } from './welcome/welcome.component'; @NgModule({ declarations: [ AppComponent, HomeComponent, HomeSignInComponent, QuetionsComponent, QuestionDetailComponent, QuestionPaperComponent, WelcomeComponent ], imports: [BrowserModule, FormsModule, AppRoutingModule], providers: [DataService], bootstrap: [AppComponent] }) export class AppModule {} <file_sep>/src/app/home-sign-in/home-sign-in.component.ts import { Component, OnInit } from '@angular/core'; import { NgForm } from '@angular/forms'; import { Router } from '@angular/router'; @Component({ selector: 'app-home-sign-in', templateUrl: './home-sign-in.component.html', styleUrls: ['./home-sign-in.component.scss'] }) export class HomeSignInComponent implements OnInit { constructor(public router: Router) {} ngOnInit() {} onSubmit(form: NgForm) { localStorage.setItem('username', form.value.email); // this.router.navigate(['/questions']); this.router.navigate(['/welcome']); } } <file_sep>/src/app/welcome/welcome.component.ts import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { DataService } from '../data.service'; @Component({ selector: 'app-welcome', templateUrl: './welcome.component.html', styleUrls: ['./welcome.component.css'] }) export class WelcomeComponent implements OnInit { constructor(public router: Router, public dataService: DataService) {} question = []; ngOnInit() {} onsubmit(category: string) { this.dataService.setCurrentCat(category); this.router.navigate(['/questions']); } } <file_sep>/src/app/data.service.ts import { Injectable } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; @Injectable({ providedIn: 'root' }) export class DataService { private currentIndex$ = new BehaviorSubject(0); private currentCat$ = new BehaviorSubject(''); htmlQuestions = [ { question: 'Inside which HTML element do we put the JavaScript?', options: ['scripting', 'js', 'script', 'javascript'] }, { question: 'Inside which HTML element do we put the JavaScript?', options: ['scripting test', 'js', 'script', 'javascript'] }, { question: 'Inside which HTML element do we put the JavaScript?', options: ['scripting', 'js', 'script', 'javascript'] }, { question: 'Inside which HTML element do we put the JavaScript?', options: ['scripting', 'js', 'script', 'javascript'] }, { question: 'Inside which HTML element do we put the JavaScript?', options: ['scripting', 'js', 'script', 'javascript'] } ]; cssQuestions = [ { question: 'Inside which CSS element do we put the JavaScript?', options: ['scripting', 'js', 'script', 'javascript'] }, { question: 'Inside which CSS element do we put the JavaScript?', options: ['scripting test', 'js', 'script', 'javascript'] }, { question: 'Inside which CSS element do we put the JavaScript?', options: ['scripting', 'js', 'script', 'javascript'] }, { question: 'Inside which CSS element do we put the JavaScript?', options: ['scripting', 'js', 'script', 'javascript'] }, { question: 'Inside which CSS element do we put the JavaScript?', options: ['scripting', 'js', 'script', 'javascript'] } ]; javaScriptQuestions = [ { question: 'Inside which JAVA element do we put the JavaScript?', options: ['scripting', 'js', 'script', 'javascript'] }, { question: 'Inside which JAVA element do we put the JavaScript?', options: ['scripting test', 'js', 'script', 'javascript'] }, { question: 'Inside which JAVA element do we put the JavaScript?', options: ['scripting', 'js', 'script', 'javascript'] }, { question: 'Inside which JAVA element do we put the JavaScript?', options: ['scripting', 'js', 'script', 'javascript'] }, { question: 'Inside which JAVA element do we put the JavaScript?', options: ['scripting', 'js', 'script', 'javascript'] } ]; sqlQuestions = [ { question: 'Inside which SQL element do we put the JavaScript?', options: ['scripting', 'js', 'script', 'javascript'] }, { question: 'Inside which SQL element do we put the JavaScript?', options: ['scripting test', 'js', 'script', 'javascript'] }, { question: 'Inside which SQL element do we put the JavaScript?', options: ['scripting', 'js', 'script', 'javascript'] }, { question: 'Inside which SQL element do we put the JavaScript?', options: ['scripting', 'js', 'script', 'javascript'] }, { question: 'Inside which SQL element do we put the JavaScript?', options: ['scripting', 'js', 'script', 'javascript'] } ]; getCurrentIndex() { return this.currentIndex$.asObservable(); } setCurrentIndex(index: any) { this.currentIndex$.next(index); } getCurrentCat() { return this.currentCat$.asObservable(); } setCurrentCat(cat: any) { this.currentCat$.next(cat); } getHtmlQuestions() { return this.htmlQuestions; } getCssQuestions() { return this.cssQuestions; } getJavaScriptQuestions() { return this.javaScriptQuestions; } getSqlQuestions() { return this.sqlQuestions; } getQuestionOnIndex(index: number, cat: string) { if (cat === 'html') { return this.htmlQuestions[index]; } else if (cat === 'css') { return this.cssQuestions[index]; } } } <file_sep>/src/app/app-routing.module.ts import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { HomeSignInComponent } from './home-sign-in/home-sign-in.component'; import { QuetionsComponent } from './quetions/quetions.component'; import { HomeComponent } from './home/home.component'; import { WelcomeComponent } from './welcome/welcome.component'; const routes: Routes = [ { path: '', component: HomeComponent }, { path: 'home-sign-in', component: HomeSignInComponent }, { path: 'questions', component: QuetionsComponent }, { path: 'welcome', component: WelcomeComponent } ]; @NgModule({ imports: [RouterModule.forRoot(routes)], exports: [RouterModule], providers: [] }) export class AppRoutingModule {} <file_sep>/src/app/question-paper/question-paper.component.ts import { Component, OnInit } from '@angular/core'; import { DataService } from '../data.service'; import { CurrencyIndex } from '@angular/common/src/i18n/locale_data'; @Component({ selector: 'app-question-paper', templateUrl: './question-paper.component.html', styleUrls: ['./question-paper.component.css'] }) export class QuestionPaperComponent implements OnInit { questions = []; question: any; cat: string; currentIndex: number; questionsLength: number; disableNext = false; constructor(public dataService: DataService) {} ngOnInit() { this.dataService.getCurrentCat().subscribe(cat => { this.cat = cat; if (cat === 'html') { this.questions = this.dataService.getHtmlQuestions(); this.questionsLength = this.questions.length - 1; } else if (cat === 'css') { this.questions = this.dataService.getCssQuestions(); this.questionsLength = this.questions.length - 1; } }); console.log(this.questionsLength); // this.questions = this.dataService.getQuestions(); this.dataService.getCurrentIndex().subscribe(index => { this.currentIndex = index; this.question = this.dataService.getQuestionOnIndex( this.currentIndex, this.cat ); if (this.currentIndex === this.questionsLength) { this.disableNext = true; } else { this.disableNext = false; } }); } createRange(number) { for (let i = 1; i <= number; i++) { this.questions.push(i); } } incrementIndex() { this.dataService.setCurrentIndex(this.currentIndex + 1); } }
9ab142d1c4c38bae51ed9bb3e2172b6aebb0684d
[ "TypeScript" ]
7
TypeScript
skmuddamsetty/quiz-app
271ef1379dd6a48f1fc9cbe2a99d171750ed964c
d88acde8d91a2fffcfb9ead0703e6aa5810326fc
refs/heads/master
<repo_name>gomezjesus/Monitoreo<file_sep>/README.md "# Monitoreo" <file_sep>/NewsMockDataAccess/MockDA.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using NewsModel; namespace NewsMockDataAccess { public class MockDA { public static IEnumerable<Nota> GetNota() { List<Nota> places = new List<Nota>(); places.Add(new Nota() { Notaid = 1, Titulo = "Nota de prueba", Reportero = "<NAME>", Seccion = "Principal", Categoria = "Academica", Fecha = new DateTime(2018, 4, 10), Ubicacion = "Portada", Relevancia = "Muy importante", Espacio = "cuadro amplio", Archivo = "directorio", Dimensiones = "25x30", Precio = new decimal(100.50), Privacidad = 'N', DiarioImpreso = "El Siglo de Torreon" }); return places; } } } <file_sep>/NewsModel/Seccion.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NewsModel { public class Seccion { public int SeccionID { get; set; } public string NombreSeccion { get; set; } } } <file_sep>/NewsDataAccess/SeccionRepository.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data.SqlClient; using NewsModel; namespace NewsDataAccess { public class SeccionRepository { //static string ConnectionString = "Data Source = .\\; Initial Catalog=Monitoreo; Integrated Security = True"; static string ConnectionString = "Server=10.32.121.1;Database=Monitoreo;User Id=A01233540; Password=<PASSWORD>;"; public static IEnumerable<Seccion> GetSecciones() { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); connection.Open(); command.CommandText = "Select *from Seccion"; SqlDataReader reader = command.ExecuteReader(); List<Seccion> secciones = new List<Seccion>(); while (reader.Read()) { Seccion seccion = new Seccion(); seccion.SeccionID = (int)reader["seccionID"]; seccion.NombreSeccion = reader["nombreSeccion"] as string; secciones.Add(seccion); } return secciones; } public static Seccion GetSeccion(int? id) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); connection.Open(); command.CommandText = "Select * from Seccion where seccionID = @id"; command.Parameters.AddWithValue("@id", id); SqlDataReader reader = command.ExecuteReader(); Seccion seccion = new Seccion(); while (reader.Read()) { seccion.SeccionID = (int)reader["seccionID"]; seccion.NombreSeccion = reader["nombreSeccion"] as string; } return seccion; } public static bool InsertSeccion(Seccion seccion) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); command.CommandText = @"insert into Seccion(nombreSeccion) values(@nombreSeccion)"; command.Parameters.AddWithValue("@nombreSeccion", seccion.NombreSeccion); connection.Open(); int result = command.ExecuteNonQuery(); if (result > 0) return true; else return false; } public static bool UpdateSeccion(Seccion seccion) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); command.CommandText = @"update Seccion set NombreSeccion = @NombreSeccion where SeccionID = @seccionId"; command.Parameters.AddWithValue("@nombreSeccion", seccion.NombreSeccion); command.Parameters.AddWithValue("@seccionId", seccion.SeccionID); connection.Open(); int result = command.ExecuteNonQuery(); if (result > 0) return true; else return false; } public static bool DeleteSeccion(int id) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); command.CommandText = @"delete Seccion where SeccionID = @seccionId"; command.Parameters.AddWithValue("@seccionId", id); connection.Open(); int result = command.ExecuteNonQuery(); if (result > 0) return true; else return false; } } } <file_sep>/NewsModel/Usuario.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ComponentModel; using System.ComponentModel.DataAnnotations; namespace MonitoreoModels { public class Usuario { [Display(Name ="Escribe tu usuario")] public string NombreUsuario { get; set; } public string Password { get; set; } public string Rol { get; set; } } } <file_sep>/NewsModel/Nota.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ComponentModel; using System.Web.Mvc; using System.ComponentModel.DataAnnotations; namespace NewsModel { public class Nota { public int Notaid { get; set; } [Required(ErrorMessage = "Escribe un nombre para Título")] public string Titulo { get; set; } [Required(ErrorMessage ="Escribe un nombre para reportero")] public string Reportero { get; set; } public string Seccion { get; set; } [Required(ErrorMessage ="Selecciona una categoria")] public int SeccionID { get; set; } [Required(ErrorMessage = "Selecciona un género")] public int CategoriaID { get; set; } [Required(ErrorMessage = "Selecciona un diario")] public int DiarioImpresoID { get; set; } public string Categoria { get; set; } [DataType(DataType.Date),Required(ErrorMessage ="Selecciona una fecha")] public DateTime Fecha { get; set; } public string Ubicacion { get; set; } [Range(1,3,ErrorMessage ="Rango entre 1-3")] public int Relevancia { get; set; } public string Archivo { get; set; } [Required(ErrorMessage = "Selecciona dimensiones en el formato: anchoxlargo")] public string Dimensiones { get; set; } [RegularExpression(@"^[0-9]+(\.[0-9]{1,2})$", ErrorMessage = "Introduce un numero con 2 decimales.")] public string Precio { get; set; } public char Privacidad { get; set; } [DisplayName("Medio")] public string DiarioImpreso { get; set; } public SelectList Categorias { get; set; } public SelectList Secciones { get; set; } public SelectList Diarios { get; set; } [Required(ErrorMessage = "Escriba los tags separados por coma")] public string Tag { get; set; } } } <file_sep>/NewsDataAccess/DiarioRepository.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data.SqlClient; using MonitoreoModels; namespace NewsDataAccess { public class DiarioRepository { //static string ConnectionString = "Data Source = .\\; Initial Catalog=Monitoreo; Integrated Security = True"; static string ConnectionString = "Server=10.32.121.1;Database=Monitoreo;User Id=A01233540; Password=<PASSWORD>;"; public static IEnumerable<DiarioImpreso> GetDiarios() { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); connection.Open(); command.CommandText = "Select *from DiarioImpreso"; SqlDataReader reader = command.ExecuteReader(); List<DiarioImpreso> diarios = new List<DiarioImpreso>(); while (reader.Read()) { DiarioImpreso diario = new DiarioImpreso(); diario.DiarioID = (int)reader["DiarioID"]; diario.Nombre = reader["Nombre"] as string; diarios.Add(diario); } return diarios; } public static DiarioImpreso GetDiario(int? id) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); connection.Open(); command.CommandText = "Select * from DiarioImpreso where DiarioId = @id"; command.Parameters.AddWithValue("@id", id); SqlDataReader reader = command.ExecuteReader(); DiarioImpreso diario = new DiarioImpreso(); while (reader.Read()) { diario.DiarioID = (int)reader["DiarioID"]; diario.Nombre = reader["Nombre"] as string; } return diario; } public static bool InsertDiario(DiarioImpreso diario) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); command.CommandText = @"insert into DiarioImpreso(Nombre) values(@nombre)"; command.Parameters.AddWithValue("@nombre", diario.Nombre); connection.Open(); int result = command.ExecuteNonQuery(); connection.Close(); if (result > 0) return true; else return false; } public static bool UpdateDiario(DiarioImpreso diario) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); command.CommandText = @"update DiarioImpreso set Nombre = @nombre where DiarioID = @diarioID"; command.Parameters.AddWithValue("@nombre", diario.Nombre); command.Parameters.AddWithValue("@diarioID", diario.DiarioID); connection.Open(); int result = command.ExecuteNonQuery(); connection.Close(); if (result > 0) return true; else return false; } public static bool DeleteDiario(int? id) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); command.CommandText = @"delete DiarioImpreso where DiarioID = @diarioID"; command.Parameters.AddWithValue("@diarioID", id); connection.Open(); int result = command.ExecuteNonQuery(); if (result > 0) return true; else return false; } } } <file_sep>/NewsDataAccess/NewsRepository.cs using System; using System.Collections.Generic; using System.Data.SqlClient; using NewsModel; namespace NewsDataAccess { public class NewsRepository { //static string ConnectionString = "Data Source = .\\; Initial Catalog=Monitoreo; Integrated Security = True"; static string ConnectionString = "Server=10.32.121.1;Database=Monitoreo;User Id=A01233540; Password=<PASSWORD>;"; public static IEnumerable<Nota> GetNews() { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); connection.Open(); command.CommandText = @"select n.Notaid,n.Titulo,n.Reportero,s.NombreSeccion, c.NombreCategoria, n.Fecha, n.Ubicacion, n.Relevancia,n.Archivo, n.Dimensiones, n.Precio, n.Privacidad, n.Tag, d.Nombre from Nota n, Categoria c, Seccion s, DiarioImpreso d where n.CategoriaID = c.CategoriaID and n.SeccionID = s.SeccionID and n.DiarioID = d.DiarioID order by Fecha desc"; SqlDataReader reader = command.ExecuteReader(); List<Nota> notas = new List<Nota>(); while (reader.Read()) { Nota nota = new Nota(); nota.Notaid = (int)reader["Notaid"]; nota.Titulo = reader["Titulo"] as string; nota.Reportero = reader["Reportero"] as string; nota.Seccion = reader["NombreSeccion"] as string; nota.Categoria = reader["NombreCategoria"] as string; nota.Fecha = (DateTime)reader["Fecha"]; nota.Ubicacion = reader["Ubicacion"] as string; nota.Relevancia = (int)reader["Relevancia"]; nota.Archivo = reader["Archivo"] as string; nota.Dimensiones = reader["Dimensiones"] as string; nota.Precio = reader["Precio"] as string; nota.Privacidad = Convert.ToChar(reader["Privacidad"]); nota.DiarioImpreso = reader["Nombre"] as string; nota.Tag = reader["Tag"] as string; notas.Add(nota); } connection.Close(); return notas; } public static IEnumerable<Nota> FindNews(string keywords) { keywords = keywords.Trim(); keywords = keywords.Replace(',', '%'); keywords = keywords.Insert(0, "%"); keywords = keywords.Insert(keywords.Length, "%"); SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); connection.Open(); command.CommandText = @"select n.Notaid,n.Titulo,n.Reportero,s.NombreSeccion, c.NombreCategoria, n.Fecha, n.Ubicacion, n.Relevancia,n.Archivo, n.Dimensiones, n.Precio, n.Privacidad, n.Tag, d.Nombre from Nota n, Categoria c, Seccion s, DiarioImpreso d where n.CategoriaID = c.CategoriaID and n.SeccionID = s.SeccionID and n.DiarioID = d.DiarioID and n.Tag like @tags order by Fecha desc"; command.Parameters.AddWithValue("@tags", keywords); SqlDataReader reader = command.ExecuteReader(); List<Nota> notas = new List<Nota>(); while (reader.Read()) { Nota nota = new Nota(); nota.Notaid = (int)reader["Notaid"]; nota.Titulo = reader["Titulo"] as string; nota.Reportero = reader["Reportero"] as string; nota.Seccion = reader["NombreSeccion"] as string; nota.Categoria = reader["NombreCategoria"] as string; nota.Fecha = (DateTime)reader["Fecha"]; nota.Ubicacion = reader["Ubicacion"] as string; nota.Relevancia = (int)reader["Relevancia"]; nota.Archivo = reader["Archivo"] as string; nota.Dimensiones = reader["Dimensiones"] as string; nota.Precio = reader["Precio"] as string; nota.Privacidad = Convert.ToChar(reader["Privacidad"]); nota.DiarioImpreso = reader["Nombre"] as string; nota.Tag = reader["Tag"] as string; notas.Add(nota); } connection.Close(); return notas; } public static Nota GetNew(int? id) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); connection.Open(); command.CommandText = @"select n.Notaid,n.Titulo,n.Reportero,s.NombreSeccion, c.NombreCategoria, n.Fecha, n.Ubicacion, n.Relevancia, n.Archivo, n.Dimensiones, n.Precio, n.Privacidad, n.Tag, d.Nombre from Nota n, Categoria c, Seccion s, DiarioImpreso d where n.CategoriaID = c.CategoriaID and n.SeccionID = s.SeccionID and n.DiarioID = d.DiarioID and n.Notaid = @id"; command.Parameters.AddWithValue("@id", id); SqlDataReader reader = command.ExecuteReader(); Nota nota = new Nota(); while (reader.Read()) { nota.Notaid = (int)reader["Notaid"]; nota.Titulo = reader["Titulo"] as string; nota.Reportero = reader["Reportero"] as string; nota.Seccion = reader["NombreSeccion"] as string; nota.Categoria = reader["NombreCategoria"] as string; nota.Fecha = (DateTime)reader["Fecha"]; nota.Ubicacion = reader["Ubicacion"] as string; nota.Relevancia = (int)reader["Relevancia"]; nota.Archivo = reader["Archivo"] as string; nota.Dimensiones = reader["Dimensiones"] as string; decimal precio = (decimal)reader["Precio"]; nota.Precio = precio.ToString(); nota.Privacidad = Convert.ToChar(reader["Privacidad"]); nota.DiarioImpreso = reader["Nombre"] as string; nota.Tag = reader["Tag"] as string; } connection.Close(); return nota; } public static bool InsertNota(Nota nota) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); command.CommandText = @"insert into Nota(Titulo,Reportero,SeccionID,CategoriaID,Fecha,Ubicacion,Relevancia, Archivo,Dimensiones,Precio,Privacidad,DiarioID,Tag) values(@titulo,@reportero,@seccion,@categoria,@fecha,@ubicacion,@relevancia, @archivo,@dimensiones,@precio,@privacidad,@diario,@tag)"; command.Parameters.AddWithValue("@titulo", nota.Titulo); command.Parameters.AddWithValue("@reportero", nota.Reportero); command.Parameters.AddWithValue("@seccion", nota.SeccionID); command.Parameters.AddWithValue("@categoria", nota.CategoriaID); command.Parameters.AddWithValue("@fecha", nota.Fecha); command.Parameters.AddWithValue("@ubicacion", nota.Ubicacion); command.Parameters.AddWithValue("@relevancia", nota.Relevancia); command.Parameters.AddWithValue("@archivo", nota.Archivo); command.Parameters.AddWithValue("@dimensiones", nota.Dimensiones); command.Parameters.AddWithValue("@precio", Convert.ToDecimal(nota.Precio)); command.Parameters.AddWithValue("@privacidad", nota.Privacidad); command.Parameters.AddWithValue("@diario", nota.DiarioImpresoID); command.Parameters.AddWithValue("@tag", nota.Tag); connection.Open(); int result = command.ExecuteNonQuery(); connection.Close(); if (result > 0) return true; else return false; } public static bool UpdateNota(Nota nota) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); command.CommandText = @"update Nota set Titulo = @titulo, Reportero = @reportero, SeccionID = @seccion, CategoriaID = @categoria, Fecha = @fecha, Ubicacion = @ubicacion, Relevancia = @relevancia, Archivo = @archivo, Dimensiones = @dimensiones, Precio = @precio, Privacidad= @privacidad, Tag = @tag, DiarioID = @diario where Notaid = @notaid"; command.Parameters.AddWithValue("@titulo", nota.Titulo); command.Parameters.AddWithValue("@reportero", nota.Reportero); command.Parameters.AddWithValue("@seccion", nota.SeccionID); command.Parameters.AddWithValue("@categoria", nota.CategoriaID); command.Parameters.AddWithValue("@fecha", nota.Fecha); command.Parameters.AddWithValue("@ubicacion", nota.Ubicacion); command.Parameters.AddWithValue("@relevancia", nota.Relevancia); command.Parameters.AddWithValue("@archivo", nota.Archivo); command.Parameters.AddWithValue("@dimensiones", nota.Dimensiones); command.Parameters.AddWithValue("@precio", nota.Precio); command.Parameters.AddWithValue("@privacidad", nota.Privacidad); command.Parameters.AddWithValue("@diario", nota.DiarioImpresoID); command.Parameters.AddWithValue("@notaid", nota.Notaid); command.Parameters.AddWithValue("@tag", nota.Tag); connection.Open(); int result = command.ExecuteNonQuery(); connection.Close(); if (result > 0) return true; else return false; } public static bool DeleteNota(int id) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); command.CommandText = @"delete nota where Notaid = @id"; command.Parameters.AddWithValue("@id", id); connection.Open(); int result = command.ExecuteNonQuery(); connection.Close(); if (result > 0) return true; else return false; } } } <file_sep>/INoteDataAccess/INoteDataAccess.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using NewsModel; namespace INoteDataAccess { public interface INoteDataAccess { IEnumerable<Nota> GetNota(); void InsertNota(); void UpdateNota(); } } <file_sep>/NewsModel/Evento.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MonitoreoModels { public class Evento { public int EventID { get; set; } public string Subject { get; set; } public string Description { get; set; } public DateTime Inicio { get; set; } public DateTime Fin { get; set; } public string start { get; set; } public string end { get; set; } public string Color { get; set; } public bool IsFullDay { get; set; } } } <file_sep>/WebApplication/Controllers/NewsController.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Data; using System.Data.SqlClient; using NewsDataAccess; using NewsModel; using System.IO; namespace WebApplication.Controllers { public class NewsController : Controller { // GET: News [HttpGet] public ActionResult Index() { var notas = NewsRepository.GetNews(); return View(notas); } // GET: News/Details/5 public ActionResult Details(int id) { var nota = NewsRepository.GetNew(id); return View(nota); } // GET: News/Create public ActionResult Create() { Nota nota = new Nota(); nota.Secciones = new SelectList(SeccionRepository.GetSecciones(), "SeccionID", "NombreSeccion"); nota.Categorias = new SelectList(CategoriaRepository.GetCategorias(), "CategoriaID", "NombreCategoria"); nota.Diarios = new SelectList(DiarioRepository.GetDiarios(), "DiarioID", "Nombre"); return View(nota); } // POST: News/Create [HttpPost] public ActionResult Create(Nota nota, HttpPostedFileBase file) { Nota nota2 = new Nota(); nota2.Secciones = new SelectList(SeccionRepository.GetSecciones(), "SeccionID", "NombreSeccion"); nota2.Categorias = new SelectList(CategoriaRepository.GetCategorias(), "CategoriaID", "NombreCategoria"); nota2.Diarios = new SelectList(DiarioRepository.GetDiarios(), "DiarioID", "Nombre"); if (ModelState.IsValid) { try { if (file.ContentLength > 0) { string filename = Path.GetFileName(file.FileName); string server_path = Path.Combine(Server.MapPath("~/Images"), filename); file.SaveAs(server_path); nota.Archivo = "~/Images/" + filename; } bool success = NewsRepository.InsertNota(nota); if (success) return RedirectToAction("Index"); else { return View(); } } catch (SqlException e) { System.Diagnostics.Debug.WriteLine(e.Message); return View(); } } else return View(nota2); } [HttpPost] public ActionResult Find(string tags) { var notas = NewsRepository.FindNews(tags); return View("Index",notas); } // GET: News/Edit/5 public ActionResult Edit(int id) { var nota = NewsRepository.GetNew(id); nota.Secciones = new SelectList(SeccionRepository.GetSecciones(), "SeccionID", "NombreSeccion"); nota.Categorias = new SelectList(CategoriaRepository.GetCategorias(), "CategoriaID", "NombreCategoria"); nota.Diarios = new SelectList(DiarioRepository.GetDiarios(), "DiarioID", "Nombre"); return View(nota); } // POST: News/Edit/5 [HttpPost] public ActionResult Edit(Nota nota, HttpPostedFileBase file) { try { if (file.ContentLength > 0) { string filename = Path.GetFileName(file.FileName); string server_path = Path.Combine(Server.MapPath("~/Images"), filename); file.SaveAs(server_path); nota.Archivo = "~/Images/" + filename; } bool success = NewsRepository.UpdateNota(nota); if (success) return RedirectToAction("Index"); else return View(); } catch(SqlException e) { System.Diagnostics.Debug.WriteLine(e.Message); return View(); } } // GET: News/Delete/5 [HttpGet] public ActionResult Delete(int? id) { var nota = NewsRepository.GetNew(id); return View(nota); } // POST: News/Delete/5 [HttpPost] public ActionResult Delete(int id) { try { bool success = NewsRepository.DeleteNota(id); if (success) return RedirectToAction("Index"); else return View(); } catch { return View(); } } } } <file_sep>/WebApplication/Controllers/LoginController.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using MonitoreoModels; using NewsDataAccess; using System.Security.Cryptography; using System.Text; namespace WebApplication.Controllers { public class LoginController : Controller { // GET: Login public ActionResult Index() { if (Session["user"] != null) Session["user"] = null; return View(); } // GET: Login/Details/5 public ActionResult Details(int id) { return View(); } public string Encrypt(string pass) { MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); md5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(pass)); byte[] res = md5.Hash; StringBuilder str = new StringBuilder(); for(int i = 0; i < res.Length; i++) { str.Append(res[i].ToString("x2")); } return str.ToString(); } public ActionResult Enter(Usuario usuario) { usuario.Password = <PASSWORD>(usuario.Password); bool exists = UsuarioRepository.VerifyUser(usuario); if (exists) { Session["user"] = UsuarioRepository.GetUsuario(usuario); return RedirectToAction("Index", "News"); } else return View("Index"); } // GET: Login/Create public ActionResult Create() { return View(); } // POST: Login/Create [HttpPost] public ActionResult Create(FormCollection collection) { try { // TODO: Add insert logic here return RedirectToAction("Index"); } catch { return View(); } } // GET: Login/Edit/5 public ActionResult Edit(int id) { return View(); } // POST: Login/Edit/5 [HttpPost] public ActionResult Edit(int id, FormCollection collection) { try { // TODO: Add update logic here return RedirectToAction("Index"); } catch { return View(); } } // GET: Login/Delete/5 public ActionResult Delete(int id) { return View(); } // POST: Login/Delete/5 [HttpPost] public ActionResult Delete(int id, FormCollection collection) { try { // TODO: Add delete logic here return RedirectToAction("Index"); } catch { return View(); } } } } <file_sep>/NewsDataAccess/UsuarioRepository.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using MonitoreoModels; using System.Data.SqlClient; using System.Security.Cryptography; namespace NewsDataAccess { public class UsuarioRepository { //static string ConnectionString = "Data Source = .\\; Initial Catalog=Monitoreo; Integrated Security = True"; static string ConnectionString = "Server=10.32.121.1;Database=Monitoreo;User Id=A01233540; Password=<PASSWORD>;"; public static bool VerifyUser(Usuario usuario) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); connection.Open(); command.CommandText = "Select count(*) from Usuario where NombreUsuario = @nombreUsuario and Password = <PASSWORD>"; command.Parameters.AddWithValue("@nombreUsuario", usuario.NombreUsuario); command.Parameters.AddWithValue("@pass", usuario.Password); int c = (int)command.ExecuteScalar(); if (c == 1) return true; else return false; } public static Usuario GetUsuario(Usuario usuario) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); connection.Open(); command.CommandText = "Select * from Usuario where NombreUsuario = @nombreUsuario and Password = <PASSWORD>"; command.Parameters.AddWithValue("@nombreUsuario", usuario.NombreUsuario); command.Parameters.AddWithValue("@pass", usuario.Password); SqlDataReader reader = command.ExecuteReader(); Usuario user = new Usuario(); while (reader.Read()) { user.NombreUsuario = reader["NombreUsuario"] as string; user.Password = reader["Password"] as string; user.Rol = reader["Rol"] as string; } return user; } //public static bool InsertUsuario(Usuario usuario) //{ // SqlConnection connection = new SqlConnection(ConnectionString); // SqlCommand command = connection.CreateCommand(); // connection.Open(); // command.CommandText = "Select * from Usuario where NombreUsuario = @nombreUsuario"; // command.Parameters.AddWithValue("@nombreUsuario", usuario.NombreUsuario); // SqlDataReader reader = command.ExecuteReader(); // Usuario user = new Usuario(); // while (reader.Read()) // { // user.NombreUsuario = reader["NombreUsuario"] as string; // user.Password = reader["<PASSWORD>"] as string; // } // return user; //} } } <file_sep>/NewsDataAccess/EventoRepository.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data.SqlClient; using MonitoreoModels; using Newtonsoft.Json; using Dapper; namespace NewsDataAccess { public class EventoRepository { //static string ConnectionString = "Data Source = .\\; Initial Catalog=Monitoreo; Integrated Security = True"; static string ConnectionString = "Server=10.32.121.1;Database=Monitoreo;User Id=A01233540; Password=<PASSWORD>;"; public static string GetEventos() { SqlConnection connection = new SqlConnection(ConnectionString); //var e = connection.Query<Evento>("Select *from Evento").ToList(); SqlCommand command = connection.CreateCommand(); command.CommandText = "select *from Evento"; connection.Open(); SqlDataReader reader = command.ExecuteReader(); List<Evento> eventos = new List<Evento>(); while (reader.Read()) { Evento evento = new Evento(); evento.EventID = (int)reader["EventID"]; evento.Subject = reader["Subject"] as string; evento.Description = reader["Description"] as string; evento.Inicio = (DateTime)reader["Inicio"]; evento.Fin = (DateTime)reader["Fin"]; evento.Color = reader["Color"] as string; evento.IsFullDay = (bool)reader["IsFullDay"]; eventos.Add(evento); } string json = JsonConvert.SerializeObject(eventos); return json; } public static bool AddEvento(Evento e) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); DateTime inicio = DateTime.ParseExact(e.start, "dd/MM/yyyy HH:mm tt", System.Globalization.CultureInfo.InvariantCulture); DateTime fin = DateTime.ParseExact(e.end, "dd/MM/yyyy HH:mm tt", System.Globalization.CultureInfo.InvariantCulture); command.CommandText = @"insert into Evento(Subject,Description,Inicio,Fin,Color,IsFullDay) values(@sub,@desc,@inicio,@fin,@color,@fullday)"; command.Parameters.AddWithValue("@sub", e.Subject); command.Parameters.AddWithValue("@desc", e.Description); command.Parameters.AddWithValue("@inicio",inicio ); command.Parameters.AddWithValue("@fin", fin); command.Parameters.AddWithValue("@color", e.Color); command.Parameters.AddWithValue("@fullday", e.IsFullDay); connection.Open(); int result = command.ExecuteNonQuery(); connection.Close(); if (result > 0) return true; else return false; } public static bool UpdateEvento(Evento e) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); command.CommandText = @"update Evento set Subject = @sub, Description = @desc, Inicio = @ini, Fin = @fin, Color=@color where EventID = @eID"; DateTime inicio = DateTime.ParseExact(e.start, "dd/MM/yyyy HH:mm tt", System.Globalization.CultureInfo.InvariantCulture); DateTime fin = DateTime.ParseExact(e.end, "dd/MM/yyyy HH:mm tt", System.Globalization.CultureInfo.InvariantCulture); command.Parameters.AddWithValue("@sub", e.Subject); command.Parameters.AddWithValue("@desc", e.Description); command.Parameters.AddWithValue("@ini", inicio); command.Parameters.AddWithValue("@fin", fin); command.Parameters.AddWithValue("@color", e.Color); command.Parameters.AddWithValue("@eID", e.EventID); connection.Open(); int result = command.ExecuteNonQuery(); connection.Close(); if (result > 0) return true; else return false; } public static bool DeleteEvent(int id) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); command.CommandText = @"delete Evento where EventID = @eID"; command.Parameters.AddWithValue("@eID", id); connection.Open(); int result = command.ExecuteNonQuery(); if (result > 0) return true; else return false; } } }<file_sep>/WebApplication/Controllers/SeccionController.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using NewsDataAccess; using NewsModel; using System.Data.SqlClient; namespace WebApplication.Controllers { public class SeccionController : Controller { // GET: Seccion public ActionResult Index() { var secciones = SeccionRepository.GetSecciones(); return View(secciones); } // GET: Seccion/Details/5 public ActionResult Details(int id) { var secciones = SeccionRepository.GetSeccion(id); return View(secciones); } // GET: Seccion/Create public ActionResult Create() { return View(new Seccion()); } // POST: Seccion/Create [HttpPost] public ActionResult Create(Seccion seccion) { try { // TODO: Add insert logic here bool success = SeccionRepository.InsertSeccion(seccion); if (success) return RedirectToAction("Index"); else return View(); } catch (SqlException e) { System.Diagnostics.Debug.WriteLine(e.Message); return View(); } } // GET: Seccion/Edit/5 public ActionResult Edit(int id) { var seccion = SeccionRepository.GetSeccion(id); return View(seccion); } // POST: Seccion/Edit/5 [HttpPost] public ActionResult Edit(int id, Seccion seccion) { try { bool success = SeccionRepository.UpdateSeccion(seccion); if (success) return RedirectToAction("Index"); else return View(); } catch (SqlException e) { System.Diagnostics.Debug.WriteLine(e.Message); return View(); } } // GET: Seccion/Delete/5 public ActionResult Delete(int? id) { var nota = SeccionRepository.GetSeccion(id); return View(nota); } // POST: Seccion/Delete/5 [HttpPost] public ActionResult Delete(int id) { try { bool success = SeccionRepository.DeleteSeccion(id); if (success) return RedirectToAction("Index"); else return View(); } catch { return View(); } } } } <file_sep>/WebApplication/Controllers/HomeController.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using NewsModel; using NewsDataAccess; using MonitoreoModels; namespace WebApplication.Controllers { public class HomeController : Controller { // GET: Home public ActionResult Index() { return View(); } [HttpGet] public JsonResult GetEvents() { string eventos = EventoRepository.GetEventos(); return new JsonResult {Data= eventos, JsonRequestBehavior = JsonRequestBehavior.AllowGet}; } [HttpPost] public JsonResult Save(Evento e) { if (e.EventID > 0) { bool success = EventoRepository.UpdateEvento(e); } else { bool success = EventoRepository.AddEvento(e); } return new JsonResult { Data = new { status = true } }; } [HttpPost] public JsonResult DeleteEvent(int id) { bool success = EventoRepository.DeleteEvent(id); return new JsonResult { Data = new { status = true } }; } } }<file_sep>/WebApplication/Controllers/CategoriaController.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using MonitoreoModels; using NewsDataAccess; namespace WebApplication.Controllers { public class CategoriaController : Controller { // GET: Categoria public ActionResult Index() { var categorias = CategoriaRepository.GetCategorias(); return View(categorias); } // GET: Categoria/Details/5 public ActionResult Details(int id) { var categoria = CategoriaRepository.GetCategoria(id); return View(categoria); } // GET: Categoria/Create public ActionResult Create() { return View(new Categoria()); } // POST: Categoria/Create [HttpPost] public ActionResult Create(Categoria categoria) { try { bool success = CategoriaRepository.InsertCategoria(categoria); if (success) return RedirectToAction("Index"); else return View(); } catch { return View(); } } // GET: Categoria/Edit/5 public ActionResult Edit(int id) { var categoria = CategoriaRepository.GetCategoria(id); return View(categoria); } // POST: Categoria/Edit/5 [HttpPost] public ActionResult Edit(Categoria categoria) { try { bool success = CategoriaRepository.UpdateCategoria(categoria); if (success) return RedirectToAction("Index"); else return View(); } catch { return View(); } } // GET: Categoria/Delete/5 public ActionResult Delete(int id) { var categoria = CategoriaRepository.GetCategoria(id); return View(categoria); } // POST: Categoria/Delete/5 [HttpPost] public ActionResult Delete(int? id) { try { bool success = CategoriaRepository.DeleteCategoria(id); if (success) return RedirectToAction("Index"); else return View(); } catch { return View(); } } } } <file_sep>/NewsDataAccess/CategoriaRepository.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using MonitoreoModels; using System.Data.SqlClient; namespace NewsDataAccess { public class CategoriaRepository { //static string ConnectionString = "Data Source = .\\; Initial Catalog=Monitoreo; Integrated Security = True"; static string ConnectionString = "Server=10.32.121.1;Database=Monitoreo;User Id=A01233540; Password=<PASSWORD>;"; public static IEnumerable<Categoria> GetCategorias() { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); connection.Open(); command.CommandText = "Select *from Categoria"; SqlDataReader reader = command.ExecuteReader(); List<Categoria> categorias = new List<Categoria>(); while (reader.Read()) { Categoria categoria = new Categoria(); categoria.CategoriaID = (int)reader["CategoriaID"]; categoria.NombreCategoria = reader["NombreCategoria"] as string; categorias.Add(categoria); } return categorias; } public static Categoria GetCategoria(int? id) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); connection.Open(); command.CommandText = "Select * from Categoria where CategoriaID = @id"; command.Parameters.AddWithValue("@id", id); SqlDataReader reader = command.ExecuteReader(); Categoria categoria = new Categoria(); while (reader.Read()) { categoria.CategoriaID = (int)reader["CategoriaID"]; categoria.NombreCategoria = reader["NombreCategoria"] as string; } return categoria; } public static bool InsertCategoria(Categoria categoria) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); command.CommandText = @"insert into Categoria(NombreCategoria) values(@nombreCategoria)"; command.Parameters.AddWithValue("@nombreCategoria", categoria.NombreCategoria); connection.Open(); int result = command.ExecuteNonQuery(); if (result > 0) return true; else return false; } public static bool UpdateCategoria(Categoria categoria) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); command.CommandText = @"update Categoria set NombreCategoria = @NombreCategoria where CategoriaID = @CategoriaID"; command.Parameters.AddWithValue("@NombreCategoria", categoria.NombreCategoria); command.Parameters.AddWithValue("@CategoriaID", categoria.CategoriaID); connection.Open(); int result = command.ExecuteNonQuery(); if (result > 0) return true; else return false; } public static bool DeleteCategoria(int? id) { SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = connection.CreateCommand(); command.CommandText = @"delete Categoria where CategoriaID = @CategoriaID"; command.Parameters.AddWithValue("@CategoriaID", id); connection.Open(); int result = command.ExecuteNonQuery(); if (result > 0) return true; else return false; } } }
ab978ae7480d92d771de9cb84516ae0f99c7ffbc
[ "Markdown", "C#" ]
18
Markdown
gomezjesus/Monitoreo
982da4134cb0203397787a2029f3a18aaaaf0726
5ebaa412cd4e5dad44d5747b68ef57a08247ca17
refs/heads/main
<file_sep>package polynom; import automat.FSM; import automat.RowTable; public class Tree { static private int count; private int id; private Tree child00; private Tree child01; private Tree child10; private Tree child11; // Созадние дерева с присвоением порядкового номера public Tree() { id = count; count++; } public int getId() { return id; } // Начальная инициализация static public void clear() { count = 0; } // Появление нового пути до листа в дереве static public void add(Tree tree, int x, int y, int k) { if (k == 0) { return; } int xOst = x % 2; int yOst = y % 2; x /= 2; y /= 2; k--; if (xOst == 0 && yOst == 0) { if (tree.child00 == null) { tree.child00 = new Tree(); } add(tree.child00, x, y, k); } else if (xOst == 0 && yOst == 1) { if (tree.child01 == null) { tree.child01 = new Tree(); } add(tree.child01, x, y, k); } else if (xOst == 1 && yOst == 0) { if (tree.child10 == null) { tree.child10 = new Tree(); } add(tree.child10, x, y, k); } else { if (tree.child11 == null) { tree.child11 = new Tree(); } add(tree.child11, x, y, k); } } public boolean equals(Tree tree) { if (this.child00 == null && tree.child00 != null || this.child01 == null && tree.child01 != null || this.child10 == null && tree.child10 != null || this.child11 == null && tree.child11 != null) { return false; } return true; } static public boolean equalsAll(Tree tree1, Tree tree2) { if (tree2 == null) { return true; } return tree1.equals(tree2) && equalsAll(tree1.child00, tree2.child00) && equalsAll(tree1.child01, tree2.child01) && equalsAll(tree1.child10, tree2.child10) && equalsAll(tree1.child11, tree2.child11); } static public void truncate(Tree tree, Tree treeCopy) { if (tree.child00 != null) { if (equalsAll(treeCopy, treeCopy.child00)) { tree.child00.id = tree.id; tree.child00.child00 = null; tree.child00.child01 = null; tree.child00.child10 = null; tree.child00.child11 = null; } else { truncate(tree.child00, treeCopy.child00); } } if (tree.child01 != null) { if (equalsAll(treeCopy, treeCopy.child01)) { tree.child01.id = tree.id; tree.child01.child00 = null; tree.child01.child01 = null; tree.child01.child10 = null; tree.child01.child11 = null; } else { truncate(tree.child01, treeCopy.child01); } } if (tree.child10 != null) { if (equalsAll(treeCopy, treeCopy.child10)) { tree.child10.id = tree.id; tree.child10.child00 = null; tree.child10.child01 = null; tree.child10.child10 = null; tree.child10.child11 = null; } else { truncate(tree.child10, treeCopy.child10); } } if (tree.child11 != null) { if (equalsAll(treeCopy, treeCopy.child11)) { tree.child11.id = tree.id; tree.child11.child00 = null; tree.child11.child01 = null; tree.child11.child10 = null; tree.child11.child11 = null; } else { truncate(tree.child11, treeCopy.child11); } } } public static void generateFSM(Tree tree, FSM fsm) { if (tree.child00 != null) { fsm.addRowStateTable(new RowTable(Integer.toString(tree.id), "0", Integer.toString(tree.child00.id), "0")); generateFSM(tree.child00, fsm); } if (tree.child01 != null) { fsm.addRowStateTable(new RowTable(Integer.toString(tree.id), "0", Integer.toString(tree.child01.id), "1")); generateFSM(tree.child01, fsm); } if (tree.child10 != null) { fsm.addRowStateTable(new RowTable(Integer.toString(tree.id), "1", Integer.toString(tree.child10.id), "0")); generateFSM(tree.child10, fsm); } if (tree.child11 != null) { fsm.addRowStateTable(new RowTable(Integer.toString(tree.id), "1", Integer.toString(tree.child11.id), "1")); generateFSM(tree.child11, fsm); } } } <file_sep>package automat; // Одна строка таблицы переходов - выходов public class RowTable { String[] row = new String[4]; public RowTable(String currentState, String event, String nextState, String reaction) { this.row[0] = currentState; this.row[1] = event; this.row[2] = nextState; this.row[3] = reaction; } // Найти строку по текущему состоянию и входному символу public boolean getRowTable(String currentState, String event) { return currentState.equals(this.row[0]) && event.equals(this.row[1]); } }
8c7fce13f744a146a79257559879082cbac207fe
[ "Java" ]
2
Java
tchernets-maria/TchernetsMV
4ec3eb3792c23350465edbe7b0e9768fcb937ec3
8ecc5af02210baf1e6fd01b2cce23cda5abe1913
refs/heads/master
<repo_name>ahmadsalimi/XO_game<file_sep>/client/src/models/GameInfo.java package models; public class GameInfo { private String xUsername; private String oUsername; private int gameId; String getXUsername() { return xUsername; } String getOUsername() { return oUsername; } int getGameId() { return gameId; } }<file_sep>/README.md # XO_game - a network XO game made by java. game interface: ![alt text](https://github.com/ahmadsalimi/XO_game/raw/master/resources/game_interface.png) <file_sep>/server/src/controller/message/ScoreBoardList.java package controller.message; import models.Account; class ScoreBoardList { private Account[] accounts; ScoreBoardList(Account[] accounts) { this.accounts = accounts; } } <file_sep>/server/src/controller/message/MakeGameMessage.java package controller.message; class MakeGameMessage { private int gameId; private char[][] currentState; private String opponentName; private char currentTurn; private char myTurn; MakeGameMessage(int gameId, String opponentName, char[][] currentState, char currentTurn, char myTurn) { this.gameId = gameId; this.opponentName = opponentName; this.currentState = currentState; this.currentTurn = currentTurn; this.myTurn = myTurn; } } <file_sep>/client/src/controller/message/MapUpdate.java package controller.message; import javafx.util.Pair; import models.Position; public class MapUpdate { private Pair<Position, MapUpdateType> updates; private char currentTurn; public Pair<Position, MapUpdateType> getUpdates() { return updates; } public char getCurrentTurn() { return currentTurn; } } <file_sep>/client/src/controller/message/ScoreBoardList.java package controller.message; import models.Account; public class ScoreBoardList { private Account[] accounts; public Account[] getAccounts() { return accounts; } } <file_sep>/client/src/models/Tile.java package models; import javafx.scene.control.Label; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import java.util.HashMap; import static models.ScreenData.SCALE; public class Tile { private static final double DEFAULT_SIZE = 300 * SCALE; private static final String DEFAULT_FONT_FAMILY = "SansSerif"; private static final double DEFAULT_FONT_SIZE = 300 * SCALE; private static final HashMap<Character, Color> textFills = new HashMap<>(); private static final HashMap<Character, Color> backgrounds = new HashMap<>(); static { textFills.put('X', Color.rgb(0, 112, 255)); textFills.put('O', Color.rgb(255, 50, 0)); textFills.put((char) 0, Color.WHITE); backgrounds.put('X', Color.rgb(255, 204, 0)); backgrounds.put('O', Color.rgb(152, 255, 0)); backgrounds.put((char) 0, Color.rgb(255, 203, 158)); } private Rectangle rectangle; private Label label; Tile(char value, double scale) { this.rectangle = new Rectangle(DEFAULT_SIZE * scale, DEFAULT_SIZE * scale); rectangle.setArcWidth(rectangle.getWidth()); rectangle.setArcHeight(rectangle.getHeight()); this.label = new Label(); label.setFont(Font.font(DEFAULT_FONT_FAMILY, FontWeight.EXTRA_BOLD, DEFAULT_FONT_SIZE * scale)); setValue(value); } public Rectangle getRectangle() { return rectangle; } public Label getLabel() { return label; } public void setValue(char value) { label.setText(String.valueOf(value)); label.setTextFill(textFills.get(value)); rectangle.setFill(backgrounds.get(value)); } } <file_sep>/client/src/controller/message/GameState.java package controller.message; public enum GameState { WIN("You won!"), LOSE("You Lost!"), DRAW("Draw!!"); private final String message; GameState(String message) { this.message = message; } public String getMessage() { return message; } } <file_sep>/server/src/models/Game.java package models; import models.exception.ClientException; import java.util.HashMap; import java.util.concurrent.atomic.AtomicReference; public class Game { private static Integer number = 0; private int row; private int column; private int gameId; private HashMap<Character, PlayerInfo> playersInfo = new HashMap<>(); private char[][] currentState; private char currentTurn = 'X'; private char winnerSign; private int numberOfTurnsPlayed; private int combo; private boolean finished; public Game(Account xAccount, Account oAccount, int row, int column) { synchronized (number) { this.gameId = number++; } this.row = row; this.column = column; this.playersInfo.put('X', new PlayerInfo(xAccount)); this.playersInfo.put('O', new PlayerInfo(oAccount)); this.combo = (row == 3 || column == 3) ? 3 : 4; this.initializeCurrentState(); } public void put(Position position) { playersInfo.get(currentTurn).setLastPosition(position); currentState[position.getRow()][position.getColumn()] = currentTurn; numberOfTurnsPlayed++; if (gameIsFinished(position.getRow(), position.getColumn())) { applyGameStatus(); finished = true; return; } changeCurrentTurn(); } public Position undo() throws ClientException { if (currentTurn == 'X') { return applyUndo('O'); } return applyUndo('X'); } public boolean invalidPut(Position position) { return position.getRow() >= row || position.getRow() < 0 || position.getColumn() >= column || position.getColumn() < 0 || currentState[position.getRow()][position.getColumn()] != 0; } public char[][] getCurrentState() { return currentState; } public HashMap<Character, PlayerInfo> getPlayersInfo() { return playersInfo; } public Account getOtherAccount(Account account) throws ClientException { if (playersInfo.get('X').getAccount().equals(account)) { return playersInfo.get('O').getAccount(); } if (playersInfo.get('O').getAccount().equals(account)) { return playersInfo.get('X').getAccount(); } throw new ClientException("this game isn't yours"); } public boolean haveAccount(Account account) { for (PlayerInfo info : playersInfo.values()) { if (info.getAccount().equals(account)) { return true; } } return false; } public int getId() { return this.gameId; } public boolean isFinished() { return finished; } public char getWinnerSign() { return winnerSign; } public boolean canAct(Account account) { return playersInfo.get(currentTurn).getAccount().equals(account); } public char getCurrentTurn() { return this.currentTurn; } private void initializeCurrentState() { currentState = new char[row][column]; for (int i = 0; i < row; i++) { for (int j = 0; j < column; j++) { currentState[i][j] = 0; } } } private void changeCurrentTurn() { switch (currentTurn) { case 'X': currentTurn = 'O'; break; case 'O': currentTurn = 'X'; break; } } private void applyGameStatus() { if (winnerSign == 0) { setDrawsOnScores(); } else { setWinAndLoseOnScores(); } } private void setDrawsOnScores() { playersInfo.get('X').getAccount().increaseNumberOfDraws(); playersInfo.get('O').getAccount().increaseNumberOfDraws(); } private void setWinAndLoseOnScores() { for (char playerSign : playersInfo.keySet()) { if (playerSign == winnerSign) { playersInfo.get(playerSign).getAccount().increaseNumberOfWinnings(); } else { playersInfo.get(playerSign).getAccount().increaseNumberOfLoses(); } } } private boolean gameIsFinished(int i, int j) { return checkHorizontal(i, j) || checkVertical(i, j) || checkAscendingDiagonal(i, j) || checkDescendingDiagonal(i, j) || checkDraw(); } private boolean checkDraw() { return numberOfTurnsPlayed == row * column; } private boolean checkHorizontal(int i, int j) { int start = j >= combo ? -combo + 1 : -j; int end = column - j >= combo ? 0 : column - combo - j; for (int k = start; k <= end; k++) { if (horizontalLineFound(i, j + k)) return true; } return false; } private boolean horizontalLineFound(int i, int j) { for (int k = 0; k < combo; k++) { if (currentState[i][j + k] != currentTurn) return false; } winnerSign = currentTurn; return true; } private boolean checkVertical(int i, int j) { int start = i >= combo ? -combo + 1 : -i; int end = row - i >= combo ? 0 : row - combo - i; for (int k = start; k <= end; k++) { if (verticalLineFound(i + k, j)) return true; } return false; } private boolean verticalLineFound(int i, int j) { for (int k = 0; k < combo; k++) { if (currentState[i + k][j] != currentTurn) return false; } winnerSign = currentTurn; return true; } private boolean checkAscendingDiagonal(int i, int j) { int start = getStartOfDiagonal(i, j); int end = getEndOfDiagonal(i, j); for (int k = start; k <= end; k++) { if (ascendingDiagonalFound(i + k, j + k)) return true; } return false; } private boolean ascendingDiagonalFound(int i, int j) { for (int k = 0; k < combo; k++) { if (currentState[i + k][j + k] != currentTurn) { return false; } } winnerSign = currentTurn; return true; } private boolean checkDescendingDiagonal(int i, int j) { int mirroredJ = column - j - 1; int start = getStartOfDiagonal(i, mirroredJ); int end = getEndOfDiagonal(i, mirroredJ); for (int k = start; k <= end; k++) { if (descendingDiagonalFound(i + k, j - k)) return true; } return false; } private boolean descendingDiagonalFound(int i, int j) { boolean win = true; for (int k = 0; k < combo; k++) { if (currentState[i + k][j - k] != currentTurn) { win = false; break; } } if (win) { winnerSign = currentTurn; return true; } return false; } private int getStartOfDiagonal(int i, int j) { int start; if (i < j) { start = i >= combo ? -combo + 1 : -i; } else { start = j >= combo ? -combo + 1 : -j; } return start; } private int getEndOfDiagonal(int i, int j) { int end; if (row - i < column - j) { end = row - i >= combo ? 0 : row - combo - i; } else { end = column - j >= combo ? 0 : column - combo - j; } return end; } private Position applyUndo(char playerSign) throws ClientException { if (!playersInfo.get(playerSign).isUndoUsed() && playersInfo.get(playerSign).getLastPosition() != null) { currentTurn = playerSign; Position position = playersInfo.get(playerSign).getLastPosition(); currentState[position.getRow()][position.getColumn()] = 0; playersInfo.get(playerSign).setUndoUsed(); numberOfTurnsPlayed--; return position; } else { throw new ClientException("you can not undo"); } } public char getTurn(Account account) { AtomicReference<Character> value = new AtomicReference<>((char) 0); playersInfo.forEach((character, playerInfo) -> { if (playerInfo.getAccount().equals(account)) { value.set(character); } }); return value.get(); } } <file_sep>/client/src/view/ScoreBoardView.java package view; import controller.Controller; import controller.message.Message; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ScrollPane; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import models.Account; import models.BoxMaker; import models.DefaultButton; import models.LeaderBoardCell; import java.util.ArrayList; public class ScoreBoardView { private static Group root; private static Scene scene; private ScrollPane scrollPane; private Button backButton = new DefaultButton("Back", scene).getButton(); public static Scene getScene() { root = new Group(); scene = new Scene(root, Controller.getCurrentWidth(), Controller.getCurrentHeight()); return scene; } public void showLeaderBoard() { HBox container = BoxMaker.makeContainer(scene); HBox box = BoxMaker.makeSidedBox(scrollPane, backButton); container.getChildren().add(box); root.getChildren().addAll(container); } public void setList(Message message) { Account[] gamesInfo = message.getScoreBoardList().getAccounts(); ArrayList<HBox> boxesList = new ArrayList<>(); for (int i = 0; i < gamesInfo.length; i++) { LeaderBoardCell cell = new LeaderBoardCell(gamesInfo[i], i + 1); boxesList.add(cell.getBox()); } HBox[] boxes = new HBox[boxesList.size()]; boxes = boxesList.toArray(boxes); VBox content = BoxMaker.makeSimpleVertical(); content.getChildren().addAll(boxes); scrollPane = new ScrollPane(); scrollPane.setContent(content); } public Button getBackButton() { return backButton; } } <file_sep>/client/src/view/ErrorType.java package view; public enum ErrorType { CLIENT_ERROR("Client error!"), SERVER_ERROR("Server error!"); private final String message; ErrorType(String message) { this.message = message; } public String getMessage() { return message; } } <file_sep>/client/src/models/LogoImage.java package models; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import java.io.FileInputStream; import java.io.FileNotFoundException; import static models.ScreenData.SCALE; public class LogoImage { private static final String IMAGE_PATH = "favicon.png"; private static Image image; private static ImageView imageView; static { try { image = new Image(new FileInputStream(IMAGE_PATH)); imageView = new ImageView(image); imageView.setFitWidth(image.getWidth() * SCALE); imageView.setFitHeight(image.getHeight() * SCALE); imageView.setCache(true); imageView.setMouseTransparent(true); } catch (FileNotFoundException ignored) { } } public static Image getImage() { return image; } public static ImageView get() { return imageView; } } <file_sep>/client/src/controller/message/ErrorMessage.java package controller.message; public class ErrorMessage { private String messageId; private String errorMessage; public String getMessageId() { return messageId; } public String getMessage() { return errorMessage; } } <file_sep>/client/src/models/BoxMaker.java package models; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ScrollPane; import javafx.scene.control.TextField; import javafx.scene.effect.BlurType; import javafx.scene.effect.DropShadow; import javafx.scene.image.ImageView; import javafx.scene.layout.*; import javafx.scene.paint.Color; import static models.ScreenData.SCALE; public class BoxMaker { private static final CornerRadii CORNER_RADIUS = new CornerRadii(30 * SCALE); private static final Color SHADOW_COLOR = Color.rgb(102, 128, 128, 0.5); private static final Insets DEFAULT_PADDING = new Insets(40 * SCALE); private static final double DEFAULT_SPACING = 20 * SCALE; private static final double SCROLL_MIN_WIDTH = 800 * SCALE; private static final double BOX_MAX_WIDTH = 700 * SCALE; private static final double BOX_MAX_HEIGHT = 900 * SCALE; private static final double GRID_GAP = 10 * SCALE; private static final double CONTAINER_SPACING = 30 * SCALE; private static final double GAME_GRID_SIZE = 1300 * SCALE; private static final double FIELD_BOX_SPACING = 50 * SCALE; private static final DropShadow SHADOW = new DropShadow( BlurType.TWO_PASS_BOX, SHADOW_COLOR, 30 * SCALE, 50 * SCALE, 0, 0 ); private static final Background CONTAINER_BACKGROUND = new Background( new BackgroundFill(Color.rgb(242, 255, 232), CornerRadii.EMPTY, Insets.EMPTY) ); private static final Background BOX_BACKGROUND = new Background( new BackgroundFill(Color.rgb(244, 244, 244), CORNER_RADIUS, Insets.EMPTY) ); private static final Border DEFAULT_BORDER = new Border( new BorderStroke(Color.gray(0.4), BorderStrokeStyle.DASHED, CornerRadii.EMPTY, BorderWidths.DEFAULT) ); public static VBox makeVertical() { VBox box = new VBox(); box.setAlignment(Pos.CENTER); box.setPadding(DEFAULT_PADDING); box.setMaxSize(BOX_MAX_WIDTH, BOX_MAX_HEIGHT); box.setBackground(BOX_BACKGROUND); box.setSpacing(DEFAULT_SPACING); box.setEffect(SHADOW); return box; } private static HBox makeHorizontal() { HBox box = new HBox(); box.setAlignment(Pos.CENTER); box.setPadding(DEFAULT_PADDING); box.setMaxSize(BOX_MAX_WIDTH, BOX_MAX_HEIGHT); box.setBackground(BOX_BACKGROUND); box.setSpacing(DEFAULT_SPACING); box.setEffect(SHADOW); return box; } public static HBox makeContainer(Scene scene) { HBox container = new HBox(); container.setAlignment(Pos.CENTER); container.resize(scene.getWidth(), scene.getHeight()); container.prefWidthProperty().bind(scene.widthProperty()); container.prefHeightProperty().bind(scene.heightProperty()); container.setBackground(CONTAINER_BACKGROUND); container.setSpacing(CONTAINER_SPACING); return container; } public static VBox makeGameGrid(GridPane gridPane) { gridPane.setAlignment(Pos.CENTER); gridPane.setVgap(GRID_GAP); gridPane.setHgap(GRID_GAP); VBox gridContainer = new VBox(gridPane); gridContainer.setMinSize(GAME_GRID_SIZE, GAME_GRID_SIZE); gridContainer.setAlignment(Pos.CENTER); return gridContainer; } public static HBox makeFieldBox(Scene scene) { HBox fieldBox = new HBox(); fieldBox.setSpacing(FIELD_BOX_SPACING); fieldBox.setAlignment(Pos.CENTER); TextField textField = new DefaultTextField().getTextField(); Button button = new DefaultButton("Login", scene).getButton(); fieldBox.getChildren().addAll(textField, button); return fieldBox; } public static HBox makeSidedBox(ScrollPane scrollPane, Button backButton) { HBox box = BoxMaker.makeHorizontal(); ImageView imageView = LogoImage.get(); VBox leftSidebar = BoxMaker.makeLeftSideBar(); leftSidebar.getChildren().addAll(backButton, imageView); scrollPane.setMinWidth(SCROLL_MIN_WIDTH); scrollPane.setFitToWidth(true); scrollPane.setFitToHeight(true); box.getChildren().addAll(leftSidebar, scrollPane); return box; } private static VBox makeLeftSideBar() { VBox leftSidebar = new VBox(); leftSidebar.setAlignment(Pos.CENTER_LEFT); leftSidebar.setPadding(DEFAULT_PADDING); leftSidebar.setSpacing(DEFAULT_SPACING); return leftSidebar; } static HBox makeSimpleHorizontal() { HBox box = new HBox(); box.setSpacing(DEFAULT_SPACING); box.setPadding(DEFAULT_PADDING); box.setAlignment(Pos.CENTER); box.setBorder(DEFAULT_BORDER); return box; } public static VBox makeSimpleVertical() { VBox box = new VBox(); box.setAlignment(Pos.CENTER); return box; } } <file_sep>/client/src/view/GameView.java package view; import controller.Controller; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.image.ImageView; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; import models.*; public class GameView { private static Group root; private static Scene scene; private Game game; private Button undoButton; private Button pauseButton; private Button stopButton; private GridPane gridPane = new GridPane(); public static Scene getScene() { root = new Group(); scene = new Scene(root, Controller.getCurrentWidth(), Controller.getCurrentHeight()); return scene; } public void showGame(Game game) { this.game = game; HBox container = BoxMaker.makeContainer(scene); VBox gridContainer = BoxMaker.makeGameGrid(gridPane); Tile[][] tiles = game.getCurrentState(); for (int i = 0; i < tiles.length; i++) { for (int j = 0; j < tiles[i].length; j++) { gridPane.add(new StackPane(tiles[i][j].getRectangle(), tiles[i][j].getLabel()), j, i); } } VBox menuBox = makeBox(); container.getChildren().addAll(gridContainer, menuBox); root.getChildren().addAll(container); } private VBox makeBox() { VBox box = BoxMaker.makeVertical(); ImageView imageView = LogoImage.get(); Label label = new DefaultLabel("opponent username:").getLabel(); Label oppName = new DefaultLabel(game.getOpponentUserName()).getLabel(); undoButton = new DefaultButton("Undo", scene).getButton(); pauseButton = new DefaultButton("Pause", scene).getButton(); stopButton = new DefaultButton("Stop", scene).getButton(); Tile currentTurnTile = game.getCurrentTurn(); StackPane turnPane = new StackPane(currentTurnTile.getRectangle(), currentTurnTile.getLabel()); box.getChildren().addAll(imageView, label, oppName, undoButton, pauseButton, stopButton, turnPane); return box; } public Button getUndoButton() { return undoButton; } public Button getPauseButton() { return pauseButton; } public Button getStopButton() { return stopButton; } public GridPane getGridPane() { return gridPane; } } <file_sep>/client/src/models/DefaultLabel.java package models; import javafx.scene.control.Label; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import static models.ScreenData.SCALE; public class DefaultLabel extends Label { public static final Font DEFAULT_FONT = Font.font("SansSerif", FontWeight.BOLD, 30 * SCALE); private Label label; public DefaultLabel(String info) { label = new Label(info); label.setFont(DEFAULT_FONT); } public Label getLabel() { return label; } } <file_sep>/client/src/models/Game.java package models; import controller.message.MakeGameMessage; public class Game { private static final double DEFAULT_DIMENSION = 3; private int gameId; private Tile[][] currentState; private String opponentUserName; private Tile currentTurn; private char myTurn; public Game(MakeGameMessage game) { this.gameId = game.getGameId(); int row = game.getCurrentState().length; int column = game.getCurrentState()[0].length; currentState = new Tile[row][column]; for (int i = 0; i < row; i++) { for (int j = 0; j < column; j++) { currentState[i][j] = new Tile( game.getCurrentState()[i][j], DEFAULT_DIMENSION / Math.max(row, column) ); } } this.opponentUserName = game.getOpponentName(); this.currentTurn = new Tile(game.getCurrentTurn(), 0.6); this.myTurn = game.getMyTurn(); } public int getGameId() { return gameId; } public Tile[][] getCurrentState() { return currentState; } public String getOpponentUserName() { return opponentUserName; } public Tile getCurrentTurn() { return currentTurn; } public boolean isMyTurn() { return myTurn == currentTurn.getLabel().getText().charAt(0); } public Tile getTile(Position position) { return currentState[position.getRow()][position.getColumn()]; } } <file_sep>/server/src/models/GameInfo.java package models; public class GameInfo { private String xUsername; private String oUsername; private int gameId; public GameInfo(Game game) { this.xUsername = game.getPlayersInfo().get('X').getAccount().getName(); this.oUsername = game.getPlayersInfo().get('O').getAccount().getName(); this.gameId = game.getId(); } }<file_sep>/client/src/controller/ResumeMenuController.java package controller; import controller.message.Message; import javafx.scene.Scene; import models.PausedGameBox; import view.ResumeMenuView; import java.util.ArrayList; class ResumeMenuController { private static SocketData socketData; private Scene scene = ResumeMenuView.getScene(); private ResumeMenuView view = new ResumeMenuView(); void start(SocketData socketData) { ResumeMenuController.socketData = socketData; Controller.setScene(scene); view.showResumeList(); view.getBackButton().setOnMouseClicked(event -> new MainMenuController().start(socketData)); } private void setPlayActions() { ArrayList<PausedGameBox> pausedGames = view.getPausedGames(); pausedGames.forEach( pausedGameBox -> pausedGameBox.getPlayButton().setOnMouseClicked( event -> Message.makeResumeMessage( socketData.getMessagePort(), pausedGameBox.getGameId() ).sendTo(socketData) ) ); } void setList(Message message) { view.setList(message); setPlayActions(); } } <file_sep>/client/src/view/LoginView.java package view; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.image.ImageView; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import models.BoxMaker; import models.DefaultLabel; import models.LogoImage; import models.ScreenData; public class LoginView { private static Group root; private static Scene scene; private Button loginButton; private TextField textField; public static Scene getScene() { root = new Group(); scene = new Scene(root, ScreenData.SCENE_WIDTH, ScreenData.SCENE_HEIGHT); return scene; } public void showLoginBox() { HBox container = BoxMaker.makeContainer(scene); VBox box = makeLoginBox(); container.getChildren().add(box); root.getChildren().addAll(container); } public Button getLoginButton() { return loginButton; } public String getFieldText() { return textField.getText(); } private VBox makeLoginBox() { VBox box = BoxMaker.makeVertical(); ImageView imageView = LogoImage.get(); Label label = new DefaultLabel("Enter your name:").getLabel(); HBox fieldBox = BoxMaker.makeFieldBox(scene); fieldBox.getChildren().stream().filter( node -> node instanceof TextField ).forEach(node -> this.textField = (TextField) node); fieldBox.getChildren().stream().filter( node -> node instanceof Button ).forEach(node -> this.loginButton = (Button) node); box.getChildren().addAll(imageView, label, fieldBox); return box; } public void clearField() { textField.clear(); } public TextField getField() { return textField; } }<file_sep>/client/src/controller/message/PutMessage.java package controller.message; import models.Position; class PutMessage { private int gameId; private Position position; PutMessage(int gameId, Position position) { this.gameId = gameId; this.position = position; } } <file_sep>/server/src/controller/message/MessageType.java package controller.message; public enum MessageType { // client -> server LOGIN, NEW_GAME, RESUME_GAME, SCOREBOARD_REQUEST, PAUSED_GAMES_REQUEST, PUT, UNDO, PAUSE, STOP, // server -> client SCOREBOARD_LIST, PAUSED_GAMES_LIST, MAP_UPDATE_MESSAGE, ERROR_MESSAGE, MAKE_GAME, DONE_MESSAGE, FINISH_GAME, PORT_MESSAGE } <file_sep>/server/src/controller/message/PausedGamesList.java package controller.message; import models.GameInfo; import java.util.ArrayList; class PausedGamesList { private ArrayList<GameInfo> games; PausedGamesList(ArrayList<GameInfo> games) { this.games = games; } } <file_sep>/server/src/controller/message/MapUpdateType.java package controller.message; public enum MapUpdateType { X, O, EMPTY } <file_sep>/client/src/controller/message/MakeGameMessage.java package controller.message; public class MakeGameMessage { private int gameId; private char[][] currentState; private String opponentName; private char currentTurn; private char myTurn; public int getGameId() { return gameId; } public String getOpponentName() { return opponentName; } public char[][] getCurrentState() { return currentState; } public char getCurrentTurn() { return currentTurn; } public char getMyTurn() { return myTurn; } } <file_sep>/server/src/controller/message/PutMessage.java package controller.message; import models.Position; public class PutMessage { private int gameId; private Position position; public int getGameId() { return gameId; } public Position getPosition() { return position; } } <file_sep>/client/src/controller/message/FinishGameMessage.java package controller.message; public class FinishGameMessage { private GameState state; public GameState getState() { return state; } }
b5a0216ed5cd0a345a5b14e2a0cbb176557bc982
[ "Markdown", "Java" ]
27
Java
ahmadsalimi/XO_game
7d233fe9e31c397ab65faafea5a322257765117a
48a5a44f13823fb3ecf71d85b3b01511d7d3c126
refs/heads/master
<repo_name>v3sking/siapp<file_sep>/crudGenerator1/src/main/java/com/wisedu/zzfw/generator/model/entity/JavaEntity.java package com.wisedu.zzfw.generator.model.entity; import lombok.Getter; import lombok.Setter; @Setter @Getter public class JavaEntity { private String packageName; private String className; private String description; } <file_sep>/crudGenerator1/src/main/java/com/wisedu/zzfw/generator/model/parametter/ControllerParamatter.java package com.wisedu.zzfw.generator.model.parametter; import com.wisedu.zzfw.generator.model.entity.ControllerEntity; public interface ControllerParamatter extends JavaParamatter{ ControllerEntity getJavaEntity(); } <file_sep>/crudGenerator1/src/main/resources/template/template.sql --1、创建模块 --创建第二级目录节点 insert into ss_module (WID, NAME, MEMO, PARENT_WID, INDEXED, TYPE) values ('${moduleWid}', '${moduleName}', null,(select wid from ss_module p where p.name='${parentModuleName}'), (select max(indexed)+1 from ss_module where parent_wid = (select wid from ss_module p where p.name='${parentModuleName}')), '1'); --二级目录添加URL delete from ss_modulepath where MODULE_WID = '${moduleWid}'; <#list modulepath as path> insert into ss_modulepath (WID, MODULE_WID, PATH, MEMO, INDEXED) values ('${path.wid}', '${moduleWid}', '/${controllerPath}/${path.methodName}.do', '', <#if path.methodName == "view">0<#else>1</#if>); </#list> --2、创建菜单,默认菜单创建在实施人员权限下 insert into ss_menuitem (WID, NAME, ICON_PATH, PATH, MODULE_WID, MENU_WID, MEMO, PARENT_WID, INDEXED) values ('${menuitemWid}', '${moduleName}', null, null, '${moduleWid}', (select wid from ss_menu where role='${roleName}'), null, (select wid from ss_menuitem where name='${parentModuleName}'), (select max(indexed)+1 from ss_menuitem where parent_wid = (select wid from ss_menuitem where name='${parentModuleName}'))); commit; <file_sep>/crudGenerator1/pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>crudGenerator</artifactId> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.3.RELEASE</version> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <spring-boot-version>1.5.3.RELEASE</spring-boot-version> <java.version>1.7</java.version> <spring-version>4.3.8.RELEASE</spring-version> <tk-mybatis-version>3.4.0</tk-mybatis-version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.freemarker</groupId> <artifactId>freemarker</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.3</version> </dependency> <dependency> <groupId>com.wisedu</groupId> <artifactId>zzfw-template</artifactId> <version>3.0.1</version> <exclusions> <exclusion> <artifactId>*</artifactId> <groupId>*</groupId> </exclusion> </exclusions> </dependency> <!-- Swagger --> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.6.1</version> </dependency> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>3.3.0</version> </dependency> <dependency> <groupId>tk.mybatis</groupId> <artifactId>mapper</artifactId> <version>${tk-mybatis-version}</version> </dependency> <!-- lombok --> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> <version>2.11.0</version> </dependency> </dependencies> <build> <finalName>crudGenerator</finalName> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <!-- -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000开启8000监听端口 --> <!-- 提供远程调试功能 --> <jvmArguments> -Dfile.encoding=UTF-8 -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 </jvmArguments> </configuration> <dependencies> <!-- spring热部署 --> <dependency> <groupId>org.springframework</groupId> <artifactId>springloaded</artifactId> <version>1.2.6.RELEASE</version> </dependency> </dependencies> <!-- 如果不继承boot-parent 怎需要添加如下配置 否则jar包不能单独运行 --> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>${java.version}</source> <target>${java.version}</target> </configuration> </plugin> </plugins> </build> </project> <file_sep>/crudGenerator1/src/main/java/com/wisedu/zzfw/model/ColumnModel.java package com.wisedu.zzfw.model; import java.lang.reflect.Field; import javax.persistence.Column; import javax.persistence.Id; import org.springframework.util.StringUtils; import com.wisedu.zzfw.util.StringUtil; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data public class ColumnModel { private Field field; private boolean primary; private String columnName; private String columnDesc; private String columnNameDx; private String dbColumnName; private boolean canNull; private Class<?> columnType; public ColumnModel(Field field){ this.field = field; Id annotation = field.getAnnotation(Id.class); if (annotation != null) { primary = true; } columnName = field.getName(); ApiModelProperty apiModelProperty = field.getAnnotation(ApiModelProperty.class); Column column = field.getAnnotation(Column.class); dbColumnName = column.name(); if (apiModelProperty != null) { if(!StringUtils.isEmpty(apiModelProperty.value())){ columnDesc = apiModelProperty.value(); }else{ columnDesc = column.name(); } canNull = !apiModelProperty.required(); } columnNameDx = StringUtil.firstToUpperCase(columnName); columnType = field.getType(); } } <file_sep>/crudGenerator1/src/main/java/com/wisedu/zzfw/Application.java package com.wisedu.zzfw; import java.io.IOException; import java.util.List; import javax.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import com.wisedu.zzfw.GeneratorPropertiesWarpper; import com.wisedu.zzfw.builder.Builder; import com.wisedu.zzfw.model.BeanModel; import freemarker.template.Configuration; import lombok.extern.slf4j.Slf4j; @SpringBootApplication @Slf4j public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Autowired Configuration configuration; @Autowired List<Builder> builders; @Autowired GeneratorPropertiesWarpper generatorProperties; @PostConstruct private void init() throws IOException{ log.info("开始生成"); List<BeanModel> beanModelClasses = generatorProperties.getBeanModelClass(); for (BeanModel beanModel : beanModelClasses) { for (Builder builder : builders) { builder.build(beanModel).getGenerator().genCode(); } } log.info("生成结束"); System.exit(0); } } <file_sep>/crudGenerator1/src/main/java/com/wisedu/zzfw/generator/AbstractGenerator.java package com.wisedu.zzfw.generator; import java.io.File; import java.util.Map; import org.apache.commons.io.FileUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ui.freemarker.FreeMarkerTemplateUtils; import com.wisedu.zzfw.GeneratorProperties.ModelAttributes; import com.wisedu.zzfw.model.BeanModel; import freemarker.template.Configuration; import freemarker.template.Template; import lombok.Getter; import lombok.Setter; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; @Getter @Setter @Slf4j public abstract class AbstractGenerator implements Generator { private boolean enabled; @Autowired private Configuration configuration; /** * mbg生成的java模型类 */ private BeanModel beanModel; /** * 模型额外属性 */ private ModelAttributes modelAttributes; /** * E:/workspace/crudGenerator例如 */ private String projectPath;//TODO custom /** * "E:/workspace/crudGenerator/src/main/java/com/wisedu/zzfw/bulletion/web/bulletion.java */ private String filePath; private String fileName; /** * 例如 TemplateController.java */ private String templateName; protected void init(){ configuration.setClassForTemplateLoading(this.getClass(), "/template"); } /** * * @Title: filePathCallback * @Description: 必须等待init方法加载完毕后才执行 * @return void 返回类型 */ protected abstract void filePathCallback(); protected abstract String templateName(); protected abstract String filePath(); @Override @SneakyThrows public void genCode() { this.init(); this.filePathCallback(); Map<String, Object> model = this.initModelParams(); Template t = configuration.getTemplate(templateName); String content = FreeMarkerTemplateUtils.processTemplateIntoString(t, model); File file = new File(filePath); FileUtils.write(file, content, "utf-8"); log.info("生成文件content:{}",content); log.info("生成文件路径:{}",file.getAbsolutePath()); } protected abstract Map<String, Object> initModelParams(); } <file_sep>/crudGenerator1/src/main/java/com/wisedu/zzfw/generator/model/entity/FileEntity.java package com.wisedu.zzfw.generator.model.entity; import java.io.File; import lombok.Getter; import lombok.Setter; @Setter @Getter public class FileEntity{ /** * "E:/workspace/crudGenerator/src/main/java/com/wisedu/zzfw/bulletion/web/bulletion.java */ private File file; } <file_sep>/crudGenerator1/src/main/java/com/wisedu/zzfw/model/BeanModel.java package com.wisedu.zzfw.model; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.List; import com.wisedu.zzfw.GeneratorProperties.ModelAttributes; import io.swagger.annotations.ApiModel; import lombok.Data; @Data public class BeanModel { private Class<?> beanClass; private String beanDescription; private String beanSimpleName; private String beanFullName; private List<ColumnModel> columns = new ArrayList<ColumnModel>(); private ModelAttributes modelAttributes = new ModelAttributes(); public BeanModel(Class<?> beanClass, ModelAttributes modelAttributes) { this.beanClass = beanClass; this.beanSimpleName = beanClass.getSimpleName(); this.beanFullName = beanClass.getName(); this.modelAttributes = modelAttributes; ApiModel annotation = beanClass.getAnnotation(ApiModel.class); if (annotation != null) { String value = annotation.value(); this.beanDescription = value; } Field[] declaredFields = beanClass.getDeclaredFields(); for (Field field : declaredFields) { if(!Modifier.isStatic(field.getModifiers())){ //判断是否静态属性 columns.add(new ColumnModel(field)); } } } } <file_sep>/crudGenerator1/src/main/java/com/wisedu/zzfw/generator/model/parametter/Parametter.java package com.wisedu.zzfw.generator.model.parametter; import com.wisedu.zzfw.generator.model.entity.ConfigEntity; import com.wisedu.zzfw.generator.model.entity.FileEntity; public interface Parametter { ConfigEntity getConfigEntity(); FileEntity getFileEntity(); } <file_sep>/crudGenerator1/src/main/resources/template/template.js /** * 请求异常处理 */ $(function(){ //初始化加载 ${viewName}.init(); $.ajaxSetup({ complete : function(xhr,status){ console.log(status); if(status !="success"){ var message = "<div class='message' >操作失败!</div>"; cwxbox.box.show(message,2); } } }) }); function formatOperation(val, row, index) { return '<a href="#" onclick="${viewName}.showEdit(true,'+index+')' + '">编辑</a>&nbsp&nbsp<a href="#" onclick="${viewName}.del(true,'+index+')">删除</a>'; } var ${viewName} ={ editFlag:false, rowIndex:null, init: function(){ ${viewName}.initTable(); }, initTable : function(){ var param = $("#searchForm").serializeJSON(); Common.datagrid("table",{ queryParams: param, url:rootUrl+'/${controllerPath}/list.do', toolbar:"#toolbar", fitColumns:true, pagination:true, pageSize:20 }); }, showEdit: function(editFlag,index){ //为空时新增 ${viewName}.editFlag = editFlag; ${viewName}.rowIndex = index; $("#editForm").form("clear"); if(!editFlag){ $("#edit-window").window("setTitle","新增"); }else{ $('#table').datagrid('selectRow', index); var row = $("#table").datagrid("getSelected"); if (row == null) { Common.alertWarning("请选择行!"); return; } $("#edit-window").window("setTitle","编辑"); $("#editForm").form("load",row); } $("#edit-window").window("open"); }, del: function(tipFlag,index){ $('#table').datagrid('selectRow', index); var row = $("#table").datagrid("getSelected"); if (row == null) { Common.alertWarning("请选择行!"); return; } if(tipFlag==undefined || tipFlag==true){ $.messager.confirm('提示','您确定要删除该记录吗?',function(r){ if (r){ ${viewName}._del(tipFlag,row); } }); }else{ ${viewName}._del(tipFlag,row); } }, _del: function(tipFlag,row){ $.ajax({ url:rootUrl+'/${controllerPath}/delete.do', async:false, type:'post', data:{"id":row.wid}, dataType:"json", success:function(data){ if (data.ret == 0){ if(tipFlag==undefined || tipFlag == true){ Common.alertSuccess("该记录删除成功!"); ${viewName}.initTable(); } }else{ if(tipFlag==undefined || tipFlag == true){ Common.alertWarning("该记录删除失败!"); } } } }); }, save : function(){ var data = $("#editForm").serializeJSON(); //校验必填 var flag = true; for(var p in data){ if(typeof(data[p]) != "function"){ if("${requiredColumn}".indexOf(p)<0){ continue; } var input = $("#editForm #"+p); var fieldName = input.parent("td").prev("td").text(); if(Common.isNull(fieldName)){ continue; } if(fieldName.endWith(":")||fieldName.endWith(":")){ fieldName = fieldName.substring(0,fieldName.length-1); } var font; var require = input.next(); if(require.length == 0 || !require.is("font")){ require = input.next().next(); } if(require.length == 0 || !require.is("font")){ continue; }else{ if( Common.isNull(data[p])){ Common.alertWarning("'"+fieldName+"'为空!"); flag = false; break; } } } } if(!flag){ return; } //是否需要校验唯一性 var needCheckFlag = false; //新增校验 if(Common.isNull(data.wid)){ needCheckFlag = true; delete data.wid; }else{ //修改了编号时也校验 var row = $("#table").datagrid("getSelected"); if(!${viewName}.editFlag){ needCheckFlag = true; }else{ var checkColumns = "${validColumn}".split(","); for(var i = 0; i<checkColumns.length; i++ ){ if(data[checkColumns[i]] != row[checkColumns[i]]){ needCheckFlag = true; break; } } } } //校验编号是否重复结果 var validRet = false; if(needCheckFlag){ var validColumnStr = "${validColumn}"; var validParam = {}; var validColumns = validColumnStr.split(","); for(var i = 0; i<validColumns.length; i++){ var col = validColumns[i]; validParam[col] = $("#editForm #"+col).val(); } $.ajax({ url:rootUrl+'/${controllerPath}/exist.do', async:false, data:validParam, dataType:"json", success:function(obj){ if (obj.ret == 0){ //存在 validRet = true; }else{ validRet = false; } } }); } if(validRet){ Common.alertWarning("该数据已存在,请检查!"); return; } var action = ""; if(${viewName}.editFlag){ // 因为自增长主键 编辑删掉再新增 ${viewName}.del(false,${viewName}.rowIndex); } $.ajax({ url:rootUrl+'/${controllerPath}/add.do', async:false, type:"post", data:data, dataType:"json", success:function(obj){ if (obj.ret == 0){ Common.alertSuccess("保存成功!"); ${viewName}.initTable(); $("#edit-window").window("close"); }else{ Common.alertWarning("保存失败!"); } } }); } };<file_sep>/crudGenerator1/src/main/java/com/wisedu/zzfw/builder/impl/PageModelParamBuilder.java package com.wisedu.zzfw.builder.impl; import com.wisedu.zzfw.builder.JavaBuilder; public class PageModelParamBuilder extends JavaBuilder{ } <file_sep>/crudGenerator1/src/main/java/com/wisedu/zzfw/generator/impl/PageModelGenerator.java package com.wisedu.zzfw.generator.impl; import java.util.Map; import org.springframework.stereotype.Component; import com.wisedu.zzfw.generator.JavaGenerator; @Component public class PageModelGenerator extends JavaGenerator{ @Override protected void init() { super.init(); this.setPackageName(this.getModelPackageName()); this.setClassName(this.getModelSimpleName()+"Param");//controller,service,param this.setTemplateName("TemplatePageModelParam.java"); this.initFilePath(); } @Override protected Map<String, Object> initModelParams() { return super.initModelParams(); } } <file_sep>/crudGenerator1/src/main/java/com/wisedu/zzfw/generator/controller/DefaultControllerGenerator.java package com.wisedu.zzfw.generator.controller; import java.util.Map; import com.wisedu.zzfw.GeneratorProperties.ModelAttributes; import com.wisedu.zzfw.model.BeanModel; import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; @Slf4j @Getter @Setter public class DefaultControllerGenerator extends AbstractControllerGenerator { @Override protected String controllerRequestMapping() { return this.getJavaAttributes().getControllerPath(); } @Override protected String viewPath() { return this.getModelAttributes().getPageAttributes().getJspPath(); } @Override protected String viewFilePrefix() { return this.getBeanModel().getBeanSimpleName().toLowerCase(); } @Override protected Map<String, Object> initModelParams() { Map<String, Object> model = super.initModelParams(); model.put("controllerPath",this.getControllerPath()); model.put("jspPath",this.getJspPath()); model.put("viewName",viewName); return model; } protected void initFilePath(){ String packageName = this.getPackageName(); String filePath = this.getViewProjectName()+ "/src/main/java/"+ packageName.replaceAll("\\.", "/") +"/"+this.getClassName()+".java"; this.setFilePath(filePath); } } <file_sep>/crudGenerator1/src/main/java/com/wisedu/zzfw/generator/controller/AbstractControllerGenerator.java package com.wisedu.zzfw.generator.controller; import com.wisedu.zzfw.generator.JavaGenerator; import lombok.Getter; import lombok.Setter; @Getter @Setter public abstract class AbstractControllerGenerator extends JavaGenerator { private String controllerRequestMapping; private String viewPath; private String viewFilePrefix; @Override protected void init() { super.init(); this.setClassName(this.className()); this.setPackageName(this.packageName()); this.controllerRequestMapping = controllerRequestMapping(); this.viewPath = viewPath(); this.viewFilePrefix = viewFilePrefix(); this.setTemplateName(this.templateName()); this.setFilePath(this.filePath()); } protected abstract String controllerRequestMapping(); protected abstract String viewPath(); protected abstract String viewFilePrefix(); @Override protected String className() { return this.getModelSimpleName()+"Controller"; } @Override protected String templateName() { return "TemplateController.java"; } @Override protected String packageName() { return this.getJavaAttributes().getControllerPackage(); } protected String filePath() { String packageName = this.getPackageName(); String filePath = this.getViewProjectName()+ "/src/main/java/"+ packageName.replaceAll("\\.", "/") +"/"+this.getClassName()+".java"; return filePath; } } <file_sep>/crudGenerator1/src/main/java/com/wisedu/zzfw/generator/model/parametter/JavaParamatter.java package com.wisedu.zzfw.generator.model.parametter; import com.wisedu.zzfw.generator.model.entity.JavaEntity; public interface JavaParamatter extends Parametter{ JavaEntity getJavaEntity(); } <file_sep>/crudGenerator1/src/main/java/com/wisedu/zzfw/util/StringUtil.java package com.wisedu.zzfw.util; import org.springframework.util.StringUtils; public class StringUtil { public static String firstToLowerCase(String str){ if (StringUtils.isEmpty(str)) { return ""; } if (str.length() ==1) { return str.toLowerCase(); }else{ return str.substring(0, 1).toLowerCase()+str.substring(1); } } public static String firstToUpperCase(String str){ if (StringUtils.isEmpty(str)) { return ""; } if (str.length() ==1) { return str.toUpperCase(); }else{ return str.substring(0, 1).toUpperCase()+str.substring(1); } } } <file_sep>/crudGenerator1/src/main/java/com/wisedu/zzfw/GeneratorProperties.java package com.wisedu.zzfw; import java.util.ArrayList; import java.util.List; import org.springframework.boot.context.properties.ConfigurationProperties; import lombok.Getter; import lombok.Setter; @Setter @Getter @ConfigurationProperties(prefix = "crudgen") public class GeneratorProperties { private String javaProjectPath; private String mybatisGeneratorConfigPath; private String viewProjectPath; /** * 是否启用 */ private boolean controllerEnabled = true; private boolean JsEnabled = true; private boolean jspEnabled = true; private boolean pageModelParamEnabled = true; private boolean serviceEnabled = true; private boolean sqlEnabled = true; private List<ModelAttributes> modelAttributes = new ArrayList<ModelAttributes>(); @Getter @Setter public static class ModelAttributes { private String modelName; private JavaAttributes javaAttributes = new JavaAttributes(); private PageAttributes pageAttributes = new PageAttributes(); /** * 菜单 */ private MenuAttributes menuAttributes = new MenuAttributes(); @Getter @Setter public static class JavaAttributes { private String modelPackage; private String servicePackage; private String controllerPackage; private String controllerPath; } @Getter @Setter public static class PageAttributes { private String jspPath; private String queryColumns; private String queryOrderSql; private String requiredColumns; private String validExistsColumns; } @Getter @Setter public static class MenuAttributes { /** * 二级模块名称 */ private String moduleName; /** * 需要生成菜单的角色名称 */ private String roleName = "实施管理员"; /** * 父模块名称 */ private String parentModuleName; } } } <file_sep>/crudGenerator1/src/main/java/com/wisedu/zzfw/builder/ViewBuilder.java /** * @Title: ViewBuilder.java * @Package com.wisedu.zzfw.builder * @Description: TODO(用一句话描述该文件做什么) * @author wutao * @date 2017年12月21日 上午10:07:46 * @version V1.0 */ package com.wisedu.zzfw.builder; import com.wisedu.zzfw.generator.ViewGenerator; import com.wisedu.zzfw.model.BeanModel; /** * @ClassName: ViewBuilder * @Description: TODO(这里用一句话描述这个类的作用) * @author wutao * @date 2017年12月21日 上午10:07:46 * @Copyright: Copyright (c) 2017 wisedu */ public abstract class ViewBuilder extends AbstractBuilder{ @Override public Builder build(BeanModel beanModel) { super.build(beanModel); ViewGenerator javaGenerator = (ViewGenerator)generator; javaGenerator.setProjectPath(generatorProperties.getViewProjectPath()); return this; } } <file_sep>/crudGenerator1/src/main/java/com/wisedu/zzfw/generator/decorator/ParamatterDecorator.java package com.wisedu.zzfw.generator.decorator; public interface ParamatterDecorator { configPamatter(); } <file_sep>/crudGenerator1/readme.txt crudGenerator 增删改查代码生成工具 使用freeMarker 结合tkMybatis生成代码 从前端jsp,js,到后端controller,service,pageModel 后端代码生成大部分已基本实现, 剩下前端功能 使用步骤 1安装lombok eclipse 启动eclipse.ini 文件末尾添加-javaagent:lombok.jar eclipse.ini同级目录放置一个lombok.jar文件 可以从maven仓库复制,需要重命名jar文件删除版本号,配置完毕后重启eclipse 参考: lombok依赖: <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <scope>provided</scope> </dependency> 参考文档:http://blog.csdn.net/v2sking/article/details/73431364 2.application.yml 参考application.yml内容 3.运行Application.java 即可生成 controller service pageModelParam等代码 待实现: 1.所有代码表集合到一个查询页面 2.表格展示字段可以控制是否显示 3.查询条件每行三个,超过三个换行 4.字段名称默认从表中获取注释,可以对字段名称起别名, 5.字段展示顺序排序 5.可自定义模板生成规则,开发者自己决定采用什么模板,默认使用自定义模板 6.优化generator 成员变量 7.结合mbg 一键生成 <file_sep>/crudGenerator1/src/main/java/com/wisedu/zzfw/generator/model/ModelParameterConverter.java package com.wisedu.zzfw.generator.model; import java.util.Map; import com.wisedu.zzfw.generator.model.entity.ConfigEntity; /** * * @ClassName: ModelParameterConverter * @Description: 将初始化参数转为模板引擎参数 * @author hyluan * @date 2018年1月3日 下午4:13:07 * @Copyright: Copyright (c) 2017 wisedu */ public interface ModelParameterConverter { Map<String, Object> converterParameter(Map<String,Object> parametter); }
34e0579147fa5c5cf43e944b5f42c3fd254c8dfd
[ "SQL", "JavaScript", "Maven POM", "Java", "Text" ]
22
Java
v3sking/siapp
494c67273e2a3947fa59a4c34c8155935f35b726
bd46a8da962bbaf2a5bf98f3d065a7fb7302036f
refs/heads/master
<repo_name>ginny-371/JavaSession<file_sep>/Testing/src/main/java/JavaBasic/ListStaff.java package JavaBasic; import java.util.ArrayList; import java.util.Scanner; public class ListStaff { ArrayList<Staff> listStaff = new ArrayList<>(); Scanner sc = new Scanner(System.in); //Add JavaBasic.Staff public void addStaff() { listStaff.add(new Staff("NV1","Xinh", 29, "<NAME>, H<NAME>", "0122123434")); listStaff.add(new Staff("NV2", "Dong", 25, "<NAME>", "0922123434")); listStaff.add(new Staff("NV3", "Brian", 25, "<NAME>, H<NAME>", "0122123434")); } // Update JavaBasic.Staff public void updateStaff() { Boolean flag = false; System.out.println("Nhập tên nhân viên bạn muốn tìm kiếm: "); String name = sc.nextLine(); for (int i = 0; i < listStaff.size(); i++) { if (listStaff.get(i).name.contains(name)) { listStaff.set(i, new Staff(listStaff.get(i).id, "Lan", 29, "<NAME>, H<NAME>", "0122123434")); flag = true; } } if (flag == false) { System.out.println("Không tìm thấy nhân viên"); }else printStaff(); } // Remove JavaBasic.Staff public void removeStaff(){ boolean flag2 = false; System.out.println("Nhập id bạn muốn tìm kiếm: "); String id = sc.nextLine(); for (int i = 0; i < listStaff.size(); i++) { if (listStaff.get(i).id.contains(id)) { listStaff.remove(listStaff.get(i)); flag2 = true; } } if (flag2 == false) { System.out.println("Không tìm thấy nhân viên"); }else printStaff(); } // PrintStaff public void printStaff(){ for(Staff x:listStaff){ System.out.println(x); } } } <file_sep>/Java1/Circle.java public class Circle { float r = 8.0f; float pi = 3.14f; public float chuVi(){ float chuVi= r*2*pi; return(chuVi); } public float dienTich(){ float dienTich = pi*r*r ; return(dienTich); } } <file_sep>/Testing/src/main/java/JavaBasic/Main.java package JavaBasic; import java.util.Scanner; public class Main { public static void main(String[] args) throws CheckingException { Scanner sc = new Scanner(System.in); System.out.println("Nhập danh sách bạn muốn thao tác: "); System.out.println("JavaBasic.Staff: Ấn 1"); System.out.println("JavaBasic.Product: Ấn 2"); int bt = sc.nextInt(); switch (bt) { case 1: { ListStaff staff = new ListStaff(); staff.addStaff(); System.out.println("In danh sách sau khi add: ");staff.printStaff(); staff.updateStaff(); staff.removeStaff(); break; } case 2: { System.out.println(); ListProducts products = new ListProducts(); products.addProduct(); System.out.println("In danh sách sau khi add: ");products.printProduct(); products.updateProduct(); System.out.println("In danh sách sau khi update: ");products.printProduct(); products.removeProduct(); System.out.println("In danh sách sau khi xóa: ");products.printProduct(); break; } default: System.out.println("Nhập sai rồi"); } //Bai 1 // JavaBasic.BMIException tc = new JavaBasic.BMIException(); // System.out.println("Chỉ số BMI là: "+tc.tinhBMI()); //Bai 2 // JavaBasic.NumberComparation nc = new JavaBasic.NumberComparation(); // nc.compareNumber(); //Bai 3 // JavaBasic.DanhsachNhanVien dsnv = new JavaBasic.DanhsachNhanVien(); // dsnv.nhapNhanVien(); //JavaBasic.Bai1 // String str = new String("You Only Live Once. But if You do it right. One is Enough"); // JavaBasic.Bai1 b1 = new JavaBasic.Bai1(); // b1.xuLyChuoi(str); //JavaBasic.Bai2 // JavaBasic.Bai2 b2 = new JavaBasic.Bai2(); // b2.validatePassword(); // //JavaBasic.Bai3 // JavaBasic.Bai3 b3 = new JavaBasic.Bai3(); // b3.monthOfYear(); // StringBuilder str = new StringBuilder(); // StringBuilder str2 = new StringBuilder("Hello Java"); // StringBuilder str3 = new StringBuilder(50); // System.out.println("Trước khi nối: "+str2); // str2.append(" và Đông"); // System.out.println("Sau khi nối: "+str2); // // Example strTest = new Example(); // System.out.println(strTest.usingInsert(str2)); // System.out.println(strTest.usingReverse(str2)); // int i = str2.indexOf("a"); // System.out.println("Vị trí đầu tiền của chữ a là :" +i); // int j = str2.lastIndexOf("a"); // System.out.println("Vị trí cuối cùng của chữ a là :" +j); // System.out.println("Dung lượng chuỗi là:"+str2.capacity()); // System.out.println("Kích thước chuỗi là:"+str2.length()); // String [] arr = str2.toString().split("\\s"); // for (int k = arr.length-1; k>=0; k--){ // System.out.println(arr[k]); // } // String rev = new String("<NAME>"); // String getS = new String(); // for ( int i =rev.length()-1; i>=0; i--){ // getS = getS+ rev.charAt(i); // } // System.out.println(getS); // JavaBasic.ChuanHoaTen cht = new JavaBasic.ChuanHoaTen(); // cht.chuannHoa("<NAME> "); // cht.formatFullName(); } } <file_sep>/Java6/src/Main.java import java.util.Scanner; public class Main { public static void main(String[] args) throws InputNumberException { Bai3 bai3 = new Bai3(); bai3.giaiBKT3(); // Scanner sc = new Scanner(System.in); // int n; // //do { // System.out.println("Nhap n: "); // n = sc.nextInt(); // //}while (n<0); // HamTang tinhTong= new HamTang(); //System.out.printf("%.2f",tinhTong.tinhHamTang1(n)); //System.out.println(tinhTong.tinhHamTang2(n)); //tinhTong.daoSo(n); // System.out.println("Nhập n là : "); // int n = sc.nextInt(); // Fibonaci inF= new Fibonaci(); // inF.inFibonacci(n); // int arrayA[][]= new int[3][3]; // //Nhap mang A // System.out.print("Nhập các phần tử mảng A: "); // for ( int i = 0; i<3; i++){ // for ( int j = 0; j<3; j++){ // arrayA[i][j]= sc.nextInt(); // } // } // //In ra mảng A vừa nhập. // for (int i = 0; i < 3; i++) { // for (int j = 0; j < 3; j++) { // System.out.print(arrayA[i][j] + "\t"); // } // System.out.println(); // } // //Nhap mang B // int arrayB[][]= new int[3][3]; // System.out.println("Nhập các phần tử mảng B: "); // for ( int i = 0; i<3; i++){ // for ( int j = 0; j<3; j++){ // arrayB[i][j]= sc.nextInt(); // } // } // //In ra mảng B vừa nhập. // for (int i = 0; i < 3; i++) { // for (int j = 0; j < 3; j++) { // System.out.print(arrayB[i][j] + "\t"); // } // System.out.println(); // } // // //Tinh tổng 2 mảng đa chiều // int tongAB[][]= new int[3][3]; // System.out.println("Tổng 2 mảng là: "); // for (int i = 0; i < 3; i++) { // for (int j = 0; j < 3; j++) { // tongAB[i][j] = arrayA[i][j] + arrayB[i][j]; // } // System.out.println(); // } // //In ra mảng AB // for (int i = 0; i < 3; i++) { // for (int j = 0; j < 3; j++) { // System.out.print(tongAB[i][j] + "\t"); // } // System.out.println(); // } } } <file_sep>/Java7/src/SoChanCuoiCung.java import java.util.Scanner; public class SoChanCuoiCung { public void timSoChanCuoiCung(){ Scanner sc = new Scanner(System.in); System.out.println("Nhập số phần tử của mảng: "); int n=sc.nextInt(); int arrayA[]=new int[n]; System.out.println("Nhập các phần tử của mảng: "); for (int i=0; i<n; i++){ arrayA[i]=sc.nextInt(); } for (int i=n-1; i>=0;i--){ if (arrayA[i]%2==0){ System.out.println("Số chẵn cuối cùng là "+arrayA[i]); break; } } System.out.println("-1"); } } <file_sep>/JavaCollection/src/main/java/StringException.java public class StringException extends Exception { public StringException(String message){ super(message); } @Override public String getMessage(){ return "Lỗi không nhập đúng văn bản: "+ super.getMessage(); } } <file_sep>/Java3/src/Bai6.java package PACKAGE_NAME;public class Bai6 { } <file_sep>/Testing/src/main/java/JavaBasic/Bai3.java package JavaBasic; import java.util.InputMismatchException; import java.util.Scanner; public class Bai3 { public void monthOfYear() throws CheckingException { Scanner sc = new Scanner(System.in); try { System.out.println("Nhap tháng: "); int month = sc.nextInt(); sc.nextLine(); switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: System.out.println("Tháng " + month + " có 31 ngày"); break; case 2: System.out.println("Thang 2 có 28 or 29 ngày"); break; case 4: case 6: case 9: case 11: System.out.println("Tháng " + month + " có 30 ngày"); break; default: System.out.println("Không phải tháng"); break; } } catch (InputMismatchException e){ System.out.println("Tháng phải là 1 số"); } } } <file_sep>/Java4/Bai8.java public class Bai8 { public void demSoTu(){ char daucach = ' '; int dem = 0; String chuoi = "You only live once, but if you do it right, once is enough"; chuoi = chuoi.trim(); chuoi = chuoi.replaceAll("\\s+", " "); for (int i=0; i< chuoi.length(); i++){ if (chuoi.charAt(i) == daucach){ dem++; } } System.out.println("Số từ trong câu là "+(dem+1)); } } <file_sep>/Java3/src/CheckTriangle.java package PACKAGE_NAME;public class checkTriangle { } <file_sep>/Testing/src/main/java/Class/People.java package Class; public abstract class People { String name; String dob; } <file_sep>/Testing/src/main/java/Class/Contract.java package Class; import java.util.Date; public class Contract { private Long id; private String name; private Date startAt; private Date endAt; public void type(){ } } <file_sep>/Testing/src/main/java/JavaBasic/Person.java package JavaBasic; import java.time.LocalDate; public class Person { String firstname; String lastname; LocalDate birthday; public Person(String firstname, String lastname, LocalDate birthday) { this.firstname = firstname; this.lastname = lastname; this.birthday = birthday; } public Person() { Person Ginny = new Person("Ginny","Tống",LocalDate.of(1973,05,21)); } } <file_sep>/Java4/Bài5.java public class Bài5 { public void indexString(){ char kytu = 'i'; int dem = 0; String chuoi = "You only live once, but if you do it right, once is enough"; System.out.print("Vị trí của "+kytu+" trong mảng là: "); for (int i=0; i< chuoi.length(); i++){ if (chuoi.charAt(i) == kytu){ System.out.printf(i+"\t"); dem++; } } System.out.println("Số lần xuất hiện "+kytu+ " là " +dem); } } <file_sep>/Java8/src/MangMotChieu.java import java.util.Scanner; public class MangMotChieu { static boolean isPrimeNumber(int n){ if (n<2){ return false; } for (int i=2; i<=Math.sqrt(n); i++){ if(n%i==0){ return false; } } return true; } static void inSoNguyenToCuaMang (int array[]){ int tong=0; System.out.println("In ra các số nguyên tố của mảng "); for (int i=0;i<array.length;i++){ if (isPrimeNumber(array[i])){ System.out.print(array[i]); tong=tong+array[i]; } } System.out.println("Tổng của các số nguyên trong mảng là: "+tong); } static void suaPhanTuCuaMang(int array[]){ int m; Scanner sc = new Scanner(System.in); System.out.println("Nhập k:"); int k = sc.nextInt(); if (k<0||k>array.length){ System.out.println("Không tồn tại vị trí K"); } else { System.out.println("Nhập giá trị muốn thay đổi: "); m=sc.nextInt(); array[k]=m; } for (int i=0;i<array.length; i++){ System.out.print(array[i]+" "); } } } <file_sep>/Testing/src/test/java/DemoTest.java import org.assertj.core.data.Offset; import org.junit.Test; import org.junit.jupiter.api.Assertions; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.BeforeAll; import static org.assertj.core.api.Java6Assertions.assertThat; import static org.assertj.core.api.Assertions.withPrecision; import java.util.Scanner; public class DemoTest { // Nhan2so n2s = new Nhan2so(); // CompareString cp = new CompareString(); // char[] expectedArray = { 'G', 'I', 'N', 'N','Y'} ; // char[] actualArray = { 'G', 'I', 'N', 'N','Y'} ; // int[] nul= null; // char[] same = expectedArray; // // //assertEquals() để xác minh giá trị mong đợi và giá trị thực tế bằng nhau. Trong khi assertNotEquals() dùng để xác minh 2 giá trị không giống nhau. // @Test // public void testEqual(){ // assertEquals(6,n2s.tinhNhan2so(2,3)); // assertNotEquals(6,n2s.tinhNhan2so(3,7)); // } // //assertTrue() dùng để xác minh điều kiện phải trả về true trong khi assertFalse() yêu cầu điều kiện kiểm thử phải là false. // @Test // public void testTrueFalse(){ // assertFalse(cp.check2String("Đông c","Nguy")); // assertTrue((cp.check2String("Dong hamham","Dong hamham"))); // } // //Method assertArrayEquals() dùng để xác mình rằng mảng dự kiến và mảng mong đợi bằng nhau. // @Test // public void testArrayEqual(){ // assertArrayEquals(expectedArray,actualArray); // } // //Nếu chúng ta muốn kiểm tra một object không được null sử dụng assertNotNull() ngược lại sử dụng assertNull() nếu mong muốn một object là null trong test case. // @Test // public void testNull(){ // assertNull(nul); // assertNotNull(expectedArray); // } // //Khi chúng ta muốn kiểm tra 2 object cùng tham chiếu đến một object trong vùng nhớ heap. // @Test // public void testSame(){ // assertSame(expectedArray,same); // assertNotSame(actualArray,same); // } // // @Test // public void test_AssertJ_String(){ // String[] contries = new String[]{"Russia", "Viet Nam", "America", "Japan", "China"}; // assertThat(contries).contains("Viet Nam"); // assertThat(contries).isNotEmpty(); // assertThat(contries).startsWith("Russia"); // assertThat(contries).isNotEmpty(); // assertThat(contries).isNotEmpty() // .contains("Viet Nam") // .doesNotContainNull() // .containsSequence("America", "Viet Nam") // .hasSize(5); // } // @Test // public void test_AssertJ_Number(){ // Double number1= 12.0; // Double number2= 10.0; // assertThat(number1).isBetween(12.0,12.2) // .isEqualTo(12.2,withPrecision(0.2d)) // .isStrictlyBetween(9.0,12.1) // .isCloseTo(15.0, Offset.offset(3d)) // .isNotZero(); // } // @Test // public void testFormat_PhoneNumber(){ // String phone_number = "92839203"; // assertThat(phone_number).startsWith("0") // .hasSize(10) // .containsOnlyDigits(); // } // @Test // public void testFormat_Email(){ // String email = "<EMAIL>"; // assertThat(email).isNotEmpty() // .containsPattern("^[A-Za-z0-9]+[A-Za-z0-9]*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)$"); // } } <file_sep>/Testing/src/main/java/Lombok/PersonRepository.java package Lombok; public class PersonRepository { } <file_sep>/Java3/src/Bai8.java package PACKAGE_NAME;public class Bai8 { } <file_sep>/Testing/src/main/java/Class/Teacher.java package Class; import java.util.Date; public class Teacher extends Employee{ private String contract; private String major; } <file_sep>/Testing/src/main/java/JavaBasic/CompareString.java package JavaBasic; public class CompareString { public boolean check2String(String str1,String str2){ if (str1==str2){ return true; } else return false; } } <file_sep>/JavaCollection/src/main/java/Person.java import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.time.LocalDate; import java.time.Period; import java.time.format.DateTimeFormatter; @Data @NoArgsConstructor @AllArgsConstructor public class Person { public String name; public String email; public String job; public String gender; public String city; public int salary; public String birthdate; public LocalDate convertStringToLocalDate() { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); return LocalDate.parse(birthdate, formatter); } public int getAge() { return Period.between(convertStringToLocalDate(), LocalDate.now()).getYears(); } @Override public String toString() { return "{" + "name='" + name + '\'' + ", email='" + email + '\'' + ", job='" + job + '\'' + ", gender='" + gender + '\'' + ", city='" + city + '\'' + ", salary=" + salary + ", birthdate=" + convertStringToLocalDate() + '}'; } } <file_sep>/Java8/src/Main.java import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n; System.out.println("Bài 1"); System.out.print("Nhập số hàng, cột của ma trận vuông: "); n = sc.nextInt(); int m = n; int[][] mangA = new int[n][m]; int[] mangB = new int[n]; for (int i = 0; i < n; i++) { mangB[i] = sc.nextInt(); } // MangDaChieu inMang = new MangDaChieu(); // inMang.taoMang(n,m,mangA); // inMang.inMang(mangA); // inMang.listPhanTuDuongCheoChinh(mangA); // inMang.sapXepHang2(mangA); MangMotChieu mc = new MangMotChieu(); //System.out.println(mc.isPrimeNumber(6)); mc.inSoNguyenToCuaMang(mangB); mc.suaPhanTuCuaMang(mangB); } } <file_sep>/Java2/Main.java public class Main { public static void main(String[] args){ DateOfMonthSwitchCase currentMonth = new DateOfMonthSwitchCase(); currentMonth.printDateOfBirth(); DateOfMonthIfElse currentMonth1 = new DateOfMonthIfElse(); currentMonth1.printDateOfMonth(); CheckTriangle checkTriangle = new CheckTriangle(); checkTriangle.isTriangle(); GiaiPhuongTrinh timGiaTri1 = new GiaiPhuongTrinh(); timGiaTri1.timGiatri(); } }<file_sep>/Testing/src/main/java/Class/Student.java package Class; public class Student extends People { String status; public void status(){ } } <file_sep>/Java3/src/Bai7.java package PACKAGE_NAME;public class Bai7 { } <file_sep>/Java3/src/FIzzBuzz.java public class FIzzBuzz { public void inFizzBuzz() { for (int k = 1; k < 101; k++) { if (k % 3 == 0) { if (k % 5 == 0) { System.out.println(k+" FizzBuzz"); } else System.out.println(k+" Fizz"); } else { if (k%5==0) { System.out.println(k+" Buzz"); } System.out.println(k+" không chia hết cho 3 và 5"); } } } } <file_sep>/Testing/src/main/java/JavaBasic/ListProducts.java package JavaBasic; import java.util.ArrayList; public class ListProducts { ArrayList<Product> listProduct = new ArrayList<>(); public void addProduct(){ listProduct.add(new Product(1, "Thịt Gà", 10, 45.000)); listProduct.add(new Product(2, "Thịt lợn", 10, 90.000)); listProduct.add(new Product(3, "Thịt Bò", 10, 200.000)); } //In ra các sản phẩm public void printProduct() { System.out.println("In các sản phẩm"); for (Product x : listProduct) { System.out.println(x); } } //Update sản phẩm public void updateProduct(){ System.out.println("Tìm kiếm sản phẩm thịt gà"); for (int i = 0; i < listProduct.size(); i++) { if (listProduct.get(i).productName=="Thịt Gà") { System.out.println(listProduct.get(i)); } } System.out.println("Sửa sản phẩm"); for(int i = 0; i<listProduct.size(); i++){ if(listProduct.get(i).productID ==1){ // listProduct.get(i).productName="Thịt gà"; listProduct.set(i,new Product(listProduct.get(i).productID,"Thịt gà",listProduct.get(i).quantity,listProduct.get(i).price)); } } } //Xóa sản phẩm public void removeProduct() { for (int i = 0; i < listProduct.size(); i++) { if (listProduct.get(i).productID == 1) { listProduct.remove(listProduct.get(i)); } } System.out.println("in thông tin sau khi Xóa"); for (Product x : listProduct) { System.out.println(x); } } } <file_sep>/Java4/Main.java import javax.swing.*; import java.util.Random; import java.util.Scanner; public class Main { public static void main(String[] args) { /* whilePrimeNumber(); doWhilePrimeNumber(); forPrimeNumber(); Random rd = new Random(); int number = rd.nextInt(15); RandomNumber randomNumber = new RandomNumber(); long giai_thua = randomNumber.giaiThua(number); System.out.println(number+"! = "+ giai_thua); randomNumber.printNumber(number); Bài5 inIndex = new Bài5(); inIndex.indexString(); Bai6 inBangCuuChuong = new Bai6(); inBangCuuChuong.inBangCuuChuong(); Bai7 checkTriangle= new Bai7(); checkTriangle.isTriangle();*/ Bai8 demTu= new Bai8(); demTu.demSoTu(); Bai9 chx = new Bai9(); String str = " nguyen van quan 7826 "; str = chx.chuanHoa(str); System.out.println(str); } //Bai 1 dùng While static void whilePrimeNumber() { PrimeNumber pm = new PrimeNumber(); Scanner sc = new Scanner(System.in); System.out.printf("\n Nhập n = "); int n = sc.nextInt(); //List ra n số nguyên tố đầu tiên. System.out.printf("%d số nguyên tố đầu tiên là: \n", n); int dem = 0; int i = 2; while (dem < n) { if (pm.isPrimeNumber(i)) { System.out.print(i + " "); dem++; } i++; } //In ra các số nguyên tố nhỏ hơn 100 System.out.printf("\n Các só nguyên tố nhỏ hơn 100 là: "); int j = 0; while (j < 100) { if (pm.isPrimeNumber(j)) { System.out.print(j + "\t"); } j++; } } // Bài 1 dùng do while static void doWhilePrimeNumber() { PrimeNumber pm = new PrimeNumber(); Scanner sc = new Scanner(System.in); System.out.printf("\n Nhập n = "); int n = sc.nextInt(); //List ra n số nguyên tố đầu tiên. System.out.printf("%d số nguyên tố đầu tiên là: \n", n); int dem = 0; int i = 2; do { if (pm.isPrimeNumber(i)) { System.out.print(i + " "); dem++; } i++; } while (dem < n); //In ra các số nguyên tố nhỏ hơn 100 System.out.println("\n Các só nguyên tố nhỏ hơn 100 là: "); int j = 0; do { if (pm.isPrimeNumber(j)) { System.out.print(j + "\t"); } j++; } while (j < 100); } // Bài 1 làm theo for static void forPrimeNumber() { PrimeNumber pm = new PrimeNumber(); Scanner sc = new Scanner(System.in); System.out.printf("\n Nhập n = "); int n = sc.nextInt(); //List ra n số nguyên tố đầu tiên. System.out.printf("%d số nguyên tố đầu tiên là: \n", n); int dem=0; for (int i=0; dem<n; i++) if (pm.isPrimeNumber(i)) { System.out.print(i + " "); dem++; } //In ra các số nguyên tố nhỏ hơn 100 System.out.print("Các só nguyên tố nhỏ hơn 100 là: "); for (int j= 0; j<100;j++){ if (pm.isPrimeNumber(j)){ System.out.print(j+"\t"); } } } } <file_sep>/Java3/src/PrimeNumber.java public class PrimeNumber { public static boolean isPrimeNumber(int n) { if (n < 2) { return false; } int squareRoot = (int) Math.sqrt(n); for (int i = 2; i <= squareRoot; i++) { if (n % i == 0) { return false; } } return true; } }
474021f54cd58a0c39e4effd0cd9c6d1a140a7a7
[ "Java" ]
29
Java
ginny-371/JavaSession
b5f0ca7737b49be2f871a9a977161e634219bc5b
ff890c9c1d201724f7565943b54a3b15a2965c6e
refs/heads/master
<file_sep>''' @File : 链表_单向链表删除指定节点.py @Time : 2020/05/04 17:01:15 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: N = int(input()) mylist = [] mylist.append(input()) for i in range(N-1): indata = input().split() if indata[0] in mylist: continue else: mylist.insert(int(indata[1]),indata[0]) j = input() mylist.remove(j) print(' '.join(mylist)) except: break<file_sep>''' @File : 统计各类型字符个数.py @Time : 2020/04/27 15:28:04 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' import re while 1: try: instr = input() l = len(instr) eng = len(re.findall(r'[a-zA-Z]',instr)) dec = len(re.findall(r'[0-9]',instr)) nspace = len(re.findall(r' ',instr)) print(eng) print(nspace) print(dec) print(l-eng-dec-nspace) except: break<file_sep>''' @File : 分割输入参数.py @Time : 2020/05/16 17:54:37 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: incommand, flag,prev = input(), 0, 0 mylist = [] for i in range(len(incommand)): if incommand[i] == '"': if flag == 1: mylist.append(incommand[prev:i]) prev = i+1 else: prev += 1 flag = 1-flag else: if flag == 0 and incommand[i] == ' ': mylist.append(incommand[prev:i]) prev = i+1 mylist.append(incommand[prev:]) while '' in mylist: mylist.remove('') print(len(mylist)) for i in mylist: print(i) except: break <file_sep>''' @File : 素数伴侣.py @Time : 2020/04/23 16:26:56 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: N = int(input()) Nstr = input().split() Nint = [int(i[0:N]) for i in Nstr] mydict, mylist = dict(),[] for i in range(N): for j in range(i+1,N,1): if Nint[i] != Nint[j]: mydict[(Nint[i],Nint[j])] = Nint[i]+Nint[j] for i,j in mydict.items(): if j%2 == 0: mylist.append(i) for i in mylist: mydict.pop(i) value = list(mydict.values()) remli = [] maxval = max(value) for i in range(2,int(maxval/2+1)): for j in value: if (i != j and j%i == 0): remli.append(j) for j in remli: value.remove(j) remli.clear() print(len(value),value) except: break<file_sep>def getResult(ulDataInput): half = ulDataInput//2+1 i = 2 if half <= 2: return (str(ulDataInput)+' ') else: while i < half: if ulDataInput%i == 0: return (str(i) +' '+getResult(ulDataInput//i)) i = i+1 return (str(ulDataInput)+' ') try: ulInput = int(input()) print(getResult(ulInput)) except: pass<file_sep>''' @File : 字符串加解密.py @Time : 2020/04/23 19:27:47 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' def Encrypt(instr): mylist = list(instr) newlist = [] for i in mylist: if i.isdecimal(): newlist.append(str((int(i)+1)%10)) elif i.isalpha(): if i.islower(): if i == 'z': i = 'A' else: i = chr(ord(i.upper())+1) else: if i == 'Z': i = 'a' else: i = chr(ord(i.lower())+1) newlist.append(i) else: newlist.append(i) rstr = ''.join(newlist) return rstr def unEncrypt(instr): mylist = list(instr) newlist = [] for i in mylist: if i.isdecimal(): newlist.append(str((int(i)+9)%10)) elif i.isalpha(): if i.islower(): if i == 'a': i = 'Z' else: i = chr(ord(i.upper())-1) else: if i == 'A': i = 'z' else: i = chr(ord(i.lower())-1) newlist.append(i) else: newlist.append(i) rstr = ''.join(newlist) return rstr while 1: try: stra = input() strb = input() print(Encrypt(stra)) print(unEncrypt(strb)) except: break<file_sep>''' @File : dict_sort.py @Time : 2020/04/18 16:56:36 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' num_sen, mylist = int(input()), [] for i in range(num_sen): mylist.append(input()) newlist = sorted(mylist) for i in newlist: print(i) <file_sep>''' @File : 英语数字.py @Time : 2020/04/28 17:06:13 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' Digits = ['one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen'] Tendigits = ['twenty','thirty','forty','fifty','sixty','seventy','eighty','ninety'] def num(x): ret = '' if x > 0: if x//100 > 0: ret += '%s hundred '%(Digits[int(x//100-1)]) if x%100 > 0: ret += 'and ' if (x%100)//10 > 1: ret += '%s '%(Tendigits[int((x%100)//10-2)]) if x%10 > 0: ret += '%s '%(Digits[int(x%10-1)]) else: ret += '%s '%(Digits[int(x%20-1)]) return ret while 1: try: indec = int(input()) out = '' x = int(indec//1e6) y = indec%1e6 if x > 0: out += '%smillion '%(num(x)) x = int(y//1e3) y = y%1e3 if x > 0: out += '%sthousand '%(num(x)) x = int(y) if x > 0: out += '%s'%(num(x)) mylist = list(out) if mylist[-1] == ' ': mylist.pop() print(''.join(mylist)) except: break <file_sep># nowcoder_huawei 华为108道笔试题部分代码 <file_sep>mydict = dict() record_len = int(input()) for i in range(record_len): a, b = input().split() index = int(a) value = int(b) if index in mydict.keys(): mydict[index] = mydict[index]+value else: mydict[index] = value # print(mydict) mylist = sorted(mydict) for i in mylist: print(i,mydict[i]) <file_sep>''' @File : 字符串排序.py @Time : 2020/04/22 13:29:05 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' from collections import OrderedDict while 1: try: instr = list(input()) newlist = instr.copy() indict = OrderedDict() lenstr = len(instr) count = 0 for i in instr: indict[count] = i count += 1 if not i.isalpha(): newlist.remove(i) newlen = len(newlist) for i in range(newlen): for j in range(0,newlen-1-i,1): if newlist[j].lower() > newlist[j+1].lower(): newlist[j], newlist[j+1] = newlist[j+1], newlist[j] for i,j in indict.items(): if not j.isalpha(): newlist.insert(i,j) print(''.join(newlist)) except: break <file_sep>''' @File : eval函数_字符串加法.py @Time : 2020/05/07 21:33:53 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: print(eval(input()+'+('+input()+')')) except: break <file_sep>''' @File : n个篮子m个苹果.py @Time : 2020/05/07 22:30:39 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: m1, n1 = input().split() m , n = int(m1), int(n1) a = [0]*n except: break <file_sep>''' @File : length_of_string.py @Time : 2020/04/15 15:20:38 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' sentence = input() strlen = len(sentence) for i in range(strlen): if sentence[strlen-1-i] == ' ': print(i) break elif i == strlen-1: print(strlen) else: pass <file_sep>''' @File : 顺序计数_找出字符串中第一个只出现一次的字符.py @Time : 2020/05/07 21:49:50 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: instr = input() i = 0 while i<len(instr): char = instr[i] if instr.count(char) == 1: print(char) break else: i += 1 if i == len(str): print(-1) except: break <file_sep>''' @File : 链表_输出链表倒数第k个结点.py @Time : 2020/05/04 20:20:21 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while True: try: N, inlist, k = int(input()), input().split(), int(input()) if k>N or k==0: print(0) else: print(inlist[-k]) except: break<file_sep>''' @File : 简单密码.py @Time : 2020/04/22 08:55:03 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: inp = list(input()) j = [] for i in inp: if i.isupper(): if i == 'Z': j.append('a') else: j.append(chr(ord(i.lower())+1)) elif i.islower(): if i<'d': j.append('2') elif i<'g': j.append('3') elif i<'j': j.append('4') elif i<'m': j.append('5') elif i<'p': j.append('6') elif i<'t': j.append('7') elif i<'w': j.append('8') else: j.append('9') else: j.append(i) print(''.join(j)) except: break<file_sep>''' @File : 排序.py @Time : 2020/05/07 21:40:31 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: a = list(map(int,input().split())) b = list(map(int,input().split())) b = sorted(b) print(' '.join(list(map(str,b[0:a[1]])))) except: break <file_sep>print(str(int(float(input())+0.5)))<file_sep>''' @File : re_通配符.py @Time : 2020/05/12 21:18:55 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' import re while 1: try: instr, str2 = input(), input() str1 = instr.replace("?","\w{1}").replace(".","\.").replace("*","\w*") pattern = re.compile(str1) if re.match(pattern,str2)!=None: print('true') else: print('false') except: break <file_sep>''' @File : 二分搜索_素数差值最小的素数对.py @Time : 2020/05/07 22:00:02 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' def isprime(n : int) -> bool: if n%2 == 0: return False elif n%3 == 0: return False elif n%5 == 0: return False for i in range(2,n//5+1,1): if n%i == 0: return False return True while 1: try: N = int(input()) for i in range(N//2,N,1): if isprime(i): if isprime(N-i): print(N-i) print(i) break except: break <file_sep>''' @File : reverse_words.py @Time : 2020/04/18 16:53:23 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' sentence = input().split() sentence.reverse() print(' '.join(sentence))<file_sep>''' @File : 穷举法_DNA序列.py @Time : 2020/05/08 16:58:08 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: instr, strlen = input(), int(input()) GCratio, flag, out = 0, 0, instr[0:strlen] for i in range(len(instr)-strlen): Substring = instr[i:i+strlen] if 'A' not in Substring and 'T' not in Substring: flag = 1 print(Substring) break else: temp = Substring.count('G')+Substring.count('C') if temp>GCratio: GCratio = temp out = Substring if flag == 0: print(out) except: break <file_sep>''' @File : 滑动窗口_MP3歌曲显示.py @Time : 2020/05/08 17:18:17 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: num, operation = int(input()), input() loc_all, loc_screen = 1, 1 if num<=4: for ope in operation: if ope == 'U': loc_all = num-(num-loc_all+1)%num else: loc_all = (loc_all+1)%num for i in range(1,num+1,1): print(i,end='') if i != num: print('',end=' ') else: print('') print(loc_all) else: for ope in operation: if ope == 'U': if loc_all == 1: loc_all = num loc_screen = 4 elif loc_screen == 1: loc_all -= 1 else: loc_all -= 1 loc_screen -= 1 else: if loc_all == num: loc_all = 1 loc_screen = 1 elif loc_screen == 4: loc_all += 1 else: loc_all += 1 loc_screen += 1 for i in range(1,5,1): print(loc_all+i-loc_screen,end='') if i != 4: print('',end=' ') else: print('') print(loc_all) except: break <file_sep>''' @File : eval函数_执行字符串形式的算术表达式.py @Time : 2020/05/04 20:10:19 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: a = input() b = a.replace('[','(').replace(']',')') c = b.replace('{','(').replace('}',')') print(eval(c)) except: break<file_sep>''' @File : DP_bag.py @Time : 2020/04/19 20:58:01 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' items = dict() str_budget, str_num = input().split() budget, num = int(str_budget)//10, int(str_num) gain = [0]*(budget+1) lines = 0 for i in range(num): v1,p1,q1 = input().split() lines = lines + 1 v, p, q = int(v1)//10, int(p1), int(q1) if q == 0: items[lines] = [(v,p)] else: items[q].append((v,p)) for i in items.keys(): if len(items[i])<3: for k in range(3-len(items[i])): items[i].append((0,0)) for j in range(budget,0,-1): a, b = items[i][0] if a <= j: gain[j] = max(gain[j], gain[j-a]+a*b) x1, y1 = items[i][1] x2, y2 = items[i][2] if j-a-x1 >= 0: gain[j] = max(gain[j], gain[j-a-x1]+a*b+x1*y1) if j-a-x2 >= 0: gain[j] = max(gain[j], gain[j-a-x2]+a*b+x2*y2) if j-a-x1-x2 >= 0: gain[j] = max(gain[j], gain[j-a-x1-x2]+a*b+x1*y1+x2*y2) print(gain[budget]*10) <file_sep>''' @File : 查找兄弟单词.py @Time : 2020/04/22 16:06:07 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' from collections import OrderedDict h = 0 while h == 0: try: f = open('data.txt','r') instr,mydict = f.readline().split(),OrderedDict() f.close() N = int(instr[0]) search = instr[N+1] index = int(instr[N+2]) N = N+1 strlist = instr[1:N+1] for i in strlist: mydict[i] = [] for i in range(N): a = list(strlist[i]) c = strlist[i] for j in range(len(strlist)): b = list(strlist[j]) e = strlist[j] if len(a) == len(b): for k in a: if k in b: b.remove(k) if len(b)==0 and c != e: mydict[c].append(e) for i,j in mydict.items(): mydict[i] = sorted(j) x = len(mydict[search]) print(x) if index <= x: print(mydict[search][index-1]) h = 2 except: break <file_sep>''' @File : 蛇形矩阵.py @Time : 2020/04/26 22:00:05 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' def snake_matrix(N): if N <= 0: return N else: num = list(range(1,N*(N+1)//2+1,1)) mylist = [] for i in range(1,N+1,1): t = min(num) mylist.append(str(t)) for j in range(i+1,N+1,1): t += j mylist.append(str(t)) out = ' '.join(mylist) print(out) for k in mylist: num.remove(int(k)) mylist.clear() return N while 1: try: N = int(input()) snake_matrix(N) except: break<file_sep>''' @File : 最长公共子串.py @Time : 2020/05/08 17:57:54 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: str3, str4 = input().split() maxlen, len3, len4 = 0, len(str3), len(str4) if len3<=len4: str1, str2 = str3, str4 len1, len2 = len3, len4 else: str1, str2 = str4, str3 len1, len2 = len4, len3 out = '' for i in range(len1): for j in range(i,len1,1): substring = str1[i:j+1] len5 = len(substring) if len5<=maxlen: continue else: if substring in str2: maxlen = len5 out = substring else: break print(len(out)) except: break <file_sep>''' @File : 坐标移动.py @Time : 2020/04/20 16:47:00 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' import re while 1: try: Loc = [0,0] Instring = input().split(';') pattern = re.compile(r'^([A|W|S|D]\d+)$') for i in Instring: if re.match(pattern,i): if i[0]=='A': Loc[0] -= int(i[1:]) elif i[0]=='D': Loc[0] += int(i[1:]) elif i[0]=='S': Loc[1] -= int(i[1:]) elif i[0]=='W': Loc[1] += int(i[1:]) else: pass print(str(Loc[0])+','+str(Loc[1])) except: break<file_sep>''' @File : 穷举_完全数个数.py @Time : 2020/05/07 21:19:26 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' def count(n:int) -> int: mylist = [] for i in range(1,n+1,1): b = 0 for j in range(1,i//2+1,1): if i%j == 0: b += j if b == i: mylist.append(i) return len(mylist) while 1: try: N = int(input()) print(count(N)) except: break <file_sep>''' @File : 兔子总数.py @Time : 2020/04/27 15:08:54 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: month = int(input()) rabbit_age = [1,0,0] for i in range(month-1): rabbit_age[2] += rabbit_age[1] rabbit_age[1] = rabbit_age[0] rabbit_age[0] = rabbit_age[2] print(sum(rabbit_age)) except: break<file_sep>''' @File : Password_ok.py @Time : 2020/04/21 21:26:40 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' import re while 1: try: inp,li = input(),[] a,b = 0,True if len(inp)<9: print('NG') else: if re.search(r'[a-z]+.*',inp): a += 1 if re.search(r'[A-Z]+.*',inp): a += 1 if re.search(r'[0-9]',inp): a += 1 if not inp.isalnum(): a += 1 for i in range(len(inp)-2): li.append(inp[i:i+3]) len1 = len(li) len2 = len(set(li)) # newlist = li.copy() # for j in newlist: # li.remove(j) # if j in li: # b = False # break if a > 2 and len1==len2: print('OK') else: print('NG') except: break<file_sep>logdict = dict({}) logdict2 = dict({}) printlist = [] while 1: try: string = input() strlist = string.split('\\') dot_num = strlist.pop().split() dot_num1 = dot_num[0].split('.') if len(dot_num1[0])>16: dot_num1[0] = dot_num1[0][-16:] key = dot_num1[0]+' '+dot_num[1] if key not in logdict.keys(): logdict.update({key:1}) printlist.append(key) else: logdict[key] = logdict[key] + 1 except: break printlist = printlist[-8:] for i in printlist: print(i+' '+str(logdict[i]))<file_sep>''' @File : 删除字符串中出现次数最少的字符.py @Time : 2020/04/22 10:48:10 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: instr = input() countdict = dict() for i in instr: countdict[i] = instr.count(i) sortedlist = sorted(countdict.items(),key = lambda x: x[1]) choice = sortedlist[0][1] for i in sortedlist: if i[1]==choice: instr = instr.replace(i[0],'') else: break print(''.join(instr)) except: break <file_sep>''' @File : 单向链表修正.py @Time : 2020/05/04 17:12:35 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: inputlist = input().split() N, head, mylist = inputlist[0], inputlist[1], inputlist[2:] newlist = [] newlist.append(head) i = 0 while i<=len(mylist)-3: m,n = mylist[i], mylist[i+1] newlist.insert(newlist.index(n)+1,m) i += 2 if mylist[-1] in newlist: newlist.remove(mylist[-1]) else: pass print(' '.join(newlist)) except: break <file_sep>''' @File : 第5次反弹高度.py @Time : 2020/04/26 22:56:10 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: height = float(input()) dist = height distance = height lasth = 0.0 for i in range(4): dist /= 2.0 distance += dist*2.0 dist /= 2.0 print('%.6f'%distance) print('%.6f'%dist) except: break<file_sep>''' @File : 砝码称重.py @Time : 2020/04/27 15:49:15 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: N, weight, num = int(input()), input().split(), input().split() mylist = [] for i in range(len(weight)): mylist.append((int(weight[i]), int(num[i]))) totalw = [0] t = 0 addlist = [] for i,j in mylist: for k in totalw: for h in range(j+1): t = k + h*i if t not in totalw: addlist.append(t) for k in addlist: totalw.append(k) addlist.clear() print(len(totalw)) except: break<file_sep>''' @File : 数学定理_验证尼科彻斯定理.py @Time : 2020/05/19 20:11:27 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: inum = int(input()) odd_head,odd_tail = inum*(inum-1)+1, (inum-1)**2+3*(inum-1)+1 odd = list(range(odd_head,odd_tail+2,2)) strodd = list(map(str,odd)) print('+'.join(strodd)) except: break <file_sep>integer, a = list(input()),list() integer.reverse() for i in integer: if i in a: pass else: a.append(i) b = list(a) print(''.join(b))<file_sep>''' @File : split_8char.py @Time : 2020/04/15 17:06:20 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' for i in range(2): string = input() if string != '': strlen = len(string) if strlen%8 != 0: string = string + '0'*int(8-strlen%8) strlen = strlen + int(8-strlen%8) for j in range(strlen//8): print(string[j*8:(j+1)*8]) <file_sep>''' @File : 矩阵乘法实现.py @Time : 2020/05/11 20:08:58 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: m,n,p = int(input()), int(input()), int(input()) mat1, mat2, prod = [], [], [] for i in range(m): prod.append([]) for i in range(m): mat1.append(list(map(int,input().split()))) for i in range(n): mat2.append(list(map(int,input().split()))) for i in range(m): for j in range(p): temp = 0 m1, m2 = mat1[i], list(a[j] for a in mat2) for k in range(len(m1)): temp += m1[k]*m2[k] prod[i].append(temp) for i in prod: out = ' '.join(list(map(str,i))) print(out) except: break <file_sep>''' @File : 穷举法_有关7的数字个数.py @Time : 2020/05/06 22:02:11 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: num = int(input()) count = 0 for i in range(1,num+1,1): if i%7 == 0: count += 1 elif '7' in list(str(i)): count += 1 else: continue print(count) except: break <file_sep>''' @File : int_bin_1_num.py @Time : 2020/04/18 17:03:38 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' int2bin = bin(int(input())) bin_1num = str(int2bin).count('1') print(bin_1num) <file_sep>''' @File : 单词倒排.py @Time : 2020/04/23 17:18:54 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' import re while 1: try: inp = input() instr = re.findall(r'[a-zA-Z]+',inp) instr.reverse() print(' '.join(instr)) except: break<file_sep>''' @File : 列表_超长正整数相加.py @Time : 2020/05/23 22:04:59 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' # while 1: # try: # add1, add2, result = list(input()),list(input()), [] # add1, add2 = list(map(int,add1)), list(map(int,add2)) # C = 0 # if len(add1)<len(add2): # add1, add2 = add2, add1 # for i in range(len(add1)): # if i<len(add2): # sum1 = add1[-1-i] + add2[-1-i] + C # else: # sum1 = add1[-1-i] + C # result.append(str(sum1%10)) # C = 1 if sum1>=10 else 0 # if C == 1: # result.append('1') # result.reverse() # print(''.join(result)) # except: # break while True: try: a = input() b = input() print(str(int(a) + int(b))) except: break <file_sep>''' @File : 插入排序_顺序输出.py @Time : 2020/05/11 19:50:45 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: N, flag = int(input()), input() mylist = [] for i in range(N): inlist = input().split() j = 0 for k in range(len(mylist)): if flag == '0': if int(inlist[1]) > int(mylist[k][1]): j = 1 mylist.insert(k,inlist) break else: if int(inlist[1]) < int(mylist[k][1]): j = 1 mylist.insert(k,inlist) break if j == 0: mylist.append(inlist) for i in mylist: print(' '.join(i)) except: break <file_sep>''' @File : charnum.py @Time : 2020/04/18 16:40:33 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' Instring = list(input()) Instring.reverse() print(''.join(Instring))<file_sep>''' @File : 字典序排序.py @Time : 2020/05/21 20:49:43 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: n, num = int(input()), input().split() def printseq(atstation:list,outstation:list,train): global n,num if train==n: atstation.reverse() print(outstation+atstation) return True for i in range(3): if i==0: atstation.append(num[train]) print(atstation,outstation) printseq(atstation,outstation,train+1) atstation.pop() print(111) elif i==1: outstation.append(num[train]) print(atstation,outstation) printseq(atstation,outstation,train+1) elif i==2 and len(atstation)>0: outstation.append(atstation.pop()) printseq(atstation,outstation,train) return False printseq([],[],0) except: break <file_sep>''' @File : 给出日期输出一年的第几天.py @Time : 2020/05/16 17:42:24 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: year, month, day = int(input()), int(input()), int(input()) num_days = [31,28,31,30,31,30,31,31,30,31,30,31] num_days_run = [31,29,31,30,31,30,31,31,30,31,30,31] if (year%4 == 0 and year%100 != 0) or (year%400 == 0): out = sum(num_days_run[0:month-1]) + day else: out = sum(num_days[0:month-1]) + day print(out) except: break <file_sep>''' @File : ip地址分类.py @Time : 2020/04/21 19:29:40 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' import re A,B,C,D,E,error,private = [0]*7 while 1: try: global bmask ip, mask = input().split('~') if_iplegal = re.compile(r'^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$') ignore = re.compile(r'^[0]{1}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$') if_masklegal = re.compile(r'^[1]+[0]+$') temp = mask.split('.') bmask = '' aa = 1 if len(temp)==4: for i in temp: if int(i) > 255: aa = 0 continue b = '{:08b}'.format(int(i)) bmask = bmask+str(b) if aa == 1 and re.match(if_iplegal,ip)!=None and re.match(if_masklegal,bmask)!=None: if re.match(ignore,ip)!=None: aa = 0 continue flag = ip.split('.') if aa == 1 and int(flag[0])<256 and int(flag[1])<256 and int(flag[2])<256 and int(flag[3])<256: if int(flag[0])<127: A += 1 if int(flag[0])==10: private += 1 elif int(flag[0])<192 and int(flag[0])>127: B += 1 if int(flag[0])==172 and int(flag[1])<32 and int(flag[1])>15: private += 1 elif int(flag[0])<224 and int(flag[0])>191: C += 1 if int(flag[0])==192 and int(flag[1])==168: private += 1 elif int(flag[0])<240 and int(flag[0])>223: D += 1 elif int(flag[0])<256 and int(flag[0])>239: E += 1 else: pass else: error += 1 else: error += 1 else: error += 1 except: print(A,B,C,D,E,error,private) break<file_sep>''' @File : 按字节截取字符串.py @Time : 2020/05/04 09:57:08 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' def select_n_char(instr: str,N: int): indexes, count = 0, 0 for i in instr: if count <= N: if ord(i) > 255: count += 2 else: count += 1 indexes += 1 else: break indexes -= 1 return instr[0:indexes] while 1: try: instr, N1 = input().split() N = int(N1) print(select_n_char(instr,N)) except: break<file_sep>''' @File : 砝码称重2.py @Time : 2020/04/27 16:15:20 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: N, weight, num = int(input()), input().split(), input().split() mylist = [] for i in range(len(weight)): for j in range(int(num[i])): mylist.append(int(weight[i])) totalw = [0] t = 0 newlist = [] for k in mylist: newset = set(totalw) for h in newset: totalw.append(h+k) print(len(set(totalw))) except: break<file_sep>''' @File : 回溯法_和为24.py @Time : 2020/05/10 19:43:51 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' def cal24(alllist, outstr, index_list): if len(outstr)==7: if eval(''.join(outstr))==24: return True else: if '*' in outstr: outstr.insert(0,'(') for i in range(len(outstr)): if outstr[i] == '*': outstr[i] = ')*' break if eval(''.join(outstr))==24: return True return False elif len(outstr)==0: for i in range(4): index_list.append(i) if cal24(alllist,[alllist[i]],index_list): return True index_list.remove(i) return False for i in range(4): if i in index_list: continue else: outstr1 = outstr + ['+'] + [alllist[i]] index_list.append(i) if cal24(alllist,outstr1,index_list): return True index_list.remove(i) outstr2 = outstr + ['-'] + [alllist[i]] index_list.append(i) if cal24(alllist,outstr2,index_list): return True index_list.remove(i) outstr3 = outstr + ['*'] + [alllist[i]] index_list.append(i) if cal24(alllist,outstr3,index_list): return True index_list.remove(i) outstr4 = outstr + ['/'] + [alllist[i]] index_list.append(i) if cal24(alllist,outstr4,index_list): return True index_list.remove(i) return False while 1: try: innum = input().split() index = [] out = [] if cal24(innum, out, index): print('true') else: print('false') except: break <file_sep>''' @File : 贪心_名字漂亮度.py @Time : 2020/05/04 09:31:03 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' def beauty(name): nameset = set(name) countlist = [] for i in nameset: countlist.append(name.count(i)) newlist = sorted(countlist) newlist.reverse() value, beauty_degree = 26, 0 for j in range(len(newlist)): beauty_degree += newlist[j]*value value -= 1 return beauty_degree while 1: try: N = int(input()) for i in range(N): print(beauty(input())) except: break<file_sep>''' @File : 字典加密.py @Time : 2020/04/27 14:35:07 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' from collections import OrderedDict while 1: try: key, data = list(input()),list(input()) mydict = OrderedDict() for i in key: mydict[i] = 0 key = list(mydict.keys()) mydict.clear() for j in range(97,123,1): if chr(j) not in key: key.append(chr(j)) for k in range(26): mydict[chr(97+k)] = key[k] out = [] for h in data: if h.islower(): out.append(mydict[h]) else: s = str(mydict[h.lower()]) out.append(s.upper()) print(''.join(out)) except: break <file_sep>''' @File : 集合子集_字符串匹配.py @Time : 2020/05/26 21:12:31 @Author : Pan @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2025, USTC @Desc : None ''' while 1: try: str1, str2 = set(input()), set(input()) print(str.lower(str(str1.issubset(str2)))) except: break
a0e3eef7c30356046affebe47e4febd5d9b331ff
[ "Markdown", "Python" ]
57
Python
ChuanguangPan/nowcoder_huawei
44d959a78d79254a7a68d7b8a6d6acd8ce7cab7a
a267118c7ba571566d04d2228fb47a8b0cc4fbdb
refs/heads/master
<repo_name>ololduck/tpassist<file_sep>/requirements.txt Flask==0.9 Jinja2==2.6 Markdown==2.3.1 Pygments==1.6 Werkzeug==0.8.3 argparse==1.2.1 distribute==0.6.24 wsgiref==0.1.2 <file_sep>/tpassist/models.py """ models.py contains the data models for the tpassist project. but for an other version. """ import markdown as md import os import subprocess from jinja2 import Template class Document: def __init__(self, name=None): self.name = name self.markdown = None if(self.name is not None and os.path.exists(self.name + ".md")): with open(self.name + ".md", 'r') as f: self.markdown = f.read() with open("markdown.html", 'r') as f: self.template = Template(f.read()) def save(self): with open(self.name + ".md", 'w') as f: f.write(self.markdown) def save_to_html(self): with open(self.name + ".html", 'w') as f: f.write(self._gen_html()) return f.name def _gen_html(self): html = md.markdown(self.markdown, ['codehilite', 'extra', 'nl2br', 'toc']) return self.template.render(html=html) def save_to_pdf(self): subprocess.call(["wkhtmltopdf", self.save_to_html(), self.name + ".pdf"]) return self.name + ".pdf" def get_pdf_file_descriptor(self): fname = self.save_to_pdf() if(os.path.exists(fname)): return open(fname, 'r') <file_sep>/tpassist/tpassist.py #!/usr/bin/env python # -*- coding:utf8 -*- import os from flask import Flask, request, render_template, redirect, send_file from werkzeug import secure_filename import markdown as md import json from models import Document version = "0.1.0" app = Flask("tpassist") if(os.path.exists("tpassist.conf.json")): with open("tpassist.conf.json", 'r') as f: conf = json.loads(f.read()) else: conf = {} docs = {} # NB: We should use the app.config dict for retaining config information DEFAULT_UPLOAD_FOLDER = 'static/media' app.config['UPLOAD_FOLDER'] = conf.get("UPLOAD_FOLDER", DEFAULT_UPLOAD_FOLDER) @app.route("/<name>/update_md", methods=['POST']) def update_md(name): data = json.loads(request.form.keys()[0]) app.logger.info(data) global docs try: doc = docs[name] except KeyError: app.logger.error("index \"%s\" does not exist in the global document index! That means the server has been restarted, and the client view has not been refreshed. Please go to / and try reopening the document." % name) return "ERROR: please see logs", 500 doc.markdown += data["markdown"] doc.save() return md.markdown(doc.markdown, ['codehilite', 'extra', 'nl2br', 'toc']) @app.route("/<fname>/dl/<format>") def dl(fname, format): if(format == "md"): return docs[fname].markdown elif(format == "html"): return docs[fname]._gen_html() elif(format == "pdf"): return send_file(docs[fname].get_pdf_file_descriptor()) return "501 Not implemented", 501 @app.route("/<name>/upload", methods=["POST"]) def upload_file(name): f = request.files['file_up'] desired_path = request.form['file_to'] if(f): if(not os.path.exists(conf.get("UPLOAD_FOLDER", DEFAULT_UPLOAD_FOLDER))): os.mkdir(conf.get("UPLOAD_FOLDER", DEFAULT_UPLOAD_FOLDER)) desired_path = secure_filename(desired_path) f.save(os.path.join(app.config['UPLOAD_FOLDER'], desired_path)) return "", 200 else: return "No file", 400 @app.route('/', methods=['GET']) def home(): return render_template('home.html') @app.route('/<fname>/edit') def edit(fname): global docs document = Document(fname) docs[fname] = document return render_template('editor.html', doc=document) # @app.route("/login", methods=['GET', 'POST']) # def login(): # if(request.method == 'GET'): # return render_template('login.html') # elif(request.method == 'POST'): # for user in conf["users"]: # if(request.form['user'] == user['username'] and request.form['passwd'] == user['passwd']): # user = user['username'] # print("logged user %s" % user) # return redirect('/') # @app.route('/logout') # def logout(): # if(user): # user = False # return redirect('/') if __name__ == '__main__': app.debug = True app.run("0.0.0.0")
d3580a55980e8474e2b7d48abe481cb1def6d5a2
[ "Python", "Text" ]
3
Text
ololduck/tpassist
7eafe12cc15b1acd973c601d2cec75b89dd2e82e
9d3cc76a0dc5e9491fdccb0e376cc4fd3b89ddc5
refs/heads/master
<file_sep># Solc Microservice Microservice that uses cli solc to complie Solidity <file_sep>var exec = require('child_process').exec; var fs = require('fs'); var express = require('express'); var bodyParser = require('body-parser'); var app = express(); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); var spawnOptions = { 'cwd': '/dev/shm' }; var solcArgs = ' --combined-json abi,asm,ast,bin,bin-runtime,clone-bin,devdoc,interface,opcodes,userdoc '; var showCwd = function () { exec('pwd', spawnOptions, (error, stdout, stderr) => { if (error) { console.error(`exec error: ${error}`); return; } console.log(`cwd: ${stdout}`); if (stderr.length > 0) { console.log(`stderr: ${stderr}`); } }); }; var compile = function (src) { // PoC for running cli solc from node return new Promise(function (resolve, reject) { // save the input to a temp file fs.writeFile(spawnOptions.cwd + "/foo.sol", src, function (err) { if (err) { reject(Promise.reject(err)); return; } resolve(); }); }).then( function () { return true; }, showCwd // note the cwd ).then(function () { // compile with solc return new Promise(function (resolve, reject) { exec(`solc foo.sol ${solcArgs}`, spawnOptions, (error, stdout, stderr) => { if (error) { reject(`exec error: ${error}`); return; } if (stderr.length > 0) { console.log(`stderr: ${stderr}`); } resolve(stdout); }); }); }); }; /** * Listen for "src" data to be posted, compile that code data with solc and return the results as json */ app.post('/solc', function (req, res) { var src = req.body.src; compile(src).then(function (result) { res.setHeader('Content-Type', 'application/json'); res.send(result); }, function (err) { res.send(err); }); }); app.listen(3000, function () { console.log('Solc compiler listening on port 3000!'); });
4379d699212ad89ea5d610943e8540c92229fd26
[ "Markdown", "JavaScript" ]
2
Markdown
Victory/solc-microservice
98c8fb3c064fba5b1282cc07bd7d3044e05e076d
9ce70f273b71b9bc83cd1c9f768cc9a8552358b6
refs/heads/master
<repo_name>Anuj-Main/HCL-Training-Program<file_sep>/Employees.java public class Employees { private String name; private String address; private int salary; public String getName(){ return name; } public String getAddress(){ return address; } public int getSalary(){ return salary; } public void setName(String name){ this.name = name; } public void setAddress(String address){ this.address = address; } public void setSalary(int salary){ this.salary=salary; } } class Show_Details{ public static void main(String args[]){ Employees e=new Employees(); e.setName("<NAME>"); e.setAddress("Bhopal"); e.setSalary(20000); System.out.println("The Details of HCL Employee"); System.out.println(" Name: " + e.getName() + " Address: " + e.getAddress() + " Salary: " + e.getSalary()); } } <file_sep>/Core Java Programs/src/ScanPara.java import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.Scanner; public class ScanPara{ public static void main(String[] args) throws FileNotFoundException { String s = "Hello How are you I hope you are good and healthy"; InputStream inps = new FileInputStream(s); try (Scanner scan = new Scanner(inps, StandardCharsets.UTF_8.name())) { while (scan.hasNextLine()) { System.out.println(scan.nextLine()); } } } }<file_sep>/Employee.java public class Employee { float salary=30000; } class Programmer extends Employee{ int bonus = 10000; public static void main (String args[]){ Programmer p=new Programmer(); System.out.println("Programmer salary is:" + p.salary); System.out.println("Bonus of Programmer is:" + p.bonus); } } <file_sep>/Serialization and De-Serialization/src/Serial.java import java.io.FileOutputStream; import java.io.ObjectOutputStream; import java.io.Serializable; public class Serial implements Serializable{ public static void main(String[] args){ Bank bnk=new Bank(); bnk.bnkName = "HDFC"; bnk.bnkBranch = "Bhopal"; } try { FileOutputStream fos=new FileOutputStream("Serialization "); ObjectOutputStream oos=new ObjectOutputStream(fos); oos.writeObject(bnk); oos.close(); fos.close(); System.out.println("Serialization is Created"); } catch (Exception e) { System.out.println(e); } } <file_sep>/Logical_operator.java public class Logical_operator { public static void main(String args[]){ int a=2; int b=3; int c=5; System.out.println(a<b&&a<c); } } <file_sep>/Threading/src/ExceptProgram.java public class ExceptProgram { public static void main(String args[]){ try { int n[]={1,2,3,4}; n[5]=30/0; } catch (Exception e) { System.out.print(e); } System.out.print("Exception Handling is Worked by try and catch perfectly"); } } <file_sep>/Genrics, Synchronization and Serialization/src/GenClass.java public class GenClass { public static<E> void printArray(E[] elements){ for(E element : elements){ System.out.println(element); } System.out.println(); } public static void main(String args[]){ Integer[] intArray={1,2,3,4,5,6,7,8,9,10}; Character[] charArray={'A','B','C','D','E','F','G','H','I','J'}; System.out.println("It will print Integer Array: "); printArray(intArray); System.out.println("It will print Integer Array: "); printArray(charArray); } } <file_sep>/Mother.java public class Mother { void hair(){ System.out.println("Brown Hair"); } } class Daughter extends Mother{ void same(){ System.out.println("Daughter inherit the brown hair"); } public static void main(String args[]) { Daughter d=new Daughter(); d.same(); d.hair(); } } <file_sep>/Threading/src/MulExcept.java public class MulExcept { public static void main(String args[]){ try { int a[]={1,2,3,4,5}; a[5]=5/0; } catch (Exception e) { System.out.println("1st Exception is Handled"); }finally{ System.out.println("All Exception are Handled by Try and Catch "); } } } <file_sep>/Trim_String_prog.java public class Trim_String_prog { public static void main(String args[]) { String s1 = "Wel"; String s2 = new String(" Welcome to HCL Training Program "); String s2upper = s2.toUpperCase(); System.out.println(s1.trim() + "come "); System.out.println(s2upper); } } <file_sep>/Core Java Programs/src/QuickSort.java public class QuickSort{ public int partition(int arr[], int left, int right){ int pivot=arr[left]; int i=left; for(int j=left+1; j<=right; j++) { if (arr[j] < pivot) { i++; swap(arr, i, j); } } swap(arr, i, left); return i; } public void quicksort(int arr[], int mini, int maxi) { if (mini<maxi) { int p=partition(arr, mini, maxi); quicksort(arr, mini, p-1); quicksort(arr, p+1, maxi); } } public void swap(int arr[], int i, int j) { int temp=arr[i]; arr[i]=arr[j]; arr[j]=temp; } public static void main(String args[]){ int arr[]={23, 45, 34, 74, 33, 12, 61, 39, 29, 49}; QuickSort qs=new QuickSort(); System.out.print("This is element of Array Before Sorting: "); for(int i=0; i<arr.length; i++){ System.out.print(arr[i]+" "); } qs.quicksort(arr,0,9); System.out.print("This is element of Array after Sorting by Quicksort: "); for(int i = 0;i < arr.length;i++){ System.out.print(arr[i]+" "); } } } <file_sep>/Relational_operator.java public class Relational_operator { public static void main(String args[]){ int a=2; int b=3; if(a>b){ System.out.println("a is greater than b"); } else{ System.out.println("a is not greater than b"); } } } <file_sep>/Car.java public class Car { private String name; public String getName(){ return name; } public void setName(String name){ this.name=name; } } class Details{ public static void main(String args[]) { Car c=new Car(); c.setName("Mustang"); System.out.println(c.getName()); } } <file_sep>/Core Java Programs/src/CheckEqualsArray.java import java.util.Arrays; import java.util.Scanner; public class CheckEqualsArray{ private static Scanner sc; private static Scanner scan; public static void main(String[] args){ int a; int [] inputArray1st=new int[100]; int[] inputArray2nd = new int[100]; sc=new Scanner(System.in); System.out.println("Enter 1st Array"); a=sc.nextInt(); for(int i=0; i<a;i++){ inputArray1st[i]= sc.nextInt(); } scan=new Scanner(System.in); System.out.print("Enter 2nd Array"); for(int i=0;i<a;i++){ inputArray2nd[i] = scan.nextInt(); } if(Arrays.equals(inputArray1st, inputArray2nd)){ System.out.print("Both the Array are Same."); } else{ System.out.print("Both the Array are Different."); } } }<file_sep>/Genrics, Synchronization and Serialization/src/Company.java public class Company { synchronized public void Class(String EmployeeName){ for(int i=0; i<5; i++){ System.out.println(i+ " "+EmployeeName); } } } class MyThread extends Thread{ Company cmp; String EmployeeName; public void run(){ cmp.Class(EmployeeName); } MyThread(Company C, String EmployeeName){ this.cmp = cmp; this.EmployeeName=EmployeeName; } }<file_sep>/Genrics, Synchronization and Serialization/src/GenWild.java import java.util.ArrayList; import java.util.List; abstract class GenWild { abstract void add(); int a = 10; int b = 10; } class Addition extends GenWild{ void add(){ int c=a+b; System.out.println("Addition of a+b="+c); } } class GenResult{ public static void addGenWild(List<?extends GenWild>lst){ for(GenWild gw: lst){ gw.add(); } } public static void main(String args[]){ List<Addition> lst1=new ArrayList<Addition>(); lst1.add(new Addition()); addGenWild(lst1); } }<file_sep>/Core Java Programs/src/MultiEmployeId.java import java.util.Scanner; import java.util.InputMismatchException; public class MultiEmployeId { private static Scanner sc; public static void main(String[] args) throws InputMismatchException{ sc = new Scanner(System.in); System.out.println("Enter How much Entries do you want to Enter? "); int arr[]=new int[sc.nextInt()]; sc.nextInt(); for(int i=0; i<arr.length;i++){ arr[i]=sc.nextInt(); } System.out.println("It's Stored these Employees Id: "); for(int a:arr){ System.out.println(a); } } } <file_sep>/String_prog.java public class String_prog{ public static void main(String args[]){ char a[]={'W', 'E', 'L', 'C', 'O', 'M', 'E'}; String s1="Welcome in HCL Technologies"; String s2= new String(a); String s3=new String("Welcome to HCL Training Program"); System.out.println(s2); System.out.println(s1); System.out.println(s3); } } <file_sep>/Linked_list_prog.java import java.util.*; public class Linked_list_prog { public static void main(String args[]) { System.out.println("Name of Cars: "); LinkedList<String> ll = new LinkedList<String>(); ll.add("i20"); ll.add("Amaze"); ll.add("Santro"); ll.add("Alto"); System.out.println("Name of Cars: " + ll); } }<file_sep>/Serialization and De-Serialization/src/LamExp.java interface LamExp { abstract void Student(); } class Lam1{ public static void main(String[] args) { String s="Anuj"; LamExp le=()->{ System.out.println("Name: "+s); }; le.Student(); } } <file_sep>/Threading/src/MultryExcept.java public class MultryExcept { public static void main(String args[]){ int a[]=new int[5]; try { System.out.println("4th Value in a: "+ a[7]); } catch (IndexOutOfBoundsException e){ System.out.println("1st Exception is Handled"+e); }finally{ a[0]=5; System.out.println("1st Value in a: "+a[0]); System.out.println("Finally is Worked"); } } } <file_sep>/Main.java public class Main { int x=5; public static void main(String args[]) { Main Obj=new Main(); System.out.println(Obj.x); } } <file_sep>/Addition.java public class Addition { int c; void add(int a, int b){ c=a+b; System.out.println("Sum: "+c); } } class Subtraction extends Addition{ public void sub(int a, int b){ c=a-b; System.out.println("Difference: " + c); } public static void main(String args[]){ int a=10; int b=10; Subtraction s =new Subtraction(); s.sub(a, b); s.add(a, b); } } <file_sep>/Relational_operator2.java public class Relational_operator2{ public static void main(String args[]){ int a=20; int b=30; int c=a+b; if(c>=50){ System.out.println("True"); } else{ System.out.println("False"); } } } <file_sep>/Threading/src/Multi3.java public class Multi3 implements Runnable{ private String threadname; Multi3(String name){ threadname=name; System.out.println("Thread is Created"+threadname); } public void run(){ System.out.println("Thread is now Run"+threadname); for(int i=1; i<5;i++){ try { Thread.sleep(10); } catch (Exception e) { System.out.println(e); } System.out.println("Thread"+i+threadname); } } public void start(){ System.out.println("Threading is Start"+threadname); } public static void main(String args[]){ Multi3 m3=new Multi3("Thread 1"); m3.start(); Multi3 m=new Multi3("Thread 2"); m.start(); } } <file_sep>/Genrics, Synchronization and Serialization/src/Sync.java class Sync extends Thread{ public static void main(String args[]){ Company cmp=new Company(); MyThread th1=new MyThread(cmp, "<NAME>"); MyThread th2=new MyThread(cmp, "<NAME>"); th1.start(); th2.start(); } }
5aaa70a0613b3c64481facbdc9b585d820ca7f8e
[ "Java" ]
26
Java
Anuj-Main/HCL-Training-Program
281c33b5c59761468dfa93b830ef43ba67ff02af
27a9e32308e56318486b6480702d906ab482543a
refs/heads/master
<repo_name>Raxenx/CSGORPS<file_sep>/CSGORPS/Models/Player.cs using System; using System.ComponentModel.DataAnnotations; namespace CSGORPS.Models { public class PlayerModel { public int PlayerID { get; set; } // ID of the user [Required] public string PlayerChoice { get; set; } // What the user selected. One of: Rock, Paper, Scissors // Creates a defualt test player public PlayerModel() { PlayerChoice = RandomlySelectedChoice(); PlayerID = 1; } // A Player is one of: // -playerID // -playerChoice // -null public PlayerModel(int PlayerID, string PlayerChoice) { PlayerChoice = this.PlayerChoice; PlayerID = this.PlayerID; } // Randomly selects Rock, Paper or Scissors private static string RandomlySelectedChoice() { Random rand = new Random(); int decider = rand.Next(0, 4); if (decider <= 1) { return "Rock"; } else if (decider == 2) { return "Paper"; } else { return "Scissors"; } } } }<file_sep>/CSGORPS/Models/Game.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace CSGORPS.Models { public class Game { /// <summary> /// @params Player player1 Player player2 /// @returns the winner of the game between player1 and player2. Basic Rock, Paper, Scissors rules. /// </summary> public PlayerModel Winner(PlayerModel player1, PlayerModel player2) { if (player1.Equals(player2)) { return new PlayerModel(); // TODO: Players Tied. Restart the game. } else if (player1.PlayerChoice == "Rock" && player2.PlayerChoice == "Scissors") { return player1; } else if (player1.PlayerChoice == "Paper" && player2.PlayerChoice == "Rock") { return player2; } else if (player1.PlayerChoice == "Scissors" && player2.PlayerChoice == "Paper") { return player1; } else { return player2; } } } }
462135b88fda0fea13cb4d5e192826ea9cb2e921
[ "C#" ]
2
C#
Raxenx/CSGORPS
e4b671405d2aaf2849623bc290a24e2d35ea0226
d550cf92893da5927d780284604ab2346f60793c
refs/heads/master
<file_sep>package dev.euchigere.eventsmanager.controllers; import dev.euchigere.eventsmanager.dto.DepartmentDTO; import dev.euchigere.eventsmanager.dto.ServiceResponse; import dev.euchigere.eventsmanager.dto.UserDTO; import dev.euchigere.eventsmanager.models.Event; import dev.euchigere.eventsmanager.service.DepartmentService; import dev.euchigere.eventsmanager.service.EventService; import dev.euchigere.eventsmanager.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpSession; import java.util.List; @Controller public class MainController { @Autowired DepartmentService deptService; @Autowired UserService userService; @Autowired EventService eventService; @GetMapping("/") public String index(HttpSession session, Model model) { UserDTO currentUser = (UserDTO) session.getAttribute("currentUser"); if (currentUser == null) { return "redirect:/auth/login"; } ServiceResponse<DepartmentDTO> response = deptService.getCurrentUserDepartment(currentUser.getDepartment().getId()); ServiceResponse<List<DepartmentDTO>> deptList = deptService.getAllDepartments(); if (!response.isStatus()) { return "index"; } model.addAttribute("currentUser", currentUser); model.addAttribute("currentUserDept", response.getData()); model.addAttribute("deptList", deptList.getData()); return "index"; } @PostMapping("/add-user") public String addUser(@RequestParam(value="email") String email, @RequestParam(value="dept-id") Long id, @RequestParam(value="role") String role, HttpSession session) { UserDTO currentUser = (UserDTO) session.getAttribute("currentUser"); if (currentUser == null) { return "redirect:/auth/login"; } userService.createUser(email, id, role); return "redirect:/"; } @PostMapping("/add-department") public String addDepartment(@RequestParam(value = "dept-name") String deptName, HttpSession session) { UserDTO currentUser = (UserDTO) session.getAttribute("currentUser"); if (currentUser == null) { return "redirect:/auth/login"; } deptService.createDepartment(deptName); return "redirect:/"; } @GetMapping("/all-events") public String displayAllEvents(Model model, HttpSession session) { UserDTO currentUser = (UserDTO) session.getAttribute("currentUser"); if (currentUser == null) { return "redirect:/auth/login"; } ServiceResponse<List<Event>> eventList = eventService.getAllEvents(); ServiceResponse<List<DepartmentDTO>> deptList = deptService.getAllDepartments(); model.addAttribute("currentUser", currentUser); model.addAttribute("eventList", eventList.getData()); model.addAttribute("deptList", deptList.getData()); session.setAttribute("eventList", eventList.getData()); return "all-events"; } @GetMapping("/schedule-event") public String scheduleEvent(Event event, HttpSession session, Model model) { UserDTO currentUser = (UserDTO) session.getAttribute("currentUser"); if (currentUser == null) { return "redirect:/auth/login"; } ServiceResponse<List<DepartmentDTO>> deptList = deptService.getAllDepartments(); model.addAttribute("currentUser", currentUser); model.addAttribute("deptList", deptList.getData()); return "schedule-event"; } @RequestMapping(value = {"/schedule-event", "/schedule-event/{event-id}"}, method = RequestMethod.POST) public String scheduleEvent(@PathVariable(value = "event-id", required = false) Long eventId, Event event, HttpSession session) { UserDTO currentUser = (UserDTO) session.getAttribute("currentUser"); if (currentUser == null) { return "redirect:/auth/login"; } System.out.println(event); if (eventId != null) { System.out.println(eventId); event.setId(eventId); eventService.addEvent(event); } else { eventService.addEvent(event); } return "redirect:/all-events"; } @PostMapping("/edit-event/{index}") public String editEvent(@PathVariable(value = "index") int index, RedirectAttributes redirectAttr, HttpSession session) { ServiceResponse<Event> response = eventService.getEventFromSession(session, index); if (response.getData() == null) { return "redirect:/all-events"; } System.out.println(response.getData().getId()); redirectAttr.addFlashAttribute("event", response.getData()); return "redirect:/schedule-event"; } @PostMapping("/remove-event/{index}") public String removeEvent(@PathVariable(value = "index") int index, HttpSession session) { ServiceResponse<Event> response = eventService.getEventFromSession(session, index); eventService.deleteEvent(response.getData()); return "redirect:/all-events"; } @GetMapping("logout") public String logout(HttpSession session) { session.invalidate(); return "redirect:/auth/login"; } } <file_sep>package dev.euchigere.eventsmanager.models; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.format.annotation.DateTimeFormat; import javax.persistence.*; import java.time.LocalDate; import java.time.LocalTime; import java.util.HashSet; import java.util.List; import java.util.Set; @Data @NoArgsConstructor @AllArgsConstructor @Entity public class Event { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String title; private String description; private String venue; @DateTimeFormat(pattern = "yyyy-MM-dd") private LocalDate date; @DateTimeFormat(iso= DateTimeFormat.ISO.TIME, pattern = "HH:mm") private LocalTime time; private String attendanceType; private Long noOfAttendees = 0l; @ManyToMany() private Set<Department> departments = new HashSet<>(); @Transient private List<Long> deptIds; public void setTime(String time) { this.time = LocalTime.parse(time); } public String getTime() { if (this.time == null) { return null; } return this.time.toString(); } //Getters and setters public void addDepartment(Department dept) { departments.add(dept); dept.getEvents().add(this); } public void removeDepartment(Department dept) { departments.remove(dept); dept.getEvents().remove(this); } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Event)) return false; Event event = (Event) o; return new org.apache.commons.lang3.builder.EqualsBuilder() .append(getId(), event.getId()) .append(getTitle(), event.getTitle()) .isEquals(); } @Override public int hashCode() { return new org.apache.commons.lang3.builder.HashCodeBuilder(17, 37) .append(getId()) .append(getTitle()) .toHashCode(); } } <file_sep>package dev.euchigere.eventsmanager.repository; import dev.euchigere.eventsmanager.models.User; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.Optional; @Repository public interface UserRepo extends JpaRepository<User, Long> { Optional<User> findUserByEmailAndPassword(String email, String password); Optional<User> findUserByEmail(String email); } <file_sep>package dev.euchigere.eventsmanager.controllers; import dev.euchigere.eventsmanager.dto.ServiceResponse; import dev.euchigere.eventsmanager.dto.UserDTO; import dev.euchigere.eventsmanager.models.User; import dev.euchigere.eventsmanager.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpSession; import javax.validation.Valid; @Controller @RequestMapping("/auth/") public class AuthController { @Autowired UserService userService; @GetMapping("login") public String login() { return "login"; } @GetMapping("signup") public String signUp(User user) { return "signup"; } @PostMapping("login") public String login(@RequestParam(value = "login-email") String email, @RequestParam(value = "login-password") String password, RedirectAttributes redirectAttr, HttpSession session) { ServiceResponse<UserDTO> response = userService.authenticateUser(email, password); if (!response.isStatus()) { redirectAttr.addFlashAttribute("errorMessage", response.getMessage()); return "redirect:/auth/login"; } session.setAttribute("currentUser", response.getData()); return "redirect:/"; } @PostMapping("signup") public String signUp(@Valid User user, BindingResult result, RedirectAttributes redirectAttr) { if (result.hasErrors()) { redirectAttr.addFlashAttribute("errorMessage", result.getFieldError().getDefaultMessage()); return "redirect:/auth/signup"; } ServiceResponse<User> response = userService.validateUser(user); if (!response.isStatus()) { redirectAttr.addFlashAttribute("errorMessage", response.getMessage()); return "redirect:/auth/signup"; } redirectAttr.addFlashAttribute("flashMessage", response.getMessage()); return "redirect:/auth/login"; } } <file_sep>package dev.euchigere.eventsmanager.models; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.format.annotation.DateTimeFormat; import javax.persistence.*; import javax.validation.constraints.NotBlank; import java.time.LocalDate; @Data @NoArgsConstructor @Entity public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private Integer rank=0; @NotBlank private String firstName; @NotBlank private String lastName; private String role; @NotBlank private String gender; private String contact; @NotBlank @Column(unique = true) private String email; @DateTimeFormat(pattern = "yyyy-MM-dd") private LocalDate dob; @NotBlank private String password; @ManyToOne private Department department; } <file_sep>server.port=8080 spring.datasource.url=jdbc:h2:file:./src/main/resources/eventsmanagerdb spring.h2.console.enabled=true spring.h2.console.path=/h2-console spring.datasource.username=sa spring.datasource.password= spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true
f11023de78797d2b0a128bcd90ab8cb48186b529
[ "Java", "INI" ]
6
Java
Euchigere/EventManager
6f3e434e07d842aa5f370910675c3ba472e0a18b
65686915fec57ddb5cf7700ccee77446abd07b7f
refs/heads/master
<repo_name>srenault/webgl<file_sep>/main.js (function () { function webglStart() { var canvas = document.getElementById('world'); var gl = initGL(canvas); initBuffers(gl); gl.clearColor(0.0, 0.0, 0.0, 1.0); gl.enable(gl.DEPTH_TEST); initShaders(gl).then(function(shaderProgram) { drawScene(gl, shaderProgram); }); } function initGL(canvas) { var gl = canvas.getContext("experimental-webgl"); gl.viewportWidth = canvas.width; gl.viewportHeight = canvas.height; return gl; } function initShaders(gl) { return $.get('shader.fs').then(function(fs) { return $.get('shader.vs').then(function(vs) { var vertexShader = gl.createShader(gl.VERTEX_SHADER); gl.shaderSource(vertexShader, vs); gl.compileShader(vertexShader); var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); gl.shaderSource(fragmentShader, fs); gl.compileShader(fragmentShader); return [vertexShader, fragmentShader]; }); }).then(function(shaders) { var shaderProgram = gl.createProgram(); gl.attachShader(shaderProgram, shaders[0]); gl.attachShader(shaderProgram, shaders[1]); gl.linkProgram(shaderProgram); gl.useProgram(shaderProgram); return shaderProgram; }); } function initBuffers(gl) { var buffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, buffer); var vertices = [ 0.0, 1.0, 0.0, -1.0, -1.0, 0.0, 1.0, -1.0, 0.0 ]; gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW); return buffer; } function drawScene(gl, shaderProgram) { gl.viewport(0, 0, gl.viewportWidth, gl.viewportHeight); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); var positionLocation = gl.getAttribLocation(shaderProgram, "a_position"); gl.enableVertexAttribArray(positionLocation); gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0); gl.drawArrays(gl.TRIANGLES, 0, 3); } window.onload = function() { webglStart(); }; })();
562f208e1193bf735b79e7d0ff65380ad7e12fbe
[ "JavaScript" ]
1
JavaScript
srenault/webgl
eaf63ac222f24340bf31ba1eafc72165f052416d
fddc6d5897ba73ecfc8fef2441535820e82f30db
refs/heads/master
<file_sep>#!/router/bin/python3.8.2_mcpre-v1 -u # ----------------------------------------------------------------------------- # runtest.py -- Framework for running tests # # December 2020, <NAME> # # Copyright (c) 2020 by Cisco Systems, Inc. # All rights reserved. # ----------------------------------------------------------------------------- import os import sys import jinja2 import shutil import filecmp import tempfile import argparse import subprocess script_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) buildah = ["sudo", "/ecs/utils/container/bin/subuildah"] podman = ["sudo", "/ecs/utils/container/bin/supodman"] imagename = "xrscripttest" bases = {"debian": {"name": "Debian 9", "from": "debian:9.13-slim"}, "centos": {"name": "CentOS 7", "from": "centos:7.0.1406"}} files = [ "xr-image-extract-rpms", "setup/prep-{base}", ] test_files = [ "test/test-xr-image-extract-rpms", ] isos = [ "/release/IOX/bin/7.2.1/8000-x64-7.2.1.iso", "/release/IOX/bin/7.0.11/8000-x64-7.0.11.iso", ] tenv = jinja2.Environment(loader=jinja2.FileSystemLoader(script_root)) dockerfile_template = tenv.get_template("test/template.dockerfile") readme_template = tenv.get_template("test/template.README.md") def create_dockerfile(fname, base, *, extra_files=[], isos=[], entrypoint="/bin/bash"): base_info = bases[base] with open(fname, "w") as f: f.write( dockerfile_template.render( base=base, from_=base_info["from"], files=[f.format(base=base) for f in (files + extra_files)], isos=[os.path.basename(i) for i in isos], entrypoint=entrypoint, ) ) def create_readme(fname): for basename, base in bases.items(): with open(os.path.join(script_root, "setup/prep-{}".format(basename)), "r") as f: base["prep"] = "".join(" "+line for line in f if not line.startswith("#-")) with open(fname, "w") as f: f.write( readme_template.render( bases=bases.values(), ) ) def perform_tests(): with tempfile.TemporaryDirectory() as tmpdir: dockerfile_dir = os.path.join(tmpdir, "dockerfiles") os.mkdir(dockerfile_dir) context_dir = os.path.join(tmpdir, "context") os.mkdir(context_dir) for base, base_info in bases.items(): base_df = "{}.dockerfile".format(base) base_dfpath = os.path.join(dockerfile_dir, base_df) for f in files + test_files: f_base = f.format(base=base) src = os.path.join(script_root, f_base) dst = os.path.join(context_dir, f_base) os.makedirs(os.path.dirname(dst), exist_ok=True) shutil.copyfile(src, dst) shutil.copymode(src, dst) for i in isos: shutil.copyfile(i, os.path.join(context_dir, os.path.basename(i))) create_dockerfile(base_dfpath, base, extra_files=test_files, isos=isos, entrypoint="test-xr-image-extract-rpms") os.system("grep '' '{}'".format(base_dfpath)) os.system("find '{}'".format(context_dir)) cmd = buildah + ["bud", "-t", imagename, "-f", base_dfpath, context_dir] res = subprocess.run(cmd, capture_output=True) sys.stderr.buffer.write(res.stderr) if res.returncode != 0: print("Buildah command failed: {}", repr(cmd)) sys.exit(1) else: imageid = res.stdout subprocess.run(podman + ["run", "--name", imagename, imagename]) subprocess.run(podman + ["rm", imagename]) subprocess.run(podman + ["rmi", imagename]) def compare_files(f1, f2, update): result = False if os.path.exists(f2) and filecmp.cmp(f1, f2): # Files compare equal - no action result = True else: if update: print("Updating '{}'".format(f2)) shutil.copyfile(f1, f2) result = True else: if not os.path.exists(f2): print("File '{}' missing - rerun with --update to update".format(f2)) else: print("Content of '{}' not as expected - rerun with --update to update".format(f2)) return result def generate_files(update): with tempfile.TemporaryDirectory() as tmpdir: dockerfile = os.path.join(tmpdir, "Dockerfile") create_dockerfile(dockerfile, "debian") readme = os.path.join(tmpdir, "README.md") create_readme(readme) all_ok = all([compare_files(dockerfile, "Dockerfile", update), compare_files(readme, "README.md", update)]) if not all_ok: sys.exit(2) if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("--update", action="store_true", help="Update generated docs / configuration files") parser.add_argument("--verify", action="store_true", help="Verify generated docs / configuration files") parser.add_argument("--test", action="store_true", help="Run container-based tests") args = parser.parse_args() # If nothing specified, go with some defaults: if not (args.test or args.update or args.verify): args.verify = True args.test = True if args.test: perform_tests() if args.update or args.verify: generate_files(args.update) <file_sep># ----------------------------------------------------------------------------- # dockerfile -- Run script in a container # # December 2020, <NAME> # # Copyright (c) 2020 by Cisco Systems, Inc. # All rights reserved. # ----------------------------------------------------------------------------- FROM debian:9.13-slim COPY xr-image-extract-rpms /usr/bin COPY setup/prep-debian /usr/bin RUN /usr/bin/prep-debian ENTRYPOINT /bin/bash <file_sep># ----------------------------------------------------------------------------- # dockerfile -- Run script in a container # # December 2020, <NAME> # # Copyright (c) 2020 by Cisco Systems, Inc. # All rights reserved. # ----------------------------------------------------------------------------- FROM {{from_}} {% for file in files %}COPY {{file}} /usr/bin {% endfor %} {% for iso in isos %}COPY {{iso}} /images/{{iso}} {% endfor %} RUN /usr/bin/prep-{{base}} ENTRYPOINT {{entrypoint}} <file_sep>#!/usr/bin/python3 # ----------------------------------------------------------------------------- # xr-image-extract-rpms -- Extract RPMs from a Cisco IOS XR LNT ISO image # # December 2020, <NAME> # # Copyright (c) 2020 by Cisco Systems, Inc. # All rights reserved. # ----------------------------------------------------------------------------- import os import sys import argparse import tempfile import subprocess tools = {'isoinfo': {'packages': {'redhat': 'genisoimage', 'ubuntu': 'genisoimage'}}, 'cpio': {'packages': {'redhat': 'cpio', 'ubuntu': 'cpio'}}, } distros = {'redhat': {'installcmd': 'sudo yum install'}, 'ubuntu': {'installcmd': 'sudo apt-get install'}} def lookup_in_path(fn, paths): for path in paths: pathname = os.path.join(path, fn) if os.path.isfile(pathname) and os.access(pathname, os.X_OK): return pathname return None def get_utility_path(tool_name): # Look in path pathname = lookup_in_path(tool_name, os.environ["PATH"].split(os.pathsep)) if pathname is None: # Can't find it tool_info = tools[tool_name] tool_pkgs = tool_info['packages'] suggested_commands = "\n".join([ " ({distro}): {installcmd} {pkg}\n".format(distro=distro, installcmd=distros[distro]['installcmd'], pkg=tool_pkgs[distro]) for distro in sorted(tool_pkgs.keys())]) print("""Cannot find tool '{tool}'. It may be possible to install it using: {suggested_commands} """.format(tool=tool_name, suggested_commands=suggested_commands), file=sys.stderr) sys.exit(1) return pathname # Parse arguments parser = argparse.ArgumentParser(description="Extract RPMs from ISO") parser.add_argument('iso', help='Path to ISO file for extraction') parser.add_argument('--output-dir', help='Where to put extracted RPMs') args = parser.parse_args() if not os.path.exists(args.iso): print("Could not find ISO file '{}'".format(args.iso), file=sys.stderr) sys.exit(1) # Double check that ISO file exists (for better error reporting) # @@@b with tempfile.TemporaryDirectory() as tmpdir: isoinfo = get_utility_path('isoinfo') image_script = os.path.join(tmpdir, "image.py") # Call "isoinfo" to extract the "image.py" script with open(image_script, "wb") as image_script_file: result = subprocess.run(["isoinfo", "-i", args.iso, "-R", "-x", "/tools/image.py"], stdout = image_script_file) if result.returncode != 0: print(""" Failed to extract image script from ISO. Verify that '{iso}' is an IOS XR image of a suitable version. """.format(iso=args.iso), file=sys.stderr) sys.exit(1) # Check length if os.path.getsize(image_script) == 0: print(""" Did not find image script in ISO. Verify that '{iso}' is an IOS XR image of a suitable version. """.format(iso=args.iso), file=sys.stderr) sys.exit(1) # Check signature # @@@ # Call "image.py" to extract the ISO rpms_result = subprocess.run(["python3", image_script, "extract-rpms", "--iso", args.iso, "--output-dir", args.output_dir]) if result.returncode != 0: print(""" RPM extraction failed. See above for error messages. """, file=sys.stderr) sys.exit(1) <file_sep><!-- ===================================================================== --> <!-- README.md -- Documentation for extraction tool --> <!-- --> <!-- December 2020, <NAME> --> <!-- --> <!-- Copyright (c) 2020-21 by Cisco Systems, Inc. --> <!-- All rights reserved. --> <!-- ===================================================================== --> # Cisco IOS XR LNT RPM extraction tool A tool to extract the RPMs from LNT ISOs so that, for example, the original RPMs that came in an ISO can be re-installed if required for a downgrade scenario. ## Requirements This tool can be run on at least the distributions listed below. It may work on others too, but these have been tested. {% for base in bases %}### {{base.name}} Run the following (possibly with `sudo`) to install the required packages: {{base.prep}} {% endfor %} ## Running The tool can be run as follows: ./xr-image-extract-rpms --output-dir <output-dir> <iso-path> It will put all the RPMs found in the specified ISO into the specified directory. ## Notes The RPMs may go into subdirectories of that directory; do not rely on the exact directory layout as it may change in the future. If necessary run find <output-dir> -name "*.rpm" -type f to find all of the extracted RPM files. --- Copyright (c) 2020-21 by Cisco Systems, Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. <file_sep>#!/bin/sh # ----------------------------------------------------------------------------- # test-xr-image-extract-rpms -- Test extracting RPMs from ISO # # December 2020, <NAME> # # Copyright (c) 2020 by Cisco Systems, Inc. # All rights reserved. # ----------------------------------------------------------------------------- fail() { echo "FAIL: $1" 1>&2 [ -d "$TMP_DIR" ] && rm -rf "$TMP_DIR" exit 1 } ls -l /images TMP_DIR=$(mktemp -d) || fail "Unable to make temporary directory for RPM extraction" RPM_DIR="$TMP_DIR/rpms" for image in /images/*; do echo "Extracting RPMs from image '$image'" mkdir -p "$RPM_DIR" || fail "Can't make RPM output directory" /usr/bin/xr-image-extract-rpms --output-dir "$RPM_DIR" "$image" || fail "Error extracting images" find "$RPM_DIR" -type f -name "*.rpm" | grep -q '\.rpm$' || fail "No RPMs extracted" find "$RPM_DIR" -type f -name "*.rpm" | head -5 rm -rf "$RPM_DIR" done rm -rf "$TMP_DIR" echo PASS
320db8b00f1681be79e7ce23b74c891a26f74a4a
[ "Markdown", "Python", "Dockerfile", "Shell" ]
6
Python
ios-xr/lnt-iso-utils
ce1fd2833e5d9c6b1b3fd5a5220c129fa44cb91f
e9d17592324fb291f8239eaaaa0d5e727f361acf
refs/heads/master
<repo_name>ritaly/ColorSqueezer<file_sep>/script.js 'use strict'; let arrBlocks = document.querySelectorAll('.color-block'); function randColor() { return '#' + Math.random().toString(16).slice(2, 8).toUpperCase(); } function addColor() { let hexCode = randColor(); this.style.backgroundColor = hexCode; this.getElementsByTagName("p")[0].innerHTML = hexCode; } arrBlocks.forEach(block => block.addEventListener('click', addColor));<file_sep>/README.md # ColorSqueezer Simple color scheme generator * HTML5 / CSS * Bootstrap 4 * JavaScript Answering question about Js generator by example Test it! https://ritaly.github.io/ColorSqueezer/ ![Color Squeezer](./img/example.jpg)
4fcabe7352df40be5cfac43556b980a8e4c075c9
[ "JavaScript", "Markdown" ]
2
JavaScript
ritaly/ColorSqueezer
eb4789f5e75f1a75514f1c3c0bbeadcaeefa2b45
11f4acd305077010dbdbdbafd4079fefa2f68a91
refs/heads/master
<file_sep>import { Component } from '@angular/core'; import { UserDataService } from '../../services/userdata.service'; import { UserClass } from '../../models/user-class'; import { LandClass } from '../../models/land-class'; import { TransactionClass } from '../../models/transaction-class'; import { PortfolioClass } from '../../models/portfolio-class'; import { CommissionClass } from '../../models/commission-class'; import { Subscription } from 'rxjs/Subscription'; import { Observable } from 'rxjs'; import { Http, Response } from '@angular/http'; import { Router } from '@angular/router'; import { Headers, RequestOptions } from '@angular/http'; @Component({ selector: 'dashboard', styleUrls: ['./dashboard.scss'], templateUrl: './dashboard.html', }) export class Dashboard { subscription: Subscription; user: UserClass; lands: LandClass; portfolios: PortfolioClass; transactions: TransactionClass; earnings: CommissionClass; url: string = 'http://localhost:3000'; constructor ( private uds: UserDataService, private router: Router, private http: Http, ) { /* this.subscription = this.uds.getData('dashboard').subscribe( payload => { // console.log(`Dashboard : ${JSON.stringify(payload)}`); if (payload.sender !== 'BaPageTop') { if (payload.key === 'profile') { this.getUserProfile(payload); console.log(`baPageTop payload: ${JSON.stringify(payload)}`); this.user = payload.data; if (this.user !== undefined) { this.avatarUrl = this.user.photoUrl; console.log(`baPageTop avatar: ${this.avatarUrl}`); } } else if ((payload.key === 'lands') && (payload.cmd === 'list')) { this.getLands(payload); } else if ((payload.key === 'transactions') && (payload.cmd === 'list')) { this.getTransactions(payload); } else if ((payload.key === 'earnings') && (payload.cmd === 'list')) { this.getEarnings(payload); } else if ((payload.key === 'portfolio') && (payload.cmd === 'list')) { this.getPortfolio(payload); } } }, error => { console.log(`Error getting user data fro UDS - ${error}`); }); */ } ////////////////// API Query //////////////////////////// getTransactions() { const headers: Headers = new Headers(); const options = new RequestOptions({ headers, withCredentials: true }); this.http.get(`${this.url}/auth/transactions`, options) .map(res => res.json()) .subscribe( resp => { this.transactions = resp.data; console.log(`Dashboard restfully got transaction data for ${JSON.stringify(resp)}`); this.uds.setData('dashboard', 'transactions', 'update', this.transactions); }, err => { console.log(err); this.router.navigateByUrl('/login'); }, () => console.log('Authentication Complete'), ); } getPortfolio() { const headers: Headers = new Headers(); const options = new RequestOptions({ headers, withCredentials: true }); this.http.get(`${this.url}/auth/portfolio`, options) .map(res => res.json()) .subscribe( resp => { this.portfolios = resp.data; console.log(`Dashboard restfully got portfolio data for ${JSON.stringify(resp)}`); console.log(`user ${this.portfolios}`); this.uds.setData('dashboard', 'portfolios', 'update', this.portfolios); }, err => { console.log(err); this.router.navigateByUrl('/login'); }, () => console.log('Authentication Complete'), ); } getEarnings() { const headers: Headers = new Headers(); const options = new RequestOptions({ headers, withCredentials: true }); this.http.get(`${this.url}/auth/earnings`, options) .map(res => res.json()) .subscribe( resp => { this.earnings = resp.data; console.log(`Dashboard restfully got earnings data for ${JSON.stringify(resp)}`); this.uds.setData('dashboard', 'commissions', 'update', this.earnings); }, err => { console.log(err); this.router.navigateByUrl('/login'); }, () => console.log('Authentication Complete'), ); } getLands() { const headers: Headers = new Headers(); const options = new RequestOptions({ headers, withCredentials: true }); this.http.get(`${this.url}/auth/lands`, options) .map(res => res.json()) .subscribe( resp => { this.lands = resp.data; //console.log(`Dashboard restfully got land data for ${JSON.stringify(resp)}`); //console.log(`lands ${this.lands}`); this.uds.setData('dashboard', 'lands', 'update', this.lands); }, err => { console.log(err); this.router.navigateByUrl('/login'); }, () => console.log('Authentication Complete'), ); } getUser() { const headers: Headers = new Headers(); const options = new RequestOptions({ headers, withCredentials: true }); this.http.get(`${this.url}/auth/profile`, options) .map(res => res.json()) .subscribe( resp => { this.user = resp.profile; console.log(`Dashboard restfully get user data for ${JSON.stringify(this.user)}`); console.log(`user ${this.user}`); this.uds.setData('dashboard', 'profile', 'update', this.user); }, err => { console.log(err); this.router.navigateByUrl('/login'); }, () => console.log('Authentication Complete'), ); } } <file_sep>import { Component, Input, OnInit, OnDestroy } from '@angular/core'; import { LandClass } from '../../../../models/land-class'; import { TransactionClass } from '../../../../models/transaction-class'; import { TradeService } from '../../../../services/trade.service'; import { SearchService } from '../../../../services/search.service'; import { SearchFilterPipe } from '../../../../filters/search-filter.pipe'; import { UserDataService } from '../../../../services/userdata.service'; import { Subscription } from 'rxjs/Subscription'; @Component({ selector: 'app-list-transactions', templateUrl: './list-transactions.html', providers: [], }) export class ListTransactionsComponent implements OnDestroy, OnInit { total: number; quantity: number; message: any; subscription: Subscription; trxns: TransactionClass[]; ngOnDestroy() { // unsubscribe to ensure no memory leaks // this.subscription.unsubscribe(); } ngOnInit() { /* this.subscription = this._ss.getMessage().subscribe( data => { this.message = data; console.log('listLandsComponent '.concat(this.message)); this.uds.setData('listLandsComponent', 'lands', 'reload', {}); }, error => { console.log('Error listLandsComponent '.concat(error)); }); this.subscription = this.uds.getData('listLandsComponent').subscribe( payload => { if ((payload.key === 'lands') && (payload.sender !== 'listLandsComponent')) { this.lands = payload.data; console.log(`list-Lands: ${JSON.stringify(this.lands)}`); } }, error => { console.log(`Error getting lands data fro UDS - ${error}`); }); */ } constructor( private _ts: TradeService, private _ss: SearchService, private uds: UserDataService) { this.subscription = this._ss.getMessage().subscribe( data => { this.message = data; console.log('listTransactionsComponent got search for'.concat(this.message)); }, error => { console.log('Error listTransactionsComponent '.concat(error)); }); this.subscription = this.uds.getData('listTransactionsComponent').subscribe( payload => { if ((payload.key === 'transactions') && (payload.sender !== 'listTransactionsComponent')) { let key: any; let dTrxns: TransactionClass[] = []; for (key in payload.data) { if (key) { let trxn = payload.data[key]; // console.log(`trxn in payload: ${JSON.stringify(trxn)}`); dTrxns[key] = new TransactionClass( trxn.id, trxn.type, trxn.land_id, trxn.location, trxn.available, trxn.area, trxn.qty, trxn.price, trxn.modified, trxn.amount, trxn.status); } } this.trxns = dTrxns; // this.lands = this._mds.lands; // console.log(`list-trxns: ${JSON.stringify(JSON.stringify(this.trxns))}`); } }, error => { console.log(`Error getting lands data fro UDS - ${error}`); }); } showDetails(trxn: TransactionClass) { } // @Input() lands: LandClass[]; } <file_sep>export class PortfolioClass { id: number; landId: number; quantity: number; total: number; location: string; constructor(_id: number, _landId: number, _quantity: number, _total: number, _location: string) { this.id = _id; this.landId = _landId; this.quantity = _quantity; this.total = _total; this.location = _location; } /* getAllOrders(): OrderClass { // return baale.getAllOrders(); } */ } <file_sep>import { Component, Input } from '@angular/core'; import { LandClass } from '../../models/land-class'; import { UserDataService } from '../../services/userdata.service'; import { UserClass } from '../../models/user-class'; import { Subscription } from 'rxjs/Subscription'; @Component({ selector: 'app-lands', templateUrl: './lands.html', providers: [], }) export class LandsComponent { lands: LandClass[]; subscription: Subscription; constructor(private uds: UserDataService) { this.subscription = this.uds.getData('landsComponent').subscribe( payload => { if ((payload.key === 'lands') && (payload.sender !== 'landsComponent')) { this.lands = payload.data; //console.log(`Lands: ${JSON.stringify(this.lands)}`); } }, error => { console.log(`Error getting lands data fro UDS - ${error}`); }); this.uds.setData('landsComponent', 'lands', 'reload', {}); } } <file_sep>import { ContactClass } from '../../contacts/models/contact-class'; export class UserClass { id: number; contact: ContactClass; username: string; password: string; role: number; constructor(_id: number, _contact: ContactClass, _username: string, _password: string, _role: number ) { this.id = _id; this.contact = _contact; this.username = _username; this.password = <PASSWORD>; this.role = _role; } } <file_sep>import { Injectable, Pipe, PipeTransform } from '@angular/core'; import { LandClass } from '../models/land-class'; import { PortfolioClass } from '../models/portfolio-class'; import { CommissionClass } from '../models/commission-class'; import { TransactionClass } from '../models/transaction-class'; @Pipe({ name: 'searchfilter' }) @Injectable() export class SearchFilterPipe implements PipeTransform { transform(items: any[], field: string, value: string): any[] { // console.log(`value: ${value}`); // console.log(`search-filter: ${JSON.stringify(items)}`); if (!items) { return []; } if (value === undefined) { value = ''; } if (LandClass.prototype.isPrototypeOf(items[0])) { return items.filter(it => it[field].toLowerCase().includes(value.toLowerCase())); } if (PortfolioClass.prototype.isPrototypeOf(items[0])) { return items.filter(it => it[field].toLowerCase().includes(value.toLowerCase())); } if (CommissionClass.prototype.isPrototypeOf(items[0])) { return items.filter(it => it[field].toLowerCase().includes(value.toLowerCase())); } if (TransactionClass.prototype.isPrototypeOf(items[0])) { return items.filter(it => it[field].toLowerCase().includes(value.toLowerCase())); } } } <file_sep>import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule as AngularFormsModule } from '@angular/forms'; import { AppTranslationModule } from '../../app.translation.module'; import { NgaModule } from '../../theme/nga.module'; import { NgbRatingModule } from '@ng-bootstrap/ng-bootstrap'; import { NgbDropdownModule, NgbModalModule } from '@ng-bootstrap/ng-bootstrap'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { routing } from './portfolio.routing'; import { LandClass } from '../..//models/land-class'; import { PortfolioComponent } from './portfolio.component'; import { ListPortfolioComponent } from './components/listPortfolio/list-portfolio.component'; import { TradeService } from '../../services/trade.service'; import { SearchService } from '../../services/search.service'; import { SearchFilterModule } from '../../filters/search-filter.module'; @NgModule({ imports: [ CommonModule, AngularFormsModule, AppTranslationModule, NgaModule, NgbRatingModule, NgbModalModule, routing, SearchFilterModule, ], declarations: [ ListPortfolioComponent, PortfolioComponent, ], providers: [ TradeService, ], entryComponents: [], }) export class PortfolioModule { } <file_sep>export interface CommissionInterface { id: number; type: string; // (referral | holdings) rate: number; amount: number; trnxId: number; trnxAmount: number; buyer: string; location: string; date: Date; } <file_sep>import { AuthorityClass } from '../../authorities/models/authority-class'; import { ContactClass } from '../../contacts/models/contact-class'; export interface DocumentInterface { id: number; type: string; // [CofO/SurveyPLan/Layout/Deed of Assignment] registrationNumber: string; // official document number authority: AuthorityClass; image: string; owner: ContactClass; } <file_sep>import {Injectable} from '@angular/core'; import {BaThemeConfigProvider, colorHelper, layoutPaths} from '../../../theme'; @Injectable() export class LineChartService { constructor(private _baConfig: BaThemeConfigProvider) { } getData() { var layoutColors = this._baConfig.get().colors; var graphColor = this._baConfig.get().colors.custom.dashboardLineChart; return { type: 'serial', theme: 'blur', marginTop: 15, marginRight: 15, responsive: { 'enabled': true, }, dataProvider: [ { date: new Date(2012, 11), value1: 1000, value2: 2300, value3: 3000, value4: 4400, value5: 4300 }, { date: new Date(2013, 0), value1: 1200, value2: 2450, value3: 1000, value4: 2300, value5: 3400 }, { date: new Date(2013, 1), value1: 1300, value2: 2540, value3: 1000, value4: 2300, value5: 4500 }, { date: new Date(2013, 2), value1: 1400, value2: 2530, value3: 1000, value4: 2300, value5: 4300 }, { date: new Date(2013, 3), value1: 1500, value2: 2550, value3: 1000, value4: 2300, value5: 4200 }, { date: new Date(2013, 4), value1: 1400, value2: 2660, value3: 1000, value4: 2300, value5: 4000 }, { date: new Date(2013, 5), value1: 1600, value2: 2440, value3: 1000, value4: 2300, value5: 4000 }, { date: new Date(2013, 6), value1: 1400, value2: 4260, value3: 1000, value4: 2300, value5: 3300 }, { date: new Date(2013, 7), value1: 1800, value2: 4300, value3: 1000, value4: 2300, value5: 3400 }, { date: new Date(2013, 8), value1: 2000, value2: 4300, value3: 1000, value4: 2300, value5: 3500 }, { date: new Date(2013, 9), value1: 2200, value2: 4300, value3: 1000, value4: 2300, value5: 3600 }, { date: new Date(2013, 10), value1: 2400, value2: 5300, value3: 1000, value4: 2300, value5: 4300 }, { date: new Date(2013, 11), value1: 2500, value2: 5300, value3: 1000, value4: 2300, value5: 3300 }, { date: new Date(2014, 0), value1: 2600, value2: 2600, value3: 1000, value4: 2300, value5: 3300 }, { date: new Date(2014, 1), value1: 2700, value2: 2600, value3: 1000, value4: 2300, value5: 3300 }, { date: new Date(2014, 2), value1: 2800, value2: 2600, value3: 1000, value4: 2300, value5: 3200 }, { date: new Date(2014, 3), value1: 2400, value2: 6300, value3: 1000, value4: 2300, value5: 3400 }, { date: new Date(2014, 4), value1: 2300, value2: 4300, value3: 1000, value4: 2300, value5: 3200 }, { date: new Date(2014, 5), value1: 2200, value2: 7300, value3: 1000, value4: 2300, value5: 2100 }, { date: new Date(2014, 6), value1: 2300, value2: 7300, value3: 1000, value4: 2300, value5: 2200 }, { date: new Date(2014, 7), value1: 2500, value2: 7300, value3: 1000, value4: 2300, value5: 2300 }, { date: new Date(2014, 8), value1: 2400, value2: 8300, value3: 1000, value4: 2300, value5: 3400 }, { date: new Date(2014, 9), value1: 2300, value2: 8300, value3: 1000, value4: 2300, value5: 3400 }, { date: new Date(2014, 10), value1: 3000, value2: 8300, value3: 1000, value4: 2300, value5: 4300 }, { date: new Date(2014, 11), value1: 3200, value2: 5300, value3: 1000, value4: 2300, value5: 4300 }, { date: new Date(2015, 0), value1: 3200, value2: 3300, value3: 1000, value4: 2300, value5: 4200 }, { date: new Date(2015, 1), value1: 3300, value2: 3300, value3: 1000, value4: 2300, value5: 4500 }, ], categoryField: 'date', categoryAxis: { parseDates: true, gridAlpha: 0, color: layoutColors.defaultText, axisColor: layoutColors.defaultText, }, valueAxes: [ { minVerticalGap: 50, gridAlpha: 0, color: layoutColors.defaultText, axisColor: layoutColors.defaultText } ], graphs: [ { id: 'g0', bullet: 'Alimosho', useLineColorForBulletBorder: true, lineColor: colorHelper.hexToRgbA(graphColor, 0.7), lineThickness: 1, negativeLineColor: layoutColors.danger, type: 'smoothedLine', valueField: 'value0', fillAlphas: 1, fillColorsField: 'lineColor', }, { id: 'g1', bullet: 'Ibeju-Lekki', useLineColorForBulletBorder: true, lineColor: colorHelper.hexToRgbA(graphColor, 0.55), lineThickness: 1, negativeLineColor: layoutColors.danger, type: 'smoothedLine', valueField: 'value1', fillAlphas: 1, fillColorsField: 'lineColor', }, { id: 'g2', bullet: 'Epe', useLineColorForBulletBorder: true, lineColor: colorHelper.hexToRgbA(graphColor, 0.40), lineThickness: 1, negativeLineColor: layoutColors.danger, type: 'smoothedLine', valueField: 'value2', fillAlphas: 1, fillColorsField: 'lineColor', }, { id: 'g3', bullet: 'Badagry', useLineColorForBulletBorder: true, lineColor: colorHelper.hexToRgbA(graphColor, 0.30), lineThickness: 1, negativeLineColor: layoutColors.danger, type: 'smoothedLine', valueField: 'value3', fillAlphas: 1, fillColorsField: 'lineColor', }, { id: 'g4', bullet: 'Ikorodu', useLineColorForBulletBorder: true, lineColor: colorHelper.hexToRgbA(graphColor, 0.15), lineThickness: 1, negativeLineColor: layoutColors.danger, type: 'smoothedLine', valueField: 'value4', fillAlphas: 1, fillColorsField: 'lineColor', }, ], chartCursor: { categoryBalloonDateFormat: 'MM YYYY', categoryBalloonColor: '#4285F4', categoryBalloonAlpha: 0.7, cursorAlpha: 0, valueLineEnabled: true, valueLineBalloonEnabled: true, valueLineAlpha: 0.5 }, dataDateFormat: 'MM YYYY', export: { enabled: true }, creditsPosition: 'bottom-right', zoomOutButton: { backgroundColor: '#fff', backgroundAlpha: 0 }, zoomOutText: '', pathToImages: layoutPaths.images.amChart }; } } <file_sep>export * from './list-transactions.component'; <file_sep>import { Component, Input, OnInit, OnDestroy } from '@angular/core'; import { LandClass } from '../../../../models/land-class'; import { TransactionClass } from '../../../../models/transaction-class'; import { TradeService } from '../../../../services/trade.service'; import { SearchService } from '../../../../services/search.service'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { DefaultModal } from './default-modal/default-modal.component'; import { SearchFilterPipe } from '../../../../filters/search-filter.pipe'; import { UserDataService } from '../../../../services/userdata.service'; import { Subscription } from 'rxjs/Subscription'; @Component({ selector: 'app-list-lands', templateUrl: './list-lands.html', providers: [], }) export class ListLandsComponent implements OnDestroy, OnInit { total: number; quantity: number; message: any; subscription: Subscription; lands: LandClass[]; trnx: TransactionClass; ngOnDestroy() { // unsubscribe to ensure no memory leaks // this.subscription.unsubscribe(); } ngOnInit() { /* this.subscription = this._ss.getMessage().subscribe( data => { this.message = data; console.log('listLandsComponent '.concat(this.message)); this.uds.setData('listLandsComponent', 'lands', 'reload', {}); }, error => { console.log('Error listLandsComponent '.concat(error)); }); this.subscription = this.uds.getData('listLandsComponent').subscribe( payload => { if ((payload.key === 'lands') && (payload.sender !== 'listLandsComponent')) { this.lands = payload.data; console.log(`list-Lands: ${JSON.stringify(this.lands)}`); } }, error => { console.log(`Error getting lands data fro UDS - ${error}`); }); */ } constructor( private _ts: TradeService, private _ss: SearchService, private uds: UserDataService, private modalService: NgbModal) { this.subscription = this._ss.getMessage().subscribe( data => { this.message = data; console.log('listLandsComponent '.concat(this.message)); this.uds.setData('listLandsComponent', 'lands', 'reload', {}); }, error => { console.log('Error listLandsComponent '.concat(error)); }); this.subscription = this.uds.getData('listLandsComponent').subscribe( payload => { if ((payload.key === 'lands') && (payload.sender !== 'listLandsComponent')) { let key: any; let dLands: LandClass[] = []; for (key in payload.data) { if (key) { let land = payload.data[key]; console.log(`land in payload: ${land}`); dLands[key] = new LandClass(land.id, land.ownerId, land.description, land.location, land.area, land.available, land.price); } } this.lands = dLands; // this.lands = this._mds.lands; //console.log(`list-Lands: ${JSON.stringify(this.lands)}`); } }, error => { console.log(`Error getting lands data fro UDS - ${error}`); }); } newBuyOrder(land: LandClass) { // alert(land.id); this.trnx = new TransactionClass( 0, 0, land.id, land.location, land.available, land.area, 0, land.price, null, 0, 0 ); const activeModal = this.modalService.open(DefaultModal, { size: 'sm' }); activeModal.componentInstance.modalHeader = 'Buy'; activeModal.componentInstance.trnx = this.trnx; activeModal.componentInstance.land = land; } // @Input() lands: LandClass[]; } <file_sep>export * from './buy-lands.component'; <file_sep>import { DocumentClass } from './document-class'; import { UserClass } from './user-class'; import { LandClass } from './land-class'; export interface OrderInterface { id: number; type: number; // {sell/buy} buyer: UserClass; seller: UserClass; land: LandClass; quantity: number; status: string; total: number; date: Date; // {sucessful/failed/pending//cancelled} } <file_sep>import { Component, Input, OnInit, OnDestroy } from '@angular/core'; import { CommissionClass } from '../../../../models/commission-class'; import { TradeService } from '../../../../services/trade.service'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { SearchFilterPipe } from '../../../../filters/search-filter.pipe'; import { UserDataService } from '../../../../services/userdata.service'; import { Subscription } from 'rxjs/Subscription'; import { SearchService } from '../../../../services/search.service'; @Component({ selector: 'list-commissions', templateUrl: './list-commissions.html', providers: [], }) export class ListCommissionsComponent implements OnDestroy, OnInit { message: any; commissions: CommissionClass[]; subscription: Subscription; constructor( private _ts: TradeService, private _ss: SearchService, private uds: UserDataService, private modalService: NgbModal) { this.subscription = this._ss.getMessage().subscribe( data => { this.message = data; console.log('listCommissionsComponent '.concat(this.message)); this.uds.setData('listCommissionsComponent', 'commissions', 'reload', {}); }, error => { console.log('Error listTransactionsComponent '.concat(error)); }); this.subscription = this.uds.getData('listCommissionsComponent').subscribe( payload => { if ((payload.key === 'earnings') && (payload.sender !== 'listCommissionsComponent')) { let key: any; let dComms: CommissionClass[] = []; for (key in payload.data) { if (key) { let comm = payload.data[key]; console.log(`list-commissions comm: ${JSON.stringify(JSON.stringify(comm))}`); dComms[key] = new CommissionClass( comm.id, comm.type, comm.rate, comm.commission, comm.trxn_id, comm.amount, comm.buyer, comm.location, comm.status, comm.modified); } } this.commissions = dComms; console.log(`list-commissions: ${JSON.stringify(JSON.stringify(this.commissions))}`); } }, error => { console.log(`Error getting lands data fro UDS - ${error}`); }); } ngOnDestroy() { // unsubscribe to ensure no memory leaks // this.subscription.unsubscribe(); } ngOnInit() {} } <file_sep>import { AuthorityInterface } from './authority-interface'; import { ContactClass } from '../../contacts/models/contact-class'; export class AuthorityClass implements AuthorityInterface { id: number; type: number; name: string; contacts: ContactClass[]; constructor(_id: number, _type: number, _name: string, _contacts: ContactClass[]) { this.id = _id; this.type = _type; this.name = _name; this.contacts = _contacts; } } <file_sep>import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule as AngularFormsModule } from '@angular/forms'; import { AppTranslationModule } from '../../app.translation.module'; import { NgaModule } from '../../theme/nga.module'; import { NgbRatingModule } from '@ng-bootstrap/ng-bootstrap'; import { routing } from './commissions.routing'; import { CommissionsComponent } from './commissions.component'; import { ListCommissionsComponent } from './components/listCommissions/list-commissions.component'; import { SearchFilterModule } from '../../filters/search-filter.module'; @NgModule({ imports: [ CommonModule, AngularFormsModule, AppTranslationModule, NgaModule, NgbRatingModule, routing, SearchFilterModule, ], declarations: [ CommissionsComponent, ListCommissionsComponent, ], providers: [ ], }) export class CommissionsModule { } <file_sep>import { Injectable } from '@angular/core'; import { HttpModule } from '@angular/http'; import { Http, Response } from '@angular/http'; import { Headers, RequestOptions } from '@angular/http'; import { Observable } from 'rxjs'; import { Router } from '@angular/router'; @Injectable() export class FeedService { private _data: any[]; limit = 10; offset = 0; constructor(private http: Http) { this.fetchData(); } getData(limit: number, offset: number): any[] { this.limit = limit; this.offset = offset; this.fetchData(); return this._data; } fetchData(): void { const params = `offset=${this.offset}&limit=${this.limit}`; const url = `http://localhost:3000/auth/feeds?${params}`; const headers: Headers = new Headers(); headers.append('Content-Type', 'application/x-www-form-urlencoded'); const options = new RequestOptions({ headers, withCredentials: true }); this.http.get(url, options) .map(res => res.json()) .subscribe( data => { if (data) { this._data = data; // console.log(`feed data ${JSON.stringify(data)}`); } else { // console.log(`undefined feed data ${JSON.stringify(data)}`); this._data = []; } }, err => { console.log(err); return false; }, () => console.log('get Feeds Complete'), ); } } <file_sep>import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { Subject } from 'rxjs/Subject'; import { UserClass } from '../models/user-class'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/delay'; @Injectable() export class UserDataService { private subject = new Subject<any>(); setData(me: string, code: string, command: string, msg: any) { const payload = { sender: me, key: code, cmd: command, data: msg }; this.subject.next(payload); // console.log(`${me} sent ${command} ${code} command for ${JSON.stringify(msg)}`); } resetData() { // console.log('Reset User Service'); this.subject.next(); } getData(me: string): Observable<any> { // console.log(`${me} subscribed to UserDataService`); return this.subject.asObservable().delay(50); } } <file_sep>import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule as AngularFormsModule } from '@angular/forms'; import { AppTranslationModule } from '../../app.translation.module'; import { NgaModule } from '../../theme/nga.module'; import { NgbRatingModule } from '@ng-bootstrap/ng-bootstrap'; import { NgbDropdownModule, NgbModalModule } from '@ng-bootstrap/ng-bootstrap'; import { routing } from './lands.routing'; import { LandClass } from '../../models/land-class'; import { LandsComponent } from './lands.component'; import { ListLandsComponent } from './components/listLands/list-lands.component'; import { BuyLandsComponent } from './components/buyLands/buy-lands.component'; import { TradeService } from '../../services/trade.service'; import { SearchService } from '../../services/search.service'; import { SearchFilterModule } from '../../filters/search-filter.module'; @NgModule({ imports: [ CommonModule, AngularFormsModule, AppTranslationModule, NgaModule, NgbRatingModule, routing, SearchFilterModule, ], declarations: [ LandsComponent, ListLandsComponent, BuyLandsComponent, ], providers: [ ], entryComponents: [], }) export class LandsModule { } <file_sep>import { Routes, RouterModule } from '@angular/router'; import { BuyLandsComponent } from './buy-lands.component'; // noinspection TypeScriptValidateTypes const routes: Routes = [ { path: '', component: BuyLandsComponent, children: [ ], }, ]; export const routing = RouterModule.forChild(routes); <file_sep>import { AuthorityClass } from '../../authorities/models/authority-class'; import { ContactClass } from '../../contacts/models/contact-class'; export class DocumentClass { id: number; type: string; // [CofO/SurveyPLan/Layout/Deed of Assignment] registrationNumber: string; // official document number authority: AuthorityClass; image: string; owner: ContactClass; constructor(_id: number, _type: string, _registrationNumber: string, _authority: AuthorityClass, _image: string, _owner: ContactClass) { this.id = _id; this.type = _type; // [CofO/SurveyPLan/Layout/Deed of Assignment] this.registrationNumber = _registrationNumber; // official document number this.authority = _authority; this.image = _image; this.owner = _owner; } } <file_sep>import { ContactClass } from '../../contacts/models/contact-class'; export interface UserInterface { id: number; contact: ContactClass; username: string; password: string; role: number; } <file_sep>import { Component, OnInit, AfterViewInit, ElementRef, Input, ViewChild } from '@angular/core'; import { FormGroup, AbstractControl, FormBuilder, Validators } from '@angular/forms'; import { EmailValidator, EqualPasswordsValidator } from '../../theme/validators'; import { HttpModule } from '@angular/http'; import { Http, Response } from '@angular/http'; import { Headers, RequestOptions } from '@angular/http'; import { Observable } from 'rxjs'; import { Router } from '@angular/router'; import { BaPictureUploader } from '../../theme/components/baPictureUploader/baPictureUploader.component'; import { UserDataService } from '../../services/userdata.service'; import { UserClass } from '../../models/user-class'; import { Subscription } from 'rxjs/Subscription'; @Component({ selector: 'app-profile', templateUrl: './profile.html', styleUrls: ['./profile.scss'], }) export class ProfileComponent implements OnInit, AfterViewInit { form: FormGroup; phone: AbstractControl; bank: AbstractControl; accountNum: AbstractControl; data: any; formData: FormData = new FormData(); @ViewChild('photo') baPictureUploader: BaPictureUploader; picture: any; avatar = 'default'; user: UserClass; subscription: Subscription; promise: Promise<any>; submitted: boolean = false; url: string = 'http://localhost:3000/auth/profile'; constructor( fb: FormBuilder, private http: Http, private router: Router, private uds: UserDataService, ) { this.form = fb.group({ 'phone': ['', Validators.compose([Validators.required, Validators.minLength(11)])], 'bank': ['', Validators.compose([Validators.required, Validators.minLength(3)])], 'accountNum': ['', Validators.compose([Validators.required, Validators.minLength(10)])], }); this.phone = this.form.controls['phone']; this.bank = this.form.controls['bank']; this.accountNum = this.form.controls['accountNum']; this.subscription = this.uds.getData('profileComponent').subscribe( payload => { this.user = payload.data; console.log(`payload: ${JSON.stringify(payload)}`); console.log(`profile user: ${JSON.stringify(this.user)}`); if ((payload.key === 'profile') && (payload.sender !== 'profileComponent')) { this.avatar = this.user.photoUrl; (<FormGroup>this.form).controls['phone'].setValue(this.user.phone); (<FormGroup>this.form).controls['bank'].setValue(this.user.bank); (<FormGroup>this.form).controls['accountNum'].setValue(this.user.accountNum); } }, error => { console.log(`Error getting user data fro UDS - ${error}`); }); this.uds.setData('ProfilesComponent', 'profile', 'list', {}); } ngAfterViewInit() { } ngOnInit() { } sendFormViaXHR(formData: FormData, url: string): Promise<any> { return new Promise<any>( function(resolve, reject) { const xhr = new XMLHttpRequest(); xhr.open('POST', url, true); xhr.upload.onprogress = function(e) { if (e.lengthComputable) { const percentage = (e.loaded / e.total) * 100; console.log(`${percentage}%`); console.log(xhr.DONE); } }; xhr.onerror = function(e) { console.log('Error'); console.log(e); }; xhr.onload = function() { }; xhr.send(formData); if (xhr.DONE) { resolve('done'); } if (!xhr.DONE) { reject('error'); } }); } onSubmit( values: Object ): void { this.picture = this.baPictureUploader.getPicture(); console.log(`picture type: ${JSON.stringify(this.picture)}`); const headers: Headers = new Headers(); this.submitted = true; if (this.form.valid) { const formData = new FormData(); if (this.picture !== undefined) { /* headers.append('Accept', 'application/json'); headers.append('Content-Type', `multipart/form-data;boundary=${Math.random()}`);*/ formData.append('avatar', this.picture); formData.append('phone', values['phone']); formData.append('bank', values['bank']); formData.append('accountNum', values['accountNum']); this.sendFormViaXHR(formData, this.url) .then(function(result) { console.log(result); // "Stuff worked!" alert('Updated'); }, function(err) { console.log(err); // Error: "It broke"\ alert('Failed'); }); } else { headers.append('Content-Type', 'application/x-www-form-urlencoded'); const options = new RequestOptions({ headers, withCredentials: true }); const reqBody = `phone=${values['phone']}` .concat(`&bank=${values['bank']}`) .concat(`&photoUrl=${this.user.photoUrl}`) .concat(`&accountNum=${values['accountNum']}`); console.log(reqBody); this.http.post(this.url, reqBody, options) .map(res => res.json()) .subscribe( data => { console.log(JSON.stringify(data)); if (data) { if (data.status === 'success') { this.router.navigateByUrl('/pages/dashboard'); } } }, err => { console.log(err); this.router.navigateByUrl('/login'); }, () => console.log('Authentication Complete'), ); } } } } <file_sep>import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { AppTranslationModule } from '../../app.translation.module'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { NgaModule } from '../../theme/nga.module'; import { Login } from './login.component'; import { Feed } from './feed'; import { FeedService } from './feed/feed.service'; import { routing } from './login.routing'; import { SafeUrlFilterModule } from '../../filters/safeurl-filter.module'; import { MomentModule } from 'angular2-moment'; import { UserDataService } from '../../services/userdata.service'; @NgModule({ imports: [ CommonModule, AppTranslationModule, ReactiveFormsModule, FormsModule, NgaModule, routing, HttpModule, SafeUrlFilterModule, MomentModule, ], declarations: [ Login, Feed, ], providers: [ FeedService, UserDataService, ], }) export class LoginModule {} <file_sep>export class CommissionClass { id: number; type: number; // (referral | holdings) rate: number; amount: number; trxnId: number; trxnAmount: number; buyer: string; location: string; status: number; date: Date; constructor(_id: number, _type: number, _rate: number, _amount: number, _trxnId: number, _trxnAmount: number, _buyer: string, _location: string, _status: number, _date: Date ) { this.id = _id; this.type = _type; this.rate = _rate; this.amount = _amount; this.trxnId = _trxnId; this.trxnAmount = _trxnAmount; this.buyer = _buyer; this.location = _location; this.status = _status; this.date = _date; } } <file_sep>import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { NgaModule } from '../../../../theme/nga.module'; import { routing } from './list-commissions.routing'; import { ListCommissionsComponent } from './list-commissions.component'; import { TradeService } from '../../../../services/trade.service'; import { SearchService } from '../../../../services/search.service'; import { SearchFilterModule } from '../../../../filters/search-filter.module'; @NgModule({ imports: [ CommonModule, FormsModule, NgaModule, routing, SearchFilterModule, ], declarations: [ //ListCommissionsComponent, ], providers: [ ], entryComponents: [ ], }) export class ListCommissionsModule {} <file_sep> export interface UserInterface { id: number; name: string; phone: string; email: string; photoUrl: string; bank: string; accountNum: string; invitedBy: string; } <file_sep> <div class="vertical-scroll"> <table class="table"> <thead> Tap the list to see more </thead> <tbody> <tr *ngFor="let land of lands | searchfilter: 'location' : message"> <td class="table-id"> <button class="btn-default-outline btn-block" (click)="showBuyForm[land.id] = !showBuyForm[land.id]"> <dl> <dt class="text-capitalize text-right "> &#8358; {{land.price | number:'1.2-2'}} per m<sup>2</sup></dt> <dd class="text-left">{{land.available | number:'1.2-2'}} m<sup>2</sup> available for sale in {{land.area | number:'1.2-2'}} m<sup>2</sup> at {{land.location}}. {{land.description}}</dd> </dl> </button> <div *ngIf="showBuyForm[land.id]"> <app-buy-lands [land]="land"></app-buy-lands> </div> </td> </tr> </tbody> </table> </div><file_sep>import { DocumentClass } from './document-class'; import { ContactClass } from './contact-class'; import { CoordinateClass } from './coordinate-class'; export interface LandInterface { id: number; ownerId: number; description: string; location: string; area: number; available: number; price: number; } <file_sep>import { Component, ViewChild, Input, Output, EventEmitter, ElementRef, Renderer } from '@angular/core'; import { NgUploaderOptions } from 'ngx-uploader'; import { UserDataService } from '../../../services/userdata.service'; import { UserClass } from '../../../models/user-class'; import { Subscription } from 'rxjs/Subscription'; @Component({ selector: 'ba-picture-uploader', styleUrls: ['./baPictureUploader.scss'], templateUrl: './baPictureUploader.html', }) export class BaPictureUploader { @Input() defaultPicture: string = ''; @Input() picture: string = ''; @Input() uploaderOptions: NgUploaderOptions = { url: '' }; @Input() canDelete: boolean = true; @Output() onUpload = new EventEmitter<any>(); @Output() onUploadCompleted = new EventEmitter<any>(); @ViewChild('fileUpload') _fileUpload: ElementRef; uploadInProgress: boolean; uploaded: any; files: any; user: UserClass; subscription: Subscription; constructor(private renderer: Renderer, private uds: UserDataService) { /*this.subscription = this.uds.getUser('baPictireUploader').subscribe( payload => { this.user = payload.user.data; console.log(`baPictureUploader user: ${JSON.stringify(this.user)}`); }, error => { console.log(`Error getting user data fro UDS - ${error}`); });*/ } beforeUpload(uploadingFile): void { this.files = this._fileUpload.nativeElement.files; console.log(`files.length: ${this.files.length}`); if (this.files.length > 0) { const file = this.files[0]; this.uploaded = file; this._changePicture(file); if (!this._canUploadOnServer()) { uploadingFile.setAbort(); } else { this.uploadInProgress = true; } } } bringFileSelector(): boolean { this.renderer.invokeElementMethod(this._fileUpload.nativeElement, 'click'); return false; } removePicture(): boolean { this.picture = ''; return false; } _changePicture(file: File): void { const reader = new FileReader(); reader.addEventListener('load', (event: Event) => { this.picture = (<any> event.target).result; console.log(`event: ${JSON.stringify(event)}`); }, false); console.log(`file: ${JSON.stringify(this.picture)}`); reader.readAsDataURL(file); } _onUpload(data): void { if (data['done'] || data['abort'] || data['error']) { this._onUploadCompleted(data); console.log(`_onUpload data ${JSON.stringify(data)}`); } else { this.onUpload.emit(data); } } _onUploadCompleted(data): void { this.uploadInProgress = false; this.onUploadCompleted.emit(data); } getPicture(): any { return this.uploaded; } _canUploadOnServer(): boolean { return !!this.uploaderOptions['url']; } } <file_sep>import { LandClass } from './land-class'; export interface CoordinateInterface { id: number; longtitude: number; latitude: number; land: LandClass; } <file_sep>import { CoordinateInterface } from './coordinate-interface'; import { LandClass } from './land-class'; export class CoordinateClass implements CoordinateInterface { id: number; land: LandClass; longtitude: number; latitude: number; constructor(_id: number, lng: number, lat: number) { this.id = _id; this.longtitude = lng; this.latitude = lat; } getPoint(bearing: number, distance: number): CoordinateClass { let lng = bearing; let lat = distance; return new CoordinateClass(this.id++, lng, lat); // calculate next coordinate } } <file_sep>import { Component } from '@angular/core'; import { FormGroup, AbstractControl, FormBuilder, Validators } from '@angular/forms'; import { EmailValidator, EqualPasswordsValidator } from '../../theme/validators'; import { HttpModule } from '@angular/http'; import { Http, Response } from '@angular/http'; import { Headers, RequestOptions } from '@angular/http'; import { Observable } from 'rxjs'; import { Router } from '@angular/router'; @Component({ selector: 'register', templateUrl: './register.html', styleUrls: ['./register.scss'] }) export class Register { form: FormGroup; name: AbstractControl; phone: AbstractControl; email: AbstractControl; password: AbstractControl; invitedBy: AbstractControl; member: AbstractControl; submitted: boolean = false; url: string = 'http://localhost:3000/auth'; register: boolean = false; message: boolean = false; isLargeDisplay: boolean = false; isSmallDisplay: boolean = false; bgUrls: string[]; bgUrl: string; idx: number; mobHeight: any; mobWidth: any; reqBody: string; constructor( fb: FormBuilder, private http: Http, private router: Router) { this.form = fb.group({ 'name': ['', Validators.compose([Validators.required, Validators.minLength(4)])], 'phone': ['', Validators.compose([Validators.required, Validators.minLength(4)])], 'email': ['', Validators.compose([Validators.required, EmailValidator.validate])], 'password': ['', Validators.compose([Validators.required, Validators.minLength(4)])], 'invitedBy': ['', Validators.compose([Validators.required, Validators.minLength(4)])], 'member': ['', Validators.compose([Validators.required, Validators.minLength(4)])], }); this.invitedBy = this.form.controls['invitedBy']; this.member = this.form.controls['member']; this.name = this.form.controls['name']; this.phone = this.form.controls['phone']; this.email = this.form.controls['email']; this.password = <PASSWORD>.form.controls['password']; this.bgUrls = [ `https://www.youtube.com/embed/pqsU7yzs0i8?autoplay=1&controls=0&` .concat(`showinfo=0&autohide=1&loop=1&rel=0&start=60&end=90&mute=1;`), `https://www.youtube.com/embed/-YAimO5qchU?autoplay=1&controls=0&` .concat(`showinfo=0&autohide=1&loop=1&rel=0&start=60&end=90&mute=1;`), `https://www.youtube.com/embed/8ILj8mplkew?autoplay=1&controls=0&` .concat(`showinfo=0&autohide=1&loop=1&rel=0&start=20&end=90&mute=1;`), `https://www.youtube.com/embed/XrWmKvvfQzs?autoplay=1&controls=0&` .concat(`showinfo=0&autohide=1&loop=1&rel=0&start=60&end=90&mute=1;`), `https://www.youtube.com/embed/9RltyVgDat4?autoplay=1&controls=0` .concat(`&showinfo=0&autohide=1&loop=1&rel=0&start=60&end=90&mute=1;`), ], this.idx = Math.round(Math.random() * 4); this.bgUrl = this.bgUrls[this.idx]; this.mobHeight = window.screen.height; this.mobWidth = window.screen.width; if (window.screen.width > 640) { this.isLargeDisplay = true; } else { this.isSmallDisplay = true; } console.log(window.screen.width); console.log(window.screen.height); console.log(`idx: ${this.idx} url: ${this.bgUrl}`); } onSubmit( values: Object ): void { this.submitted = true; if (this.form.valid) { const headers: Headers = new Headers(); headers.append('Content-Type', 'application/x-www-form-urlencoded'); const reqBody = `name=${values['name']}` .concat(`&phone=${values['phone']}`) .concat(`&email=${values['email']}`) .concat(`&username=${values['email']}`) .concat(`&password=${values['<PASSWORD>']}`) .concat(`&invitedBy=${values['invitedBy']}`); console.log(reqBody); const options = new RequestOptions({ headers, withCredentials: true }); console.log(JSON.stringify(options)); const registrationUrl = `${this.url}/register`; this.http.post(registrationUrl, reqBody, options) .map(res => res.json()) .subscribe( data => { console.log(data); if (data) { if (data.status === 'success') { this.router.navigateByUrl('/pages/dashboard'); } } }, err => { console.log(err); this.router.navigateByUrl('/register'); }, () => console.log('Authentication Complete'), ); // your code goes here // console.log(values); } } findContactByPhone(): void { console.log(`value: ${this.invitedBy.value}`); console.log(`value: ${this.member.value}`); if (this.invitedBy.value === undefined || this.member.value === undefined) { return; } console.log(`value: ${this.invitedBy.value}`); console.log(`_value: ${this.member.value}`); const findMemberUrl = `${this.url}/findcontactbyphone`; const reqBody = `phone=${this.invitedBy.value}&name=${this.member.value}`; console.log(`body: ${reqBody}`); const headers: Headers = new Headers(); headers.append('Content-Type', 'application/x-www-form-urlencoded'); const options = new RequestOptions({ headers, withCredentials: true }); this.http.post(findMemberUrl, reqBody, options) .map(res => res.json()) .subscribe( data => { console.log(data); if (data) { if (data.phone === this.invitedBy.value) { this.register = true; this.message = false; } else { if (data === 'none') { this.register = false; this.message = true; console.log (`register:${this.register} message:${this.message}`) } } } }, err => { console.log(err); }, () => console.log('Registration Complete'), ); } } <file_sep>import { Component } from '@angular/core'; import { Router } from '@angular/router'; import { GlobalState } from '../../../global.state'; import { HttpModule } from '@angular/http'; import { Http, Response } from '@angular/http'; import { Headers, RequestOptions } from '@angular/http'; import { Observable } from 'rxjs'; import { SearchService } from '../../../services/search.service'; import { Subscription } from 'rxjs/Subscription'; import { UserDataService } from '../../../services/userdata.service'; import { UserClass } from '../../../models/user-class'; import { LandClass } from '../../../models/land-class'; import { OrderClass } from '../../../models/order-class'; import { PortfolioClass } from '../../../models/portfolio-class'; import { CommissionClass } from '../../../models/commission-class'; @Component({ selector: 'ba-page-top', templateUrl: './baPageTop.html', styleUrls: ['./baPageTop.scss'], providers: [], }) export class BaPageTop { isScrolled: boolean = false; isMenuCollapsed: boolean = false; url: string = 'http://localhost:3000'; headers: Headers = new Headers(); subscription: Subscription; user: UserClass; avatarUrl = 'assets/img/app/profile/default.png'; lands: LandClass; portfolio: PortfolioClass; transactions: OrderClass; earnings: CommissionClass; search: string; me = 'BaPageTop'; constructor( private _state: GlobalState, private searchService: SearchService, private uds: UserDataService, private router: Router, private http: Http) { this._state.subscribe('menu.isCollapsed', (isCollapsed) => { this.isMenuCollapsed = isCollapsed; }); this.subscription = this.uds.getData('dashboard').subscribe( payload => { // // console.log(`Dashboard : ${JSON.stringify(payload)}`); if (payload.sender !== this.me) { if (payload.key === 'profile') { this.getUserProfile(payload); // console.log(`baPageTop payload: ${JSON.stringify(payload)}`); this.user = payload.data; if (this.user !== undefined) { this.avatarUrl = this.user.photoUrl; // console.log(`baPageTop avatar: ${this.avatarUrl}`); } } else if ((payload.key === 'lands') && (payload.cmd === 'list')) { this.getLands(payload); } else if (payload.key === 'transactions') { if (payload.cmd === 'list') { this.getTransactions(payload); } else if (payload.cmd === 'buy') { this.uds.setData(this.me, payload.key, payload.cmd, payload.data); } } else if ((payload.key === 'earnings') && (payload.cmd === 'list')) { this.getEarnings(payload); } else if ((payload.key === 'portfolio') && (payload.cmd === 'list')) { this.getPortfolio(payload); } else if ((payload.key === 'topbar') && (payload.cmd === 'search')) { this.search = payload.data; this.sendMessage(this.search); } } }, error => { // console.log(`Error getting user data fro UDS - ${error}`); }); } toggleMenu() { this.isMenuCollapsed = !this.isMenuCollapsed; this._state.notifyDataChanged('menu.isCollapsed', this.isMenuCollapsed); return false; } scrolledChanged(isScrolled) { this.isScrolled = isScrolled; } sendMessage(search: string): void { // send message to subscribers via observable subject this.searchService.sendMessage(search); // let link = ['/pages/lands']; // this.router.navigate(link); // console.log('topbar-searchbox text is '.concat(search)); // alert(search); } clearMessage(): void { // clear messagey this.searchService.clearMessage(); } onSignOut(): void { this.headers.append('Content-Type', 'application/x-www-form-urlencoded'); const options = new RequestOptions({ headers: this.headers, withCredentials: true }); this.http.get(`${this.url}/auth/logout`, options) .map(res => res.json()) .subscribe( data => { // // console.log(`data => ${data}`); if (data.status === 'success') { this.router.navigateByUrl('/login'); } }, err => { // console.log(`error => ${err}`); this.router.navigateByUrl('/login'); }, () => { // console.log('Authentication Complete'); }, ); } onSettings(): void { this.headers.append('Content-Type', 'application/x-www-form-urlencoded'); const options = new RequestOptions({ headers: this.headers, withCredentials: true }); this.router.navigateByUrl('/pages/settings'); } onProfile(): void { this.headers.append('Content-Type', 'application/x-www-form-urlencoded'); const options = new RequestOptions({ headers: this.headers, withCredentials: true }); this.router.navigateByUrl('/pages/profile'); } ////////////////// API Query //////////////////////////// getTransactions(payload: any) { const headers: Headers = new Headers(); const options = new RequestOptions({ headers, withCredentials: true }); this.http.get(`${this.url}/auth/transactions`, options) .map(res => res.json()) .subscribe( data => { this.transactions = data.transactions; // console.log(`${this.me} restfully got transaction data for ${JSON.stringify(data)}`); this.uds.setData(this.me, 'transactions', payload.cmd, this.transactions); }, err => { // console.log(err); this.router.navigateByUrl('/login'); }, () => console.log('getTransactions Complete'), ); } getPortfolio(payload: any) { const headers: Headers = new Headers(); const options = new RequestOptions({ headers, withCredentials: true }); this.http.get(`${this.url}/auth/portfolio`, options) .map(res => res.json()) .subscribe( data => { this.portfolio = data.portfolio; // console.log(`${this.me} restfully got portfolio data for ${JSON.stringify(data)}`); // console.log(`portfolio ${this.portfolio}`); this.uds.setData(this.me, 'portfolio', payload.cmd, this.portfolio); }, err => { // console.log(err); this.router.navigateByUrl('/login'); }, () => console.log('getPortfolio Completed'), ); } getEarnings(payload: any) { const headers: Headers = new Headers(); const options = new RequestOptions({ headers, withCredentials: true }); this.http.get(`${this.url}/auth/earnings`, options) .map(res => res.json()) .subscribe( data => { this.earnings = data.earnings; // console.log(`${this.me} restfully got earnings data for ${JSON.stringify(data)}`); this.uds.setData(this.me, 'earnings', payload.cmd, this.earnings); }, err => { // console.log(err); this.router.navigateByUrl('/login'); }, () => console.log('getEarnings Completed'), ); } getLands(payload: any) { const headers: Headers = new Headers(); const options = new RequestOptions({ headers, withCredentials: true }); this.http.get(`${this.url}/auth/lands`, options) .map(res => res.json()) .subscribe( data => { this.lands = data.lands; // console.log(`${this.me} restfully got land data for ${JSON.stringify(data)}`); // // console.log(`lands ${this.lands}`); this.uds.setData(this.me, 'lands', payload.cmd, this.lands); }, err => { // console.log(err); this.router.navigateByUrl('/login'); }, () => console.log('getLands Complete'), ); } getUserProfile(payload: any) { const headers: Headers = new Headers(); const options = new RequestOptions({ headers, withCredentials: true }); this.http.get(`${this.url}/auth/profile`, options) .map(res => res.json()) .subscribe( data => { this.user = data.profile; // console.log(`${this.me} restfully get user data for ${JSON.stringify(data)}`); // console.log(`user ${this.user}`); this.uds.setData(this.me, 'profile', payload.cmd, this.user); }, err => { // console.log(err); this.router.navigateByUrl('/login'); }, () => console.log('getUserProfile Complete'), ); } } <file_sep>import { OrderClass } from './order-class'; import { UserClass } from './user-class'; import { LandClass } from './land-class'; export class TransactionClass { id: number; type: number; // {sell/buy} landId: number; location: string; available: number; area: number; price: number; quantity: number; total: number; date: Date; status; constructor( _id: number, _type: number, _landId: number, _location: string, _available: number, _area: number, _quantity: number, _price: number, _date: Date, _total: number, _status) { this.id = _id; this.type = _type; this.landId = _landId; this.location = _location; this.available = _available; this.area = _area; this.quantity = _quantity; this.price = _price; this.landId = _landId; this.total = _total; this.date = _date; this.status = _status; } } <file_sep>import { Component, OnInit } from '@angular/core'; import { FeedService } from './feed.service'; import { TimeAgoPipe } from 'time-ago-pipe'; @Component({ selector: 'feed', templateUrl: './feed.html', styleUrls: ['./feed.scss'] }) export class Feed { //feed:Array<Object>; feed: any[]; limit = 30; offset = 0; constructor(private _feedService: FeedService) { this._loadFeed(); } OnInit() { } expandMessage (message) { message.expanded = !message.expanded; } private _loadFeed() { setInterval(() => { this.feed = this._feedService.getData(this.limit, this.offset); //console.log(`feed component: ${this._feedService.getData(this.limit, this.offset)}`); }, 600000); } } <file_sep>import { Component, Input, OnInit, OnDestroy } from '@angular/core'; import { UserDataService } from '../../../../services/userdata.service'; import { Subscription } from 'rxjs/Subscription'; import { LandClass } from '../../../../models/land-class'; import { DocumentClass } from '../../../../models/document-class'; import { TransactionClass } from '../../../../models/transaction-class'; import { HttpModule } from '@angular/http'; import { Http, Response } from '@angular/http'; import { Headers, RequestOptions } from '@angular/http'; import { Router } from '@angular/router'; @Component({ selector: 'app-buy-lands', templateUrl: './buy-lands.html', providers: [], }) export class BuyLandsComponent implements OnInit { subscription: Subscription; quantity: number; trxn: TransactionClass; documents: Document url: string = 'http://localhost:3000'; headers: Headers = new Headers(); constructor( private uds: UserDataService, private router: Router, private http: Http) { console.log(`BuyLandsComponent land: ${JSON.stringify(this.land)}`); this.trxn = new TransactionClass(null, 0, 0, null, 0, 0, 0, 0, null, 0, 10); /* this.subscription = this.uds.getData('buyLandsComponent').subscribe( payload => { console.log(`BuyLandsComponent payload: ${JSON.stringify(payload)}`); if ((payload.key === 'lands') && (payload.sender === 'landsComponent') && (payload.cmd === 'buy')) { console.log(`BuyLandsComponent payload data: ${JSON.stringify(payload.data)}`); const land = payload.data; this.trxn.landId = land.id; this.trxn.location = land.location; this.trxn.available = land.available; this.trxn.area = land.area; this.trxn.price = land.price; console.log(`BuyLandsComponent trxn: ${JSON.stringify(this.trxn)}`); } }, error => { console.log(`Error getting lands data fro UDS - ${error}`); }); */ } ngOnInit() { this.getDocuments(this.land.id); } getOrderTotal(quantity) { if (!isFinite(quantity)) { quantity = 0; } this.trxn.quantity = parseFloat(quantity); this.trxn.total = quantity * this.land.price; } getDocuments(landId: number) { const headers: Headers = new Headers(); const options = new RequestOptions({ headers, withCredentials: true }); this.http.get(`${this.url}/auth/documents/?landId=${landId}`, options) .map(res => res.json()) .subscribe( resp => { if (resp.statusText === 'success') { console.log(` getDocuments resp: ${JSON.stringify(resp.statusText)}`); // get land referred to by transaction // documents of land } }, err => { console.log(err); this.router.navigateByUrl('/login'); }, () => console.log('got documents'), ); } createTransaction() { this.trxn.location = this.land.location; this.trxn.available = this.land.available; this.trxn.area = this.land.area; this.trxn.price = this.land.price; this.trxn.landId = this.land.id; const headers: Headers = new Headers(); headers.append('Content-Type', 'application/json;charset=UTF-8'); const options = new RequestOptions({ headers, withCredentials: true }); const body = `${JSON.stringify(this.trxn)}`; console.log(`trnx: ${JSON.stringify(this.trxn)}`); this.http.post(`${this.url}/auth/transactions`, body, options) .map(res => res.json()) .subscribe( resp => { console.log(`createTransactions resp: ${JSON.stringify(resp.statusText)}`); if (resp.statusText === 'success') { this.router.navigateByUrl('/pages/transactions'); } }, err => { console.log(err); this.router.navigateByUrl('/login'); }, () => console.log('Transaction Sent'), ); } @Input() land: LandClass; } <file_sep>import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { NgaModule } from '../../../../theme/nga.module'; import { NgbDropdownModule, NgbModalModule } from '@ng-bootstrap/ng-bootstrap'; import { routing } from './list-portfolio.routing'; import { ListPortfolioComponent } from './list-portfolio.component'; import { PortfolioClass } from '../../../../models/portfolio-class'; import { SearchFilterModule } from '../../../../filters/search-filter.module'; @NgModule({ imports: [ CommonModule, FormsModule, NgaModule, routing, NgbDropdownModule, NgbModalModule, SearchFilterModule, ], declarations: [ //ListPortfolioComponent, ], providers: [ ], entryComponents: [], }) export class ListPortfolioModule {} <file_sep>import { Component, Input } from '@angular/core'; import { CommissionClass } from '../../models/commission-class'; import { UserDataService } from '../../services/userdata.service'; import { UserClass } from '../../models/user-class'; import { Subscription } from 'rxjs/Subscription'; @Component({ selector: 'app-commissions', templateUrl: './commissions.html', providers: [], }) export class CommissionsComponent { commissions: CommissionClass[]; subscription: Subscription; constructor(private uds: UserDataService) { this.subscription = this.uds.getData('commissionComponent').subscribe( payload => { if ((payload.key === 'earnings') && (payload.sender !== 'commissionsComponent')) { this.commissions = payload.data; console.log(` earnings: ${JSON.stringify(this.commissions)}`); } }, error => { console.log(`Error getting user data fro UDS - ${error}`); }); this.uds.setData('commissionsComponent', 'earnings', 'list', {}); } } <file_sep>import { Component, Input, OnInit, OnDestroy } from '@angular/core'; import { PortfolioClass } from '../../../../models/portfolio-class'; import { TransactionClass } from '../../../../models/transaction-class'; import { TradeService } from '../../../../services/trade.service'; import { SearchService } from '../../../../services/search.service'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { SearchFilterPipe } from '../../../../filters/search-filter.pipe'; import { UserDataService } from '../../../../services/userdata.service'; import { Subscription } from 'rxjs/Subscription'; import { Router } from '@angular/router'; @Component({ selector: 'app-list-portfolio', templateUrl: './list-portfolio.html', providers: [], }) export class ListPortfolioComponent implements OnDestroy, OnInit { folio: PortfolioClass[]; message: any; subscription: Subscription; ngOnDestroy() { // unsubscribe to ensure no memory leaks // this.subscription.unsubscribe(); } ngOnInit() { this.subscription = this._ss.getMessage().subscribe( data => { this.message = data; console.log('listPortfolioComponent '.concat(this.message)); }, error => { console.log('Error listPortfolioComponent '.concat(error)); }); } constructor( private _ts: TradeService, private _ss: SearchService, private uds: UserDataService, private router: Router) { this.subscription = this._ss.getMessage().subscribe( data => { this.message = data; console.log('listPortfolioComponent '.concat(this.message)); }, error => { console.log('Error listPortfolioComponent '.concat(error)); }); this.subscription = this.uds.getData('listPortfolioComponent').subscribe( payload => { if ((payload.key === 'portfolio') && (payload.sender !== 'listPortfolioComponent')) { let key: any; let dFolio: PortfolioClass[] = []; for (key in payload.data) { if (key) { let folio = payload.data[key]; console.log(`folio in payload: ${JSON.stringify(folio)}`); dFolio[key] = new PortfolioClass( folio.id, folio.land_id, folio.quantity, folio.total, folio.location); } } this.folio = dFolio; // this.lands = this._mds.lands; // console.log(`list-trnxs: ${JSON.stringify(JSON.stringify(this.trnxs))}`); } }, error => { console.log(`Error getting portfolio data from UDS - ${error}`); }); } @Input() portfolio: PortfolioClass[]; showTransactions(trxnSet: PortfolioClass) { this.router.navigateByUrl('/pages/transactions'); this.uds.setData('listPortfolioComponent', 'topbar', 'search', trxnSet.location); } } <file_sep>import { Component, OnInit } from '@angular/core'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { UserDataService } from '../../../../../services/userdata.service'; import { Subscription } from 'rxjs/Subscription'; import { LandClass } from '../../../../../models/land-class'; import { OrderClass } from '../../../../../models/order-class'; import { TransactionClass } from '../../../../../models/transaction-class'; import { HttpModule } from '@angular/http'; import { Http, Response } from '@angular/http'; import { Headers, RequestOptions } from '@angular/http'; import { Router } from '@angular/router'; @Component({ selector: 'add-service-modal', styleUrls: [('./default-modal.component.scss')], templateUrl: './default-modal.component.html', }) export class DefaultModal implements OnInit { subscription: Subscription; quantity: number; trnx: TransactionClass; modalHeader: string; modalContent: string = ``; land: LandClass; url: string = 'http://localhost:3000'; headers: Headers = new Headers(); constructor( private activeModal: NgbActiveModal, private uds: UserDataService, private router: Router, private http: Http) { } ngOnInit() { this.getDocuments(this.trnx.id); } closeModal() { this.activeModal.close(); } getOrderTotal(quantity) { if (!isFinite(quantity)) { quantity = 0; } this.trnx.quantity = parseFloat(quantity); this.trnx.total = this.trnx.quantity * this.trnx.price; } getDocuments(landId: number) { const headers: Headers = new Headers(); const options = new RequestOptions({ headers, withCredentials: true }); this.http.get(`${this.url}/auth/documents/?landId=${landId}`, options) .map(res => res.json()) .subscribe( resp => { if (resp.statusText === 'success') { console.log(` getDocuments resp: ${JSON.stringify(resp.statusText)}`); // get land referred to by transaction // documents of land } }, err => { console.log(err); this.router.navigateByUrl('/login'); }, () => console.log('got documents'), ); } createTransaction(trnx: TransactionClass) { const headers: Headers = new Headers(); headers.append('Content-Type', 'application/json;charset=UTF-8'); const options = new RequestOptions({ headers, withCredentials: true }); const body = `${JSON.stringify(trnx)}`; console.log(`trnx: ${JSON.stringify(trnx)}`); this.http.post(`${this.url}/auth/transactions`, body, options) .map(res => res.json()) .subscribe( resp => { console.log(`createTransactions resp: ${JSON.stringify(resp.statusText)}`); if (resp.statusText === 'success') { this.activeModal.close(); this.router.navigateByUrl('/pages/transactions'); } }, err => { console.log(err); this.router.navigateByUrl('/login'); }, () => console.log('Transaction Sent'), ); } } <file_sep>import { ContactClass } from '../../contacts/models/contact-class'; export interface AuthorityInterface { id: number; type: number; name: string; contacts: ContactClass[]; } <file_sep>import { ContactInterface } from './contact-interface'; // export class ContactClass implements ContactInterface { id: number; name: string; email: string; phone: string; constructor(_contact: any) { this.id = _contact.id; this.name = _contact.name; this.email = _contact.email; this.phone = _contact.phone; } } <file_sep> export interface PorfolioInterface { id: number; landId: number; quantity: number; total: number; location: string; } <file_sep>import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule as AngularFormsModule } from '@angular/forms'; import { AppTranslationModule } from '../../app.translation.module'; import { NgaModule } from '../../theme/nga.module'; import { NgbRatingModule } from '@ng-bootstrap/ng-bootstrap'; import { NgbDropdownModule, NgbModalModule } from '@ng-bootstrap/ng-bootstrap'; import { routing } from './transactions.routing'; import { TransactionClass } from '../../models/transaction-class'; import { TransactionsComponent } from './transactions.component'; import { ListTransactionsComponent } from './components/listTransactions/list-transactions.component'; import { TradeService } from '../../services/trade.service'; import { SearchService } from '../../services/search.service'; import { SearchFilterModule } from '../../filters/search-filter.module'; @NgModule({ imports: [ CommonModule, AngularFormsModule, AppTranslationModule, NgaModule, NgbRatingModule, NgbModalModule, routing, SearchFilterModule, ], declarations: [ TransactionsComponent, ListTransactionsComponent, ], providers: [ ], entryComponents: [], }) export class TransactionsModule { } <file_sep>import { Component } from '@angular/core'; import { FormGroup, AbstractControl, FormBuilder, Validators } from '@angular/forms'; import { EmailValidator, EqualPasswordsValidator } from '../../theme/validators'; import { HttpModule } from '@angular/http'; import { Http, Response } from '@angular/http'; import { Headers, RequestOptions } from '@angular/http'; import { Observable } from 'rxjs'; import { Router } from '@angular/router'; @Component({ selector: 'app-settings', templateUrl: './settings.html', styleUrls: ['./settings.scss'], }) export class SettingsComponent { form: FormGroup; repeatPassword: AbstractControl; password: AbstractControl; passwords: FormGroup; submitted: boolean = false; url: string = 'http://localhost:3000/auth/updatepassword'; reqBody: string; headers: Headers = new Headers(); constructor(fb: FormBuilder, private http: Http, private router: Router) { this.form = fb.group({ 'passwords': fb.group({ 'password': ['', Validators.compose([Validators.required, Validators.minLength(4)])], 'repeatPassword': ['', Validators.compose([Validators.required, Validators.minLength(4)])], }, { validator: EqualPasswordsValidator.validate('password', 'repeatPassword') }), }); this.passwords = <FormGroup> this.form.controls['passwords']; this.password = this.passwords.controls['password']; this.repeatPassword = this.passwords.controls['repeatPassword']; } onSubmit( values: Object ): void { console.log(values); const newPasswords = values['passwords']; console.log(newPasswords.password); console.log(newPasswords.repeatPassword); this.submitted = true; if (this.form.valid) { this.headers.append('Content-Type', 'application/x-www-form-urlencoded'); const reqBody = `password=${<PASSWORD>}&repeatPassword=${<PASSWORD>}`; const options = new RequestOptions({ headers: this.headers, withCredentials: true }); console.log(`body: ${reqBody}`); this.http.post(this.url, reqBody, options) .map(res => res.json()) .subscribe( data => { console.log(data); if (data) { if (data.status === 'success') { this.router.navigateByUrl('/login'); } } }, err => { console.log(err); this.router.navigateByUrl('/login'); }, () => console.log('Authentication Complete'), ); // your code goes here // console.log(values); } } } <file_sep>import { Component, Input } from '@angular/core'; import { TransactionClass } from '../../models/transaction-class'; import { UserDataService } from '../../services/userdata.service'; import { UserClass } from '../../models/user-class'; import { Subscription } from 'rxjs/Subscription'; @Component({ selector: 'app-transactions', templateUrl: './transactions.html', providers: [], }) export class TransactionsComponent { trnxs: TransactionClass[]; subscription: Subscription; constructor(private uds: UserDataService) { this.subscription = this.uds.getData('TransactionsComponent').subscribe( payload => { if ((payload.key === 'transactions') && (payload.sender !== 'TransactionsComponent')) { this.trnxs = payload.data; //console.log(`trnxs: ${JSON.stringify(this.trnxs)}`); } }, error => { console.log(`Error getting trnxs data fro UDS - ${error}`); }); this.uds.setData('TransactionsComponent', 'transactions', 'list', {}); } } <file_sep>import { ContactClass } from './contact-class'; import { UserInterface } from './user-interface'; export class UserClass implements UserInterface{ id: number; name: string; phone: string; email: string; photoUrl: string; bank: string; accountNum: string; invitedBy: string; // constructor({_id: number, _contact: ContactClass, _username: string, _password: string, _role: number ) { constructor(_user: any) { this.id = _user.id; this.name = _user.name; this.phone = _user.phone; this.email = _user.email; this.photoUrl = _user.photoUrl; this.bank = _user.bank; this.accountNum = _user.accountNum; this.invitedBy = _user.invitedBy; } } <file_sep>import { DocumentClass } from './document-class'; import { ContactClass } from './contact-class'; import { CoordinateClass } from './coordinate-class'; export class LandClass { id: number; ownerId: number; description: string; location: string; area: number; available: number; price: number; constructor( _id: number, _ownerId: number, _description: string, _location: string, _area: number, _available: number, _price: number, ) { this.id = _id; this.ownerId = _ownerId; this.description = _description; this.location = _location; this.area = _area; this.available = _available; this.price = _price; } } <file_sep>import { Component } from '@angular/core'; import { FormGroup, AbstractControl, FormBuilder, Validators } from '@angular/forms'; import { NgIf } from '@angular/common'; import { HttpModule } from '@angular/http'; import { Http, Response } from '@angular/http'; import { Headers, RequestOptions } from '@angular/http'; import { Observable } from 'rxjs'; import { Router } from '@angular/router'; import { UserDataService } from '../../services/userdata.service'; import { UserClass } from '../../models/user-class'; import { Subscription } from 'rxjs/Subscription'; @Component({ selector: 'login', templateUrl: './login.html', styleUrls: ['./login.scss'], }) export class Login { form: FormGroup; email: AbstractControl; password: AbstractControl; submitted: boolean = false; url: string = 'http://localhost:3000/auth'; reqBody: string; headers: Headers = new Headers(); mobHeight: any; mobWidth: any; isLargeDisplay: boolean = false; isSmallDisplay: boolean = false; bgUrls: string[]; bgUrl: string; idx: number; user: UserClass; subscription: Subscription; data: any; constructor( fb: FormBuilder, private http: Http, private router: Router, private uds: UserDataService) { this.form = fb.group({ 'email': ['', Validators.compose([Validators.required, Validators.minLength(4)])], 'password': ['', Validators.compose([Validators.required, Validators.minLength(4)])], }); this.bgUrls = [ `https://www.youtube.com/embed/pqsU7yzs0i8?autoplay=1&controls=0&` .concat(`showinfo=0&autohide=1&loop=1&rel=0&start=60&end=90&mute=1;`), `https://www.youtube.com/embed/-YAimO5qchU?autoplay=1&controls=0&` .concat(`showinfo=0&autohide=1&loop=1&rel=0&start=60&end=90&mute=1;`), `https://www.youtube.com/embed/8ILj8mplkew?autoplay=1&controls=0&` .concat(`showinfo=0&autohide=1&loop=1&rel=0&start=20&end=90&mute=1;`), `https://www.youtube.com/embed/XrWmKvvfQzs?autoplay=1&controls=0&` .concat(`showinfo=0&autohide=1&loop=1&rel=0&start=60&end=90&mute=1;`), `https://www.youtube.com/embed/9RltyVgDat4?autoplay=1&controls=0` .concat(`&showinfo=0&autohide=1&loop=1&rel=0&start=60&end=90&mute=1;`), ], this.idx = Math.round(Math.random() * 4); this.bgUrl = this.bgUrls[this.idx]; console.log(`idx: ${this.idx} url: ${this.bgUrl}`); this.email = this.form.controls['email']; this.password = this.form.controls['<PASSWORD>']; this.mobHeight = window.screen.height; this.mobWidth = window.screen.width; if (window.screen.width > 640) { this.isLargeDisplay = true; } else { this.isSmallDisplay = true; } console.log(window.screen.width); console.log(window.screen.height); } private extractResponseHeaders(res: Response) { } private extractRequestHeaders(headers: Headers) { console.log(`login Request Headers: ${JSON.stringify(headers)}`); } private handleErrorObservable (error: Response | any) { console.log(error.message || error); return Observable.throw(error.message || error); } onSubmit( values: Object ): void { console.log(`values: ${JSON.stringify(values)} `); console.log(`email: ${values['email']}` ); console.log(`password: ${values['password']}`); this.submitted = true; if (this.form.valid) { this.headers.append('Content-Type', 'application/x-www-form-urlencoded'); this.extractRequestHeaders(this.headers); const reqBody = `username=${values['email']}&password=${values['<PASSWORD>']}`; console.log(`login req.body: ${reqBody}`); const options = new RequestOptions({ headers: this.headers, withCredentials: true }); console.log(`login options: ${JSON.stringify(options)}`); const response = this.http.post(`${this.url}/login`, reqBody, options); response.map(res => res.json()) .subscribe( data => { console.log(`login data => ${JSON.stringify(data)}`); if (data) { if (data.profile !== undefined) { this.uds.setData('login', 'profile', 'update', data.profile); this.router.navigateByUrl('/pages/dashboard'); } else { this.router.navigateByUrl('/pages/profile'); } } }, err => { console.log(`error => code:${err.code} status:${err.status} `); if (err.status === 401) { location.reload(); } else if (err.status === 404) { this.router.navigateByUrl('/login'); } }, () => { console.log('Authentication Complete'); }, ); // your code goes here // console.log(values); } } } <file_sep>export const PAGES_MENU = [ { path: 'pages', children: [ { path: 'dashboard', data: { menu: { title: 'general.menu.dashboard', icon: 'ion-android-home', selected: false, expanded: false, order: 0, }, }, }, { path: 'commissions', data: { menu: { title: 'general.menu.earnings', icon: 'ion-cash', selected: false, expanded: false, order: 10, }, }, }, { path: 'transactions', data: { menu: { title: 'general.menu.transactions', icon: 'ion-ios-list', selected: false, expanded: false, order: 10, }, }, }, { path: 'portfolio', data: { menu: { title: 'general.menu.portfolio', icon: 'ion-ios-folder', selected: false, expanded: false, order: 10, }, }, }, { path: 'lands', data: { menu: { title: 'general.menu.lands', icon: 'ion-ios-location', selected: false, expanded: false, order: 10, }, }, }, ], }, ]; <file_sep>import { DocumentClass } from './document-class'; import { UserClass } from './user-class'; import { LandClass } from './land-class'; export class OrderClass { price: number; type: number; // {sell/buy} landId: number; quantity: number; total: number; constructor( _type: number, _landId: number, _quantity: number, _price: number, _total: number) { this.type = _type; this.landId = _landId; this.quantity = _quantity; this.price = _price; this.total = _total; } /* getOrderTotal(): number { return this.quantity * this.land.price; }*/ }
d8a7c564553824ba5a6f766c68e8ac56c3adda82
[ "TypeScript", "HTML" ]
53
TypeScript
tcomax/landswoop-frontend
819f375fb9c9f93b8ca674e0c23440c9cf518627
9d5efee7c9b0fdc49c6e86bdebe5136d212e9866
refs/heads/master
<file_sep>IPADDR=$(echo "${SSH_CONNECTION}" | awk '{print $3}') SAVE='/root/hosting.txt' install_hosting() { apt-get update apt-get install -y apt-utils dialog sudo pwgen MYPASS=$(pwgen -cns -1 12) apt-get install -y software-properties-common python-software-properties sudo add-apt-repository ppa:ondrej/php apt-get update apt-get install -y apache2 php5.6 php5.6-mbstring php5.6-mysql php5.6-gd php5.6-xml cron unzip memcached libapache2-mod-php5.6 apt-get install -y php-ssh2 lib32stdc++6 openssh-server python3 screen echo mysql-server mysql-server/root_password select "$MYPASS" | debconf-set-selections echo mysql-server mysql-server/root_password_again select "$MYPASS" | debconf-set-selections apt-get install -y mysql-server echo "phpmyadmin phpmyadmin/dbconfig-install boolean true" | debconf-set-selections echo "phpmyadmin phpmyadmin/mysql/admin-user string root" | debconf-set-selections echo "phpmyadmin phpmyadmin/mysql/admin-pass password $MY<PASSWORD>" | debconf-set-selections echo "phpmyadmin phpmyadmin/mysql/app-pass password $MYPASS" |debconf-set-selections echo "phpmyadmin phpmyadmin/app-password-confirm password $MY<PASSWORD>" | debconf-set-selections echo 'phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2' | debconf-set-selections apt-get install -y phpmyadmin mv /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/.000-default.conf FILE='/etc/apache2/sites-available/000-default.conf' echo "<VirtualHost *:80>">$FILE echo " ServerName $IPADDR">>$FILE echo " DocumentRoot /var/www">>$FILE echo " <Directory /var/www/>">>$FILE echo " Options Indexes FollowSymLinks MultiViews">>$FILE echo " AllowOverride All">>$FILE echo " Order allow,deny">>$FILE echo " allow from all">>$FILE echo " </Directory>">>$FILE echo " ErrorLog \${APACHE_LOG_DIR}/error.log">>$FILE echo " LogLevel warn">>$FILE echo " CustomLog \${APACHE_LOG_DIR}/access.log combined">>$FILE echo "</VirtualHost>">>$FILE a2enmod rewrite a2enmod php5.6 wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.zip unzip ioncube_loaders_lin_x86-64.zip cp ioncube/ioncube_loader_lin_5.5.so /usr/lib/php5/20121212/ioncube_loader_lin_5.5.so rm -R ioncube* echo "zend_extension=ioncube_loader_lin_5.5.so">>"/etc/php5/apache2/php.ini" echo "zend_extension=ioncube_loader_lin_5.5.so">>"/etc/php5/cli/php.ini" apt-get update service cron restart service apache2 restart cd ~ mysql -uroot -p$MYPASS -e "CREATE DATABASE game CHARACTER SET utf8 COLLATE utf8_general_ci;" chown -R www-data:www-data /var/www/ chmod -R 775 /var/www/ cd /var/www/ rm -R html rm index.html ln -s /usr/share/phpmyadmin /var/www/phpmyadmin cd /root touch hosting.txt groupadd gameservers clear service apache2 restart service mysql restart echo "Данные для входа:">>$SAVE echo "Адрес: http://$IPADDR/">>$SAVE echo "phpMyAdmin: http://$IPADDR/phpmyadmin">>$SAVE echo "Логин: root">>$SAVE echo "Пароль: $MYPASS">>$SAVE echo "">>$SAVE echo "================ Установка успешно завершена ================" echo "Данные для входа:" echo "Адрес: http://$IPADDR/" echo "phpMyAdmin: http://$IPADDR/phpmyadmin" echo "Логин: root" echo "Пароль: $MYPASS" echo "Так-же данные были сохранены в файле: /root/hosting.txt" echo "=======================================================================" } install_servers() { dpkg --add-architecture i386 apt-get update -y apt-get install -y screen apt-get install -y python3 apt-get install -y openssh-server apt-get install -y lib32stdc++6 apt-get install -y unzip apt-get install -y wget groupadd gameservers apt-get install -y pure-ftpd echo "yes" > /etc/pure-ftpd/conf/ChrootEveryone echo "yes" > /etc/pure-ftpd/conf/CreateHomeDir echo "yes" > /etc/pure-ftpd/conf/DontResolve echo "DenyGroups gameservers" >> /etc/ssh/sshd_config service ssh restart service pure-ftpd restart cd /home/ wget $GAMES/cp.zip unzip cp.zip rm cp.zip chmod 700 /home/cp/ chmod 700 /home/cp/gameservers.py chmod 700 /home/cp/backup.sh clear menu } add_locations() { echo "Таблица для добавления локаций обязательно должна иметь название 'locations'" read -p "Введите пароль от phpMyAdmin: " PMA_PASS read -p "Введите название базы(game,hostin): " BD_NAME read -p "Введите номер локации: " LOCATION_ID read -p "Введите название локации(Москва,Киев): " LOCATION_NAME read -p "Введите IP-адрес локации(1.1.1.1): " LOCATION_IP read -p "Введите имя пользователя(root): " LOCATION_USER read -p "Введите пароль пользователя: " LOCATION_PASSWORD read -p "Введите статус локации(1-вкл;0-выкл): " LOCATION_STATUS mysql -uroot -p$PMA_PASS -D $BD_NAME -e "INSERT INTO locations (location_id, location_name, location_ip, location_ip2, location_user, location_password, location_status) VALUES ('$LOCATION_ID', '$LOCATION_NAME', '$LOCATION_IP', '$LOCATION_IP', '$LOCATION_USER', '$LOCATION_PASSWORD', '$LOCATION_STATUS');" clear menu } install_games() { clear echo "Список доступных игр" echo "• 1 ♦ Multi Theft Auto [Версия: 1.5.5]" echo "• 2 ♦ San Andreas Multiplayer [Версия: 0.3.7-R2]" echo "• 3 ♦ Crminal Russia Multiplayer [Версия: 0.3e]" echo "• 4 ♦ Counter-Strike 1.6 [Версия: ReHLHDS]" echo "• 5 ♦ Counter-Strike Source v34 [Версия: Last]" echo "• 0 ♦ В главное меню" read -p "Пожалуйста, введите пункт меню: " case case $case in 1) mkdir -p /home/cp/gameservers/files/ cd /home/cp/gameservers/files/ wget $GAMES/mta.tar mkdir -p /home/cp/gameservers/configs/ cd /home/cp/gameservers/configs/ wget $GAMES/mta.cfg install_games ;; 2) mkdir -p /home/cp/gameservers/files/ cd /home/cp/gameservers/files/ wget $GAMES/samp.tar mkdir -p /home/cp/gameservers/configs/ cd /home/cp/gameservers/configs/ wget $GAMES/samp.cfg install_games ;; 3) mkdir -p /home/cp/gameservers/files/ cd /home/cp/gameservers/files/ wget $GAMES/crmp.tar mkdir -p /home/cp/gameservers/configs/ cd /home/cp/gameservers/configs/ wget $GAMES/crmp.cfg install_games ;; 4) mkdir -p /home/cp/gameservers/files/ cd /home/cp/gameservers/files/ wget $GAMES/cs.tar mkdir -p /home/cp/gameservers/configs/ cd /home/cp/gameservers/configs/ wget $GAMES/cs.cfg install_games ;; 5) mkdir -p /home/cp/gameservers/files/ cd /home/cp/gameservers/files/ wget $GAMES/css.tar mkdir -p /home/cp/gameservers/configs/ cd /home/cp/gameservers/configs/ wget $GAMES/css.cfg install_games ;; 0) menu;; esac } add_games() { echo "Таблица для добавления игр обязательно должна иметь название 'games'" read -p "Введите пароль от phpMyAdmin: " PMA_PASS read -p "Введите название базы(game,hostin): " BD_NAME read -p "Введите номер игры: " GAME_ID read -p "Введите название игры(example: SA-MP 0.3.7-R2): " GAME_NAME read -p "Введите код игры(example: samp,crmp): " GAME_CODE read -p "Введите query-драйвер игры(example: samp,valve): " GAME_QUERY read -p "Введите минимальные слоты для покупки(example: 50): " GAME_MIN_SLOTS read -p "Введите максимальные слоты для покупки(example: 1000): " GAME_MAX_SLOTS read -p "Введите минимальный порт игры(example: 7777): " GAME_MIN_PORT read -p "Введите максимальный порт игры(example: 9999): " GAME_MAX_PORT read -p "Введите цену за слот сервера игры(example: 1): " GAME_PRICE read -p "Введите статус игры(1-вкл;0-выкл): " GAME_STATUS mysql -uroot -p$PMA_PASS -D $BD_NAME -e "INSERT INTO games (game_id, game_name, game_code, game_query, game_min_slots, game_max_slots, game_min_port, game_max_port, game_price, game_status) VALUES ('$GAME_ID', '$GAME_NAME', '$GAME_CODE', '$GAME_QUERY', '$GAME_MIN_SLOTS', '$GAME_MAX_SLOTS', '$GAME_MIN_PORT', '$GAME_MAX_PORT', '$GAME_PRICE', '$GAME_STATUS');" clear menu } menu() { clear echo "Настройка VDS под хостинг игровых серверов для Ubuntu 16.04 (amd64)" echo "- 1 - Настроить VDS для веб-части хостинга" echo "- 2 - Настроить VDS под игры" echo "- 3 - Добавление локаций" echo "- 4 - Установка игр" echo "- 5 - Добавление игр в панель" echo "- 0 - Выход" echo read -p "Пожалуйста, введите пункт меню: " case case $case in 1) install_hosting;; 2) install_servers;; 3) add_locations;; 4) install_games;; 5) add_games;; 0) exit;; esac } menu
a36d0230012db45d6fd8c3badd78e475950002a3
[ "Shell" ]
1
Shell
ArturAndreev98/f
bae6aedb21b3fd65b0b610f81d08ca558422d70d
62f0c6a00302eeadefa4b54876da426cf089e4f8
refs/heads/master
<repo_name>sj/bash-git-prompt<file_sep>/bash-git-prompt #!/bin/bash # bashrc-git control RUNDIR="/run/user/$UID/bash-git-prompt" INSTANCE_RUNDIR="/run/user/$UID/bash-git-prompt/instances/$BASH_GIT_PROMPT_PID" THIS_SCRIPT=`realpath "${BASH_SOURCE[0]}"` BGP_INSTALLDIR=`dirname "$THIS_SCRIPT"` . "$BGP_INSTALLDIR/bash-git-prompt-functions.sh" function bgp_disable(){ touch $INSTANCE_RUNDIR/disabled } function bgp_enable(){ rm -f $INSTANCE_RUNDIR/disabled } function bgp_clear_cache(){ rm -rf $RUNDIR/cache/directories rm -rf $RUNDIR/cache/repositories cat <<HEREDOC Cache cleared. If your current working directory is (part of) a Git repository on a slow medium (e.g. NFS share), then it might take some time for bash-git-prompt to repopulate the cache for this repository. HEREDOC } function bgp_refresh(){ repo_root=`bgp_get_pwd_repository_root` if [ ! "$repo_root" = "" ]; then repo_root_hash=`bgp_hash "$repo_root"` repo_cache_file="$RUNDIR/cache/repositories/$repo_root_hash" if [ -w "$repo_cache_file" ]; then rm "$repo_cache_file" && echo "Cache for repository '$repo_root' cleared - bash prompt should refresh automatically" || exit 1 else echo "No cache entry found for repository '$repo_root' (or cache not writable) - unable to refresh." >& 2 fi else echo "Can't find repository root - unable to refresh." >& 2 exit 1 fi } function usage(){ echo "Usage: bash-git-prompt [command] [parameter(s)]" echo "" echo "Available commands:" echo " disable: temporarily disables bash-git-prompt" echo " enable: (re-)enables bash-git-prompt" echo " clear-cache: force wipe of cached information about all Git repositories" echo " refresh: refreshes the information on the current repository" } if [ -z "$BASH_GIT_PROMPT_PID" ]; then echo "bash-git-prompt not installed or initialised. Please follow the installation instructions and edit ~/.bashrc accordingly." >& 2 exit 1 fi case "$1" in disable) bgp_disable ;; enable) bgp_enable ;; clear-cache) bgp_clear_cache ;; refresh) bgp_refresh ;; *) echo "Unknown or missing command-line parameter" >& 2 usage ;; esac <file_sep>/bashrc-include # vim: set filetype=bash BGP_INSTALLDIR=`dirname "${BASH_SOURCE[0]}"` . "$BGP_INSTALLDIR/bash-git-prompt-functions.sh" function bgp_make_prompt_label() { INSTANCE_RUNDIR="$RUNDIR/instances/$BASH_GIT_PROMPT_PID" if [ -f "$INSTANCE_RUNDIR/disabled" ]; then return fi repo_root="`bgp_get_pwd_repository_root`" if [ ! "$repo_root" = "" ] && [ ! -f "$repo_root/.bash-git-prompt-ignore" ]; then # There is a repository root - query cache for more info repo_root_hash=`bgp_hash "$repo_root"` repo_cache_file="$RUNDIR/cache/repositories/$repo_root_hash" bgp_log "reading cache for repository root '$repo_root' ($repo_cache_file)" repo_is_local=`bgp_is_local_directory "$repo_root"` force_git_refresh="no" if [ -r "$repo_cache_file" ]; then # Check age of cache now=`date +%s` lastmod=`stat -c %Y "$repo_cache_file"` age_secs=$((now-lastmod)) if [ "$age_secs" -lt "30" ]; then bgp_log "cache is only $age_secs seconds old - not refreshing" elif [ "$repo_is_local" = "yes" ]; then bgp_log "forcing refresh of cached Git repository information (on local filesystem): older than 30 seconds ($age_secs seconds)" force_git_refresh="yes" elif [ "$repo_is_local" = "no" ]; then bgp_log "not refreshing cached Git repository information: repository is not on a local filesystem (cache age: $age_secs seconds)" fi fi if [ "$force_git_refresh" = "no" ]; then # Check whether recent history contains a reason to refresh cache history_git=`history | tail -n1 | grep "git commit\|git push\|git pull\|git mytest\|git fetch\|git checkout\|git merge\|git rebase"` history_last=`history | tail -n1` bgp_log "last entry in Bash history: '$history_last'" if [ ! "$history_git" = "" ]; then bgp_log "forcing Git refresh because of recent history" force_git_refresh="yes" fi fi if [ ! -r "$repo_cache_file" ] || [ "$force_git_refresh" = "yes" ]; then # No cache available yet - construct from git bgp_log "querying Git for information regarding repository '$repo_root'" if [ ! -d "$RUNDIR/cache/repositories" ]; then mkdir -p "$RUNDIR/cache/repositories" fi parsed_git_info="`parse_git_info`" echo "$parsed_git_info" > "$repo_cache_file" echo "$parsed_git_info" else # Read prompt from cache to speed things op bgp_log "presenting cache information for repository at '$repo_root' in Bash prompt" cat $repo_cache_file fi fi # else: current dir not part of Git repository, or should be ignored } function parse_git_info(){ git_branch=`git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'` git_current_sha=`git log -1 --format="%H"` # 'HEAD' doesn't always work if [ ! "$git_branch" = "" ]; then # Count number of local changes that do not feature upstream # Branch names that start with '(' have no useful upstream. Usually they are things like '(detached from ABC)' or '(no branch)' if [ ! "${git_branch:0:1}" = "(" ]; then if [ ! "`git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q $git_current_sha)`" = "" ]; then # Local branch has upstream git_num_commits_not_pushed=`git log --oneline @{upstream}.. | wc -l` if [ "$git_num_commits_not_pushed" = "0" ]; then git_num_commits_not_pushed="" fi else # Local branch does not have upstream git_num_commits_not_pushed=`git show-branch "$git_branch" | wc -l` if [ "$git_num_commits_not_pushed" = "0" ]; then git_num_commits_not_pushed="" fi fi else # Detached or no branch (e.g. when rebasing) git_num_commits_not_pushed="?" fi # Count number of file changes that haven't been committed yet git_num_changes_uncommitted=`git status --porcelain | wc -l` if [ "$git_num_changes_uncommitted" = "0" ]; then git_num_changes_uncommitted="" fi if [ ! "$git_num_changes_uncommitted" = "" ]; then num_changes_str=" ~$git_num_changes_uncommitted" fi if [ ! "$git_num_commits_not_pushed" = "" ]; then commits_not_pushed_str=" ↑$git_num_commits_not_pushed" fi echo " [$git_branch$commits_not_pushed_str$num_changes_str] " fi } function proml { local BLUE="\[\033[0;34m\]" local RED="\[\033[0;31m\]" local LIGHT_RED="\[\033[1;31m\]" local GREEN="\[\033[0;32m\]" local LIGHT_GREEN="\[\033[1;32m\]" local WHITE="\[\033[1;37m\]" local LIGHT_GRAY="\[\033[0;37m\]" case $TERM in xterm*) TITLEBAR='\[\033]0;\u@\h:\w\007\]' ;; *) TITLEBAR="" ;; esac #PS1="${TITLEBAR}\u@\h:\w$WHITE\$(parse_git_info) $LIGHT_GRAY> " PS1="${TITLEBAR}\u@\h:\w$WHITE\$(bgp_make_prompt_label) $LIGHT_GRAY> " PS2='> ' PS4='+ ' } RUNDIR="/run/user/$UID/bash-git-prompt" if [ -z "$BASH_GIT_PROMPT_PID" ]; then export BASH_GIT_PROMPT_PID="$BASHPID" INSTANCE_RUNDIR="/run/user/$UID/bash-git-prompt/instances/$BASHPID" bgp_clean_instances mkdir -p "$INSTANCE_RUNDIR" &> /dev/null fi proml <file_sep>/bash-git-prompt-functions.sh # vim: set filetype=bash # Include file which contains various functions used by bash-git-prompt function bgp_get_pwd_repository_root(){ currdir=`pwd` currdir_hash=`bgp_hash "$currdir"` repo_root="" currdir_cache_file="$RUNDIR/cache/directories/$currdir_hash" if [ ! -r "$currdir_cache_file" ]; then bgp_log "no information known for '$currdir' ($currdir_cache_file does not exist)" # No cache information known for current directory - create it. mkdir -p "$RUNDIR/cache/directories" repo_root=`git rev-parse --show-toplevel 2> /dev/null` if [ "$repo_root" = "" ]; then # Current pwd is not part of repository - construct empty file bgp_log "current directory not part of Git repository" touch "$currdir_cache_file" else bgp_log "current directory part of Git repository at '$repo_root', storing in cache" echo "$repo_root" > "$currdir_cache_file" fi else bgp_log "found cache for '$currdir': $currdir_cache_file" repo_root=`cat "$currdir_cache_file"` if [ "$repo_root" = "" ]; then bgp_log "information in cache about '$currdir': not part of Git repository" else bgp_log "information in cache about '$currdir': part of Git repository at '$repo_root'" fi fi echo "$repo_root" } # Determines if a directory ($1) is local to this system. function bgp_is_local_directory(){ LOCAL_FSTYPES="ext2 ext3 ext4" dir="$1" mountpoint="" mountpoint_fs="" for mountinfo in $(mount | sed "s/ on /|/g" | sed "s/ type /|/g" | sed "s/ (/|(/g"); do this_mountdev=`echo $mountinfo | cut -d "|" -f 1` this_mountpoint=`echo $mountinfo | cut -d "|" -f 2` this_mountfstype=`echo $mountinfo | cut -d "|" -f 3` result=($(echo "$dir" | grep -o "$this_mountpoint")) if [[ ${#result} -gt ${#mountpoint} ]]; then mountpoint="$result" mountpoint_fs="$this_mountfstype" fi done if [ "$mountpoint_fs" = "" ]; then # Can't find mount point bgp_log "can't figure out whether '$dir' is local to this system" echo "yes" return fi for local_fstype in $LOCAL_FSTYPES; do if [ "$local_fstype" = "$mountpoint_fs" ]; then bgp_log "repository at '$dir' is located on mount point '$mountpoint' which is of local type '$local_fstype'" echo "yes" return fi done bgp_log "repository at '$dir' is located on mount point '$mountpoint', which is of non-local filesystem type '$mountpoint_fs'" echo "no" } function bgp_clean_instances(){ if [ ! -d "$RUNDIR/instances" ]; then mkdir -p "$RUNDIR/instances" fi cd "$RUNDIR/instances" || return bgp_log "Cleaning garbage from previous instances:" ls | while read instance_pid; do proc_cmdline="/proc/$instance_pid/cmdline" if [ ! -r "$proc_cmdline" ] || [ "`cat $proc_cmdline | grep bash`" = "" ]; then bgp_log "PID $instance_pid no longer active, cleaning up" rm -rf "$RUNDIR/instances/$instance_pid" else bgp_log "PID $instance_pid currently active, not cleaning up" fi done # Back to home dir cd } function bgp_log(){ echo "`date` -- $BASH_GIT_PROMPT_PID -- $@" >> /tmp/bash-git-prompt.log } function bgp_hash(){ echo $@ | md5sum | awk '{print $1}' }
a7729ff9965cf8063cc33c92ce908154de39b329
[ "Shell" ]
3
Shell
sj/bash-git-prompt
e22cab3c0fd2fd27d9df85bd127532ac6630d37c
b987b964d9c6f90f27cd8b39624425f6751704b9
refs/heads/master
<file_sep>package com.caitlynwiley.tictactoe; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { ImageView blue; ImageView green; //1 means blue, 2 means green, 0 is empty int[][] board; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); blue = findViewById(R.id.blue); green = findViewById(R.id.green); board = new int[3][3]; } public void switchTurn(View view) { ImageView piece = (ImageView) view; if (blue.getAlpha() == 1f) { piece.setImageResource(R.drawable.blue_piece); } else { piece.setImageResource(R.drawable.green_piece); } piece.setAlpha(1f); int i = -1; int j = -1; switch (view.getId()) { case R.id.square1: i = 0; j = 0; break; case R.id.square2: i = 0; j = 1; break; case R.id.square3: i = 0; j = 2; break; case R.id.square4: i = 1; j = 0; break; case R.id.square5: i = 1; j = 1; break; case R.id.square6: i = 1; j = 2; break; case R.id.square7: i = 2; j = 0; break; case R.id.square8: i = 2; j = 1; break; case R.id.square9: i = 2; j = 2; break; } if (blue.getAlpha() == 1f) { blue.setAlpha(0f); green.setAlpha(1f); board[i][j] = 1; } else { blue.setAlpha(1f); green.setAlpha(0f); board[i][j] = 2; } boolean playerWon = checkForWin(board[i][j]); if (playerWon) { Toast.makeText(MainActivity.this, "Player " + board[i][j] + " won!", Toast.LENGTH_SHORT).show(); } //TODO: Once a player wins, end the game (or restart) } private String printBoard() { String b = ""; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { b += board[i][j]; } b += "/n"; } return b; } private boolean checkForWin(int player) { //check across rows int count = 0; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (board[i][j] == player) { count++; } } if (count == 3) { return true; } else { count = 0; } } //check down columns for (int j = 0; j < 3; j++) { for (int i = 0; i < 3; i++) { if (board[i][j] == player) { count++; } } if (count == 3) { return true; } else { count = 0; } } //check diagonals for (int i = 0, j = 0; i < 3 && j < 3; i++, j++) { if (board[i][j] == player) { count ++; } } if (count == 3) { return true; } else { count = 0; } for (int i = 2, j = 0; i >= 0 && j < 3; i--, j++) { if (board[i][j] == player) { count ++; } } return count == 3; } }
6af4dabaf1af8a7107151b03f8e2dc5094d9a213
[ "Java" ]
1
Java
cwiley982/TicTacToe
1876af19aa3a255907bc49c47694e2e45987ac4f
1e6da60160074224641d534507526787bdbf46f2
refs/heads/main
<repo_name>Dhruvpatel1998/TDD-practice<file_sep>/test/unitTest.js const chai = require('chai'); const assert = chai.assert; const functions= require('../functions'); describe('sum', function(){ it('should return 6 when adding 3 and 3', function(){ assert.equal(functions.sum(3, 3), 6); }); it('should return -4 when adding 6 and -10', function(){ assert.equal(functions.sum(6, -10), -4); }); it('should return 2.2 when adding 1.1 and 1.1', function(){ assert.equal(functions.sum(1.1, 1.1), 2.2); }); }); describe('product', function(){ it('it should return 10 when multiplying 2 and 5', function(){ assert.equal(functions.product(2, 5), 10); }); it('it should return -6 when multiplying 2 and -3', function(){ assert.equal(functions.product(2, -3), -6); }); it('it should return 6.25 when multiplying 2.5 and 2.5', function(){ assert.equal(functions.product(2.5, 2.5), 6.25); }); }); describe('min', function(){ it('it should return 6 when numbers 6 and 6 are equal', function(){ assert.equal(functions.min(6, 6),6); }); it('it should return 7 when 9 is greater than 7', function(){ assert.equal(functions.min(9,7), 7); }); it('it should return 3 when numbers are 3 and 5', function(){ assert.equal(functions.min(3, 5), 3); }); }); describe('max', function(){ it('it should return 1 when numbers are 1 and 1', function(){ assert.equal(functions.max(1, 1),1); }); it('it should return 6 when 6 and 3. when the second number is smaller', function(){ assert.equal(functions.max(3, 6), 6); }); it('it should return 8 when numbers are 5 and -8', function(){ assert.equal(functions.max(5,8), 8); }); }); describe('head', function(){ it ('it should return null when the array is empty', function(){ let arr =[]; assert.isNull(functions.head(arr)); }); it ('it should return dhruv when the array is [dhruv,ad,7]', function(){ let arr =['dhruv','ad',7]; assert.equal(functions.head(arr),'dhruv'); }); it ('it should return 9 when the array is [9,jithu,dhruv]', function(){ let arr =[9,'jithu','DA']; assert.equal(functions.head(arr),9); }); }); describe('tail', function(){ it ('it should return null when the array is empty', function(){ let arr =[]; assert.isNull(functions.tail(arr)); }); it ('it should return 9 when the array is [dhruv,ik,9]', function(){ let arr =['dhruv','ik',9]; assert.equal(functions.tail(arr),9); }); it ('it should return raju when the array is [raju,zm,6]', function(){ let arr =['raju','zm',6]; assert.equal(functions.tail(arr),6); }); }); describe('mid', function(){ it ('it should return null when the array is empty', function(){ let arr =[]; assert.isNull(functions.mid(arr)); }); it ('it should return [Dhruv,jitu] when the array is[zameer,Dhruv,jitu,mani]', function(){ let arr =['zameer','Dhruv','jitu','mani']; assert.deepEqual(functions.mid(arr),['Dhruv','jitu']); }); it ('it should return 8 when the array is [2,8,7]', function(){ let arr =[2,8,7]; assert.deepEqual(functions.mid(arr),8); }); }); describe('total', function(){ it ('it should return null when the array is empty', function(){ let arr =[]; assert.isNull(functions.total(arr)); }); it ('It should return 6 when the array is [2, 2, 2]', function(){ let arr =[2,2,2]; assert.equal(functions.total(arr),6); }); it ('it should return 6 when the array is [6]', function(){ let arr =[6]; assert.equal(functions.total(arr),[6]); }); }); describe('average', function(){ it ('it should return null when the array is empty', function(){ let arr =[]; assert.isNull(functions.average(arr)); }); it ('it should return 2 when the array is [1, 2, 3]', function(){ let arr =[1,2,3]; assert.equal(functions.average(arr),2); }); it ('It should return -3.6666666666666665 when the array is [-4, -7, 0]', function(){ let arr =[-4,-7,0]; assert.deepEqual(functions.average(arr),-3.6666666666666665); }); }); describe('smallest', function(){ it ('it should return null when the array is empty', function(){ let arr =[]; assert.isNull(functions.smallest(arr)); }); it ('it should return 3 when the array is [7,3,9]', function(){ let arr =[7,3,9]; assert.equal(functions.smallest(arr),3); }); it ('it should return -5 when the array is [-1,9,-5]', function(){ let arr =[-1,9,-5]; assert.equal(functions.smallest(arr),[-5]); }); }); describe('largest', function(){ it ('it should return null when the array is empty', function(){ let arr =[]; assert.isNull(functions.largest(arr)); }); it ('It should return 5 when the array is [5, 4, 3]', function(){ let arr =[5,4,3]; assert.equal(functions.largest(arr),5); }); it ('It should return 4 when the array is [-7, -6, 4]', function(){ let arr =[-7,-6,4]; assert.equal(functions.largest(arr),4); }); }); describe('merge', function(){ it('it should return null when both the arrays are empty', function(){ let arr1 = []; let arr2 = []; assert.isNull(functions.merge(arr1,arr2)); }); it('It should return [7,7,4,4] when the arrays are [7,4] and [7,4]', function(){ let arr1 = [7,4]; let arr2 = [7,4]; assert.deepEqual(functions.merge(arr1,arr2), [7,7,4,4]); }); it('It should return [2,4,6,8,3] when merging [2,6,3] and [4,8]', function(){ let arr1 = [2,6,3]; let arr2 = [4,8]; assert.deepEqual(functions.merge(arr1,arr2), [2,4,6,8,3]); }); });
57a2c7f4b55d2640d7cb6a5d3ee25f16e8d40e78
[ "JavaScript" ]
1
JavaScript
Dhruvpatel1998/TDD-practice
3d497a395ddf9b4bd389392d44372f3bfa62cb48
2297ffb50862d40e30a66f291a0e706b03de67b2
refs/heads/master
<repo_name>MedwedHub/swiftC<file_sep>/swiftC/CustomTableViewCell.swift // // CustomTableViewCell.swift // swiftC // // Created by xc106d3 on 2018-03-21. // Copyright © 2018 xc106d3. All rights reserved. // import UIKit class CustomTableViewCell: UITableViewCell { // @IBOutlet weak var cellView: UIView! @IBOutlet weak var favCityImage: UIImageView! @IBOutlet weak var cityLabel: UILabel! override func awakeFromNib() { super.awakeFromNib() // Initialization code } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } } <file_sep>/swiftC/Data.swift // // Data.swift // swiftC // // Created by xc106d3 on 2018-03-20. // Copyright © 2018 xc106d3. All rights reserved. // import Foundation class Data { static let shared = Data() private init() {} internal var cities = [City]() private var favouriteCities = [City]() internal func appendCity() { for i in 0..<50 { cities.append(City(name: "City \(i)", id: " id = \(UUID().uuidString)")) } } internal func isFavourite(city: City) -> Bool { for favorite in favouriteCities { if favorite.id == city.id { return true } } return false } internal func changeFavourite(for city: City){ let exist = isFavourite(city: city) if exist { removeCity(city: city) print("Remove") } else { favouriteCities.append(city) print("Append") } } internal func removeCity(city: City) { for favourite in favouriteCities { if favourite.id == city.id{ if let position = favouriteCities.index(where: { $0.id == city.id}) { favouriteCities.remove(at: position)} } else { } } } } <file_sep>/swiftC/UserManager.swift // // UserManager.swift // swiftC // // Created by xc106d3 on 2018-03-23. // Copyright © 2018 xc106d3. All rights reserved. // import UIKit /*class UserManager { private let user = User() func getCurrentUser() -> User { let name = UserDefaults.standard.string(forKey: "nameKey") let birthDay = UserDefaults.standard.object(forKey: "birthDayKey") as? Date let user = User(name: name, birthDay: birthDay, avatar: nil) return user } func changeUser(_ user: User) { UserDefaults.standard.set(user.name, forKey: "nameKey") UserDefaults.standard.set(user.birthDay, forKey: "birthDayKey") } }*/ protocol UserManagerDelegate { } class UserManager { var delegate: UserManagerDelegate? var user: User { get { let name = UserDefaults.standard.string(forKey: "nameKey") let birthDay = UserDefaults.standard.object(forKey: "birthDayKey") as? Date let user = User(name: name, birthDay: birthDay, avatar: nil) return user } set { UserDefaults.standard.set(newValue.name, forKey: "nameKey") UserDefaults.standard.set(newValue.birthDay, forKey: "birthDayKey") } } } <file_sep>/swiftC/CityViewController.swift // // CityViewController.swift // swiftC // // Created by xc106d3 on 2018-03-20. // Copyright © 2018 xc106d3. All rights reserved. // import UIKit class CityViewController: UIViewController { @IBOutlet weak var cityLabel: UILabel! internal var city: City! @IBAction func press(_ sender: Any) { Data.shared.changeFavourite(for: city) updateUI() } override func viewDidLoad() { super.viewDidLoad() cityLabel.text = city.name } override func viewWillAppear(_ animated: Bool) { updateUI() } private func updateUI() { let favorite = Data.shared.isFavourite(city: city) let image: UIImage if favorite { image = UIImage(named: "Star_on")! } else { image = UIImage(named: "Star_off")! } navigationItem.rightBarButtonItem?.image = image } } <file_sep>/swiftC/User.swift // // User.swift // swiftC // // Created by xc106d3 on 2018-03-23. // Copyright © 2018 xc106d3. All rights reserved. // import UIKit struct User { var name: String? var birthDay: Date? var avatar: UIImage? } <file_sep>/swiftC/City.swift // // City.swift // swiftC // // Created by xc106d3 on 2018-03-20. // Copyright © 2018 xc106d3. All rights reserved. // import Foundation struct City { let name: String let id: String } <file_sep>/swiftC/ViewController.swift // // ViewController.swift // swiftC // // Created by xc106d3 on 2018-03-20. // Copyright © 2018 xc106d3. All rights reserved. // import UIKit class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { @IBOutlet weak var tableView: UITableView! override func viewDidLoad() { super.viewDidLoad() tableView.delegate = self tableView.dataSource = self Data.shared.appendCity() } func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return Data.shared.cities.count } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 45.0 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "CityCell", for: indexPath) as! CustomTableViewCell let city = Data.shared.cities[indexPath.row] let favourite = Data.shared.isFavourite(city: city) cell.cityLabel.text = "\(city.name)" + " with \(city.id)" cell.favCityImage.image = UIImage(named: "Star_on")! if !favourite { cell.favCityImage.isHidden = true } else { cell.favCityImage.isHidden = false } return cell } override func viewWillAppear(_ animated: Bool) { tableView.reloadData() } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { let cityVC: CityViewController? = segue.destination as? CityViewController let indexPath = tableView.indexPathForSelectedRow let city = Data.shared.cities[indexPath!.row] cityVC?.city = city } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } } <file_sep>/swiftC/ProfileViewController.swift // // ProfileViewController.swift // swiftC // // Created by xc106d3 on 2018-03-23. // Copyright © 2018 xc106d3. All rights reserved. // import UIKit class ProfileViewController: UIViewController { @IBOutlet weak var birthField: UITextField! @IBOutlet weak var nameField: UITextField! private var datePicker: UIDatePicker! // private var user: User! private var userManager: UserManager! override func viewDidLoad() { super.viewDidLoad() nameField.delegate = self configureDate() birthField.inputView = datePicker userManager = UserManager() //user = userManager.getCurrentUser() nameField.text = userManager.user.name let dateToString: String if let date = userManager.user.birthDay { let dateFormatter = DateFormatter() dateToString = dateFormatter.string(from: date) birthField.text = dateToString } else { birthField.text = "" } } func configureDate() { datePicker = UIDatePicker(frame: CGRect.zero) datePicker.datePickerMode = .date datePicker.addTarget(self, action: #selector(onDatePickerChanged), for: UIControlEvents.valueChanged) let accView = UIView() accView.frame = CGRect(x: 0, y: 0, width: 0, height: 30) accView.layer.backgroundColor = UIColor.lightGray.cgColor let accButton = UIButton() accButton.setTitle("Done", for: .normal) accButton.frame = CGRect(x: self.view.frame.width - 70, y: 5, width: 50, height: 20) accButton.addTarget(self, action: #selector(birthFieldDidEndEditing), for: .touchUpInside) accView.addSubview(accButton) birthField.inputAccessoryView = accView if let name = UserDefaults.standard.string(forKey: "nameKey"){ print(name) } else { print("There is no name in database") } } @objc func onDatePickerChanged(_ datePicker: UIDatePicker) { let date = datePicker.date let dateFormatter = DateFormatter() dateFormatter.dateFormat = "dd-MM-yyyy" birthField.text = dateFormatter.string(from: date) user.birthDay = date userManager.changeUser(user) } func textFieldDidEndEditing(_ textField: UITextField) { if let text = textField.text, text.count > 0 { userManager.user.name = text //userManager.changeUser(user) print("Username changed") if let name = UserDefaults.standard.string(forKey: "nameKey"){ print(name) } else { print("There is no name in database") } } } @objc func birthFieldDidEndEditing(sender: Any) { self.view.endEditing(true) } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } } extension ProfileViewController: UITextFieldDelegate { func textFieldShouldReturn(_ textField: UITextField) -> Bool { textField.endEditing(true) return true } }
ab75c7065c517430c7afcfa8e82b59c927032dba
[ "Swift" ]
8
Swift
MedwedHub/swiftC
8585c00df05de1fdf72ad9af5e42878511e83ae6
5e76a1ff1c134af0040017dcadeca7b7f166e581
refs/heads/master
<file_sep># "Pong" import simplegui import random # initialize globals - pos and vel encode vertical info for paddles WIDTH = 600 HEIGHT = 400 BALL_RADIUS = 20 PAD_WIDTH = 8 PAD_HEIGHT = 80 HALF_PAD_WIDTH = PAD_WIDTH / 2 HALF_PAD_HEIGHT = PAD_HEIGHT / 2 LEFT = False RIGHT = True red_score = 0 green_score =0 # initialize ball_pos and ball_vel for new bal in middle of table ball_pos=[WIDTH/2, HEIGHT/2] ball_vel = [0, 0] # if direction is RIGHT, the ball's velocity is upper right, else upper left def spawn_ball(direction): global ball_pos, ball_vel # these are vectors stored as lists if direction == RIGHT: ball_vel = [random.randrange(120, 240)/60, -random.randrange(60, 180)/60] if direction == LEFT: ball_vel = [-random.randrange(120, 240)/60, -random.randrange(60, 180)/60] # define event handlers def new_game(): global ball_pos, ball_vel, paddle1_pos, paddle2_pos, paddle1_vel, paddle2_vel # these are numbers global red_score, green_score # these are ints red_score = 0 green_score = 0 paddle1_pos = HEIGHT/2 paddle2_pos = HEIGHT/2 paddle1_vel = 0 paddle2_vel = 0 ball_pos=[WIDTH/2, HEIGHT/2] ball_vel = [0, 0] spawn_ball(RIGHT if random.randint(0,1) == 1 else LEFT) def draw(canvas): global paddle1_pos, paddle2_pos,paddle1_vel, paddle2_vel, ball_pos, ball_vel, red_score, green_score # draw mid line and gutters canvas.draw_line([WIDTH / 2, 0],[WIDTH / 2, HEIGHT], 1, "White") canvas.draw_line([PAD_WIDTH, 0],[PAD_WIDTH, HEIGHT], 1, "White") canvas.draw_line([WIDTH - PAD_WIDTH, 0],[WIDTH - PAD_WIDTH, HEIGHT], 1, "White") # update ball ball_pos[0] += ball_vel[0] ball_pos[1] += ball_vel[1] # draw ball canvas.draw_circle(ball_pos, BALL_RADIUS, 2, "White", "White") # collides with top/bottom if ball_pos[1] <= BALL_RADIUS or ball_pos[1] >= HEIGHT-BALL_RADIUS: ball_vel[1] = -ball_vel[1] # collides with left/right if ball_pos[0] <= (PAD_WIDTH + BALL_RADIUS): if ball_pos[1] < (paddle1_pos - HALF_PAD_HEIGHT) or ball_pos[1] > (paddle1_pos + HALF_PAD_HEIGHT): ball_pos=[WIDTH/2, HEIGHT/2] spawn_ball(RIGHT) green_score +=1 else: ball_vel[0] = -ball_vel[0]*1.1 if ball_pos[0] >= WIDTH - 1 - PAD_WIDTH - BALL_RADIUS: if ball_pos[1] < (paddle2_pos - HALF_PAD_HEIGHT) or ball_pos[1] > (paddle2_pos + HALF_PAD_HEIGHT): ball_pos=[WIDTH/2, HEIGHT/2] spawn_ball(LEFT) red_score +=1 else: ball_vel[0] = -ball_vel[0]*1.1 # update paddle's vertical position, keep paddle on the screen paddle1_pos += paddle1_vel paddle2_pos += paddle2_vel if paddle1_pos < (HALF_PAD_HEIGHT) and paddle1_vel< 0: paddle1_vel = 0 elif paddle1_pos > (HEIGHT - HALF_PAD_HEIGHT) and paddle1_vel> 0: paddle1_vel = 0 if paddle2_pos < (HALF_PAD_HEIGHT) and paddle2_vel< 0: paddle2_vel = 0 elif paddle2_pos > (HEIGHT - HALF_PAD_HEIGHT) and paddle2_vel> 0: paddle2_vel = 0 # draw paddles canvas.draw_line([HALF_PAD_WIDTH, (paddle1_pos - HALF_PAD_HEIGHT)], [HALF_PAD_WIDTH, (paddle1_pos + HALF_PAD_HEIGHT)], PAD_WIDTH, "Red") canvas.draw_line([(WIDTH - HALF_PAD_WIDTH), (paddle2_pos - HALF_PAD_HEIGHT)], [(WIDTH - HALF_PAD_WIDTH), (paddle2_pos + HALF_PAD_HEIGHT)], PAD_WIDTH, "Green") # draw scores canvas.draw_text(str(red_score), (140, 70),60, 'Red') canvas.draw_text(str(green_score), (460, 70),60, 'Green') def keydown(key): global paddle1_vel, paddle2_vel acc = 3 if key == simplegui.KEY_MAP["w"]: paddle1_vel -= acc elif key == simplegui.KEY_MAP["s"]: paddle1_vel += acc elif key == simplegui.KEY_MAP["up"]: paddle2_vel -= acc elif key == simplegui.KEY_MAP["down"]: paddle2_vel += acc def keyup(key): global paddle1_vel, paddle2_vel if key == simplegui.KEY_MAP["w"] or key == simplegui.KEY_MAP["s"]: paddle1_vel = 0 elif key == simplegui.KEY_MAP["up"] or key == simplegui.KEY_MAP["down"]: paddle2_vel = 0 # create frame frame = simplegui.create_frame("Pong", WIDTH, HEIGHT) frame.set_draw_handler(draw) frame.set_keydown_handler(keydown) frame.set_keyup_handler(keyup) button1 = frame.add_button('Reset', new_game) # start frame new_game() frame.start() <file_sep>#Game-Blackjack import simplegui import random # load card sprite - 936x384 - source: jfitz.com CARD_SIZE = (72, 96) CARD_CENTER = (36, 48) card_images = simplegui.load_image("http://storage.googleapis.com/codeskulptor-assets/cards_jfitz.png") CARD_BACK_SIZE = (72, 96) CARD_BACK_CENTER = (36, 48) card_back = simplegui.load_image("http://storage.googleapis.com/codeskulptor-assets/card_jfitz_back.png") # initialize some useful global variables in_play = False #if player's hand is still being played outcome = "" report = "" score = 0 # define globals for cards SUITS = ('C', 'S', 'H', 'D') RANKS = ('A', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K') VALUES = {'A':1, '2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9, 'T':10, 'J':10, 'Q':10, 'K':10} # define card class class Card: def __init__(self, suit, rank): if (suit in SUITS) and (rank in RANKS): self.suit = suit self.rank = rank else: self.suit = None self.rank = None print "Invalid card: ", suit, rank def __str__(self): return self.suit + self.rank def get_suit(self): return self.suit def get_rank(self): return self.rank def draw(self, canvas, pos): card_loc = (CARD_CENTER[0] + CARD_SIZE[0] * RANKS.index(self.rank), CARD_CENTER[1] + CARD_SIZE[1] * SUITS.index(self.suit)) canvas.draw_image(card_images, card_loc, CARD_SIZE, [pos[0] + CARD_CENTER[0], pos[1] + CARD_CENTER[1]], CARD_SIZE) # define hand class class Hand: def __init__(self):# create Hand object-the field for storing Card objects self.cardlist = list() def __str__(self):# return a string representation of a hand s = "Hand contains " for i in range(len(self.cardlist)): s += str(self.cardlist[i]) +" " return s def add_card(self, card):# add a card object to a hand self.cardlist.append(card) def get_value(self): key_of_cards = list() value_of_cards = list() for card in self.cardlist: cardkey = card.rank value_of_cards.append(VALUES[cardkey]) handvalue = sum(value_of_cards) #handvalue is the sum of card value with Aces as 1 for card in self.cardlist: cardkey = card.rank key_of_cards.append(cardkey) if 'A' not in key_of_cards: return handvalue else: if handvalue + 10 <=21: #count Aces as 1, if dont bust, add 10 to hand value return handvalue + 10 else: return handvalue def draw(self, canvas, pos): i = 0 for card in self.cardlist: card.draw(canvas,[pos[0]+(CARD_SIZE[0]+20)*i, pos[1]]) i += 1 # define deck class class Deck: def __init__(self): #create a Deck object-the field for storing a list of Card objects self.deckcards = list() for suit in SUITS: for rank in RANKS: self.deckcards.append(Card(suit,rank)) def shuffle(self):# shuffle the deck random.shuffle(self.deckcards) def deal_card(self):# deal a card object from the deck chopcard = self.deckcards[-1] self.deckcards.pop(-1) return chopcard def __str__(self):#return a string representing the deck s ="Deck contains " for i in range(len(self.deckcards)): s += str(self.deckcards[i]) +" " return s #define event handlers for buttons new_deck = Deck() player_hand = Hand() dealer_hand = Hand() def deal(): global outcome, in_play, new_deck, player_hand, dealer_hand, score, report report = "" #get rid of the reporting message for a new game if in_play == True: score -= 1 else: new_deck = Deck() #shuffle a new deck each time player_hand = Hand() #new hand cards for both player and dealer dealer_hand = Hand() new_deck.shuffle() p1 = new_deck.deal_card() p2 = new_deck.deal_card() d1 = new_deck.deal_card() d2 = new_deck.deal_card() player_hand.add_card(p1) player_hand.add_card(p2) dealer_hand.add_card(d1) dealer_hand.add_card(d2) print "player's cards are", p1, p2, '\n',"dealer's cards are", d1, d2,'\n', "the cards left in deck are", new_deck print "there are", len(new_deck.deckcards), "cards left" in_play = True outcome = "Hit or Stand?" def hit(): global in_play, outcome, score, report if in_play == True: # if the hand is in play, hit the player if player_hand.get_value() <= 21: p_extra = new_deck.deal_card() player_hand.add_card(p_extra) print "the player's value is", player_hand.get_value(),"now" if player_hand.get_value() > 21: print "You have busted" # if busted, assign a message to outcome, update in_play and score in_play = False outcome = "New deal?" report = "You lose!" score -= 1 def stand(): global outcome, in_play, score, report if player_hand.get_value > 21: print "the player have busted" in_play = False score -= 1 report = "You lose!" else: while dealer_hand.get_value() < 17: # if hand is in play, repeatedly hit dealer until his hand has value 17 or more d_extra = new_deck.deal_card() dealer_hand.add_card(d_extra) if dealer_hand.get_value() > 21: print " The dealer have busted" in_play = False score += 1 report = "You won!" else: if player_hand.get_value() <= dealer_hand.get_value(): print " The dealer won!" score -= 1 report = "You lose!" else: print "The player won!" score += 1 report = "You won!" in_play = False outcome = "New deal?" # assign a message to outcome, update in_play and score # draw handler def draw(canvas): global in_play player_hand.draw(canvas, [150, 350]) #to draw player's hand dealer_hand.draw(canvas, [150, 200]) #to draw dealer's hand canvas.draw_text(outcome, [220, 160], 30, 'Black') canvas.draw_text(report, [250, 520], 30, 'black') canvas.draw_text("Score:" + str(score), [450, 160], 30, 'black') canvas.draw_text("Blackjack", [200, 100], 50, 'lightblue') canvas.draw_text("Dealer", [30, 250], 30, "black") canvas.draw_text("Player", [30, 400], 30, "black") if in_play == True: #if in play, hide dealer's first card pos = [150, 200] card_loc = (CARD_CENTER[0], CARD_CENTER[1] ) canvas.draw_image(card_back, card_loc, CARD_SIZE, [pos[0] + CARD_CENTER[0], pos[1] + CARD_CENTER[1]], CARD_SIZE) # initialization frame frame = simplegui.create_frame("Blackjack", 600, 600) frame.set_canvas_background("Green") #create buttons and canvas callback frame.add_button("Deal", deal, 200) frame.add_button("Hit", hit, 200) frame.add_button("Stand", stand, 200) frame.set_draw_handler(draw) # get things rolling deal() frame.start() <file_sep>#"Guess the number" mini-project # helper function to start and restart the gamedef import random import simplegui #initialize global variables n_guess=7 guess_range=100 secret_number=-1 # define event handlers for control panel def range100(): global n_guess global guess_range global secret_number n_guess=7 guess_range=100 secret_number=random.randrange(0,100) print "New game. Range is from 0 to 100." print "Number of remaining guesses is", n_guess,"\n" return secret_number def range1000(): global n_guess global guess_range global secret_number n_guess=10 guess_range=1000 secret_number=random.randrange(0,1000) print "New game. Range is from 0 to 1000." print "Number of remaining guesses is", n_guess,"\n" return secret_number def input_guess(guess): global n_guess n_guess=n_guess-1 if (n_guess==0): print "You ran out of guesses!" print "The number was",secret_number,"\n" reset() else: global guess_number guess_number=int(guess) print "Guess was", guess_number print "Number of remaining guesses is",n_guess if (guess_number == secret_number): print "Correct!\n" reset() elif (guess_number < secret_number): print "Higher!\n" else: print "Lower!\n" #when the game ends, a new game with the same range as the last one begins def reset(): global guess_range if (guess_range==100): range100() else: range1000() # register event handlers for control elements and start frame import simplegui frame=simplegui.create_frame("guess_the_number",200,200) guess=frame.add_input("Please guess a number",input_guess,50) frame.add_button("Range0-100",range100,100) frame.add_button("Range0-1000",range1000,100) # new game begin in range [0,100) frame.start() range100() <file_sep>#Quiz 4b #which funciton must have global point declaration? point = [0, 0] def function1(): point[0] += 1 #doesn't have to do global declaration when change elements point[1] += 2 function1() print point def function2(): global point #has to do global declaration point = [50, 50] function2() print point print "========" #whether these three accomplish the same thing #1 a = range(5) def mutate(a): a[3] = 100 mutate(a) print a[3] #2 a = range(5) def mutate(b): a[3] = 100 mutate(a) print a[3] #3 a = range(5) def mutate(b): b[3] = 100 mutate(a) print a[3] print "========" #Do the point and rectangle ever overlap? import simplegui width = 300 hight = 200 radius=5 point_pos = [10,20] vel = [3, 0.7] def timer_hander(): point_pos[0] += vel[0] point_pos[1] += vel[1] def draw_handler(canvas):#!!!creat a time handler canvas.draw_circle(point_pos,radius, 2, "White") canvas.draw_polyline([(50, 50), (180, 50), (180, 140), (50,140)], 5, 'Red') canvas.draw_polyline([(50, 50), (50,140)], 5, 'Red') frame = simplegui.create_frame("point goes to rectangle", width, hight) frame.set_draw_handler(draw_handler) timer = simplegui.create_timer(100,timer_hander) frame.start() timer.start()#!!!start the timer! print "========" #change global variable by press key and release key import simplegui a = str(5) #!to draw on canvas, must convert to string first def keydown(key): global a a = str(int(a)*2)#convert to intiger for calculation and change back to string for drawing def keyup(key): global a a = str(int(a)-3) def draw(canvas): canvas.draw_text(a, [50,50], 20, "Red") frame=simplegui.create_frame("keypress", 100,100) frame.set_keydown_handler(keydown) frame.set_keyup_handler(keyup) frame.set_draw_handler(draw) frame.start() #Quiz 5a #Q9 mylist = [0, 1] for i in range(0, 40): mylist.append(sum([mylist[-1], mylist[-2]])) print mylist #Quiz 6a class BankAccount: def __init__(self, initial_balance): self.balance = initial_balance self.fee = 0 """Creates an account with the given balance.""" def deposit(self, amount): self.balance = self.balance + amount """Deposits the amount into the account.""" def withdraw(self, amount): self.balance = self.balance - amount if self.balance < 0: self.balance = self.balance - 5 self.fee = self.fee + 5 """ Withdraws the amount from the account. Each withdrawal resulting in a negative balance also deducts a penalty fee of 5 dollars from the balance. """ def get_balance(self): """Returns the current balance in the account.""" return self.balance def get_fees(self): """Returns the total fees ever deducted from the account.""" return self.fee account1 = BankAccount(10) account1.withdraw(15) account2 = BankAccount(15) account2.deposit(10) account1.deposit(20) account2.withdraw(20) print account1.get_balance(), account1.get_fees(), account2.get_balance(), account2.get_fees() #Quiz 6b #Q7 keep only prime number in the list n = 1000 numbers = range(2, n) result = [] while len(numbers) > 0: result.append(numbers[0]) numbers = [n for n in numbers if n % numbers[0] != 0] print len(result) #Q8 by which year fast worm outnumber slow worm def Wump(slow, fast): i = 1 while slow > fast: slow = slow*2 slow = slow *0.6 fast = fast *2 fast = fast *0.7 i = i+1 print "in year", i, "slow is:", slow, "fast is:", fast Wump(1000, 1) ########################################### #Quiz 7a #Q1 class Point2D: def __init__(self, x = 0, y = 0): self.x = x self.y = y def translate(self, deltax = 0, deltay = 0): """Translate the point in the x direction by deltax and in the y direction by deltay.""" self.x += deltax self.y += deltay point1 = Point2D(3, 9) point2 = Point2D() point2.translate(20, 4) #Q2 class Point2D: def __init__(self, x = 0, y = 0): self.x = x self.y = y def translate(self, deltax = 0, deltay = 0): """Translate the point in the x direction by deltax and in the y direction by deltay.""" self.x += deltax self.y += deltay point0 = Point2D(2, 5) point1 = Point2D(8, 3) point2 = Point2D(0, 2) points = [point0, point1, point2] for point in points: point.translate(-1, -1) ######################################## #Quiz 8 #Q8 How many distinct numbers are printed by the following code? Enter the count. '''def next(x): return (x ** 2 + 79) % 997 x = 1 for i in range(1000): print x x = next(x)''' def next(x): return (x ** 2 + 79) % 997 x = 1 s=set([]) for i in range(1000): #print x s.add(x) x = next(x) print len(s) <file_sep># "Stopwatch: The Game" #Import Medules import simplegui # Global state counter=0 interval=100 no_of_stops=0 stop_on_second=0 status=0 #Boolean variable that is 1 when stopwatch rnning and 0 when stopwatch stopped # define helper function format that converts time def format(t): global msecond minute = t//600 if minute >=1: second = (t-(t//600)*600)//10 else: second = t //10 msecond=t-minute*600-second*10 if second <= 9: return str(minute) + ":" + "0"+ str(second) +"." + str(msecond) else: return str(minute) + ":" + str(second) +"." + str(msecond) # define event handlers for buttons; "Start", "Stop", "Reset" def start (): global status status=1 timer.start() def stop (): global status, no_of_stops, stop_on_second if status ==1: status=0 #set status back to 0 so that futher hitting stop button does not change score when game stopped timer.stop() no_of_stops += 1 if msecond == 0: stop_on_second += 1 def reset (): global counter, no_of_stops, stop_on_second timer.stop() counter=0 status=0 no_of_stops=0 stop_on_second=0 # define event handler for timer with 0.1 sec interval def tick (): global counter counter += 1 #print counter # define draw handler def draw (canvas): canvas.draw_text(format(counter), (90, 110), 50, "Red") canvas.draw_text(str(stop_on_second)+"/"+ str(no_of_stops), (230, 30), 25, "Red") # create frame frame = simplegui.create_frame('stopwatch', 300, 200) # register event handlers timer = simplegui.create_timer(interval, tick) frame.set_draw_handler(draw) button1 = frame.add_button('Start', start) button2 = frame.add_button('Stop', stop) button3 = frame.add_button('Reset', reset) # start frame frame.start() <file_sep>#7.1 Write a program that prompts for a file name, then opens that file and reads through the file, and print the contents of the file in upper case. Use the file words.txt to produce the output below. #You can download the sample data at http://www.pythonlearn.com/code/words.txt #!!!to delete right space/new lines #!!!to upper case #fname = raw_input('Enter the file name:') #mydata = open(fname) #for line in mydata: #line = line.rstrip() #print line.upper() #7.2 #count lines starts with 'X-DSPAM-Confidence:' and extract the number following it #!!!convert charactor to float point #!!!creat new variable for new line and add to the old variabel (sum of the old lines) fname = raw_input('Enter the file name:') mydata = open(fname) counter = 0 mynum =0 for line in mydata: if line.startswith('X-DSPAM-Confidence:'): #print line counter = counter + 1 #print counter bf = line.find(':') #print bf newnum = line[bf+2:] mynum = float(mynum) + float(newnum) #print mynum #print counter #print mynum ave = mynum / counter print "Average spam confidence: ", ave #8.4 #read romeo.txt. for each line, split line into list. for each word on each line #check to see if the word is already in the list and if not append to the list. #when program completes, sort and print the resulting words. fname = raw_input('Enter file name:') mydata = open (fname) unique_words = list() for line in mydata: splitLine = line.split() for word in splitLine: if word not in unique_words: unique_words.append(word) unique_words.sort() print unique_words #8.5 # read mbox-short.txt by line. for lines starts with "From". split the line # and print out the second word. Then print out a count at the end. fname = raw_input('Enter file name:') mydata = open (fname) counter = 0 for line in mydata: line = line.rstrip() if not line.startswith('From '): continue counter = counter + 1 words = line.split() print words[1] print "There were", counter, "lines in the file with From as the first word" #9.4 read from mbox-short.txt and figure who has sent the greatest number # of mail messages (looks for "From" lines and takes the second word of those lines) fname = raw_input('Enter file name:') mydata = open (fname) emails = list() for line in mydata: line = line.rstrip() if not line.startswith('From '): continue words = line.split() emails.append(words[1]) #print emails countEmail = dict() for email in emails: countEmail[email] = countEmail.get(email,0) + 1 #print countEmail bigcount = None big_email_sender = None for email,count in countEmail.items(): if bigcount is None or count > bigcount: big_email_sender = email bigcount = count print big_email_sender, bigcount #10.2 Read the mbox-short.txt and figure out the distrubute #by hour of the day for each messages. once get the counts # for each hour, print out the counts, sorted by hour. fname = raw_input('Enter file name:') mydata = open (fname) hours = list() for line in mydata: line = line.rstrip() if not line.startswith('From '): continue words = line.split() time = words[5].split(':') hours.append(time[0]) #print hours counts = dict() for hour in hours: counts[hour] = counts.get(hour, 0) + 1 #print counts list_hour = list() for key, val in counts.items(): list_hour.append((key, val)) list_hour.sort() for key, val in list_hour: print key, val <file_sep>#"Memory" Game import simplegui import random numbers = [ ] exposed = [ ] index = 0 card_height = 100 card_width = 50 state = 0 card_fliped1 = 0 card_fliped2 = 0 turns = 0 # helper function to initialize globals def new_game(): global numbers, exposed, turns turns = 0 exposed = [ ] #generate number list for all 16 cards list1 = range(0,8) list2 = range(0,8) numbers = list1 + list2 random.shuffle(numbers) #set exposed list to False for all cards for number in numbers: exposed.append(False) # define event handlers def mouseclick(pos): global index, exposed, state, card_fliped1, card_fliped2, turns card_pos = list(pos) index = card_pos[0]/50 if exposed[index] == False: #only response to mouseclick when card is not exposed if state == 0: exposed[index] = True state = 1 card_fliped1 = index elif state == 1: exposed[index] = True turns = turns + 1 state = 2 card_fliped2 = index else: if not numbers[card_fliped1] == numbers[card_fliped2]: #if the two previous card unpair exposed[card_fliped1] = False #flip them over exposed[card_fliped2] = False exposed[index] = True card_fliped1 = index #reset the fliped card1 state = 1 # cards are logically 50x100 pixels in size def draw(canvas): global exposed, index, card_height, card_width label.set_text("Turns = " + str(turns)) #update the turns for index in range(0, 16): if exposed[index] == True: #exposed is True, the card should face up with value visible canvas.draw_text(str(numbers[index]), (index*card_width+10, 65), 50, "White") if exposed[index] == False: # exposed is False, the card should face down with value hidden canvas.draw_line([card_width*index, 0],[card_width*index, card_height], 5, 'Grey') canvas.draw_line([card_width*(index+1), 0], [card_width*(index+1), card_height], 5, 'Grey') canvas.draw_line([index*card_width + card_width/2, 0], [index*card_width + card_width/2, card_height], 46, 'Green') # create frame and add a button and labels frame = simplegui.create_frame("Memory", 800, 100) frame.add_button("Reset", new_game) label = frame.add_label('label') # register event handlers frame.set_mouseclick_handler(mouseclick) frame.set_draw_handler(draw) # get things rolling new_game() frame.start()
715222255839ffd60ed92624662e8d403f722034
[ "Python" ]
7
Python
usagainsttheworld/Python
d8a9722c4e6ee1534475c84be2b44bded32eb64f
7652e00698a30905b005f9be941383287b978267
refs/heads/master
<repo_name>ngunsu/config<file_sep>/install_ubuntu_18.04.sh #!/bin/bash # Install requirements sudo apt update sudo apt install -y curl fzy python3-pip silversearcher-ag sudo snap install node --classic sudo npm -g install neovim sudo apt install -y ruby-dev sudo gem install neovim # Install neovim sudo snap install nvim --classic # Install neovim plugins and config mkdir -p $HOME/.config/nvim ln -s $PWD/init.vim $HOME/.config/nvim/init.vim ln -s $PWD/coc-settings.json $HOME/.config/nvim/coc-settings.json curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim python3 -m pip install flake8 pynvim jedi # Install fonts git clone --depth 1 https://github.com/ryanoasis/nerd-fonts.git cd nerd-fonts chmod +x install.sh ./install.sh cd .. rm nerd-fonts # Install Plugs nvim +PlugInstall +qall ln -s $HOME/.config/nvim/plugged/tender.vim/colors $HOME/.config/nvim/colors nvim +'CocInstall -sync coc-python' +qall nvim +'CocInstall -sync coc-markdownlint' +qall nvim +'CocInstall -sync coc-html' +qall nvim +'CocInstall -sync coc-snippets' +qall # Link custom snippets mkdir -p /home/$USER/.config/coc/ultisnips ln -s $PWD/snippets/markdown.snippets /home/$USER/.config/coc/ultisnips/markdown.snippets # Install tmux sudo apt install tmux cd git clone https://github.com/gpakosz/.tmux.git ln -s -f .tmux/.tmux.conf cp .tmux/.tmux.conf.local . # Install zsh sudo apt install -y zsh sudo chsh -s $(which zsh) sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && echo 'export PATH=$PATH:~/.local/bin' >> $HOME/.zshrc <file_sep>/README.md # Neovim configuration and installer To install in ubuntu 18.04 ```bash ./install_ubuntu_18.04.sh ``` <file_sep>/install_big_sur.sh #!/bin/bash # Install requirements brew install fzy curl brew install nodejs brew install python3 alias python3="/usr/local/bin/python3" brew install ag brew install neovim npm -g install neovim # Install neovim brew install neovim # Install neovim plugins and config mkdir -p $HOME/.config/nvim ln -s $PWD/init.vim $HOME/.config/nvim/init.vim ln -s $PWD/coc-settings.json $HOME/.config/nvim/coc-settings.json curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim python3 -m pip install flake8 pynvim jedi nvim +PlugInstall +qall ln -s $HOME/.config/nvim/plugged/tender.vim/colors $HOME/.config/nvim/colors nvim +'CocInstall -sync coc-python' +qall nvim +'CocInstall -sync coc-markdownlint' +qall # Install tmux brew install tmux cd git clone https://github.com/gpakosz/.tmux.git ln -s -f .tmux/.tmux.conf cp .tmux/.tmux.conf.local . # Install zsh brew install zsh chsh -s $(which zsh) sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && echo 'export PATH=$PATH:~/.local/bin' >> $HOME/.zshrc <file_sep>/install_ubuntu_20.04.sh #!/bin/bash # Install requirements sudo apt update sudo apt install -y curl fzy python3-pip silversearcher-ag curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm nvm install 14.15.4 nvm use 14.15.4 sudo npm -g install neovim sudo apt install -y ruby-dev sudo gem install neovim # Install neovim sudo add-apt-repository ppa:neovim-ppa/stable sudo apt-get update sudo apt-get install -y neovim # Install neovim plugins and config mkdir -p $HOME/.config/nvim ln -s $PWD/init.vim $HOME/.config/nvim/init.vim ln -s $PWD/coc-settings.json $HOME/.config/nvim/coc-settings.json curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim python3 -m pip install flake8 pynvim jedi # Install fonts git clone --depth 1 https://github.com/ryanoasis/nerd-fonts.git cd nerd-fonts chmod +x install.sh ./install.sh cd .. rm nerd-fonts # Install Plugs nvim +PlugInstall +qall ln -s $HOME/.config/nvim/plugged/tender.vim/colors $HOME/.config/nvim/colors nvim +'CocInstall -sync coc-python' +qall nvim +'CocInstall -sync coc-markdownlint' +qall nvim +'CocInstall -sync coc-html' +qall nvim +'CocInstall -sync coc-snippets' +qall # Link custom snippets mkdir -p /home/$USER/.config/coc/ultisnips ln -s $PWD/snippets/markdown.snippets /home/$USER/.config/coc/ultisnips/markdown.snippets # Install tmux sudo apt install -y tmux cd git clone https://github.com/gpakosz/.tmux.git ln -s -f .tmux/.tmux.conf cp .tmux/.tmux.conf.local . # Install zsh sudo apt install -y zsh sudo chsh -s $(which zsh) sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && echo 'export PATH=$PATH:~/.local/bin' >> $HOME/.zshrc # Add nvm to zsh echo 'export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"' >> ~/.zshrc echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.zshrc
93cb456e9124a748e139ae254b3c559daf1886d4
[ "Markdown", "Shell" ]
4
Shell
ngunsu/config
3a6735f4236f43c538fc60e7f9192c31c27a1312
be2b973284a625cdb876cb27faebb222b4100fd6
refs/heads/master
<repo_name>carlcorsini/react-test-breakout<file_sep>/src/App.test.js import React from 'react' import { shallow } from 'enzyme' import App from './App' import Header from './Header' describe('App', () => { it('renders without crashing', () => { const wrapper = shallow(<App />) expect(wrapper.find('.App')).toHaveLength(1) expect(wrapper.find(Header)).toHaveLength(1) const header = wrapper.find(Header) expect(header.prop('href')).toBe('https://reactjs.org') }) }) describe('Header', () => { it('does the thing when we click the button', () => { const wrapper = shallow(<Header />) expect(wrapper.find('.clicky')).toHaveLength(1) expect(wrapper.find('.paragraphy')).toHaveLength(0) let button = wrapper.find('.clicky') button.simulate('click', e => { e.preventDefault() }) expect(wrapper.find('.paragraphy')).toHaveLength(1) }) it('does the other thing when we click the other button', () => { const wrapper = shallow(<Header />) expect(wrapper.find('.clicky-logo')).toHaveLength(1) expect(wrapper.find('.App-logo')).toHaveLength(0) let button = wrapper.find('.clicky-logo') button.simulate('click', e => { e.preventDefault() }) expect(wrapper.find('.App-logo')).toHaveLength(1) }) })
0077941e26243efd7012a0c053858f27903d1685
[ "JavaScript" ]
1
JavaScript
carlcorsini/react-test-breakout
51a002bd4b638e97866ea059e2ca5adbb7433f12
51d008ce78cb10ff1fba59bf65c1aeb59ba0de7f
refs/heads/main
<repo_name>cyber-physical-systems/cyber-physical-systems.github.io<file_sep>/contract.md --- title: '' feature_text: | Contact us feature_image: "https://picsum.photos/2560/600?image=873" excerpt: "Contact us" aside: true --- ### Contact form {% include site-form.html %} <file_sep>/people.md --- title: '' feature_text: | CPSLab Members feature_image: "https://picsum.photos/2560/600?image=873" excerpt: "CPSLab Members" aside: true --- ### Faculty - **<NAME>** Assistant Professor Knight Foundation School of Computing and Information Sciences Florida International University. ### Graduate Students - **<NAME>** Ph.D. student, SCIS, FIU, since Spring 2019 Master from Northeastern University, China - **<NAME>** Ph.D. student, SCIS, FIU, since Fall 2019 B.S. from Southeast University - **<NAME>** M.S. in CS, SCIS, FIU from: Beihang University first employment: Facebook - **<NAME>** M.S./Ph.D. student, SCIS, FIU - **<NAME>** M.S. student, FIU ### Undergraduate Students - **<NAME>** (2020) - **<NAME>** (2020) - **<NAME>** (2020) - **<NAME>** (2020, Now Ph.D. at George Mason University) - **<NAME>** (2019, FIU Honors College) - **<NAME>** (2018) - **<NAME>** (2018) - **<NAME>** (2018, Now master at Georgia Institute of Technology) <small>A small element</small> [A link](https://david.darn.es "A link") ### Button include {% include button.html text="A button" link="https://david.darn.es" %} {% include button.html text="A button with icon" link="https://twitter.com/daviddarnes" icon="twitter" %} ``` html {% raw %}{% include button.html text="A button" link="https://david.darn.es" %} {% include button.html text="A button with icon" link="https://twitter.com/daviddarnes" icon="twitter" %}{% endraw %} ``` ### Icon include {% include icon.html id="twitter" title="twitter" %} [{% include icon.html id="linkedin" title="twitter" %}](https://www.linkedin.com/in/daviddarnes) ``` html {% raw %}{% include icon.html id="twitter" title="twitter" %} [{% include icon.html id="linkedin" title="twitter" %}](https://www.linkedin.com/in/daviddarnes){% endraw %} ``` ### Video include {% include video.html id="zrkcGL5H3MU" title="Siteleaf tutorial video" %} ``` html {% raw %}{% include video.html id="zrkcGL5H3MU" title="Siteleaf tutorial video" %}{% endraw %} ``` ### Image includes {% include figure.html image="https://picsum.photos/600/800?image=894" caption="Image with caption" width="300" height="800" %} {% include figure.html image="https://picsum.photos/600/800?image=894" caption="Right aligned image" position="right" width="300" height="800" %} {% include figure.html image="https://picsum.photos/600/800?image=894" caption="Left aligned image" position="left" width="300" height="800" %} {% include figure.html image="https://picsum.photos/1600/800?image=894" alt="Image with just alt text" %} ``` html {% raw %}{% include figure.html image="https://picsum.photos/600/800?image=894" caption="Image with caption" width="300" height="800" %} {% include figure.html image="https://picsum.photos/600/800?image=894" caption="Right aligned image" position="right" width="300" height="800" %} {% include figure.html image="https://picsum.photos/600/800?image=894" caption="Left aligned image" position="left" width="300" height="800" %} {% include figure.html image="https://picsum.photos/1600/800?image=894" alt="Image with just alt text" %}{% endraw %} ``` <file_sep>/publications.md --- title: '' feature_text: | Publications feature_image: "https://picsum.photos/2560/600?image=873" excerpt: "Publications" aside: true --- ###### Note: <small>For the complete list of our publications, please check this page [https://scholar.google.com/citations?user=3-nlJyUAAAAJ&hl=en](https://scholar.google.com/citations?user=3-nlJyUAAAAJ&hl=en)</small> ###### Selected Conference Papers * <small>[SECON’21] BIoTA: Control-Aware Attack Analytics for Building Internet of Things. <NAME>, <NAME>, <NAME>, <NAME>. In Proc. of the 18th IEEE International Conference on Sensing, Communication and Networking (IEEE SECON 2021), July 6-9, Virtual Conference, 2021, USA. Acceptance Rate = 26.42%. </small> * <small>[IPSN’21] PrivacyGuard: Enhancing Smart Home User Privacy. <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>. In Proc. of the 20th ACM/IEEE International Conference on Information Processing in Sensor Networks, IPSN’21, May 18–21, 2021, Nashville, TN, USA. Acceptance Rate = 24.76%. (Source Code and Data) </small> * <small>[BuildSys’20] SolarTrader: Enabling Distributed Solar Energy Trading in Residential Virtual Power Plants. <NAME>, <NAME>, <NAME>, and <NAME>. In Proc. of the 7th ACM International Conference on Systems for Energy-Efficient Built Environments (BuildSys 2020), Acceptance Rate = 24.3%, November 18–20, 2020, Virtual Event, Japan. (Source Code and Data) The Best Paper Award at ACM BuildSys’20. </small> * <small>[IGSC’20] SolarDiagnostics: Automatic Rooftop Solar Photovoltaic Array Damage Detection. <NAME>, <NAME> and <NAME>. In Proc. of the Eleventh IEEE International Green and Sustainable Computing Conference, IGSC’20, Oct 19-22, Acceptance Rate = 23%. </small> * <small>[IPSN’20] SolarFinder: Automatic Detection of Solar Photovoltaic Arrays. <NAME>, <NAME>, <NAME> and <NAME>. In Proc. of the 19th ACM/IEEE International Conference on Information Processing in Sensor Networks, IPSN’20, April 21-24, 2020, Sydney, Australia, Acceptance Rate = 21.33%. </small> * <small>[Milcom’19] IoTSpot: Identifying the IoT Devices Using Their Anonymous Network Traffic Data. <NAME>, <NAME>, <NAME>, and <NAME>. In Proc. of the 38th IEEE Military Communications Conference, MILCOM 2019, November 12-14, 2019, Norfolk, VA. </small> * <small>[MASS’19] Solar-TK: A Data-driven Toolkit for Solar PV Performance Modeling and Forecasting. <NAME>, <NAME>, <NAME>, and <NAME>. In Proc. of the 16th IEEE International Conference on Mobile Ad-Hoc and Smart Systems, November 4-7, 2019, Monterey, CA, USA. </small> * <small>[BuildSys’18] Staring at the Sun: A Physical Black-box Solar Performance Model. <NAME>, <NAME>, <NAME>. In Proc. of the 2018 ACM International Conference on Systems for Energy-Efficient Built Environments (BuildSys’18), November 07 – 08, 2018. Acceptance rate: 24.19%. </small> * <small>[ICDCS’18] Private Memoirs of IoT Devices: Safeguarding User Privacy in the IoT Era. <NAME>, <NAME>, <NAME> and <NAME>. In Proc. of the 38th IEEE International Conference on Distributed Computing Systems (ICDCS’18), July 2 – 5, 2018, Vienna, Austria. </small> * <small>[BigData’17] Weatherman: Exposing Weather-based Privacy Threats in Big Energy Data. <NAME>, <NAME>. In Proceedings of 2017 IEEE International Conference on Big Data (BigData’17), Boston, MA, USA, Dec 11-14, 2017. Accept Rate = 87/437 = 20%. </small> * <small>[eEnergy’17] SunDance: Black-box Behind-the-Meter Solar Disaggregation. <NAME>, <NAME>. In Proceedings of the eighth ACM International Conference on Future Energy Systems (e-Energy’17), Hongkong, 2017. Acceptance ratio = 26.7%. </small> * <small>[Greenmetrics’17] Black-box Solar Performance Modeling: Comparing Physical, Machine Learning, and Hybrid Approaches. <NAME>, <NAME>. In Proceedings of 2017 ACM Greenmetrics (Greenmetrics’17), Urbana-Champaign, IL, USA, June 6, 2017. Re-published: Performance Evaluation Review, Vol. 45, No. 2, September 2017. </small> * <small>[BuildSys’16] SunSpot: Exposing the Location of Anonymous Solar-powered Homes. <NAME>, <NAME>, <NAME>, <NAME>. In Proceedings of the 2016 ACM International Conference on Systems for Energy-Efficient Built Environments (BuildSys’16), Stanford, CA, USA, 2016. Accept Rate = 24.48%. </small> * <small>[SmartGridComm’16] SmartSim: A Device-Accurate Smart Home Simulator for Energy Analytics. <NAME>, <NAME>, <NAME>. In Proceedings of the 2016 IEEE International Conference on Smart Grid Communications (SmartGridComm’16), Sydney, Australia, 2016. </small> * <small>[Percom’14] Combined Heat and Privacy: Preventing Occupancy Detection from Smart Meters. <NAME>, <NAME>, <NAME>, <NAME>. In Proceedings of the 12th IEEE International Conference on Pervasive Computing and Communications (Percom’14), Budapest, Hungary, 2014. Acceptance rate = 14%. </small> * <small>[BuildSys’13] Non-Intrusive Occupancy Monitoring using Smart Meters. <NAME>, <NAME>, <NAME>, <NAME>, <NAME>. In Proceedings of the Fifth ACM Workshop On Embedded Sensing Systems For Energy-Efficiency In Buildings (BuildSys’13), Roma, Italy, November 11-15, 2013. Accept Ratio = 39%. </small> * <small>[ICGEC’11] A novel secure architecture for the Internet of Things. <NAME>, <NAME>. In Proceedings of 2011 Fifth International Conference on Genetic and Evolutionary Computing, pages: 311-314. </small> <file_sep>/index.md --- title: '' feature_text: | The Cyber-Physical Systems Laboratory (CPSLab) conducts research at the intersection of distributed computation, energy, security and privacy, and control of Cyber-Physical Systems. We investigate the performance modeling, data analysis, system security and privacy, and control of Cyber-Physical Systems. feature_image: "https://picsum.photos/1300/400?image=989" --- <!--- (Alembic is a starting point for [Jekyll](https://jekyllrb.com/) projects. Rather than starting from scratch, this boilerplate is designed to get rolling immediately. Install it, configure it, tweak it, push it. ---> ### News - <small>04/2020 Dr. Chen is invited to serve on Organizing Committee (Publication Chair) for **[ACM BuildSys’21](http://buildsys.acm.org/2021/)**, please consider submitting!</small> - <small> 03/2021 Dr. Chen attended **[ASEE](https://www.asee.org/)** (American Society for Engineering Education) DELTA Junior Faculty Institute.</small> - <small> 03/2021 Dr. Chen serves as TPC member for **[MASS’21](https://eng.auburn.edu/conference/ieee-mass2021/)**, please consider submitting!</small> - <small> 03/2021 Dr. Chen serves as Guest Editor on Security, Privacy, and Multimodal Data Analysis for Social Media Call For Papers, please consider submitting!</small> - <small> 01/2021 IoT device privacy paper will appear at **[ACM/IEEE IPSN’21](https://ipsn.acm.org/2021/index.html)** (Acceptance Rate: 24.76%), part of **[CPS-IoT Week 2021](https://cps-iot-week2021.isis.vanderbilt.edu/)**.</small> - <small> 12/2020 Dr. Chen serves as TPC member (Track: Distributed Operating Systems and Middleware) for **[ICDCS’21](https://icdcs2021.us/)**, please consider submitting!</small> - <small> 12/2020 Congratulations to Qi for receiving 2020 SCIS Annual Best Research Student Award!</small> - <small> 11/2020 SolarTrader paper won the **Best Paper Award** at **[ACM BuildSys’20](http://buildsys.acm.org/2020/)**.</small> - <small> 10/2020 Dr Chen received CERTIFICATE OF APPRECIATION from IGSC Steering Committee.</small> - <small> 10/2020 PhD student (Qi) received **IGSC’20** participating grant to present our SolarDiagnostics work.</small> - <small> 09/2020 SolarTrader paper accepted at **BuildSys’20** (Regular Paper Acceptance Rate: 24%).</small> - <small> 08/2020 SolarDiagnostics paper accepted at **IGSC’20** (Acceptance Rate: 23%).</small> - <small> 08/2020 Dr Chen serves as TPC member for **IoTDI’21**, part of **CPS-IoT Week 2021**, please consider submitting!</small> - <small> 06/2020 Dr Chen organizes **BigDataCPS’20**, please consider submitting!</small> - <small> 05/2020 Dr Chen serves as TPC member for **BuildSys’20**, please consider submitting!</small> - <small> 05/2020 Dr Chen serves as TPC member for **MASS’20**, please consider submitting!</small> - <small> 04/2020 Dr Chen serves as TPC member for **IGSC’20**, please consider submitting!</small> - <small> 04/2020 Dr Chen serves as TPC member for **BigData’20**, Atlanta, please consider submitting!</small> - <small> 04/2020 Two PhD students: Qi has passed her Ph.D. qualifying exams.</small> - <small> 04/2020 IoT security research: “Online Learning and Visualization for Intrusion Detection and Prevention in Privacy-Enhanced IoT Networks” is funded by **Cyber Florida Collaborative Seed Program**.</small> - <small> 03/2020 SolarFinder source code and data are released on **CPS GitHub**.</small> - <small> 01/2020 SolarFinder paper accepted at **ACM & IEEE IPSN’20** (Acceptance Rate: 22.13%), part of CPS-IoT Week 2020.</small> - <small> 10/2019 Dr Chen received Appreciation Certificate from IGSC Steering Committee.</small> - <small> 09/2019 Dr Chen organizes **CPSBigData'19** Workshop.</small> - <small> 08/2019 Solar-TK paper is accepted at (the 16th) **MASS'19**.</small> - <small> 08/2019 IoT device identification paper is accepted at (the 38th) **MilCom'19**.</small> - <small> 06/2019 Dr Chen serves as TPC member for **AIChallengeIoT'19**, New York.</small> - <small> 04/2019 Dr Chen serves as **Keynote Speaker** at **Cybersecurity in Florida Public Transportation Workshop**.</small> - <small> 04/2019 Dr Chen attends NSF CISE Career Workshop with travel grant.</small> - <small> 04/2019 Dr Chen serves as TPC member for **IEEE AICCSA’19**, Abu Dhabi, UAE.</small> - <small> 03/2019 Dr Chen serves as TPC member for **IEEE BigData’19**, Los Angeles, USA.</small> - <small> 01/2019 Smart Building Image Processing Project is funded by **Google Cloud** $9,976.</small> - <small> 10/2018 Dr Chen attends Sustainable Research Pathways (SRP) Workshop, **Lawrence Berkeley National Laboratory**.</small> - <small> 09/2018 Sun paper is accepted to **ACM BuildSys’18** (Acceptance Rate: 24.19%)</small> - <small> 08/2018 Dr Chen joins **FIU SCIS** as tenure-track **Assistant Professor**.</small> <file_sep>/projects.md - **SolarTrader: Enabling Distributed Solar Energy Trading in Residential Virtual Power PlantsSolar.** <small>Distributed solar energy resources (DSERs) in smart grid are rapidly increasing due to the steep decline in solar module prices. is DSERs penetration has been playing pressure on the utilities to balance electricity’s real-time supply and demand. Recently, there is a rising interest to develop a cost-effective approach virtual power plants (VPPs) that enable solar generated energy trading to mitigate the impacts of the internment distributed DSERs and take advantage of distributed generation from DSERs for more reliable and profitable grid management. However, the existing trading approaches in residential VPPs do not actually allow DSER users to trade their surplus solar energy concurrently to achieve their maximum benefits, and typically require a trusted third-party to play the role of middleman online. In addition, due to a lack of fair trading algorithms, these approaches do not necessarily result in “fair” solar energy saving among all the VPP users for long term. </small> <small>To address these problems, we design a new solar energy trading system – SolarTrader that enables unsupervised, distributed, and long term fair solar energy trading in residential VPPs. In essence, SolarTrader leverages a new multiple-agent deep reinforcement learning approach that enables Peer-to-Peer solar energy trading among different DSERs to ensure both the DSER users and the VPPs to achieve maximum benefits equally and simultaneously. We implement our SolarTrader and evaluate it using both synthetic and real smart meter data from 4 U.S. residential VPP communities that are comprised of ∼229 residential DSERs in total. Our results show that SolarTrader can reduce the aggregated VPP energy consumption by 83.8% than the non-trading approach. In addition, we show that SolarTrader achieves ∼105% average saving in VPP residents’ monthly electricity cost. We also nd that SolarTrader— enabled VPPs can achieve a Gini Coecient (a standard measure of an approach’s fairness performance) as 0.05, which is the same as the best fairness Round-Robin approach. We will release all the datasets and source code of SolarTrader to the research community. </small> - **SolarFinder: Automatic Detection of Solar Photovoltaic Arrays.** <small>Smart cities, utilities, third-parties, and government agencies are having pressure on managing stochastic power generation from distributed rooftop solar photovoltaic arrays, such as accurately predicting solar generation capacity and react to the variations in the electric grid. Recently, there is a rising interest in automatically collecting solar installation information that are critical to manage this stochastic solar generation. Given a geospatial region, the information may include the quantity and locations of solar deployments within the region, and also the profiling information for each deployment such as orientation, size, inverter inefficiency, etc. Traditional approaches such as online assessment and utilities interconnection filings are time-consuming and costly, and also limited in geospatial resolution and thus do not scale up to every location. Significant recent work focuses on using aerial imagery to train machine learning or deep learning models to automatically detect solar arrays. Unfortunately, these approaches all require training data that includes Very High Resolution (VHR) images and human handcrafted image templates, which have a minimum cost of \$15 per km^2 and are not always available at every location. </small> <small>To address the problem, we design a new system—SolarFinder that can automatically detect distributed solar photovoltaic arrays in a given geospatial region without any extra cost. SolarFinder first automatically fetches low or regular resolution satellite images within the region using publicly-available maps APIs. Then, SolarFinder leverages multi-dimensional K-means algorithm to automatically segment solar arrays on rooftop images. Eventually, SolarFinder employs hybrid linear regression approach that integrates support vectors machine (SVMs-RBF) modeling with a deep convolutional neural network (CNN) approach to accurately identify rooftop solar arrays and also learn the detailed installation information for each solar array simultaneously. We evaluate SolarFinder using 41,683 public satellite images that include 180,833 contours from 11 geospatial regions in the U.S. We find that pre-trained (or unsupervised) SolarFinder yields a MCC of 0.17, which is 3 times better than the most recent pre-trained CNN approach and is the same as a supervised CNN approach. </small> - **IoTSpot: Identifying the IoT Devices Using their Anonymous Network Traffic Data.** <small>The Internet of Things (IoT) has been erupting the world widely over the decade. Smart homeowners and smart building managers are increasingly deploying IoT devices to monitor and control their environments due to the rapid decline in the price of IoT devices. The network traffic data produced by these IoT devices are collected by Internet Service Providers (ISPs) and telecom providers, and often shared with third-parties to maintain and promote user services. Such network traffic data is considered “anonymous” if it is not associated with identifying device information, e.g., MAC address and DHCP negotiation. Extensive prior work has shown that IoT devices are vulnerable to multiple cyber attacks. However, people do not believe that these attacks can be launched successfully without the knowledge of what IoT devices are deployed in their houses. Our key insight is that the network traffic data is not anonymous: IoT devices have unique network traffic patterns, and they embedded detailed device information. To explore the severity and extent of this privacy threat, we design IoTSpot to identify the IoT devices using their “anonymous” network traffic data. We evaluate IoTSpot on publicly-available network traffic data from 3 homes. We find that IoTSpot is able to identify 19 IoT devices with F1 accuracy of 0.984. More importantly, our approach only requires very limited data for training, as few as 40 minutes. IoTSpot paves the way for operators of smart homes and smart buildings to monitor the functionality, security and privacy threat without requiring any additional devices. </small> - **Preventing Occupancy Detection from Smart Meters** <small>Utilities are rapidly deploying smart meters that measure electricity usage in real-time. Unfortunately, smart meters indirectly leak sensitive information about a home’s occupancy, which is easy to detect because it highly correlates with simple statistical metrics, such as power’s mean, variance and range. To prevent occupancy detection, we propose using the thermal energy storage of electric water heaters already present in many homes. In essence, our approach, which we call combined heat and privacy (CHPr), modulates a water heater’s power usage to make it look like someone is always home. We design a CHPr-enabled water heater that regulates its energy usage to thwart a variety of occupancy detection attacks without violating its objective to provide hot water on demand and evaluate it in simulation using real data. Our results show that a standard 50-gal CHPr-enabled water heater prevents a wide range of state-of-the-art occupancy detection attacks. </small> - **Weatherman: Exposing Weather-Based Privacy Threats in Big Energy Data.** <small>Smart energy meters record electricity consumption and generation at fine-grained intervals and are among the most widely deployed sensors in the world. Energy data embeds detailed information about a building’s energy-efficiency, as well as the behavior of its occupants, which academia and industry are actively working to extract. In many cases, either inadvertently or by design, these third-parties only have access to anonymous energy data without an associated location. We present Weatherman, which leverages a suite of analytics techniques to localize the source of anonymous energy data. Our key insight is that energy consumption data, as well as wind and solar generation data, largely correlates with weather, e.g., temperature, wind speed, and cloud cover and that every location on Earth has a distinct weather signature that uniquely identifies it. Weatherman represents a serious privacy threat, but also a potentially useful tool for researchers working with anonymous smart meter data. We evaluate Weatherman’s potential in both areas by localizing data from over one hundred smart meters using a weather database that includes data from over 35,000 locations. </small> - **SunSpot: Exposing the Location of Anonymous Solar-Powered Homes.** <small>Homeowners are increasingly deploying grid-tied solar systems due to the rapid decline in solar module prices. The energy produced by these solar-powered homes is monitored by utilities and third parties using networked energy meters, which record and transmit energy data at fine-grained intervals. Such energy data is considered anonymous if it is not associated with identifying account information, e.g., a name and address. Thus, energy data from these “anonymous” homes are often not handled securely: it is routinely transmitted over the Internet in plaintext, stored unencrypted in the cloud, shared with third-party energy analytics companies, and even made publicly available over the Internet. Extensive prior work has shown that energy consumption data is vulnerable to multiple attacks, which analyze it to reveal a range of sensitive private information about occupant activities. However, these attacks are useless without knowledge of a home’s location. Our key insight is that solar energy data is not anonymous: since every location on Earth has a unique solar signature, it embeds detailed location information. To explore the severity and extent of this privacy threat, we design SunSpot to localize “anonymous” solar-powered homes using their solar energy data. We evaluate SunSpot on publicly available energy data from 14 homes with rooftop solar. We find that SunSpot can localize a solar-powered home to a small region of interest that is near the smallest possible area given the energy data resolution, e.g., within a ∼500m and ∼28km radius for per-second and per-minute resolution, respectively. SunSpot then identifies solar-powered homes within this region using crowd-sourced image processing of satellite data before applying additional filters to identify a specific home. </small> <file_sep>/alembic-jekyll-theme.gemspec # coding: utf-8 Gem::Specification.new do |spec| spec.name = "alembic-jekyll-theme" spec.version = "4.1.0" spec.authors = ["<NAME>"] spec.email = ["<EMAIL>"] spec.summary = %q{A Jekyll boilerplate theme designed to be a starting point for any Jekyll website.} spec.description = "CPSLab aims to build data-driven experimental computer systems to make Cyber-Physical Systems (CPS) more energy-efficient and more secure. I have been looking into multiple CPS research problems, such as system sustainability, data privacy, and system security in CPS at different scales, such as the IoT and Edge Computing devices, smart homes and buildings, renewable energy systems, smart grids, and smart cities." spec.homepage = "https://dongchen0523.github.io/" spec.license = "MIT" spec.metadata["plugin_type"] = "theme" spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r{^(assets|_layouts|_includes|_sass|LICENSE|README|sw|manifest)}i) } spec.add_runtime_dependency "jekyll", "~> 4.1" spec.add_runtime_dependency "jekyll-sitemap", "~> 1.4.0" spec.add_runtime_dependency "jekyll-mentions", "~> 1.6.0" spec.add_runtime_dependency "jekyll-paginate", "~> 1.1.0" spec.add_runtime_dependency "jekyll-seo-tag", "~> 2.6.1" spec.add_runtime_dependency "jekyll-redirect-from", "~> 0.16" spec.add_runtime_dependency "jekyll-feed", "~> 0.15" spec.add_runtime_dependency "jekyll-commonmark", "~> 1.3.1" spec.add_runtime_dependency "jekyll-include-cache", "~> 0.2" spec.add_runtime_dependency "jemoji", "~> 0.12" end
4d2de5c03f262c32b7eb98a66c7140b5c1108754
[ "Markdown", "Ruby" ]
6
Markdown
cyber-physical-systems/cyber-physical-systems.github.io
ee6b16a38677254c025aa8b2bc75c983377bd48f
19a58eaf7297229c76c383d37a75feb302fdf9ca
refs/heads/master
<repo_name>slamdev/crossover-showcase<file_sep>/service/src/main/java/com/dev/service/boundary/BaseEndpoint.java package com.dev.service.boundary; import static java.util.stream.Collectors.toList; import static org.springframework.web.bind.annotation.RequestMethod.DELETE; import static org.springframework.web.bind.annotation.RequestMethod.GET; import static org.springframework.web.bind.annotation.RequestMethod.POST; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import com.dev.rest.model.BaseDto; import com.dev.rest.model.Reference; import com.dev.service.entity.BaseEntity; public abstract class BaseEndpoint<ENTITY extends BaseEntity, DETAILS extends BaseDto, ROW extends BaseDto> { @RequestMapping(value = "{code}", method = DELETE) public void delete(@PathVariable String code) { getRepository().delete(code); } @RequestMapping(value = "{code}", method = GET) public DETAILS get(@PathVariable String code) { return convertToDetails(getRepository().getOne(code)); } @RequestMapping(value = "", method = GET) public List<ROW> getAll() { return getRepository().findAll().stream().map(this::convertToRow).collect(toList()); } @RequestMapping(value = "references", method = GET) public List<Reference> getAllReferences() { return getRepository().findAll().stream().map(this::reference).collect(toList()); } @RequestMapping(value = "", method = POST) public DETAILS save(@RequestBody DETAILS dto) { return convertToDetails(getRepository().saveAndFlush(convertToEntity(dto))); } protected abstract DETAILS convertToDetails(ENTITY entity); protected abstract ENTITY convertToEntity(DETAILS dto); protected abstract ROW convertToRow(ENTITY entity); protected abstract JpaRepository<ENTITY, String> getRepository(); protected abstract Reference reference(ENTITY entity); }<file_sep>/service/src/main/java/com/dev/service/entity/SalesOrder.java package com.dev.service.entity; import static java.lang.String.format; import java.util.HashSet; import java.util.Set; import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.OneToOne; import javax.validation.constraints.NotNull; import org.hibernate.validator.constraints.NotEmpty; @Entity public class SalesOrder extends BaseEntity { private static final long serialVersionUID = 2356639092459704148L; @NotNull @OneToOne private Customer customer; @ElementCollection @NotEmpty private Set<OrderedProduct> orderedProducts; public SalesOrder() { orderedProducts = new HashSet<>(); } public Customer getCustomer() { return customer; } public Set<OrderedProduct> getOrderedProducts() { return orderedProducts; } public void setCustomer(Customer customer) { this.customer = customer; } public void setOrderedProducts(Set<OrderedProduct> orderedProducts) { this.orderedProducts = orderedProducts; } @Override public String toString() { return super.toString() + format(" | customer=%s | products=%s", customer, orderedProducts); } } <file_sep>/rest-api/src/main/java/com/dev/rest/model/ProductRow.java package com.dev.rest.model; public class ProductRow extends ProductDetails { private static final long serialVersionUID = 3152509851530574737L; } <file_sep>/service/src/main/java/com/dev/service/boundary/SalesOrdersEndpoint.java package com.dev.service.boundary; import static java.util.stream.Collectors.toSet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.dev.rest.model.Reference; import com.dev.rest.model.SalesOrderDetails; import com.dev.rest.model.SalesOrderDetails.OrderedProductDetails; import com.dev.rest.model.SalesOrderRow; import com.dev.service.entity.OrderedProduct; import com.dev.service.entity.SalesOrder; @RestController @RequestMapping("orders") public class SalesOrdersEndpoint extends BaseEndpoint<SalesOrder, SalesOrderDetails, SalesOrderRow> { @Autowired private CustomerRepository customers; @Autowired private SalesOrderRepository orders; @Autowired private ProductRepository products; @Autowired private OrderService service; @Override public SalesOrderDetails save(@RequestBody SalesOrderDetails dto) { SalesOrder entity = convertToEntity(dto); entity = service.process(entity); return convertToDetails(entity); } @Override protected SalesOrderDetails convertToDetails(SalesOrder entity) { SalesOrderDetails details = new SalesOrderDetails(); details.setCode(entity.getCode()); details.setCustomerCode(entity.getCustomer().getCode()); details.setTotal(service.calculateTotalOrderPrice(entity)); details.setOrderedProductsDetails( entity.getOrderedProducts().stream().map(this::convertToOrderedProductDetails).collect(toSet())); return details; } @Override protected SalesOrder convertToEntity(SalesOrderDetails details) { SalesOrder entity = new SalesOrder(); entity.setCode(details.getCode()); entity.setCustomer(customers.getOne(details.getCustomerCode())); entity.setOrderedProducts( details.getOrderedProductsDetails().stream().map(this::convertToOrderedProduct).collect(toSet())); return entity; } @Override protected SalesOrderRow convertToRow(SalesOrder entity) { SalesOrderRow row = new SalesOrderRow(); row.setCode(entity.getCode()); row.setCustomerName(entity.getCustomer().getName()); row.setTotalPrice(service.calculateTotalOrderPrice(entity)); return row; } @Override protected JpaRepository<SalesOrder, String> getRepository() { return orders; } @Override protected Reference reference(SalesOrder entity) { throw new UnsupportedOperationException(); } private OrderedProduct convertToOrderedProduct(OrderedProductDetails details) { OrderedProduct entity = new OrderedProduct(); entity.setProduct(products.getOne(details.getProductCode())); entity.setQuantity(details.getQuantity()); return entity; } private OrderedProductDetails convertToOrderedProductDetails(OrderedProduct entity) { OrderedProductDetails details = new OrderedProductDetails(); details.setProductCode(entity.getProduct().getCode()); details.setQuantity(entity.getQuantity()); details.setPrice(entity.getProduct().getPrice()); details.setTotal(service.calculateTotalProductPrice(entity)); return details; } }<file_sep>/frontend/src/main/java/com/dev/frontend/panels/Main.java package com.dev.frontend.panels; import java.awt.CardLayout; import java.awt.Component; import java.awt.EventQueue; import java.util.HashMap; import javax.swing.JFrame; import javax.swing.JPanel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.builder.SpringApplicationBuilder; import com.dev.frontend.panels.edit.EditContainer; import com.dev.frontend.panels.edit.EditCustomer; import com.dev.frontend.panels.edit.EditProduct; import com.dev.frontend.panels.edit.EditSalesOrder; import com.dev.frontend.panels.list.CustomerDataModel; import com.dev.frontend.panels.list.ListContentPanel; import com.dev.frontend.panels.list.ProductDataModel; import com.dev.frontend.panels.list.SalesOrderDataModel; public class Main implements PanelSwitcher, CommandLineRunner { private static final Logger LOGGER = LoggerFactory.getLogger(Main.class); public static void main(String[] args) { new SpringApplicationBuilder(Main.class).headless(false).run(args); } private HashMap<String, HasBusinessPresenter> containersMap = new HashMap<>(); private JFrame frame; private JPanel panel; @Override public HasBusinessPresenter getPanelOfClass(String name) { return containersMap.get(name); } @Override public void run(String... args) { initialize(); EventQueue.invokeLater(() -> { try { MenuPanel menuPanel = new MenuPanel(this); panel.add(menuPanel, MenuPanel.class.getName()); EditContainer productContainer = new EditContainer(new EditProduct(), this); EditContainer customerContainer = new EditContainer(new EditCustomer(), this); EditContainer salesOrderContainer = new EditContainer(new EditSalesOrder(), this); addPanel(productContainer, EditProduct.class.getName()); addPanel(customerContainer, EditCustomer.class.getName()); addPanel(salesOrderContainer, EditSalesOrder.class.getName()); addPanel(new ListContentPanel(this, new CustomerDataModel()), CustomerDataModel.class.getName()); addPanel(new ListContentPanel(this, new ProductDataModel()), ProductDataModel.class.getName()); addPanel(new ListContentPanel(this, new SalesOrderDataModel()), SalesOrderDataModel.class.getName()); frame.setVisible(true); } catch (Exception e) { LOGGER.error("", e); } }); } @Override public void switchTo(String name) { CardLayout layout = (CardLayout) panel.getLayout(); HasBusinessPresenter container = getPanelOfClass(name); if (container != null) { container.getBusinessPresenter().clear(); container.getBusinessPresenter().onInit(); } layout.show(panel, name); } void addPanel(HasBusinessPresenter container, String name) { containersMap.put(name, container); panel.add((Component) container, name); } private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 500); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); panel = new JPanel(new CardLayout()); frame.add(panel); } } <file_sep>/frontend/src/main/java/com/dev/frontend/panels/list/SalesOrderDataModel.java package com.dev.frontend.panels.list; import java.util.List; import com.dev.frontend.services.Services; import com.dev.rest.model.SalesOrderRow; public class SalesOrderDataModel extends ListDataModel { private static final long serialVersionUID = 7526529951747614655L; private static String[] toTable(Object object) { SalesOrderRow row = (SalesOrderRow) object; return new String[] { row.getCode(), row.getCustomerName(), Double.toString(row.getTotalPrice()) }; } public SalesOrderDataModel() { super(new String[] { "Order Number", "Customer", "Total Price" }, 0); } @Override public String[][] convertRecordsListToTableModel(List<Object> list) { return list.stream().map(SalesOrderDataModel::toTable).toArray(String[][]::new); } @Override public int getObjectType() { return Services.TYPE_SALESORDER; } } <file_sep>/service/src/main/java/com/dev/service/Application.java package com.dev.service; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import com.dev.service.boundary.CustomerRepository; import com.dev.service.boundary.ProductRepository; import com.dev.service.boundary.SalesOrderRepository; import com.dev.service.entity.Customer; import com.dev.service.entity.OrderedProduct; import com.dev.service.entity.Product; import com.dev.service.entity.SalesOrder; @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Autowired private CustomerRepository customerRepository; @Autowired private ProductRepository productRepository; @Autowired private SalesOrderRepository salesOrderRepository; @PostConstruct public void initData() { List<Product> products = new ArrayList<>(); // Product p1 = new Product(); p1.setCode("dog"); p1.setDescirption("strong dog"); p1.setPrice(10); p1.setQuantity(4); products.add(p1); // Product p2 = new Product(); p2.setCode("cat"); p2.setDescirption("small dog"); p2.setPrice(5.5f); p2.setQuantity(8); products.add(p2); // Product p3 = new Product(); p3.setCode("toy"); p3.setDescirption("big toy"); p3.setPrice(1); p3.setQuantity(50); products.add(p3); // Product p4 = new Product(); p4.setCode("milk"); p4.setDescirption("white milk"); p4.setPrice(2); p4.setQuantity(40); products.add(p4); // productRepository.save(products); /// List<Customer> customers = new ArrayList<>(); // Customer c1 = new Customer(); c1.setAddress("USA"); c1.setCode("slam"); c1.setCreditLmit(50); c1.setName("Slam"); c1.setPhone1("+79279829722"); c1.setPhone2("546768"); customers.add(c1); // Customer c2 = new Customer(); c2.setAddress("Russia"); c2.setCode("ilya"); c2.setCreditLmit(45); c2.setName("Ilya"); c2.setPhone1("+79170245459"); c2.setPhone2("217200"); customers.add(c2); // customerRepository.save(customers); /// List<SalesOrder> orders = new ArrayList<>(); // SalesOrder o1 = new SalesOrder(); o1.setCustomer(c1); o1.setCode("1"); Set<OrderedProduct> ops1 = new HashSet<>(); OrderedProduct op1 = new OrderedProduct(); op1.setProduct(p1); op1.setQuantity(2); ops1.add(op1); OrderedProduct op2 = new OrderedProduct(); op2.setProduct(p2); op2.setQuantity(4); ops1.add(op2); o1.setOrderedProducts(ops1); orders.add(o1); // SalesOrder o2 = new SalesOrder(); o2.setCustomer(c2); o2.setCode("2"); Set<OrderedProduct> ops2 = new HashSet<>(); OrderedProduct op3 = new OrderedProduct(); op3.setProduct(p3); op3.setQuantity(1); ops2.add(op3); OrderedProduct op4 = new OrderedProduct(); op4.setProduct(p4); op4.setQuantity(15); ops2.add(op4); o2.setOrderedProducts(ops2); orders.add(o2); // salesOrderRepository.save(orders); } } <file_sep>/frontend/src/main/java/com/dev/frontend/services/CustomersService.java package com.dev.frontend.services; import com.dev.rest.model.CustomerDetails; import com.dev.rest.model.CustomerRow; public class CustomersService extends BaseService { private static final String ENDPOINT = "customers"; @Override protected Class<CustomerDetails> detailsType() { return CustomerDetails.class; } @Override protected String endpoint() { return ENDPOINT; } @Override protected Class<CustomerRow> rowType() { return CustomerRow.class; } } <file_sep>/frontend/src/main/java/com/dev/frontend/services/Services.java package com.dev.frontend.services; import java.util.List; import com.dev.frontend.panels.ComboBoxItem; import com.dev.rest.model.BaseDto; public class Services { public static final int TYPE_CUSTOMER = 2; public static final int TYPE_PRODUCT = 1; public static final int TYPE_SALESORDER = 3; /** * This method is called when you click delete button on an edit view the code parameter is the code of (Customer - * PRoduct) or order number of Sales Order and the type is identifier of the object type and may be TYPE_PRODUCT, * TYPE_CUSTOMER or TYPE_SALESORDER */ public static boolean deleteRecordByCode(String code, int objectType) { return service(objectType).delete(code); } /** * This method is used to get unit price of product with the code passed as a parameter */ public static double getProductPrice(String productCode) { return ((ProductsService) service(TYPE_PRODUCT)).getProductPrice(productCode); } /** * This method is called when a Combo Box need to be initialized and should return list of ComboBoxItem which * contains code and description/name for all records of specified type */ public static List<ComboBoxItem> listCurrentRecordRefernces(int objectType) { return service(objectType).getAllReferences(); } /** * This method is called when you open any list screen and should return all records of the specified type */ @SuppressWarnings("rawtypes") public static List listCurrentRecords(int objectType) { return service(objectType).getAll(); } /** * This method is called when you select record in list view of any entity and also called after you save a record * to re-bind the record again the code parameter is the first column of the row you have selected and the type is * identifier of the object type and may be TYPE_PRODUCT, TYPE_CUSTOMER or TYPE_SALESORDER */ public static Object readRecordByCode(String code, int objectType) { return service(objectType).get(code); } /** * This method is called eventually after you click save on any edit screen object parameter is the return object * from calling method guiToObject on edit screen and the type is identifier of the object type and may be * TYPE_PRODUCT, TYPE_CUSTOMER or TYPE_SALESORDER */ public static Object save(Object object, int objectType) { return service(objectType).save((BaseDto) object); } private static BaseService service(int objectType) { switch (objectType) { case TYPE_CUSTOMER: return new CustomersService(); case TYPE_PRODUCT: return new ProductsService(); case TYPE_SALESORDER: return new SalesOrdersService(); default: throw new IllegalArgumentException(Integer.toString(objectType)); } } } <file_sep>/rest-api/src/main/java/com/dev/rest/model/CustomerRow.java package com.dev.rest.model; public class CustomerRow extends BaseDto { private static final long serialVersionUID = 7920157186783536659L; private double currentCredit; private String name; private String phone; public double getCurrentCredit() { return currentCredit; } public String getName() { return name; } public String getPhone() { return phone; } public void setCurrentCredit(double currentCredit) { this.currentCredit = currentCredit; } public void setName(String name) { this.name = name; } public void setPhone(String phone) { this.phone = phone; } }<file_sep>/frontend/src/main/java/com/dev/frontend/panels/ComboBoxItem.java package com.dev.frontend.panels; public class ComboBoxItem { private String key; private String value; public ComboBoxItem() { } public ComboBoxItem(String key, String value) { this.key = key; this.value = value; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof ComboBoxItem)) { return false; } return getKey().equals(((ComboBoxItem) obj).getKey()); } public String getKey() { return key; } public String getValue() { return value; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (key == null ? 0 : key.hashCode()); return result; } public void setKey(String key) { this.key = key; } public void setValue(String value) { this.value = value; } @Override public String toString() { return value + "(" + key + ")"; } } <file_sep>/service/src/main/java/com/dev/service/entity/Product.java package com.dev.service.entity; import static java.lang.String.format; import javax.persistence.Entity; import javax.validation.constraints.Min; import javax.validation.constraints.Size; @Entity public class Product extends BaseEntity { private static final long serialVersionUID = 2356639092459704148L; @Size(min = 1, max = 255) private String descirption; private double price; @Min(1) private int quantity; public Product() { quantity = 1; } public String getDescirption() { return descirption; } public double getPrice() { return price; } public int getQuantity() { return quantity; } public void setDescirption(String descirption) { this.descirption = descirption; } public void setPrice(double price) { this.price = price; } public void setQuantity(int quantity) { this.quantity = quantity; } @Override public String toString() { return super.toString() + format(" | description=%s", descirption); } } <file_sep>/service/src/main/java/com/dev/service/boundary/ProductsEndpoint.java package com.dev.service.boundary; import static org.springframework.web.bind.annotation.RequestMethod.GET; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.dev.rest.model.ProductDetails; import com.dev.rest.model.ProductRow; import com.dev.rest.model.Reference; import com.dev.service.entity.Product; @RestController @RequestMapping("products") public class ProductsEndpoint extends BaseEndpoint<Product, ProductDetails, ProductRow> { @Autowired private ProductRepository products; @RequestMapping(value = "{code}/price", method = GET) public double getPrice(@PathVariable String code) { return products.getPrice(code); } @Override protected ProductDetails convertToDetails(Product entity) { return convertToRow(entity); } @Override protected Product convertToEntity(ProductDetails details) { Product entity = new Product(); entity.setCode(details.getCode()); entity.setDescirption(details.getDescirption()); entity.setPrice(details.getPrice()); entity.setQuantity(details.getQuantity()); return entity; } @Override protected ProductRow convertToRow(Product entity) { ProductRow row = new ProductRow(); row.setCode(entity.getCode()); row.setDescirption(entity.getDescirption()); row.setPrice(entity.getPrice()); row.setQuantity(entity.getQuantity()); return row; } @Override protected JpaRepository<Product, String> getRepository() { return products; } @Override protected Reference reference(Product entity) { return new Reference(entity.getCode(), entity.getDescirption()); } }<file_sep>/frontend/src/main/java/com/dev/frontend/panels/edit/EditCustomer.java package com.dev.frontend.panels.edit; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.JLabel; import javax.swing.JTextField; import com.dev.frontend.services.Services; import com.dev.rest.model.CustomerDetails; public class EditCustomer extends EditContentPanel { private static final long serialVersionUID = -8971249970444644844L; private JTextField txtAddress = new JTextField(); private JTextField txtCode = new JTextField(); private JTextField txtCreditLimit = new JTextField(); private JTextField txtCurrentCredit = new JTextField(); private JTextField txtName = new JTextField(); private JTextField txtPhone1 = new JTextField(); private JTextField txtPhone2 = new JTextField(); public EditCustomer() { GridBagLayout gridBagLayout = new GridBagLayout(); setLayout(gridBagLayout); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 5); gbc.gridx = 0; gbc.gridy = 0; add(new JLabel("Code"), gbc); gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 5); gbc.gridx = 1; gbc.gridy = 0; gbc.fill = GridBagConstraints.HORIZONTAL; add(txtCode, gbc); gbc.anchor = GridBagConstraints.LAST_LINE_START; txtCode.setColumns(10); gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 5); gbc.gridx = 0; gbc.gridy = 1; add(new JLabel("Name"), gbc); gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 5); gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 3; gbc.anchor = GridBagConstraints.LAST_LINE_START; add(txtName, gbc); txtName.setColumns(28); gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 5); gbc.gridx = 0; gbc.gridy = 2; add(new JLabel("Address"), gbc); gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 5); gbc.gridx = 1; gbc.gridy = 2; gbc.gridwidth = 3; gbc.anchor = GridBagConstraints.LAST_LINE_START; add(txtAddress, gbc); txtAddress.setColumns(28); gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 5); gbc.gridx = 0; gbc.gridy = 3; add(new JLabel("Phone 1"), gbc); gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 5); gbc.gridx = 1; gbc.gridy = 3; gbc.anchor = GridBagConstraints.LAST_LINE_START; add(txtPhone1, gbc); txtPhone1.setColumns(10); gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 5); gbc.gridx = 2; gbc.gridy = 3; add(new JLabel("Phone 2"), gbc); gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 15); gbc.gridx = 3; gbc.gridy = 3; gbc.anchor = GridBagConstraints.LAST_LINE_START; add(txtPhone2, gbc); txtPhone2.setColumns(10); gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 5); gbc.gridx = 0; gbc.gridy = 4; add(new JLabel("Credit Limit"), gbc); gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 5); gbc.gridx = 1; gbc.gridy = 4; gbc.anchor = GridBagConstraints.LAST_LINE_START; add(txtCreditLimit, gbc); txtCreditLimit.setColumns(10); gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 5); gbc.gridx = 2; gbc.gridy = 4; add(new JLabel("Current Credit"), gbc); gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 15); gbc.gridx = 3; gbc.gridy = 4; gbc.anchor = GridBagConstraints.LAST_LINE_START; add(txtCurrentCredit, gbc); txtCurrentCredit.setColumns(10); txtCurrentCredit.setEditable(false); } @Override public boolean bindToGUI(Object o) { CustomerDetails details = (CustomerDetails) o; txtCode.setText(details.getCode()); txtAddress.setText(details.getAddress()); txtCreditLimit.setText(Double.toString(details.getCreditLmit())); txtCurrentCredit.setText(Double.toString(details.getCurrentCredit())); txtName.setText(details.getName()); txtPhone1.setText(details.getPhone1()); txtPhone2.setText(details.getPhone2()); return false; } @Override public void clear() { txtCode.setText(""); txtName.setText(""); txtPhone1.setText(""); txtPhone2.setText(""); txtAddress.setText(""); txtCreditLimit.setText(""); txtCurrentCredit.setText(""); } @Override public String getCurrentCode() { return txtCode.getText(); } @Override public int getObjectType() { return Services.TYPE_CUSTOMER; } @Override public Object guiToObject() { CustomerDetails details = new CustomerDetails(); details.setAddress(txtAddress.getText()); details.setCode(txtCode.getText()); details.setCreditLmit(Double.valueOf(txtCreditLimit.getText())); details.setName(txtName.getText()); details.setPhone1(txtPhone1.getText()); details.setPhone2(txtPhone2.getText()); return details; } @Override public void onInit() { // nothing to implement } } <file_sep>/service/src/main/java/com/dev/service/control/StringUtil.java package com.dev.service.control; import static java.util.Arrays.stream; public final class StringUtil { public static String firstNotEmpty(String... strings) { return stream(strings).filter(s -> s != null && !s.isEmpty()).findFirst().orElse(""); } private StringUtil() { // Util class should not be instantiated directly } } <file_sep>/service/src/main/java/com/dev/service/entity/OrderedProduct.java package com.dev.service.entity; import static java.lang.String.format; import static java.lang.System.identityHashCode; import static java.util.Objects.hash; import javax.persistence.Embeddable; import javax.persistence.ManyToOne; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; @Embeddable public class OrderedProduct { @ManyToOne(optional = false) @NotNull private Product product; @Min(1) private int quantity; @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } OrderedProduct other = (OrderedProduct) obj; if (product == null) { if (other.product != null) { return false; } } else if (!product.equals(other.product)) { return false; } if (quantity != other.quantity) { return false; } return true; } public Product getProduct() { return product; } public int getQuantity() { return quantity; } @Override public int hashCode() { return hash(product, quantity); } public void setProduct(Product product) { this.product = product; } public void setQuantity(int quantity) { this.quantity = quantity; } @Override public String toString() { return format("%s: hash=%s | product=%s | quantity=%s", getClass().getSimpleName(), identityHashCode(this), product, quantity); } } <file_sep>/service/src/main/java/com/dev/service/boundary/CustomerRepository.java package com.dev.service.boundary; import org.springframework.data.jpa.repository.JpaRepository; import com.dev.service.entity.Customer; public interface CustomerRepository extends JpaRepository<Customer, String> { // nothing to implement }
0064f32ef59b275303c61dbc45244f6eb74dcb2b
[ "Java" ]
17
Java
slamdev/crossover-showcase
3bf62c3f6fc0850d73235b1974108b66340124f1
9df32aa640310a7c82e7a17c7a29fcf76cc77725
refs/heads/master
<repo_name>Lithumist/ExploreGame<file_sep>/ExploreGameEngine/source/save.h #ifndef SAVE_H #define SAVE_H /* save.h declares class 'EGSave' This class handles saving data to game files. (saves and loads 'savedata' objects) */ /* Stuff not loading correctly? Use number suffixes!!!! Remember that the compiler assumes what type a number is. Sometimes this assumption isn't the same as yours. e.g: 3.14 <- compiler will assume type 'double' 3.14f <- compiler now knows you ment type 'float' */ #include <iostream> #include <string> #include <fstream> namespace eg { struct savedata // POD { bool a; bool b; bool c; int number; float another_number; }; class EGSave { private: public: EGSave(); void LoadFromFile(const std::string& filename, savedata& dat); void SaveToFile(const std::string& filename, const savedata& dat); }; } #endif<file_sep>/ExploreGameEngine/source/game.h #ifndef GAME_H #define GAME_H /* game.h Declares class 'EGGame' Manages the real gameplay at the highest level */ #include <iostream> //#include <string> //#include <fstream> #include "eg_map.h" #include "globals.h" #define PLAYER_STARTING_HP 100 #define PLAYER_HP_BAR_X 8 #define PLAYER_HP_BAR_Y 640 #define PLAYER_HP_BAR_FULL_WIDTH 128 #define PLAYER_HP_BAR_HEIGHT 8 namespace eg { enum GAME_START_TYPE { NEW_GAME, LOAD_GAME }; class EGGame { private: static const std::string firstMapName; static const std::string firstMapFilename; // The map that is loaded on 'new game' bool mouseRelease; bool mDownPrev; eg::global* GlobalData; eg::EGMap currentMap; bool kDownPrev; void init(); public: EGGame(); EGGame(eg::global* data); void setData(eg::global* data); void startGameplay(GAME_START_TYPE type); bool damagePlayer(int dmg); // returns true when player is dead //static int LUA_damagePlayer(lua_State* l); int step(); void draw(); }; } #endif<file_sep>/ExploreGameEngine/source/utils.h /* utils.h Declares a namespace containing useful utility functions that the rest of the game uses. */ /* Some functions commented out becuse they were left from a previous game I got these files from. Wanted to leave the code there incase I needed it */ #ifndef UT_H #define UT_H #include <stdlib.h> #include <time.h> #include <string> #include <sstream> #include <vector> #include <stdlib.h> namespace eg{ namespace ut { // Sets the seed for random number generation to the current time void seed(); // The current seed (do not modify! ) extern unsigned int current_seed; // Generates a random number between min and max (inclusive) int random(int min, int max); // Clears screen ready for drawing next frame //void frameStart(); // Flips the screen buffers //void frameEnd(); // Rounds a float accurately to an integer int round(float number); // Set of functions to convert numbers to strings std::string toString(int num); std::string toString(float num); int toNumber(std::string string); // Returns a vector of coordinates that make up a line between 2 points // USES TILE COORDINATES! //std::vector<sf::Vector2i> calculateLine(int x0, int y0, int x1, int y1); // Returns the distance between 2 points float distanceBetween(float x1, float y1, float x2, float y2); }} // End namespaces #endif<file_sep>/ExploreGameEngine/source/event_receiver.h #ifndef EVENT_RECEIVER_H #define EVENT_RECEIVER_H /* event_receiver.h declares class 'EGEventReceiver' Does shit lal */ #include <irrlicht.h> using namespace irr; using namespace core; using namespace scene; using namespace video; using namespace io; using namespace gui; namespace eg { class EGEventReceiver : public IEventReceiver { public: virtual bool OnEvent(const SEvent& event); virtual bool IsKeyDown(EKEY_CODE keyCode) const; EGEventReceiver(); private: bool KeyIsDown[KEY_KEY_CODES_COUNT]; }; } #endif<file_sep>/ExploreGameEngine/source/game.cpp // game.cpp #include "game.h" namespace eg { // On new game const std::string EGGame::firstMapFilename = "res/maps/test2"; const std::string EGGame::firstMapName = "test2"; // Default constructor EGGame::EGGame() { EGGame::GlobalData = NULL; mouseRelease = false; mDownPrev = false; } // Constructor with global data pointer EGGame::EGGame(eg::global* data) { EGGame::GlobalData = NULL; if(!data) eg::log::log("Bad pointer being passed to EGGame::EGGame(eg::global* data)"); EGGame::GlobalData = data; currentMap.setData(EGGame::GlobalData); init(); } // Set global data pointer void EGGame::setData(eg::global* data) { if(!data) eg::log::log("Bad pointer being passed to EGGame::setData(eg::global* data)"); EGGame::GlobalData = data; currentMap.setData(EGGame::GlobalData); init(); } // Private initialization function void EGGame::init() { if(!EGGame::GlobalData) { eg::log::error("EGGame::init() can't execute because global data pointer is not defined"); return; } EGGame::GlobalData->isPaused = false; EGGame::GlobalData->escapePressedPrev = false; } // Start game void EGGame::startGameplay(GAME_START_TYPE type) { if(type == NEW_GAME) { // Load test level currentMap.loadFromFile(EGGame::firstMapFilename, eg::EGGame::firstMapName); // Set up player EGGame::GlobalData->playerHp = PLAYER_STARTING_HP; EGGame::GlobalData->playerMaxHp = PLAYER_STARTING_HP; } else if(type == LOAD_GAME) { } } // damagePlayer bool EGGame::damagePlayer(int dmg) { EGGame::GlobalData->playerHp -= dmg; if(EGGame::GlobalData->playerHp < 0) { EGGame::GlobalData->playerHp = -1; return true; } return false; } /* int EGGame::LUA_damagePlayer(lua_State* l) { eg::log::log("EGGame::LUA_damagePlayer()"); int n = lua_gettop(l); if(n != 1) { eg::log::error( "EG_DamagePlayer only takes 1 argument."); lua_pushstring(l, "EG_DamagePlayer only takes 1 argument."); lua_error(l); return 0; } eg::log::log("HP: " + ut::toString(EGGame::GlobalData->playerHp)); EGGame::GlobalData->playerHp -= (int)lua_tointeger(l,1); eg::log::log("HP: " + ut::toString(EGGame::GlobalData->playerHp)); if(EGGame::GlobalData->playerHp < 0) { EGGame::GlobalData->playerHp = -1; // return true //lua_pushnumber(l,1); //return 1; } eg::log::log("HP: " + ut::toString(EGGame::GlobalData->playerHp)); // return false //lua_pushnumber(l,0); //return 1; return 0; } */ // Draw game void EGGame::draw() { if(!EGGame::GlobalData->isPaused || !mouseRelease) { EGGame::GlobalData->driver->beginScene(true, true, SColor(255,100,101,140)); // Draw 3D scene EGGame::GlobalData->smgr->drawAll(); ///////////// // Draw HUD ///////////// // Draw HP bar float width = ((float)GlobalData->playerHp/(float)GlobalData->playerMaxHp)*(float)PLAYER_HP_BAR_FULL_WIDTH; EGGame::GlobalData->driver->draw2DRectangle( rect<s32>(PLAYER_HP_BAR_X,PLAYER_HP_BAR_Y,PLAYER_HP_BAR_X+( PLAYER_HP_BAR_FULL_WIDTH ),PLAYER_HP_BAR_Y+PLAYER_HP_BAR_HEIGHT) , SColor(255,255,0,0) , SColor(255,255,0,0) , SColor(255,255,0,0) , SColor(255,255,0,0) ); EGGame::GlobalData->driver->draw2DRectangle( rect<s32>(PLAYER_HP_BAR_X,PLAYER_HP_BAR_Y,PLAYER_HP_BAR_X+( (int)width ),PLAYER_HP_BAR_Y+PLAYER_HP_BAR_HEIGHT) , SColor(255,0,255,0) , SColor(255,0,255,0) , SColor(255,0,255,0) , SColor(255,0,255,0) ); EGGame::GlobalData->driver->endScene(); } } // Step game int EGGame::step() { // Turn pause on/off if(!EGGame::GlobalData->escapePressedPrev && EGGame::GlobalData->receiver.IsKeyDown(KEY_ESCAPE)) { EGGame::GlobalData->isPaused = !EGGame::GlobalData->isPaused; eg::log::log_iostream("toggle pause"); } EGGame::GlobalData->escapePressedPrev = EGGame::GlobalData->receiver.IsKeyDown(KEY_ESCAPE); // Handle quitting from pause if(EGGame::GlobalData->isPaused && EGGame::GlobalData->receiver.IsKeyDown(KEY_KEY_Q)) { eg::log::log("Quitting from pause screne"); return 1; } // Handle debug mouse release #ifdef EG_DEBUG_MODE if(!mDownPrev && EGGame::GlobalData->receiver.IsKeyDown(KEY_KEY_M)) { mouseRelease = !mouseRelease; eg::log::log_iostream("toggle mouse release"); } mDownPrev = EGGame::GlobalData->receiver.IsKeyDown(KEY_KEY_M); #endif // Prevent the rest of the code from running if the game is paused if(EGGame::GlobalData->isPaused && !mouseRelease) return 0; // Handle LUA debug prompt //if(GlobalData->receiver.IsKeyDown(KEY_KEY_L)) //{ //std::string l; //std::cout << "LUA DEBUG: "; //std::getline(std::cin, l); //GlobalData->lua.ExecuteCode(l); //} // Test action triggers for(unsigned int t=0; t<currentMap.actionTriggers.size(); t++) { if(currentMap.actionTriggers[t].CloseEnough(currentMap.getCamera()->getPosition().X,currentMap.getCamera()->getPosition().Y,currentMap.getCamera()->getPosition().Z)) { eg::log::log("Close!"); // TODO: make it only execute once //GlobalData->lua.ExecuteScript(currentMap.actionTriggers[t].luafilename); } } // Test collision triggers // TODO: Fix this, idk but it seems to always think that the bounding boxes are touching. for(unsigned int t=0; t<currentMap.collisionTriggers.size(); t++) { //if(currentMap.collisionTriggers[t].PointInside(currentMap.getCamera()->getPosition().X,currentMap.getCamera()->getPosition().Y,currentMap.getCamera()->getPosition().Z)) if(currentMap.collisionTriggers[t].BoundingBoxInside(currentMap.getCamera()->getTransformedBoundingBox())) { eg::log::log("Collision!"); // TODO: make it only execute once //GlobalData->lua.ExecuteScript(currentMap.collisionTriggers[t].luafilename); } } // Test HP bar if(EGGame::GlobalData->receiver.IsKeyDown(irr::KEY_KEY_K) && !kDownPrev) { eg::log::log("HP: " + ut::toString(EGGame::GlobalData->playerHp)); damagePlayer(1); eg::log::log("HP: " + ut::toString(EGGame::GlobalData->playerHp)); } kDownPrev = EGGame::GlobalData->receiver.IsKeyDown(irr::KEY_KEY_K); return 0; } }<file_sep>/ExploreGameEngine/source/lua_wrap.cpp // lua_wrap.cpp #include "lua_wrap.h" // Default constructor LuaWrap::LuaWrap() { state = NULL; } // Initializes lua and registers functions from LuaWrap class void LuaWrap::Init() { state = luaL_newstate(); luaL_openlibs(state); RegisterFunction("EG_Log", LuaLog); } // Free memory used by lua void LuaWrap::Free() { lua_close(state); } // Register function to call from lua void LuaWrap::RegisterFunction(std::string name, lua_CFunction function) { lua_register(state, name.c_str(), function); } // Execute a lua script void LuaWrap::ExecuteScript(std::string filename) { eg::log::log("running script " + filename); luaL_dofile(state, filename.c_str()); eg::log::log("finished script " + filename); } // Execute some given lua code void LuaWrap::ExecuteCode(std::string lua_code) { luaL_dostring(state,lua_code.c_str()); } // Wrap the logging function to LUA int LuaWrap::LuaLog(lua_State* l) { int n = lua_gettop(l); if(n != 1) { lua_pushstring(l, "EG_Log only takes 1 argument."); lua_error(l); return 0; } std::string msg = lua_tostring(l,1); // first argument is index 1 eg::log::log(msg); return 0; }<file_sep>/ExploreGameEngine/source/save.cpp // save.cpp #include "save.h" namespace eg { EGSave::EGSave() { // nothing to be done } // Load void EGSave::LoadFromFile(const std::string& filename, savedata& dat) { std::ifstream in(filename.c_str()); in.read(reinterpret_cast<char*>(&dat), sizeof(savedata)); } // Save void EGSave::SaveToFile(const std::string& filename, const savedata& dat) { std::ofstream out(filename.c_str()); out.write(reinterpret_cast<const char*>(&dat), sizeof(savedata)); } }<file_sep>/ExploreGameEngine/source/globals.h #ifndef GLOBALS_H #define GLOBALS_H /* globals.h declares struct 'global' stores all global varibles the whole program needs to know about. */ #include <string> #include <irrlicht.h> using namespace irr; using namespace core; using namespace scene; using namespace video; using namespace io; using namespace gui; #include "event_receiver.h" #include "save.h" #include "lua_wrap.h" namespace eg { class EGGame; struct global { public: // state info int current_state; // window info std::wstring window_caption; unsigned int window_width; unsigned int window_height; // irrlicht core objects IrrlichtDevice* device; IVideoDriver* driver; ISceneManager* smgr; IGUIEnvironment* guienv; EGEventReceiver receiver; // fonts IGUIFont* fnt_trololol; // global savegame info savedata SaveData; std::string savegameFilename; // lua wrapper LuaWrap lua; // game manager eg::EGGame* g; // pause flags bool isPaused; bool escapePressedPrev; // player info int playerHp; int playerMaxHp; }; } #endif<file_sep>/ExploreGameEngine/source/log.h #ifndef LOG_H #define LOG_H /* log.h declares a logging interface (in a namespace) Provides methods for the whole engine to log acivities */ /* * * For all logging operations, newlines ARE added * automaticallyat the end of the supplied message. * */ #include <iostream> #include <string> #include <fstream> namespace eg { namespace log { bool open(std::string filename); // opens the log file for writing void close(); // closes the log file, (must be called at the end of the program) // // Basic logging // void log(std::string message); // logs to iostream and the log file void log_iostream(std::string message); // logs to iostream void log_file(std::string message); // logs to log file // // Warning logging (formatted to be easy to spot) // void warning(std::string message); // logs a warning message to iostream and the log file void warning_iostream(std::string message); // logs a warning message to iostream void warning_file(std::string message); // logs a warning message to the log file // // Error logging (formatted to be easy to spot) // void error(std::string message); // logs an error message to iostream and the log file void error_iostream(std::string message); // logs an error message to iostream void error_file(std::string messasge); // logs an error message to the log file /* PRIVATE VARIABLES */ extern std::ofstream LOG_FILE; } } #endif<file_sep>/Resources/res/maps/test2/startup.lua -- test2 map startup script EG_Log("Hello world from lua!"); EG_DamagePlayer(50);<file_sep>/ExploreGameEngine/source/log.cpp // log.cpp #include "log.h" namespace eg { namespace log { /* open */ bool open(std::string filename) { // close the log file if it's open close(); LOG_FILE.open(filename.c_str()); if(LOG_FILE.fail()) return false; else return true; } /* close */ void close() { if(LOG_FILE.is_open()) LOG_FILE.close(); } /* log */ void log(std::string message) { log_iostream(message); log_file(message); } /* log_iostream */ void log_iostream(std::string message) { // only log to iostream in debug mode #ifndef EG_DEBUG_MODE return; #endif std::cout << message << std::endl; } /* log_file */ void log_file(std::string message) { if(!LOG_FILE.is_open()) return; LOG_FILE << message << std::endl; LOG_FILE.flush(); } /* warning */ void warning(std::string message) { warning_iostream(message); warning_file(message); } /* warning_iostream */ void warning_iostream(std::string message) { // only log to iostream in debug mode #ifndef EG_DEBUG_MODE return; #endif std::cout << std::endl; std::cout << " --- Warning ---" << std::endl; std::cout << message << std::endl; std::cout << " ---------------" << std::endl; } /* warning_file */ void warning_file(std::string message) { if(!LOG_FILE.is_open()) return; LOG_FILE << std::endl; LOG_FILE << " --- Warning ---" << std::endl; LOG_FILE << message << std::endl; LOG_FILE << " ---------------" << std::endl; } /* error */ void error(std::string message) { error_iostream(message); error_file(message); } /* error_iostream */ void error_iostream(std::string message) { // only log to iostream in debug mode #ifndef EG_DEBUG_MODE return; #endif std::cout << std::endl; std::cout << " ~~~~~~~~~~~ ERROR ~~~~~~~~~~~" << std::endl; std::cout << message << std::endl; std::cout << " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl; } /* error_file */ void error_file(std::string message) { if(!LOG_FILE.is_open()) return; LOG_FILE << std::endl; LOG_FILE << " ~~~~~~~~~~~ ERROR ~~~~~~~~~~~" << std::endl; LOG_FILE << message << std::endl; LOG_FILE << " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl; } /* PRIVATE VARIABLES */ std::ofstream LOG_FILE; } }<file_sep>/ExploreGameEngine/source/event_receiver.cpp // event_receiver.cpp #include "event_receiver.h" namespace eg { bool EGEventReceiver::OnEvent(const SEvent& event) { if(event.EventType == irr::EET_KEY_INPUT_EVENT) KeyIsDown[event.KeyInput.Key] = event.KeyInput.PressedDown; return false; } bool EGEventReceiver::IsKeyDown(EKEY_CODE keyCode) const { return KeyIsDown[keyCode]; } EGEventReceiver::EGEventReceiver() { for(u32 i=0; i<KEY_KEY_CODES_COUNT; ++i) KeyIsDown[i] = false; } }<file_sep>/ExploreGameEngine/source/main.cpp /* * * * * Explore Game Engine * * * <NAME> 2013 * * * * */ #include <irrlicht.h> using namespace irr; using namespace core; using namespace scene; using namespace video; using namespace io; using namespace gui; #ifdef _IRR_WINDOWS_ #ifndef EG_DEBUG_MODE #pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup") #endif #endif #include "game.h" #include "globals.h" #include "log.h" #include "eg_map.h" #include "save.h" #include "lua_wrap.h" int step(eg::global* data); void draw(eg::global* data); int main() { // Open log file eg::log::open("log.txt"); eg::log::log("Explore Game engine started"); // Create global struct eg::global GlobalData; // Set state to initial loading GlobalData.current_state = 0; // Create the window and set caption GlobalData.window_width = 960; GlobalData.window_height = 656; GlobalData.device = createDevice(video::EDT_OPENGL, dimension2d<u32>(GlobalData.window_width,GlobalData.window_height), 16, false, false, false, &GlobalData.receiver); if(!GlobalData.device) { eg::log::error("Unable to create Irrlicht device"); eg::log::close(); return 1; } eg::log::log("Created Irrlicht device"); GlobalData.window_caption = L"ExploreGame"; GlobalData.device->setWindowCaption(GlobalData.window_caption.c_str()); GlobalData.driver = GlobalData.device->getVideoDriver(); GlobalData.smgr = GlobalData.device->getSceneManager(); GlobalData.guienv = GlobalData.device->getGUIEnvironment(); eg::log::log("Window set up"); // Set the filename to use when saving and loading games GlobalData.savegameFilename = "savegame.dat"; // Initialize lua GlobalData.lua.Init(); // - - - - - - - - - - - - - // Load basic resources // - - - - - - - - - - - - - // Load fonts GlobalData.fnt_trololol = NULL; GlobalData.fnt_trololol = GlobalData.guienv->getFont("res/fonts/trololol.xml"); if(GlobalData.fnt_trololol == NULL) { eg::log::error("Unable to load font file res/fonts/trololol.xml"); GlobalData.lua.Free(); GlobalData.device->drop(); eg::log::close(); return 2; } eg::log::log("Loaded font file res/fonts/trololol.xml"); // - - - - - - - - - - - - - // End // - - - - - - - - - - - - - // Create the game manager eg::EGGame game(&GlobalData); GlobalData.g = &game; // Set state to main menu GlobalData.current_state = 1; // Main loop while(GlobalData.device->run()) { // step int rtn = step(&GlobalData); if(rtn != 0) { GlobalData.device->drop(); GlobalData.lua.Free(); eg::log::close(); return rtn; } // draw draw(&GlobalData); } // Exit eg::log::log("Explore Game engine exited"); GlobalData.device->drop(); GlobalData.lua.Free(); eg::log::close(); return 0; } void draw(eg::global* data) { switch(data->current_state) { case 0: // initial loading break; case 1: // main menu data->driver->beginScene(true, true, SColor(255,100,101,140)); data->fnt_trololol->draw(L"Explore Game",rect<s32>(64,32,400,64),SColor(255,255,255,255)); data->fnt_trololol->draw(L"N - new game",rect<s32>(128,128,400,64),SColor(255,255,255,255)); data->fnt_trololol->draw(L"L - load game",rect<s32>(128,160,400,64),SColor(255,255,255,255)); data->driver->endScene(); break; case 2: // in gameplay eg::EGGame* gam; gam = data->g; gam->draw(); break; } } int step(eg::global* data) { switch(data->current_state) { case 0: // initial loading break; case 1: // main menu if(data->receiver.IsKeyDown(irr::KEY_KEY_N)) { // start the gameplay manager eg::EGGame* gam; gam = data->g; gam->startGameplay(eg::NEW_GAME); // tell the main loop to step and render the gameplay data->current_state = 2; } if(data->receiver.IsKeyDown(irr::KEY_KEY_L)) { // load game eg::EGSave sv; sv.LoadFromFile(data->savegameFilename,data->SaveData); // start the gameplay manager eg::EGGame* gam; gam = data->g; gam->startGameplay(eg::LOAD_GAME); // tell the main loop to step and render the gameplay data->current_state = 2; } break; case 2: // in gameplay eg::EGGame* gam; gam = data->g; int res = gam->step(); if(res != 0) return res; break; } return 0; }<file_sep>/ExploreGameEngine/source/utils.cpp // ut.cpp #include "utils.h" namespace eg{ namespace ut { // Sets the seed for random number generation to the current time void seed() { current_seed = (unsigned int)time(NULL); time_t lol = time(NULL); srand(current_seed); } // The current seed (do not modify! ) unsigned int current_seed = 0; // Generates a random number between min and max (inclusive) int random(int min, int max) { return (rand()%(max+1))+min; } // Clears screen ready for drawing next frame /* void frameStart() { global::rwpWindow->clear(); } */ /* // Flips the screen buffers void frameEnd() { global::rwpWindow->display(); } */ // Rounds a float accurately to an integer int round(float number) { return (int)(floor(number+0.5)); } // Set of functions to convert numbers to strings and vice versa std::string toString(int num){std::stringstream ss; ss << num; return ss.str();} std::string toString(float num){std::stringstream ss; ss << num; return ss.str();} int toNumber(std::string string){return atoi(string.c_str());} // Returns a vector of coordinates that make up a line between 2 points // USES TILE COORDINATES! // http://rosettacode.org/wiki/Bitmap/Bresenham's_line_algorithm // Slight modifications /* std::vector<sf::Vector2i> calculateLine(int x0, int y0, int x1, int y1) { std::vector<sf::Vector2i> tmp; int dx = abs(x1-x0), sx = x0<x1 ? 1 : -1; int dy = abs(y1-y0), sy = y0<y1 ? 1 : -1; int err = (dx>dy ? dx : -dy)/2, e2; for(;;){ tmp.push_back(sf::Vector2i(x0,y0)); if (x0==x1 && y0==y1) break; e2 = err; if (e2 >-dx) { err -= dy; x0 += sx; } if (e2 < dy) { err += dx; y0 += sy; } } return tmp; } */ // Returns the distance between 2 points float distanceBetween(float x1, float y1, float x2, float y2) { float d1 = x1 - x2; float d2 = y1 - y2; return sqrt(d1*d1 + d2*d2); } }} // End namespaces<file_sep>/Resources/res/maps/test2/0002.lua -- test2 script 0001 EG_Log("Script 0002!");<file_sep>/README.txt Unnamed 3D Exploration Platformer Game Made using Irrlicht<file_sep>/ExploreGameEngine/source/eg_map.cpp // eg_map.cpp #include "eg_map.h" namespace eg { // // mapspot // mapspot::mapspot() { x=y=z=0; } mapspot::mapspot(float X, float Y, float Z) { x = X; y = Y; z = Z; } // // triggercollision // triggercollision::triggercollision() { x=y=z=0; luafilename = ""; } triggercollision::triggercollision(float X, float Y, float Z, core::aabbox3d<float> BOX, std::string filename) { setData(X,Y,Z,BOX,filename); } void triggercollision::setData(float X, float Y, float Z, core::aabbox3d<float> BOX, std::string filename) { x = X; y = Y; z = Z; bbox = BOX; luafilename = filename; } bool triggercollision::PointInside(float X, float Y, float Z) { return bbox.isPointInside(vector3d<f32>(X,Y,Z)); } bool triggercollision::BoundingBoxInside(core::aabbox3d<float> box) { return bbox.intersectsWithBox(box); } // // triggeraction // triggeraction::triggeraction() { x=y=z=0; luafilename = ""; } triggeraction::triggeraction(float X, float Y, float Z, std::string filename) { setData(X,Y,Z,filename); } void triggeraction::setData(float X, float Y, float Z, std::string filename) { x = X; y = Y; z = Z; luafilename = filename; } bool triggeraction::CloseEnough(float X, float Y, float Z) // TODO: implement this { float distance = sqrt( ((X-x)*(X-x)) + ((Y-y)*(Y-y)) + ((Z-z)*(Z-z)) ); if(distance > ACTION_TRIGGER_RANGE) return false; else return true; } // // EGMap // // Default constructor EGMap::EGMap() { playerStartX = 0.0f; playerStartY = 0.0f; setUpKeyMap(); } // Constructor with global data pointer EGMap::EGMap(global* data) { if(!data) eg::log::log("Bad pointer being passed to EGMap::EGMap(global* data)"); GlobalData = data; playerStartX = 0.0f; playerStartY = 0.0f; setUpKeyMap(); } // Clears the map void EGMap::clear() { mapSpots.clear(); collisionTriggers.clear(); playerStartX = 0.0f; playerStartY = 0.0f; } // Loads map from a file EGMap::EGMap(global* data, std::string filename, std::string map_name) { if(!data) eg::log::log("Bad pointer being passed to EGMap::EGMap(global* data, std::string filename)"); GlobalData = data; setUpKeyMap(); loadFromFile(filename, map_name); } void EGMap::setData(global* data) { if(!data) eg::log::log("Bad pointer being passed to EGMap::setData(global* data)"); GlobalData = data; } // Set up WASD movement with space to jump and ctrl to crouch void EGMap::setUpKeyMap() { keymap[0].Action = EKA_MOVE_FORWARD; keymap[0].KeyCode = KEY_KEY_W; keymap[1].Action = EKA_MOVE_BACKWARD; keymap[1].KeyCode = KEY_KEY_S; keymap[2].Action = EKA_STRAFE_LEFT; keymap[2].KeyCode = KEY_KEY_A; keymap[3].Action = EKA_STRAFE_RIGHT; keymap[3].KeyCode = KEY_KEY_D; keymap[4].Action = EKA_JUMP_UP; // doesn't work keymap[4].KeyCode = KEY_SPACE; keymap[5].Action = EKA_CROUCH; // doesn't work keymap[5].KeyCode = KEY_LCONTROL; } // Loads map from a file bool EGMap::loadFromFile(std::string filename, std::string map_name) { // Define tracking variables bool gotVisual = false; bool gotPhysics = false; bool gotStarting = false; bool error = false; // Clear old map data (if any) clear(); // Log eg::log::log("Loading map " + filename); // Clear old scene GlobalData->smgr->clear(); // Load .irr file std::string file = filename + "/" + map_name + ".irr"; GlobalData->smgr->loadScene(file.c_str()); // Create meta triangle selector meta = GlobalData->smgr->createMetaTriangleSelector(); // Process each mesh type core::array<scene::ISceneNode*> nodes; GlobalData->smgr->getSceneNodesFromType(scene::ESNT_ANY, nodes); for(u32 i=0; i<nodes.size(); i++) { ISceneNode* node = nodes[i]; ITriangleSelector* selector = 0; // Do some trickery to convert the meshes name into a comparable string core::stringc name = node->getName(); std::string rname = name.c_str(); // Log for easy level debugging eg::log::log("Node number " + eg::ut::toString((int)i) +", name '" + rname + "'"); if(rname == "MeshVisual") { gotVisual = true; } else if(rname == "MeshPhysics") { gotPhysics = true; selector = GlobalData->smgr->createOctreeTriangleSelector(((scene::IMeshSceneNode*)node)->getMesh(), node); } else if(rname == "MeshStart") { if(gotStarting) eg::log::warning("Multiple starting meshes"); gotStarting = true; playerStartX = node->getPosition().X; playerStartY = node->getPosition().Y; playerStartZ = node->getPosition().Z; node->setVisible(false); } else if(rname.substr(0,rname.length()-4) == "MapSpot") { int id = ut::toNumber(rname.substr(rname.length()-4,rname.length())); eg::log::log("Map Spot with id " + ut::toString(id) + ". At " + ut::toString(node->getPosition().X) + "," + ut::toString(node->getPosition().Y) + "," +ut::toString(node->getPosition().Z)); mapSpots[id] = mapspot(node->getPosition().X, node->getPosition().Y, node->getPosition().Z); } else if(rname.substr(0,rname.length()-4) == "TriggerAction") { std::string luafile =rname.substr(rname.length()-4,rname.length()); luafile += ".lua"; eg::log::log("Action trigger with lua file " + luafile + ". At " + ut::toString(node->getPosition().X) + "," + ut::toString(node->getPosition().Y) + "," +ut::toString(node->getPosition().Z)); actionTriggers.push_back(triggeraction(node->getPosition().X, node->getPosition().Y, node->getPosition().Z, filename + "/" + luafile)); } else if(rname.substr(0,rname.length()-4) == "TriggerCollision") { std::string luafile =rname.substr(rname.length()-4,rname.length()); luafile += ".lua"; eg::log::log("Collision trigger with lua file " + luafile + ". At " + ut::toString(node->getPosition().X) + "," + ut::toString(node->getPosition().Y) + "," +ut::toString(node->getPosition().Z)); collisionTriggers.push_back(triggercollision(node->getPosition().X, node->getPosition().Y, node->getPosition().Z, node->getTransformedBoundingBox(), filename + "/" + luafile)); } if(selector) { meta->addTriangleSelector(selector); selector->drop(); } }//end for loop // Set up fps camera for collision mapCamera = GlobalData->smgr->addCameraSceneNodeFPS(0,50.0f,0.1f,-1,keymap, 6); ISceneNodeAnimator* anim = GlobalData->smgr->createCollisionResponseAnimator(meta,mapCamera, vector3df(10,15,10),vector3df(0,-2,0)); meta->drop(); mapCamera->addAnimator(anim); anim->drop(); // Set camera position mapCamera->setPosition(vector3df(playerStartX,playerStartY,playerStartZ)); // Print any necessary warnings if(!gotVisual) { error = true; eg::log::warning("No visual mesh found"); } if(!gotPhysics) { error = true; eg::log::warning("No physics mesh found"); } if(!gotStarting) { error = true; eg::log::warning("No starting mesh found"); } // Log eg::log::log("Finished loading map " + filename); // Execute map startup script GlobalData->lua.ExecuteScript(filename + "/startup.lua"); return !error; } // get+set player start position void EGMap::setPlayerStartX(float x){playerStartX = x;} void EGMap::setPlayerStartY(float y){playerStartY = y;} void EGMap::setPlayerStartZ(float z){playerStartZ = z;} float EGMap::getPlayerStartX(){return playerStartX;} float EGMap::getPlayerStartY(){return playerStartY;} float EGMap::getPlayerStartZ(){return playerStartZ;} // camera control ICameraSceneNode* EGMap::getCamera(){ return mapCamera; } }<file_sep>/ExploreGameEngine/res/maps/test2/0001.lua -- test2 script 0001 EG_Log("Script 0001!");<file_sep>/ExploreGameEngine/source/lua_wrap.h #ifndef LUA_WRAP_H #define LUA_WRAP_H /* lua_wrap.h Declares class 'LuaWrap' Facilitates lua scripting intigration */ #include <iostream> #include <fstream> extern "C" { #include "lua.h" #include "lualib.h" #include "lauxlib.h" } #include "log.h" class LuaWrap { private: lua_State* state; public: LuaWrap(); void Init(); void Free(); void RegisterFunction(std::string name, lua_CFunction function); void ExecuteScript(std::string filename); void ExecuteCode(std::string lua_code); static int LuaLog(lua_State* l); lua_State* GetState(); }; #endif<file_sep>/ExploreGameEngine/source/eg_map.h #ifndef EG_MAP_H #define EG_MAP_H /* eg_map.h declares class 'EGMap' Represents a game map that can be loaded in from a specially formatted .irr file */ #include <iostream> #include <string> #include <vector> #include <map> #include "globals.h" #include "log.h" #include "utils.h" #include "lua_wrap.h" #include <irrlicht.h> using namespace irr; using namespace core; using namespace scene; using namespace video; using namespace io; using namespace gui; #define ACTION_TRIGGER_RANGE 50.0f namespace eg { class mapspot { public: mapspot(); mapspot(float X, float Y, float Z); float x,y,z; }; class triggercollision { public: triggercollision(); triggercollision(float X, float Y, float Z, core::aabbox3d<float> BOX, std::string filename); void setData(float X, float Y, float Z, core::aabbox3d<float> BOX, std::string filename); bool PointInside(float X, float Y, float Z); bool BoundingBoxInside(core::aabbox3d<float> box); float x,y,z; core::aabbox3d<float> bbox; std::string luafilename; }; class triggeraction { public: triggeraction(); triggeraction(float X, float Y, float Z, std::string filename); void setData(float X, float Y, float Z, std::string filename); bool CloseEnough(float X, float Y, float Z); float x,y,z; std::string luafilename; }; class EGMap { private: global* GlobalData; float playerStartX, playerStartY, playerStartZ; IMetaTriangleSelector* meta; ICameraSceneNode* mapCamera; SKeyMap keymap[6]; std::map<int,mapspot> mapSpots; void setUpKeyMap(); public: // idgaf about OO std::vector<triggercollision> collisionTriggers; std::vector<triggeraction> actionTriggers; EGMap(); EGMap(global* data); // blank map EGMap(global* data, std::string filename, std::string map_name); // loads a map from a file void clear(); // must be called before any other maps are loaded void setData(global* data); bool loadFromFile(std::string filename, std::string map_name); // get+set player start position void setPlayerStartX(float x); void setPlayerStartY(float y); void setPlayerStartZ(float z); float getPlayerStartX(); float getPlayerStartY(); float getPlayerStartZ(); // camera control ICameraSceneNode* getCamera(); }; } #endif
39c58882280863ea0a182439bd72095406a1b87f
[ "Text", "C++", "Lua" ]
20
C++
Lithumist/ExploreGame
fe1f84244728c6d727604a8dbc0156821d0bbc6c
366a1c36047c11c8010fcac8ce1deb92798f9131
refs/heads/master
<file_sep>package com.huxley.wiitools.utils; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.net.URLEncoder; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; /** * Created by huxley on 2017/4/28. */ public class DataUtils { /** * 编码 */ public static String urlEncode(String input) { try { return URLEncoder.encode(input, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } } /** * 解码 */ public static String urlDecode(String input) { try { return URLDecoder.decode(input, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } } public static String byte2hex(byte[] b) { StringBuilder sbDes = new StringBuilder(); String tmp; for(int i = 0; i < b.length; ++i) { tmp = Integer.toHexString(b[i] & 255); if(tmp.length() == 1) { sbDes.append("0"); } sbDes.append(tmp); } return sbDes.toString(); } /** * MD5 加密 */ public static String getMD5Str(String str) { MessageDigest messageDigest = null; try { messageDigest = MessageDigest.getInstance("MD5"); messageDigest.reset(); messageDigest.update(str.getBytes("UTF-8")); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return null; } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } byte[] byteArray = messageDigest.digest(); StringBuffer md5StrBuff = new StringBuffer(); for (int i = 0; i < byteArray.length; i++) { if (Integer.toHexString(0xFF & byteArray[i]).length() == 1) md5StrBuff.append("0").append(Integer.toHexString(0xFF & byteArray[i])); else md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i])); } return md5StrBuff.toString(); } } <file_sep>package com.huxley.wiitoolssample; import android.app.Application; import android.content.Context; import com.huxley.wiitools.WiiTools; import com.huxley.wiitools.companyUtils.acce.model.bean.UrlBean; /** * Created by huxley on 2017/4/19. */ public class App extends Application { public static class Url { public static final UrlBean API_AUTO = new UrlBean("https://dev.accemarket.com/", "api/auth"); public static final UrlBean YSCM_MOBILE_ERP_APP_SERVICE = new UrlBean( "http://erp.cosmosmedia.cn:8922/", "yscm/mobile/erpAppService"); } public static class ServiceCode { public static final String LOGIN = "5002U01"; } public static class Action { public static final String LOGIN = "login"; } public final static String idSecret = "24578325-1"; public final static String appSecret = "<KEY>"; public final static String rsaSecret = "<KEY>; public final static String aesKey = "<KEY>"; @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); // initialize最好放在attachBaseContext最前面 // SophixManager.getInstance().setContext(this) // .setAppVersion(Tools.getAppVersionName(this)) // .setSecretMetaData(idSecret, appSecret, rsaSecret) // .setAesKey(aesKey) // .setEnableDebug(true) // .setUnsupportedModel("", 0)//把不支持的设备加入黑名单,加入后不会进行热修复。modelName为该机型上Build.MODEL的值,这个值也可以通过adb shell getprop | grep ro.product.model取得。sdkVersionInt就是该机型的Android版本,也就是Build.VERSION.SDK_INT,若设为0,则对应该机型所有安卓版本。 // .setPatchLoadStatusStub(new PatchLoadStatusListener() { // @Override // public void onLoad(final int mode, final int code, final String info, final int handlePatchVersion) { // // 补丁加载回调通知 // if (code == PatchStatus.CODE_LOAD_SUCCESS) { // // 表明补丁加载成功 // } else if (code == PatchStatus.CODE_LOAD_RELAUNCH) { // // 表明新补丁生效需要重启. 开发者可提示用户或者强制重启; // // 建议: 用户可以监听进入后台事件, 然后应用自杀,以此加快应用补丁 // // 建议调用killProcessSafely,详见1.3.2.3 // // SophixManager.getInstance().killProcessSafely(); // } else if (code == PatchStatus.CODE_LOAD_FAIL) { // // 内部引擎异常, 推荐此时清空本地补丁, 防止失败补丁重复加载 // // SophixManager.getInstance().cleanPatches(); // } else { // // 其它错误信息, 查看PatchStatus类说明 // } // } // }).initialize(); } @Override public void onCreate() { super.onCreate(); WiiTools.init(this) .initLog(true, "wii_huxley") .initStetho() .initSinaEmailCrash("emailName", "emailPassword"); // queryAndLoadNewPatch不可放在attachBaseContext 中,否则无网络权限,建议放在后面任意时刻,如onCreate中 // SophixManager.getInstance().queryAndLoadNewPatch(); } } <file_sep>package com.huxley.wiitools.companyUtils.yscm; import com.huxley.wiitools.companyUtils.yscm.model.bean.YscmResultBean; import java.util.Map; import okhttp3.MultipartBody; import okhttp3.RequestBody; import okhttp3.ResponseBody; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; import retrofit2.http.Multipart; import retrofit2.http.POST; import retrofit2.http.Part; import retrofit2.http.PartMap; import retrofit2.http.Query; import rx.Observable; /** * Created by huxley on 2017/3/25. */ public interface YscmApi { @FormUrlEncoded @POST("yscm/mobile/erpAppService") Observable<YscmResultBean> yscmMobileErpAppService( @Field("action") String action, @Field("params") String params ); // // @Multipart // @POST("yscm/mobile/erpAppService") // Observable<ResponseBody> uploadFiles( // @Field("action") String action, // @PartMap() Map<String, RequestBody> maps // ); // // @Multipart // @POST("yscm/mobile/erpAppService") // Observable<ResponseBody> uploadFiles( // @Field("action") String action, // @Part("filename") String description, // @PartMap() Map<String, RequestBody> maps // ); @Multipart @POST("yscm/mobile/erpAppService") Observable<YscmResultBean> uploadFile( @Part MultipartBody.Part file, @Part("action") RequestBody action, @Part("commonParams") RequestBody commonParams ); } <file_sep>package com.huxley.wiitools.companyUtils.acce.model; import com.huxley.wiitools.WiiException; import com.huxley.wiitools.companyUtils.acce.AcceApi; import com.huxley.wiitools.companyUtils.acce.AcceHttpClient; import com.huxley.wiitools.companyUtils.acce.AcceSubscriber; import com.huxley.wiitools.companyUtils.acce.model.bean.BusinessBean; import com.huxley.wiitools.companyUtils.acce.model.bean.ResultBean; import com.huxley.wiitools.companyUtils.acce.model.bean.UrlBean; import com.huxley.wiitools.companyUtils.yscm.YscmHttpClient; import java.util.HashMap; import rx.Observable; import rx.android.schedulers.AndroidSchedulers; import rx.functions.Func1; import rx.schedulers.Schedulers; /** * Created by huxley on 2017/8/17. */ public class AcceHttpModel { private static AcceHttpModel instance; private HashMap<String, AcceApi> mApi; public UrlBean defaultUrl; public UrlBean currentUrl; public String currentCode; public BusinessBean business; private AcceHttpModel() { mApi = new HashMap<>(); business = new BusinessBean(); } public static AcceHttpModel getInstance() { if (instance == null) { synchronized (AcceHttpModel.class) { if (instance == null) { instance = new AcceHttpModel(); } } } return instance; } public AcceHttpModel setDefaultUrl(UrlBean urlBean) { defaultUrl = urlBean; return this; } public AcceHttpModel setDefaultUrl(String url, String path) { defaultUrl = new UrlBean(url, path); return this; } public AcceHttpModel setUrl(UrlBean urlBean) { currentUrl = urlBean; return this; } public AcceHttpModel setUrl(String url, String path) { currentUrl = new UrlBean(url, path); return this; } public AcceHttpModel setServiceCode(String serviceCode) { this.currentCode = serviceCode; return this; } public AcceHttpModel addBusiness(String key, String value) { business.add(key, value); return this; } public synchronized <T> void post(AcceSubscriber<T> subscriber) { post().subscribe(subscriber); } public synchronized Observable<Object> post() { initPost(); Observable<Object> post = post(currentUrl, currentCode, business); clearPost(); return post; } private void clearPost() { currentUrl = defaultUrl; currentCode = null; business = new BusinessBean(); } private void initPost() { if (currentUrl == null) currentUrl = defaultUrl; if (business == null) business = new BusinessBean(); if (currentUrl == null) { throw new WiiException("202", "请设置默认url"); } if (currentCode == null) { throw new WiiException("202", "请设置serviceCode"); } } public synchronized Observable<Object> post(UrlBean urlBean, String serviceCode, BusinessBean businessBean) { if (!mApi.containsKey(urlBean.url)) { mApi.put(urlBean.url, new AcceHttpClient().getAcceApi(urlBean.url)); } AcceApi acceApi = mApi.get(urlBean.url); Observable<ResultBean<Object>> observable; switch (urlBean.path) { case "api/auth": observable = acceApi.apiAuth(serviceCode, businessBean.build()); break; case "sms/message": observable = acceApi.smsMessage(serviceCode, businessBean.build()); break; case "api/iocar": observable = acceApi.apiIocar(serviceCode, businessBean.build()); break; default: observable = Observable.empty(); break; } return observable.compose(io_main()) .compose(handleResult()); } private Observable.Transformer<ResultBean<Object>, Object> handleResult() { return new Observable.Transformer<ResultBean<Object>, Object>() { @Override public Observable<Object> call(Observable<ResultBean<Object>> tObservable) { return tObservable.flatMap( new Func1<ResultBean<Object>, Observable<Object>>() { @Override public Observable<Object> call(ResultBean<Object> result) { if ("200".equals(result.returnCode)) { return Observable.just(result.result); } else { return Observable.error(new WiiException(result.returnCode, result.returnMsg)); } } } ); } }; } private Observable.Transformer<ResultBean<Object>, ResultBean<Object>> io_main() { return new Observable.Transformer<ResultBean<Object>, ResultBean<Object>>() { @Override public Observable<ResultBean<Object>> call(Observable<ResultBean<Object>> tObservable) { return tObservable .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()); } }; } }<file_sep>package com.huxley.wiitools.view.dialog; /** * Created by huxley on 2017/8/26. */ public interface IDialogResultListener<T> { void onDataResult(T result); }<file_sep>package com.huxley.wiitoolssample; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import com.huxley.wiitools.view.WiiInput; public class TestInputActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.test_input_activity); final WiiInput inputMpvcode = (WiiInput) findViewById(R.id.input_mpvcode); inputMpvcode.setSendVerificationCodeListener(new WiiInput.SendVerificationCodeListener() { @Override public void onClickListener() { TestInputActivity.this.getWindow().getDecorView().getHandler().postDelayed(new Runnable() { @Override public void run() { inputMpvcode.isSendComplete(true); } }, 2000); } }); } } <file_sep>package com.huxley.wiitools.view; import android.content.Context; import android.content.res.TypedArray; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.huxley.wiitools.R; import com.huxley.wiitools.utils.DateUtils; import com.huxley.wiitools.utils.ResUtils; import com.huxley.wiitools.utils.StringUtils; import com.huxley.wiitools.utils.logger.Logger; import java.util.Calendar; /** * Created by huxley on 2017/8/7. */ public class WiiSelectDateView extends LinearLayout { public static final String DEFAULT_FORMAT_YEAR = "yyyy"; public static final String DEFAULT_FORMAT_MONTH = "yyyy-MM"; public static final String DEFAULT_FORMAT_DAY = "yyyy-MM-dd"; private int mType; private String mContent; private String mFormat; private String mMinDate; private String mMaxDate; public WiiSelectDateView(Context context) { this(context, null); } public WiiSelectDateView(Context context, @Nullable AttributeSet attrs) { this(context, attrs, 0); } public WiiSelectDateView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); setOrientation(HORIZONTAL); obtainStyledAttributes(context, attrs); initView(); } private void obtainStyledAttributes(Context context, AttributeSet attrs) { TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.select_date); mType = ta.getInteger(R.styleable.select_date_date_type, Calendar.DAY_OF_MONTH); mContent = ta.getString(R.styleable.select_date_date_content); mFormat = ta.getString(R.styleable.select_date_date_format); mMinDate = ta.getString(R.styleable.select_date_date_min); mMaxDate = ta.getString(R.styleable.select_date_date_max); if (StringUtils.isEmpty(mFormat)) { switch (mType) { case Calendar.YEAR: mFormat = DEFAULT_FORMAT_YEAR; break; case Calendar.MONTH: mFormat = DEFAULT_FORMAT_MONTH; break; case Calendar.DAY_OF_MONTH: mFormat = DEFAULT_FORMAT_DAY; break; } } mContent = DateUtils.getCurrentTime(mFormat); } private void initView() { ImageView ivMinus = new ImageView(getContext()); ivMinus.setImageResource(R.drawable.ic_arrow_left); ivMinus.setPadding(ResUtils.dpToPx(10), 0, ResUtils.dpToPx(10), 0); ivMinus.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { minusDate(); } }); ImageView ivAdd = new ImageView(getContext()); ivAdd.setImageResource(R.drawable.ic_arrow_right); ivAdd.setPadding(ResUtils.dpToPx(10), 0, ResUtils.dpToPx(10), 0); ivAdd.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { addDate(); } }); TextView tv = new TextView(getContext()); tv.setGravity(Gravity.CENTER); tv.setText(mContent); tv.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { selectDate(); } }); LayoutParams tvParams = new LayoutParams(0, LayoutParams.MATCH_PARENT, 1); LayoutParams ivParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT); addView(ivMinus, ivParams); addView(tv, tvParams); addView(ivAdd, ivParams); } private void selectDate() { Logger.i("selectDate"); } private void addDate() { if (mContent.equals(mMaxDate)) { WiiToast.warn("不能超过日期范围"); return; } mContent = DateUtils.addDate(mType, mContent, mFormat); ((TextView)getChildAt(1)).setText(mContent); } private void minusDate() { if (mContent.equals(mMinDate)) { WiiToast.warn("不能超过日期范围"); return; } mContent = DateUtils.minusDate(mType, mContent, mFormat); ((TextView)getChildAt(1)).setText(mContent); } } <file_sep># WiiTools 一个 Android 的工具库 ## 用法 * Android Studio ```groovy compile 'com.huxley:wiitools:2.8.0 ``` * Eclipse 下载最新 aar:[wiitools-2.8.0.aar](https://dl.bintray.com/huangweiyi/maven/com/huxley/wiitools/2.8.0/wiitools-2.8.0.aar) ## 配置 在 application 中进行 WiiTools 的配置 ```java WiiTools.init(this); ``` #### WiiToast 的使用 * 显示普通信息的 Toast ```java WiiToast.show("普通信息"); ``` * 显示提示信息的 Toast ```java WiiToast.info("提示信息"); ``` * 显示成功信息的 Toast ```java WiiToast.success("成功信息"); ``` * 显示警告信息的 Toast ```java WiiToast.warn("警告信息"); ``` * 显示错误信息的 Toast ```java WiiToast.error("错误信息"); ``` #### WiiCrash 的使用 * 使用新浪邮箱 ```java WiiTools.init(this) .initSinaEmailCrash("emailName", "emailPassword"); ``` #### HandlerBus 的使用 * 注册一个消息处理者 ```java HandlerBus.getInstance().register(MainActivity.class, new IHandler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case 1: mBtnTestHandlerBus.setText(MessageFormat.format("{0}{1}", msg.obj, msg.what)); break; case 2: mBtnTestHandlerBus.setText(MessageFormat.format("{0}{1}", msg.obj, msg.what)); break; } } }); ``` * 发送一条消息 ```java HandlerBus.getInstance().post(MainActivity.class, 1, "HandlerBus 成功了"); ``` #### WiiLog 的使用 ```java WiiTools.init(this) .initLog(true, "WiiLog"); WiiLog.i(""); ``` #### ReflectUtil的使用 * ReflectUtil.on 包裹一个类或者对象,表示在这个类或对象上进行反射,类的值可以使Class,也可以是完整的类名(包含包名信息) * ReflectUtil.create 用来调用之前的类的构造方法,有两种重载,一种有参数,一种无参数 * ReflectUtil.call 方法调用,传入方法名和参数,如有返回值还需要调用get * ReflectUtil.get 获取(field和method返回)值相关,会进行类型转换,常与call和field组合使用 * ReflectUtil.field 获取属性值相关,需要调用get获取该值 * ReflectUtil.set 设置属性相关。 #### DialogFragmentHelper 的使用 * showTimeDialog:选择时间的弹出窗 * showPasswordInsertDialog:输入密码的弹出窗 * showListDialog:显示列表的弹出窗 * showIntervalInsertDialog:两个输入框的弹出窗 * showInsertDialog:一个输入框的弹出窗 * showDateDialog:选择日期的弹出窗 * showConfirmDialog:确认和取消的弹出窗 * showTips:简单提示弹出窗 * showProgress:加载中的弹出窗 * showCustomDialog:自定义提示弹出窗 <file_sep>package com.huxley.wiitools.handlerBus; import android.os.Message; /** * handler回调更新接口 * Created by huxley on 2017/4/21. */ public interface IHandler { /** * handler回调接口 */ void handleMessage(Message msg); } <file_sep>apply plugin: 'com.android.library' apply plugin: 'com.novoda.bintray-release' android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion } lintOptions { abortOnError false } useLibrary 'org.apache.http.legacy' } dependencies { // 基础包 compile "com.android.support:support-v4:${supportLibVersion}" compile "com.android.support:appcompat-v7:${supportLibVersion}" compile "com.android.support:recyclerview-v7:${supportLibVersion}" provided "com.android.support:design:${supportLibVersion}" //多类型列表 compile("me.drakeet.multitype:multitype:${multitype}", { exclude group: 'com.android.support' }) // 网络请求 // RESTful架构 compile ("com.squareup.retrofit2:retrofit:${retrofit}"){ exclude group : 'com.squareup.okhttp3' } // chrome 调试 compile "com.facebook.stetho:stetho:${stetho}" // bmob 第三方服务器 compile "cn.bmob.android:bmob-sdk:${bmob}" compile "com.zhy.base:fileprovider:${fileprovider}" // 权限申请 compile "pub.devrel:easypermissions:${easypermissions}" // 图片缓存 compile "com.github.bumptech.glide:glide:${glide}" compile files('libs/activation.jar') compile files('libs/additionnal.jar') // 发送邮件 compile files('libs/mail.jar') } publish { userOrg = 'huangweiyi' //bintray注册的用户名 groupId = 'com.huxley' //compile引用时的第1部分groupId artifactId = 'wiitools' //compile引用时的第2部分项目名 publishVersion = '2.8.3' //compile引用时的第3部分版本号 desc = 'This is a android tools' website = 'https://github.com/wii-huxley/WiiTools' }<file_sep>package com.huxley.wiitools.companyUtils.acce; import com.huxley.wiitools.WiiException; import com.huxley.wiitools.utils.GsonUtils; import com.huxley.wiitools.utils.reflect.ClassTypeReflect; import java.lang.reflect.Type; import java.net.SocketTimeoutException; import java.net.UnknownHostException; import rx.Subscriber; /** * Created by huxley on 2017/8/18. */ public abstract class AcceSubscriber<T> extends Subscriber<Object> { private Type type; public AcceSubscriber() { super(); type = ClassTypeReflect.getGenericType(this); } @Override public void onError(Throwable e) { e.printStackTrace(); String msg; if (e instanceof WiiException) { WiiException we = (WiiException) e; msg = we.getMessage(); switch (we.getCode()) { case "00000910": case "00000915": case "00000920": case "00000929": case "00000960": return; default: break; } } else if (e instanceof UnknownHostException) { msg = "没有网络..."; } else if (e instanceof SocketTimeoutException) { msg = "超时..."; } else { msg = "请求失败,请稍后重试..."; } onError(msg); } @Override public void onNext(Object obj) { try { T t = GsonUtils.fromJson(obj.toString(), type); onSuccess(t); } catch (Exception e) { if ("class java.lang.String".equals(type.toString())) { onSuccess((T) obj.toString()); } else { onError("数据解析失败!"); } } } @Override public void onCompleted() { } public abstract void onSuccess(T t); public abstract void onError(String msg); } <file_sep>package com.huxley.wiitools.companyUtils.acce.model.bean; import java.io.Serializable; /** * Created by huxley on 2017/8/17. */ public class UserBean implements Serializable { public String atUserId; public String phoneNum; public String realName; public String token; public String thumbnail; public String nickName; public String sex; public String companyName; public String companyId; public String departmentId; public String departmentName; public String companyProvince; public String companyCity; public String companyDistrict; public String companyAuthority; public String qrCode; public UserBean() { token = "411e7bc272a421b44802a9f608a740e5ca74872a"; } public UserBean(String phoneNum) { token = "411e7bc272a421b44802a9f608a740e5ca74872a"; atUserId = phoneNum; } } <file_sep>package com.huxley.wiitools.handlerBus; import java.util.Hashtable; /** * WiiHandler操作对象(核心) * Created by huxley on 2017/4/21. */ public class HandlerBus { private static HandlerBus instance; protected Class<?> clazz; private int mHandlerId = 0X8; private Hashtable<Class<?>, Integer> mHandlerIds = null; /** * 获取hBaseHandler操作对象 */ public synchronized static HandlerBus getInstance() { if (instance == null) { synchronized (HandlerBus.class) { if (instance == null) { instance = new HandlerBus(); } } } return instance; } private HandlerBus() { WiiHandler.getInstance().setHandlerBus(this); mHandlerIds = new Hashtable<>(); } /** * 把当前对象对象添加到指定键里面 */ public HandlerBus register(Class<?> clazz, IHandler iHandler) { if (clazz != null) { this.clazz = clazz; WiiHandler.getInstance().register(clazz, iHandler); } return this; } /** * 给指定的handler发送message */ public HandlerBus post(Class<?> clazz, int tag, Object obj) { if (clazz != null) { this.clazz = clazz; WiiHandler.getInstance().post(clazz, tag, obj); } return this; } /** * 移除BaseHandler里面的指定key对象 */ public HandlerBus unregister(Class<?> clazz) { if (clazz != null) { this.clazz = clazz; WiiHandler.getInstance().unregister(); mHandlerIds.remove(clazz); } return this; } /** * 移除所有的handler里面的对象 */ public HandlerBus unregisterAll() { WiiHandler.getInstance().unregisterAll(); mHandlerIds.clear(); return this; } public synchronized int getHandlerId() { if (mHandlerIds.containsKey(clazz)) { return mHandlerIds.get(clazz); } else { int handlerId = createHandlerId(); mHandlerIds.put(clazz, handlerId); return handlerId; } } /** * 保证容器里面的ID值唯一性 */ private int createHandlerId() { if (mHandlerIds.containsValue(++mHandlerId)) { createHandlerId(); } return mHandlerId; } } <file_sep>package com.huxley.wiitoolssample; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.view.View; import com.huxley.wiitools.view.WiiToast; /** * Created by huxley on 2017/4/26. */ public class TestToastActivity extends AppCompatActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.test_toast_activity); } public void show(View view) { WiiToast.show("show"); } public void info(View view) { WiiToast.info("info"); } public void success(View view) { WiiToast.success("success"); } public void warn(View view) { WiiToast.warn("warn"); } public void error(View view) { WiiToast.error("error"); } } <file_sep>package com.huxley.wiitools.utils; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.Map; /** * Date 工具类 * Created by huxley on 2017/4/20. */ public class DateUtils { private static Map<String, ThreadLocal<SimpleDateFormat>> sdfMap = new HashMap<>(); /** * 根据map中的key得到对应线程的sdf实例 * * @param pattern map中的key * @return 该实例 */ private static SimpleDateFormat getSdf(final String pattern) { ThreadLocal<SimpleDateFormat> sdfThread = sdfMap.get(pattern); if (sdfThread == null) { //双重检验,防止sdfMap被多次put进去值 synchronized (DateUtils.class) { sdfThread = sdfMap.get(pattern); if (sdfThread == null) { sdfThread = new ThreadLocal<SimpleDateFormat>() { @Override protected SimpleDateFormat initialValue() { return new SimpleDateFormat(pattern, Constant.LOCALE); } }; sdfMap.put(pattern, sdfThread); } } } return sdfThread.get(); } public static int[] getCurrentDates() { Calendar calendar = Calendar.getInstance(); int[] current = new int[3]; current[0] = calendar.get(Calendar.YEAR); current[1] = calendar.get(Calendar.MONTH) + 1; current[2] = calendar.get(Calendar.DAY_OF_MONTH); return current; } public static int[] getCurrentTimes() { Calendar calendar = Calendar.getInstance(); int[] current = new int[3]; current[0] = calendar.get(Calendar.HOUR_OF_DAY); current[1] = calendar.get(Calendar.MINUTE); return current; } /** * 按照指定pattern解析日期 * * @param date 要解析的date * @param pattern 指定格式 * @return 解析后date实例 */ public static Date parseDate(String date, String pattern) { if (date == null) { throw new IllegalArgumentException("The date must not be null"); } try { return getSdf(pattern).parse(date); } catch (ParseException e) { e.printStackTrace(); } return null; } /** * 按照指定pattern格式化日期 * * @param date 要格式化的date * @param pattern 指定格式 * @return 解析后格式 */ public static String formatDate(Date date, String pattern) { if (date == null) { throw new IllegalArgumentException("The date must not be null"); } else { return getSdf(pattern).format(date); } } public static String getCurrentTime(String pattern) { return formatDate(new Date(), pattern); } public static String addDate(int type, String date, String pattern) { GregorianCalendar gc = new GregorianCalendar(); gc.setTime(parseDate(date, pattern)); gc.add(type, 1); return formatDate(gc.getTime(), pattern); } public static String addDay(String date, String pattern) { return addDate(Calendar.DAY_OF_MONTH, date, pattern); } public static String addMonth(String date, String pattern) { return addDate(Calendar.MONTH, date, pattern); } public static String addYear(String date, String pattern) { return addDate(Calendar.YEAR, date, pattern); } public static String minusDate(int type, String date, String pattern) { GregorianCalendar gc = new GregorianCalendar(); gc.setTime(parseDate(date, pattern)); gc.add(type, -1); return formatDate(gc.getTime(), pattern); } public static String minusDay(String date, String pattern) { return minusDate(Calendar.DAY_OF_MONTH, date, pattern); } public static String minusMonth(String date, String pattern) { return minusDate(Calendar.MONTH, date, pattern); } public static String minusYear(String date, String pattern) { return minusDate(Calendar.YEAR, date, pattern); } } <file_sep>package com.huxley.wiitools.utils; import android.content.res.ColorStateList; import android.content.res.Resources; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.drawable.Drawable; import android.graphics.drawable.NinePatchDrawable; import android.support.annotation.ArrayRes; import android.support.annotation.ColorRes; import android.support.annotation.DimenRes; import android.support.annotation.IntegerRes; import android.support.annotation.StringRes; import android.support.v4.content.ContextCompat; import android.support.v4.graphics.drawable.DrawableCompat; import android.util.DisplayMetrics; import android.util.TypedValue; import com.huxley.wiitools.WiiTools; import java.util.Arrays; import java.util.List; /** * Resources 工具类 * Created by huxley on 2017/4/19. */ public class ResUtils { public static final int INITIAL = 0; private static Resources sResources; private static DisplayMetrics sDisplayMetrics; private static Resources getResources() { if (sResources== null) { sResources = WiiTools.instance.mContext.getResources(); } return sResources; } private static DisplayMetrics getDisplayMetrics() { if (sDisplayMetrics == null) { sDisplayMetrics = getResources().getDisplayMetrics(); } return sDisplayMetrics; } public static Drawable tintDrawable(int drawableResId, int colors) { final Drawable wrappedDrawable = getDrawable(drawableResId); DrawableCompat.setTintList(wrappedDrawable, ColorStateList.valueOf(colors)); return wrappedDrawable; } public static Drawable getDrawable(int drawableResId) { return ContextCompat.getDrawable(WiiTools.instance.mContext, drawableResId); } public static Drawable setNinePatchDrawableTintColor(int drawableResId, int tintColor) { NinePatchDrawable toastDrawable = null; if (drawableResId > 0) { toastDrawable = (NinePatchDrawable) getDrawable(drawableResId); if (tintColor > INITIAL) { toastDrawable.setColorFilter(new PorterDuffColorFilter(getColor(tintColor), PorterDuff.Mode.SRC_IN)); } } return toastDrawable; } public static int getColor(@ColorRes int colorResId) { return ContextCompat.getColor(WiiTools.instance.mContext, colorResId); } public static String getString(@StringRes int stringResId) { return WiiTools.instance.mContext.getString(stringResId); } public static float getDimen(@DimenRes int dimenResId) { return getResources().getDimension(dimenResId); } public static int getInt(@StringRes int strResId){ return Integer.valueOf(getString(strResId)); } public static int getInteger(@IntegerRes int intResId){ return getResources().getInteger(intResId); } public static String[] getStringArray(@ArrayRes int strAryResId) { return getResources().getStringArray(strAryResId); } public static List<String> getStringList(@ArrayRes int strAryResId) { return Arrays.asList(getStringArray(strAryResId)); } private String[][] getTwoDimensionalArray(@ArrayRes int strAryResId) { String[] array = getStringArray(strAryResId); String[][] twoDimensionalArray = null; for (int i = 0; i < array.length; i++) { String[] tempArray = array[i].split(","); if (twoDimensionalArray == null) { twoDimensionalArray = new String[array.length][tempArray.length]; } System.arraycopy(tempArray, 0, twoDimensionalArray[i], 0, tempArray.length); } return twoDimensionalArray; } /** * 根据手机的分辨率从 dp 的单位 转成为 px(像素) */ public static int dpToPx(float dpValue) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dpValue, getDisplayMetrics()); } /** * 根据手机的分辨率从 sp 的单位 转成为 px(像素) */ public static int spToPx(float spValue) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, spValue, getDisplayMetrics()); } /** * 获取状态栏的高度 * @return 状态栏的高度 */ public static int getStatusBarHeight() { int result = 0; int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { result = getResources().getDimensionPixelSize(resourceId); } if (result <= 0) { result = dpToPx(25); } return result; } /** * 取导航栏高度 * @return 导航栏高度 */ public static int getNavigationBarHeight() { int result = 0; int resourceId = getResources().getIdentifier("navigation_bar_height", "dimen", "android"); if (resourceId > 0) { result = getResources().getDimensionPixelSize(resourceId); } if (result <= 0) { result = dpToPx(40); } return result; } public static int getScreenWidth() { return getDisplayMetrics().widthPixels; } public static int getScreenHeight() { return getDisplayMetrics().heightPixels; } } <file_sep>package com.huxley.wiitools; import android.content.Context; import com.facebook.stetho.Stetho; import com.huxley.wiitools.utils.logger.AndroidLogAdapter; import com.huxley.wiitools.utils.logger.Logger; import com.huxley.wiitools.utils.logger.PrettyFormatStrategy; import com.huxley.wiitools.wiiCrash.WiiCrash; import com.huxley.wiitools.wiiCrash.mailreporter.CrashEmailReporter; import cn.bmob.v3.Bmob; import cn.bmob.v3.BmobConfig; /** * Created by huxley on 2017/4/19. */ public class WiiTools { public Context mContext; public static WiiTools instance; private WiiTools(Context context) { this.mContext = context; } public static WiiTools init(Context context) { return instance = new WiiTools(context); } public static WiiTools getInstance() { return instance; } public WiiTools initSinaEmailCrash(String emailName, String emailPassword) { return initEmailCrash(emailName, emailName, emailPassword, "smtp.sina.com", "465"); } public WiiTools initEmailCrash(String receive, String sender, String sendPassword, String smtpHost, String port) { WiiCrash.getInstance().init( new CrashEmailReporter().setReceiver(receive) .setSender(sender) .setSendPassword(<PASSWORD>) .setSMTPHost(smtpHost) .setPort(port) ); return this; } public WiiTools initLog(final boolean isLog, String tag) { Logger.addLogAdapter( new AndroidLogAdapter(PrettyFormatStrategy.newBuilder() .showThreadInfo(false) .methodCount(0) .methodOffset(7) .tag(tag) .build() ) { @Override public boolean isLoggable(int priority, String tag) { return isLog; } }); return this; } public WiiTools initStetho() { Stetho.initializeWithDefaults(mContext); return this; } public WiiTools initBmob(String applicationID) { BmobConfig config = new BmobConfig.Builder(mContext) .setApplicationId(applicationID) //设置appkey .setConnectTimeout(30) //请求超时时间(单位为秒):默认15s .setUploadBlockSize(1024 * 1024) //文件分片上传时每片的大小(单位字节),默认512*1024 .setFileExpiration(2500) //文件的过期时间(单位为秒):默认1800s .build(); Bmob.initialize(config); return this; } }<file_sep>package com.huxley.wiitools.companyUtils.yscm.model.bean; import java.io.Serializable; ////////////////////////////////////////////////////////// // // 我们的征途是星辰大海 // // .....∵ ∴★.∴∵∴ ╭ ╯╭ ╯╭ ╯╭ ╯∴∵∴∵∴ // .☆.∵∴∵.∴∵∴▍▍ ▍▍ ▍▍ ▍▍☆ ★∵∴ // ▍.∴∵∴∵.∴▅███████████☆ ★∵ // ◥█▅▅▅▅███▅█▅█▅█▅█▅█▅███◤ // . ◥███████████████████◤ // ....◥████████████████■◤ // // Created by huxley on 2017/10/12. // ////////////////////////////////////////////////////////// public class YscmResultBean implements Serializable { // 图片前缀地址 public String httpImgDomain; // 返回代码0成功1失败 不跳到登录页面2失败跳到登陆页面 public String code; // 提示信息,可直接弹出或者toast出msg public String msg; // code=0,返回成功值的类型0 Object 1 List 2 map 3字符串 public String rtnType; // 系统时间戳,例如1440037096786 public String sysTime; // code=0,返回成功的json字符串 public String rtnValues; } <file_sep>package com.huxley.wiitools.utils; import com.huxley.wiitools.WiiTools; import java.io.BufferedWriter; import java.io.Closeable; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; /** * File 工具类 * Created by huxley on 2017/4/20. */ public class FileUtils { public static File getFile(String name) { return new File(WiiTools.instance.mContext.getFilesDir(), name); } public static boolean deleteFile(File file) { return file.delete(); } public static void writeThrowable(File file, String tag, String message, Throwable tr) { if (!checkOrCreateFile(file)) { return; } String time = DateUtils.getCurrentTime("MM-dd HH:mm:ss.SSS"); synchronized (file) { FileWriter fileWriter = null; BufferedWriter bufdWriter = null; PrintWriter printWriter = null; try { fileWriter = new FileWriter(file, true); bufdWriter = new BufferedWriter(fileWriter); printWriter = new PrintWriter(fileWriter); bufdWriter.append(time).append(" ").append("E").append('/').append(tag).append(" ") .append(message).append('\n'); bufdWriter.flush(); tr.printStackTrace(printWriter); printWriter.flush(); fileWriter.flush(); } catch (IOException e) { closeQuietly(fileWriter, bufdWriter, printWriter); } } } public static boolean checkOrCreateFile(File file) { if (file == null) { return false; } if (!file.getParentFile().mkdirs()) { return false; } if (file.exists()) { return true; } try { return file.createNewFile(); } catch (IOException e) { e.printStackTrace(); return false; } } /** * 安静关闭IO */ public static void closeQuietly(Closeable... closeables) { if (closeables == null) return; try { for (Closeable closeable : closeables) { if (closeable != null) { closeable.close(); } } } catch (IOException ignored) { } } } <file_sep>// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.0' classpath 'com.novoda:bintray-release:0.3.4' } } allprojects { repositories { jcenter() mavenCentral() maven { url 'https://dl.bintray.com/huangweiyi/maven' } //Bmob的maven仓库地址--必填 maven { url "https://raw.github.com/bmob/bmob-android-sdk/master" } } } task clean(type: Delete) { delete rootProject.buildDir } ext{ minSdkVersion = 21 targetSdkVersion = 25 compileSdkVersion = 25 buildToolsVersion = '25.0.1' versionCode = 3 versionName = '1.2' supportLibVersion = '25.1.0' lombok = '1.12.6' retrofit = '2.2.0' multitype = '3.1.0' bmob = '3.5.5' stetho = '1.5.0' fileprovider = '1.0.0' easypermissions = '1.0.1' glide = '3.7.0' }<file_sep>package com.huxley.wiitools.companyUtils.acce; import com.huxley.wiitools.companyUtils.acce.model.bean.ResultBean; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; import retrofit2.http.POST; import rx.Observable; /** * Created by huxley on 2017/3/25. */ public interface AcceApi { @FormUrlEncoded @POST("api/auth") Observable<ResultBean<Object>> apiAuth( @Field("serviceCode") String serviceCode, @Field("business") String business ); @FormUrlEncoded @POST("sms/message") Observable<ResultBean<Object>> smsMessage( @Field("serviceCode") String serviceCode, @Field("business") String business ); @FormUrlEncoded @POST("api/iocar") Observable<ResultBean<Object>> apiIocar( @Field("serviceCode") String serviceCode, @Field("business") String business ); } <file_sep>package com.huxley.wiitoolssample; import android.content.Intent; import android.os.Bundle; import android.os.Message; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import com.huxley.wiitools.handlerBus.HandlerBus; import com.huxley.wiitools.handlerBus.IHandler; import com.huxley.wiitoolssample.sample.bilibili.BilibiliActivity; import com.huxley.wiitoolssample.testMagicIndicator.example.ExampleMainActivity; import java.text.MessageFormat; public class MainActivity extends AppCompatActivity { public Button mBtnTestHandlerBus; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mBtnTestHandlerBus = (Button) findViewById(R.id.btn_test_handler_bus); HandlerBus.getInstance().register(MainActivity.class, new IHandler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case 1: mBtnTestHandlerBus.setText( MessageFormat.format("{0}{1}", msg.obj, msg.what)); break; case 2: mBtnTestHandlerBus.setText( MessageFormat.format("{0}{1}", msg.obj, msg.what)); break; } } }); // AcceUserModel.getInstance().setAtUserId("15565502588"); // AcceHttpModel.getInstance() // .setUrl(App.Url.API_AUTO) // .setServiceCode(App.ServiceCode.LOGIN) // .addBusiness("phoneNum", "15565502588") // .addBusiness("pwd", AcceTools.getEnPassword("<PASSWORD>")) // .post(new AcceSubscriber<String>() { // @Override // public void onSuccess(String userBean) { // WiiLog.i("1111"); // WiiLog.json(userBean); // } // // // @Override // public void onError(String msg) { // WiiLog.i("2222"); // WiiLog.i(msg); // } // }); } public void testToast(View view) { startActivity(new Intent(this, TestToastActivity.class)); } public void testHandlerBus(final View view) { startActivity(new Intent(this, TestHandlerBusActivity.class)); } public void testInput(View view) { startActivity(new Intent(this, TestInputActivity.class)); } public void testDialog(View view) { startActivity(new Intent(this, TestDialogActivity.class)); } public void testSelectDate(View view) { startActivity(new Intent(this, TestSelectDateActivity.class)); } public void testSopfix(View view) { startActivity(new Intent(this, TestSopfixActivity.class)); } public void testMultiType(View view) { startActivity(new Intent(this, BilibiliActivity.class)); } public void testStatusButton(View view) { startActivity(new Intent(this, TestButtonActivity.class)); } public void testMagicIndicator(View view) { startActivity(new Intent(this, ExampleMainActivity.class)); } public void testCamera(View view) { startActivity(new Intent(this, TestCameraActivity.class)); } } <file_sep>package com.huxley.wiitools.utils; /** * Created by huxley on 2017/4/28. */ public class StringUtils { /** * is null or its length is 0 or it is made by space * * isBlank(null) = true; * isBlank(&quot;&quot;) = true; * isBlank(&quot; &quot;) = true; * isBlank(&quot;a&quot;) = false; * isBlank(&quot;a &quot;) = false; * isBlank(&quot; a&quot;) = false; * isBlank(&quot;a b&quot;) = false; */ public static boolean isBlank(String str) { return (str == null || str.trim().length() == 0); } /** * is null or its length is 0 * * isEmpty(null) = true; * isEmpty(&quot;&quot;) = true; * isEmpty(&quot; &quot;) = false; */ public static boolean isEmpty(String str) { return (str == null || str.length() == 0) && isBlank(str); } } <file_sep>package com.huxley.wiitoolssample; import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.support.v7.app.AppCompatActivity; import android.view.View; import com.huxley.wiitools.view.WiiToast; import com.huxley.wiitools.view.dialog.CommonDialogFragment; import com.huxley.wiitools.view.dialog.DialogFragmentHelper; import com.huxley.wiitools.view.dialog.IDialogResultListener; import java.util.Calendar; public class TestDialogActivity extends AppCompatActivity { private DialogFragment mDialogFragment; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.test_dialog_activity); } /** * 选择时间的弹出窗 */ public void showTimeDialog(View view) { // String titleTime = "请选择时间"; Calendar calendarTime = Calendar.getInstance(); DialogFragmentHelper.showTimeDialog(getSupportFragmentManager(), null, calendarTime, new IDialogResultListener<Calendar>() { @Override public void onDataResult(Calendar result) { WiiToast.info(String.valueOf(result.getTime().getDate())); } }, true); } /** * 输入密码的弹出窗 */ public void showPasswordInsertDialog(View view) { String titlePassword = "<PASSWORD>"; DialogFragmentHelper.showPasswordInsertDialog(getSupportFragmentManager(), titlePassword, new IDialogResultListener<String>() { @Override public void onDataResult(String result) { WiiToast.info("密码为:" + result); } }, true); } /** * 显示列表的弹出窗 */ public void showListDialog(View view) { String titleList = "选择哪种方向?"; final String [] languanges = new String[]{"Android", "iOS", "web 前端", "Web 后端", "老子不打码了"}; DialogFragmentHelper.showListDialog(getSupportFragmentManager(), titleList, languanges, new IDialogResultListener<Integer>() { @Override public void onDataResult(Integer result) { WiiToast.info(languanges[result]); } }, true); } /** * 两个输入框的弹出窗 */ public void showIntervalInsertDialog(View view) { String title = "请输入想输入的内容"; DialogFragmentHelper.showIntervalInsertDialog(getSupportFragmentManager(), title, new IDialogResultListener<String[]>() { @Override public void onDataResult(String[] result) { WiiToast.info(result[0] + result[1]); } }, true); } /** * 一个输入框的弹出窗 */ public void showInsertDialog(View view) { String titleInsert = "请输入想输入的内容"; DialogFragmentHelper.showInsertDialog(getSupportFragmentManager(), titleInsert, new IDialogResultListener<String>() { @Override public void onDataResult(String result) { WiiToast.info(result); } }, true); } /** * 选择日期的弹出窗 */ public void showDateDialog(View view) { // String titleDate = "请选择日期"; Calendar calendar = Calendar.getInstance(); mDialogFragment = DialogFragmentHelper.showDateDialog(getSupportFragmentManager(), null, calendar, new IDialogResultListener<Calendar>() { @Override public void onDataResult(Calendar result) { WiiToast.info(String.valueOf(result.getTime().getDate())); } }, true); } /** * 确认和取消的弹出窗 */ public void showConfirmDialog(View view) { DialogFragmentHelper.showConfirmDialog(getSupportFragmentManager(), "是否选择 Android?", new IDialogResultListener<Integer>() { @Override public void onDataResult(Integer result) { WiiToast.info("You Click Ok = " + result); } }, true, new CommonDialogFragment.OnDialogCancelListener() { @Override public void onCancel() { WiiToast.info("You Click Cancel"); } }); } public void showTips(View view) { DialogFragmentHelper.showTips(getSupportFragmentManager(), "你进入了无网的异次元中"); } public void showProgress(View view) { mDialogFragment = DialogFragmentHelper.showProgress(getSupportFragmentManager(), "true", true); } public void showProgress1(View view) { mDialogFragment = DialogFragmentHelper.showProgress(getSupportFragmentManager(), "false", false); } } <file_sep>package com.huxley.wiitools.handlerBus; import android.os.Handler; import android.os.Message; import android.util.SparseArray; import java.lang.ref.SoftReference; import java.util.HashMap; /** * Created by huxley on 2017/4/21. */ public class WiiHandler extends Handler { private static WiiHandler instance; private SparseArray<SoftReference<IHandler>> mHandlerList; private HandlerBus mHandlerBus; private HashMap<String, Object> tempMap = new HashMap<>(); private WiiHandler() { mHandlerList = new SparseArray<>(); } public synchronized static WiiHandler getInstance() { if (instance == null) { synchronized (WiiHandler.class) { if (instance == null) { instance = new WiiHandler(); } } } return instance; } @Override public void handleMessage(Message msg) { if (mHandlerList != null && mHandlerList.size() > 0) { if (mHandlerBus != null) { SoftReference<IHandler> reference = mHandlerList.get(mHandlerBus.getHandlerId()); if (reference != null) { IHandler ihandler = reference.get(); if (ihandler != null) { ihandler.handleMessage(msg); } } } else { System.out.println("handleMessage>>>>handler获取Key接口为空"); } } } public void register(Class<?> clazz, IHandler iHandler) { if (mHandlerBus != null && clazz != null) { mHandlerList.put(mHandlerBus.getHandlerId(), new SoftReference<>(iHandler)); for (String s : tempMap.keySet()) { if (s.contains(clazz.getName())) { int tag = Integer.parseInt(s.split(clazz.getName())[1]); Message message = this.obtainMessage(); message.what = tag; message.obj = tempMap.get(s); this.sendMessage(message); tempMap.remove(s); break; } } } else { System.out.println("register>>>handler获取Key接口为空"); } } /** * 发送message信息个handler */ public void post(Class clazz, int tag, Object obj) { if (mHandlerList.get(mHandlerBus.getHandlerId()) == null) { tempMap.put(clazz.getName() + tag, obj); } else { Message message = this.obtainMessage(); message.what = tag; message.obj = obj; this.sendMessage(message); } } /** * 清除SparseArray集合中指定键的软引用的数据 (!--Key是通过接口获取的,只需要调用此方法即可) */ public void unregister() { if (mHandlerList != null && mHandlerList.size() > 0) { if (mHandlerBus != null) { SoftReference<IHandler> reference = mHandlerList.get(mHandlerBus.getHandlerId()); if (reference != null) { reference.clear(); mHandlerList.remove(mHandlerBus.getHandlerId()); } } else { System.out.println("unregister>>>handler获取Key接口为空"); } } } /** * 清除SparseArray集合里面所有值 */ public void unregisterAll() { if (mHandlerList != null && mHandlerList.size() > 0) { for (int i = 0; i < mHandlerList.size(); i++) { mHandlerList.valueAt(i).clear(); } mHandlerList.clear(); } } public void setHandlerBus(HandlerBus handlerBus) { this.mHandlerBus = handlerBus; } }<file_sep>package com.huxley.wiitoolssample; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.view.View; import com.huxley.wiitools.handlerBus.HandlerBus; /** * Created by huxley on 2017/4/26. */ public class TestHandlerBusActivity extends AppCompatActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.test_handler_bus_activity); } public void close(View view) { HandlerBus.getInstance().post(MainActivity.class, 1, "HandlerBus 成功了"); finish(); } }
824f9c6797d8fd24a50f84c5fc6a1fe3c449fff6
[ "Markdown", "Java", "Gradle" ]
26
Java
wii-huxley/WiiTools
41405e195590e0077b31d185e3e9c0f200df0c1d
97408044824f06d07e4881d8fb62d6a51cff6b7f
refs/heads/master
<repo_name>stevenwanuk/ProjectEulerSample<file_sep>/src/com/sven/euler/sample/Problem2.java package com.sven.euler.sample; public class Problem2 { /* * <P>https://projecteuler.net/problem=2</P> Even Fibonacci numbers Problem 2 Each new * term in the Fibonacci sequence is generated by adding the previous two terms. By * starting with 1 and 2, the first 10 terms will be: * * 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... * * By considering the terms in the Fibonacci sequence whose values do not exceed four * million, find the sum of the even-valued terms. */ public static void main(String[] args) { int max = 4000000; int a = 1; int b = 2; int sum = b; while (true) { if (b >= max) { break; } int c = a + b; a = b; b = c; if (c%2==0) { sum += c; } } System.out.println(sum); } }
6cd714faeaf2db146d11f6cab80a46bc7ba133e8
[ "Java" ]
1
Java
stevenwanuk/ProjectEulerSample
8af5ffd604246ae3587de449123d658bfd456e71
97e6f38f524f4b205020023f2ea725677990bb6c
refs/heads/master
<repo_name>EncryptedCookie/PythonMaze<file_sep>/Maze Test.py # coding=utf-8 from msvcrt import getch levelOne = {'level': list('''█ █ █ █ █ █ █ █ █ █ ▓ █ ░ ░ ░ ░ ▒ █ █ ░ █ ░ █ █ █ █ █ █ ░ █ ░ ░ ░ ░ ░ █ █ ░ █ █ █ █ █ ░ █ █ ░ █ ░ ░ ░ █ ░ █ █ ░ █ ░ █ ░ █ ░ █ █ ░ ░ ░ █ ░ ░ ░ █ █ █ █ █ █ █ █ █ █ '''), 'playerIndex': 40, 'width': 36} levelTwo = {'level': list('''█ █ █ █ █ █ █ █ █ █ █ █ █ ▓ ░ ░ ░ ░ █ ░ ░ ░ ░ █ █ █ █ █ █ ░ █ ░ █ █ ░ █ █ ░ ░ ░ ░ ░ █ █ █ ░ ░ █ █ ░ █ █ █ ░ █ ░ ░ ░ ░ █ █ ░ ░ █ ░ ░ █ ░ █ █ ░ █ █ █ ░ █ ░ █ █ ▒ █ ░ ░ █ █ ░ ░ █ ░ ░ █ █ █ ░ █ █ █ ░ █ █ █ █ █ ░ █ ░ ░ █ █ ░ ░ ░ █ ░ ░ ░ █ █ ░ █ █ ░ █ ░ ░ ░ █ ░ ░ ░ ░ █ █ █ █ █ █ █ █ █ █ █ █ █ '''), 'playerIndex': 52, 'width': 48} levelThree = {'level': list('''█ █ █ █ █ █ █ █ █ █ █ █ █ █ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ █ █ ░ █ █ █ █ █ █ █ █ █ ░ █ █ ▓ █ ░ ░ ░ ░ ░ ░ ░ █ ░ █ █ █ █ ░ █ █ ░ █ █ █ █ ░ █ █ ░ ░ ░ █ ░ ░ ░ █ ░ █ ░ █ █ ░ █ ░ █ ░ ▒ ░ █ ░ ░ ░ █ █ ░ █ ░ █ ░ ░ ░ █ ░ █ ░ █ █ ░ █ ░ █ █ █ █ █ ░ █ ░ █ █ ░ █ ░ ░ █ ░ ░ ░ ░ █ ░ █ █ ░ █ █ █ █ ░ █ █ █ █ ░ █ █ ░ ░ ░ ░ ░ ░ ░ ░ █ ░ ░ █ █ █ █ █ █ █ █ █ █ █ █ █ █ '''), 'playerIndex': 160, 'width': 52} levelFour = {'level': list('''█ █ █ █ █ █ █ █ █ █ ▓ ░ ░ ░ ░ ░ ▒ █ █ █ █ █ █ █ █ █ █ '''), 'playerIndex': 40, 'width': 36} levelFive = {'level': list('''█ █ █ █ █ █ █ █ █ █ ▓ ░ ░ ░ ░ ░ ▒ █ █ █ █ █ █ █ █ █ █ '''), 'playerIndex': 40, 'width': 36} currentMaze = {'level': '', 'playerIndex': 0, 'width': 0, 'number': 1} def import_maze(mazeNumber): if mazeNumber == 1: currentMaze['level'] = levelOne['level'] currentMaze['playerIndex'] = levelOne['playerIndex'] currentMaze['width'] = levelOne['width'] elif mazeNumber == 2: currentMaze['level'] = levelTwo['level'] currentMaze['playerIndex'] = levelTwo['playerIndex'] currentMaze['width'] = levelTwo['width'] elif mazeNumber == 3: currentMaze['level'] = levelThree['level'] currentMaze['playerIndex'] = levelThree['playerIndex'] currentMaze['width'] = levelThree['width'] elif mazeNumber == 4: currentMaze['level'] = levelFour['level'] currentMaze['playerIndex'] = levelFour['playerIndex'] currentMaze['width'] = levelFour['width'] elif mazeNumber == 5: currentMaze['level'] = levelFive['level'] currentMaze['playerIndex'] = levelFive['playerIndex'] currentMaze['width'] = levelFive['width'] def get_goal(): if currentMaze['number'] != 5: currentMaze['number'] += 1 import_maze(currentMaze['number']) elif currentMaze['number'] == 5: print "You win!" def move_player(direction): if direction == "up" and currentMaze['level'][currentMaze['playerIndex'] - currentMaze['width']:currentMaze['playerIndex'] - currentMaze['width'] + 3] == ['\xe2','\x96','\x91']: currentMaze['level'][currentMaze['playerIndex'] - currentMaze['width']:currentMaze['playerIndex'] - currentMaze['width'] + 3] = '\xe2', '\x96', '\x93' # Moves the player up currentMaze['level'][currentMaze['playerIndex']:currentMaze['playerIndex'] + 3] = '\xe2', '\x96', '\x91' # Makes the old space empty currentMaze['playerIndex'] -= currentMaze['width'] return ''.join(currentMaze['level']) elif direction == "up" and currentMaze['level'][currentMaze['playerIndex'] - currentMaze['width']:currentMaze['playerIndex'] - currentMaze['width'] + 3] == ['\xe2','\x96','\x92']: get_goal() return ''.join(currentMaze['level']) if direction == "down" and currentMaze['level'][currentMaze['playerIndex'] + currentMaze['width']:currentMaze['playerIndex'] + currentMaze['width'] + 3] == ['\xe2', '\x96', '\x91']: currentMaze['level'][currentMaze['playerIndex'] + currentMaze['width']:currentMaze['playerIndex'] + currentMaze['width'] + 3] = '\xe2', '\x96', '\x93' # Moves the player down currentMaze['level'][currentMaze['playerIndex']:currentMaze['playerIndex'] + 3] = '\xe2', '\x96', '\x91' # Makes the old space empty currentMaze['playerIndex'] += currentMaze['width'] return ''.join(currentMaze['level']) elif direction == "down" and currentMaze['level'][currentMaze['playerIndex'] + currentMaze['width']:currentMaze['playerIndex'] + currentMaze['width'] + 3] == ['\xe2', '\x96', '\x92']: get_goal() return ''.join(currentMaze['level']) if direction == "left" and currentMaze['level'][currentMaze['playerIndex'] - 4:currentMaze['playerIndex'] - 1] == ['\xe2', '\x96','\x91']: currentMaze['level'][currentMaze['playerIndex'] - 4:currentMaze['playerIndex'] - 1] = '\xe2', '\x96', '\x93' # Moves the player left currentMaze['level'][currentMaze['playerIndex']:currentMaze['playerIndex'] + 3] = '\xe2', '\x96', '\x91' # Makes the old space empty currentMaze['playerIndex'] -= 4 return ''.join(currentMaze['level']) elif direction == "left" and currentMaze['level'][currentMaze['playerIndex'] - 4:currentMaze['playerIndex'] - 1] == ['\xe2', '\x96','\x92']: get_goal() return ''.join(currentMaze['level']) if direction == "right" and currentMaze['level'][currentMaze['playerIndex'] + 4:currentMaze['playerIndex'] + 7] == ['\xe2', '\x96','\x91']: currentMaze['level'][currentMaze['playerIndex'] + 4:currentMaze['playerIndex'] + 7] = '\xe2', '\x96', '\x93' # Moves the player right currentMaze['level'][currentMaze['playerIndex']:currentMaze['playerIndex'] + 3] = '\xe2', '\x96', '\x91' # Makes the old space empty currentMaze['playerIndex'] += 4 return ''.join(currentMaze['level']) elif direction == "right" and currentMaze['level'][currentMaze['playerIndex'] + 4:currentMaze['playerIndex'] + 7] == ['\xe2', '\x96','\x92']: get_goal() return ''.join(currentMaze['level']) import_maze(1) print(''.join(currentMaze['level'])) while True: key = ord(getch()) if key == 72: print(move_player("up")) elif key == 80: print(move_player("down")) elif key == 75: print(move_player("left")) elif key == 77: print(move_player("right")) <file_sep>/README.md # PythonMaze A text-based maze game I'm working on in Python 2.7
b790f702cb459b9f933eb18df24ba097158511a0
[ "Markdown", "Python" ]
2
Python
EncryptedCookie/PythonMaze
9b6a0988136f1dff9fd7adc2d5904cc3a1b7085c
f266cb2cefc43470888f6f61f5e7308ba2ad3501
refs/heads/master
<repo_name>kwmorris/TtR-Calc<file_sep>/app/src/main/java/com/labs/odyn/ttrcalc/Player.java package com.labs.odyn.ttrcalc; public class Player { //Player Id Number private int id; public void setId(int ID){ id = ID; } public int getId() { return id; } //Player Name private String name; public void setName(String pName){ name = pName; } public String getName(){ return name; } //Player Trains Remaining private int trains; public void setTrains(int pTrains) { trains = pTrains; } public int getTrains() { return trains; } //Player Score private int score; public void setScore(int pScore){ score = pScore; } public int getScore(){ return score; } //Player Color Index private int color; public void setColor(int pColor){ color = pColor; } public int getColor() { return color; } //Active Player private boolean isActive; public void setIsActive(boolean pIsActive) { isActive = pIsActive; } public boolean getIsActive(){ return isActive; } } <file_sep>/app/src/main/java/com/labs/odyn/ttrcalc/EditFragment.java package com.labs.odyn.ttrcalc; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import it.gmariotti.cardslib.library.internal.Card; import it.gmariotti.cardslib.library.view.CardViewNative; public class EditFragment extends Fragment { private static EditCard cardEdit1; private static EditCard cardEdit2; private static EditCard cardEdit3; private static EditCard cardEdit4; private static EditCard cardEdit5; private static Player player1 = MainActivity.player1; private static Player player2 = MainActivity.player2; private static Player player3 = MainActivity.player3; private static Player player4 = MainActivity.player4; private static Player player5 = MainActivity.player5; public static EditFragment newInstance() { return new EditFragment(); } public EditFragment() { // Required empty public constructor } /*@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); }*/ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_edit, container, false); cardEdit1 = createCard(player1); cardEdit2 = createCard(player2); cardEdit3 = createCard(player3); cardEdit4 = createCard(player4); cardEdit5 = createCard(player5); cardEdit1.setOnClickListener(new EditCard.OnCardClickListener() { @Override public void onClick(Card card, View view) { changeColor(player1); } }); cardEdit2.setOnClickListener(new EditCard.OnCardClickListener() { @Override public void onClick(Card card, View view) { changeColor(player2); } }); cardEdit3.setOnClickListener(new EditCard.OnCardClickListener() { @Override public void onClick(Card card, View view) { changeColor(player3); } }); cardEdit4.setOnClickListener(new EditCard.OnCardClickListener() { @Override public void onClick(Card card, View view) { changeColor(player4); } }); cardEdit5.setOnClickListener(new EditCard.OnCardClickListener() { @Override public void onClick(Card card, View view) { changeColor(player5); } }); CardViewNative edit1View = (CardViewNative) view.findViewById(R.id.cardEdit1); CardViewNative edit2View = (CardViewNative) view.findViewById(R.id.cardEdit2); CardViewNative edit3View = (CardViewNative) view.findViewById(R.id.cardEdit3); CardViewNative edit4View = (CardViewNative) view.findViewById(R.id.cardEdit4); CardViewNative edit5View = (CardViewNative) view.findViewById(R.id.cardEdit5); edit1View.setCard(cardEdit1); edit2View.setCard(cardEdit2); edit3View.setCard(cardEdit3); edit4View.setCard(cardEdit4); edit5View.setCard(cardEdit5); return view; } private EditCard createCard(Player player){ EditCard card = new EditCard(this.getActivity(), player); card.setBackgroundColorResourceId(Colors.getColorLight(player.getColor())); card.setTextColor(getResources().getColor(R.color.textDark)); return card; } private void changeColor(Player p){ int pId = p.getId(); int color = p.getColor(); color++; if (color > 5){ color = 0; } p.setColor(color); switch (pId){ case 1: cardEdit1.setBackgroundColorResourceId(Colors.getColorLight(color)); cardEdit1.notifyDataSetChanged(); break; case 2: cardEdit2.setBackgroundColorResourceId(Colors.getColorLight(color)); cardEdit2.notifyDataSetChanged(); break; case 3: cardEdit3.setBackgroundColorResourceId(Colors.getColorLight(color)); cardEdit3.notifyDataSetChanged(); break; case 4: cardEdit4.setBackgroundColorResourceId(Colors.getColorLight(color)); cardEdit4.notifyDataSetChanged(); break; case 5: cardEdit5.setBackgroundColorResourceId(Colors.getColorLight(color)); cardEdit5.notifyDataSetChanged(); break; } p.setColor(color); } }
6c568b971d90714c0c4d89e6d14930400d19d3d5
[ "Java" ]
2
Java
kwmorris/TtR-Calc
f888dae8f0f0973b6fb0b8444d461915702d8c74
1fd5fd3e3ab3cb268dcb2e25ddb050beb016b3a9
refs/heads/master
<repo_name>Sparkinzy/observer<file_sep>/src/Constacts/ObserverInterface.php <?php /** * Created by PhpStorm. * User: mu * Date: 2019-12-13 * Time: 17:16 */ namespace Mu\Observer\Constacts; interface ObserverInterface { public function handle(); }<file_sep>/demo/Order.php <?php /** * Created by PhpStorm. * User: mu * Date: 2019-12-13 * Time: 16:57 */ include __DIR__ . '/../vendor/autoload.php'; foreach (glob(__DIR__ . '/Observers/*/*Observer.php') as $file) { include $file; } use Mu\Observer\Facades\Subject; class Order { /** * @param $trade_id */ public function delivery(int $trade_id) { $rs = $this->mock_update($trade_id); $order = $this->get_order($trade_id); $orderSubject = new Subject($order); if ($rs['code'] === 0) { $orderSubject->attach(new NotifySellerObserver()); $orderSubject->attach(new NotifyTaobaoObserver()); $orderSubject->notify(); } } /** * * 标记更新 * * @param $trade_id * * @return array */ private function mock_update($trade_id) { return ['code' => 0, 'msg' => 'ok', 'data' => ['trade_ide' => $trade_id]]; } /** * * 获取订单数据 * * @param $trade_id * * @return array */ private function get_order($trade_id) { return [ 'id' => $trade_id, 'receiver_name' => '系统', 'receiver_mobile' => '18982949731' ]; } } $order = new Order(); $order->delivery(123123);<file_sep>/src/Constacts/SubjectInterface.php <?php /** * Created by PhpStorm. * User: mu * Date: 2019-12-13 * Time: 15:12 */ namespace Mu\Observer\Constacts; use Mu\Observer\Facades\Observer; /** * 被观察者 - 导演 - 船长 - 发布命令者 * Interface SubjectInterface * @package Mu\Observer\Constacts */ interface SubjectInterface { public function __construct($object); public function attach(Observer $observer); // 添加观察者对象 public function detach(Observer $observer); // 删除观察者对象 public function notify(); // 通知观察者执行相应功能 }<file_sep>/src/Facades/Subject.php <?php /** * Created by PhpStorm. * User: mu * Date: 2019-12-13 * Time: 15:36 */ namespace Mu\Observer\Facades; use Mu\Observer\Constacts\SubjectInterface; class Subject implements SubjectInterface { /** * 所有观察者 * @var array */ private $observers = []; /** * 观察者中会用到的数据:object * @var mixed */ private $data; public function __construct($object) { if (empty($object)) { $this->data = new \stdClass(); } if (is_array($object)) { $this->data = json_decode(json_encode($object)); } } /** * 添加观察者 * * @param Observer $observer */ public function attach(Observer $observer) { $observer->setData($this->data); $this->observers[] = $observer; } /** * 移除观察者 * * @param Observer $observer * * @return bool */ public function detach(Observer $observer) { $index = array_search($observer, $this->observers); if ($index === false || ! array_key_exists($index, $this->observers)) { return false; } unset($this->observers[$index]); return true; } /** * 当被观察者发生变化时,通知所有观察者 */ public function notify() { foreach ($this->observers as $observer) { $observer->handle(); } } }<file_sep>/README.md <h1 align="center"> observer </h1> <p align="center"> 观察者模式.</p> ## Installing ```shell $ composer require mu/observer -vvv ``` ## Usage ```php # 被观察者 $li_bai = ['title'=>'李白','age'=>9999]; $li_bai['age'] +=1; $subject = new Subject($li_bai); # 观察者 $subject->attach(new AgeObserver()); # 执行观察 $subject->notify(); ``` AgeObserver.php ```php use Mu\Observer\Facades\Observer; class AgeObserver extends Observer { public function handle() { // TODO: Implement handle() method. echo '年龄变更:', PHP_EOL; echo json_encode($this->getData(), JSON_UNESCAPED_UNICODE), PHP_EOL; } } ``` ## Contributing You can contribute in one of three ways: 1. File bug reports using the [issue tracker](https://github.com/sparkinzy/observer/issues). 2. Answer questions or fix bugs on the [issue tracker](https://github.com/sparkinzy/observer/issues). 3. Contribute new features or update the wiki. _The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable._ ## License MIT<file_sep>/src/Subject.php <?php /** * Created by PhpStorm. * User: mu * Date: 2019-12-13 * Time: 13:28 */ namespace Mu\Observer; use Mu\Observer\Constacts\ObserverInterface; /** * 被观察者 * Class SubjectInterface * @package Mu\Observer */ class Subject { private $state; private $observers = []; public function getState() { return $this->state; } public function setState($state) { $this->state = $state; $this->notify(); } public function attach(ObserverInterface $object) { $this->observers[] = $object; } public function detach(ObserverInterface $object) { foreach ($this->observers as $key => $observer) { if ($object == $observer) { unset($this->observers[$key]); } } } public function notify() { foreach ($this->observers as $observer) { $observer->update(); } } }<file_sep>/demo/Observers/TradeObservers/NotifySellerObserver.php <?php /** * Created by PhpStorm. * User: mu * Date: 2019-12-13 * Time: 17:02 */ use Mu\Observer\Facades\Observer; class NotifySellerObserver extends Observer { public function handle() { // TODO: Implement handle() method. echo '通知卖家发货', PHP_EOL; echo json_encode($this->getData(), JSON_UNESCAPED_UNICODE), PHP_EOL; } }<file_sep>/demo/Observers/TradeObservers/NotifyTaobaoObserver.php <?php /** * Created by PhpStorm. * User: mu * Date: 2019-12-13 * Time: 17:02 */ use Mu\Observer\Facades\Observer; class NotifyTaobaoObserver extends Observer { public function handle() { // TODO: Implement handle() method. echo '通知淘宝发货',PHP_EOL; echo json_encode($this->getData(),JSON_UNESCAPED_UNICODE),PHP_EOL; } }<file_sep>/src/Facades/Observer.php <?php /** * Created by PhpStorm. * User: mu * Date: 2019-12-13 * Time: 17:19 */ namespace Mu\Observer\Facades; use Mu\Observer\Constacts\ObserverInterface; class Observer implements ObserverInterface { private $object; public function setData($data) { $this->object = $data; } public function getData() { return $this->object; } public function handle() { // TODO: Implement handle() method. } }
172b116468894f1bdc9b6f94f23950a00ef66e67
[ "Markdown", "PHP" ]
9
PHP
Sparkinzy/observer
6081da6162def604d8ae187b62d24c4e5f3d2260
ecf1c13bd725093552f1548fa4097437ce4c3ed3
refs/heads/master
<file_sep> //setting addclass function showsetting(){ let setting_cntnt = document.querySelectorAll(".profile_setting")[0]; let home_anim = document.querySelectorAll(".home_animtion")[0]; setting_cntnt.classList.add("settingaddclass"); home_anim.classList.add("addhome_animation"); } function hidesetting(){ let setting_cntnt = document.querySelectorAll(".profile_setting")[0]; let home_anim = document.querySelectorAll(".home_animtion")[0]; setting_cntnt.classList.remove("settingaddclass"); home_anim.classList.remove("addhome_animation"); } document.querySelectorAll(".home_setting_btn")[0].addEventListener("click", showsetting); document.querySelectorAll(".removeclass")[0].addEventListener("click", hidesetting); //number addclass function shownumber(){ let mobile_number = document.querySelectorAll(".number_setting")[0]; let setting_cntnt = document.querySelectorAll(".profile_setting")[0]; mobile_number.classList.add("numberaddclass"); setting_cntnt.classList.add("number_animation"); } function hidenumber(){ let mobile_number = document.querySelectorAll(".number_setting")[0]; let setting_cntnt = document.querySelectorAll(".profile_setting")[0]; mobile_number.classList.remove("numberaddclass"); setting_cntnt.classList.remove("number_animation"); } document.querySelectorAll(".mobile_number")[0].addEventListener("click", shownumber); document.querySelectorAll(".removeclass")[1].addEventListener("click", hidenumber); //number update addclass function showupdatenumber(){ let mobile_number = document.querySelectorAll(".update_number_cntnt")[0]; let setting_cntnt = document.querySelectorAll(".number_setting")[0]; mobile_number.classList.add("left_divs_show"); setting_cntnt.classList.add("number_animation"); } function hideupdatenumber(){ let mobile_number = document.querySelectorAll(".update_number_cntnt")[0]; let setting_cntnt = document.querySelectorAll(".number_setting")[0]; mobile_number.classList.remove("left_divs_show"); setting_cntnt.classList.remove("number_animation"); } document.querySelectorAll(".phone_numbers")[0].addEventListener("click", showupdatenumber); document.querySelectorAll(".removeclass")[2].addEventListener("click", hideupdatenumber); //Otp addclass function showotp(){ let mobile_number = document.getElementById("otp_animtion"); let setting_cntnt = document.getElementById("ubdate_number"); mobile_number.classList.add("left_divs_show"); setting_cntnt.classList.add("number_animation"); } function hideotp(){ let mobile_number = document.getElementById("otp_animtion"); let setting_cntnt = document.getElementById("ubdate_number"); mobile_number.classList.remove("left_divs_show"); setting_cntnt.classList.remove("number_animation"); } document.querySelectorAll("#cuntinue_btn2")[0].addEventListener("click", showotp); document.querySelectorAll(".otp_remove")[0].addEventListener("click", hideotp); //Otp send Modal function show_modal(){ let modal_id = document.getElementById("send_otp_modal"); modal_id.classList.add("modal_show"); } document.getElementById("otp_resend_btn").addEventListener("click", show_modal); document.getElementById("otp_resend_btn").addEventListener("click", function(){ setTimeout(function(){ let modal_id = document.getElementById("send_otp_modal"); modal_id.classList.remove("modal_show"); ; }, 4000); }); //Oops addclass function showops(){ let oops_ = document.getElementById("oops_show"); let opt_ani = document.getElementById("otp_animtion"); oops_.classList.add("left_divs_show"); opt_ani.classList.add("number_animation"); } function hideops(){ let oops_ = document.getElementById("oops_show"); let opt_ani = document.getElementById("otp_animtion"); oops_.classList.remove("left_divs_show"); opt_ani.classList.remove("number_animation"); } document.getElementById("cuntinue_btn3").addEventListener("click", showops); document.getElementById("oops_remove").addEventListener("click", hideops); //loginemail addclass function email_login_show(){ let login_email = document.getElementById("login_email2"); let update2 = document.getElementById("ubdate_number"); login_email.classList.add("left_divs_show"); update2.classList.add("number_animation"); } function email_login_hide(){ let login_email = document.getElementById("login_email2"); let update2 = document.getElementById("ubdate_number"); login_email.classList.remove("left_divs_show"); update2.classList.remove("number_animation"); } document.getElementById("login_email").addEventListener("click", email_login_show); document.getElementById("loginemail_remove").addEventListener("click", email_login_hide); // oninput function ininput_showbtn() { var number_value = document.getElementById("myInput").value; var number_btn = document.getElementById("cuntinue_btn2"); if(number_value == ""){ number_btn.classList.remove("bgclr"); } else{ number_btn.classList.add("bgclr"); } } function ininput_showbtn2() { var number_value = document.getElementById("myInput2").value; var number_btn = document.getElementById("cuntinue_btn2"); if(number_value == ""){ number_btn.classList.remove("bgclr"); } else{ number_btn.classList.add("bgclr"); } } // otp function keyfressFun1() { var back_ = document.getElementById("otp_input1").value; if (back_[0] == null) { document.getElementById("otp_input1").focus(); }else{ document.getElementById("otp_input2").focus(); } } function keyfressFun2() { var back_1 = document.getElementById("otp_input2").value; if (back_1[0] == null) { document.getElementById("otp_input1").select(focus()); }else{ document.getElementById("otp_input3").select(focus()); } } function keyfressFun3() { var back_2 = document.getElementById("otp_input3").value; if (back_2[0] == null) { document.getElementById("otp_input2").select(focus()); }else{ document.getElementById("otp_input4").select(focus()); } } function keyfressFun4() { var back_3 = document.getElementById("otp_input4").value; if (back_3[0] == null) { document.getElementById("otp_input3").select(focus()); }else{ document.getElementById("otp_input5").select(focus()); } } function keyfressFun5() { var back_4 = document.getElementById("otp_input5").value; if (back_4[0] == null) { document.getElementById("otp_input4").select(focus()); }else{ document.getElementById("otp_input6").select(focus()); } } function keyfressFun6() { var back_5 = document.getElementById("otp_input6").value; if (back_5[0] == null ) { document.getElementById("otp_input5").select(focus()); document.getElementById("cuntinue_btn3").classList.remove("bgclr"); }else{ document.getElementById("otp_input6").select(focus()); document.getElementById("cuntinue_btn3").classList.add("bgclr"); } } // location show and hide function location_show(){ let loction_div = document.querySelectorAll(".locationhide_cntnt")[0]; document.getElementById("myloction_btn").style.display = "none"; loction_div.classList.add("heightshow"); } document.getElementById("myloction_btn").addEventListener("click", location_show); //show me moman addclass function woman_show(){ let show_me = document.getElementById("show_me_woman_cntnt"); let update3 = document.getElementById("profile_setting"); show_me.classList.add("left_divs_show"); update3.classList.add("number_animation"); } function woman_hide(){ let show_me = document.getElementById("show_me_woman_cntnt"); let update3 = document.getElementById("profile_setting"); show_me.classList.remove("left_divs_show"); update3.classList.remove("number_animation"); } document.getElementById("show_me_women").addEventListener("click", woman_show); document.getElementById("remove_women").addEventListener("click", woman_hide); //Feed me addclass function feedme_show(){ let feed_me = document.getElementById("feed_me"); let update4 = document.getElementById("profile_setting"); feed_me.classList.add("left_divs_show"); update4.classList.add("number_animation"); } function feedme_hide(){ let feed_me = document.getElementById("feed_me"); let update4 = document.getElementById("profile_setting"); feed_me.classList.remove("left_divs_show"); update4.classList.remove("number_animation"); } document.getElementById("show_feed_cntnt").addEventListener("click", feedme_show); document.getElementById("remove_feed").addEventListener("click", feedme_hide); //autoplay addclass function audo_show(){ let audo_play = document.getElementById("audo_play"); let update5 = document.getElementById("profile_setting"); audo_play.classList.add("left_divs_show"); update5.classList.add("number_animation"); } function audoe_hide(){ let audo_play = document.getElementById("audo_play"); let update5 = document.getElementById("profile_setting"); audo_play.classList.remove("left_divs_show"); update5.classList.remove("number_animation"); } document.getElementById("show_auto_cntnt").addEventListener("click", audo_show); document.getElementById("remove_audo").addEventListener("click", audoe_hide); //userName addclass function username_show(){ let username_cntnt = document.getElementById("username_cntnt"); let update6 = document.getElementById("profile_setting"); username_cntnt.classList.add("left_divs_show"); update6.classList.add("number_animation"); } function username_hide(){ let username_cntnt = document.getElementById("username_cntnt"); let update6 = document.getElementById("profile_setting"); username_cntnt.classList.remove("left_divs_show"); update6.classList.remove("number_animation"); } document.getElementById("show_username").addEventListener("click", username_show); document.getElementById("remove_username").addEventListener("click", username_hide); //hugegang addclass function huge_show(){ let hugecntnt = document.getElementById("hugegang_cntnt"); let update7 = document.getElementById("profile_setting"); hugecntnt.classList.add("left_divs_show"); update7.classList.add("number_animation"); } function huge_hide(){ let hugecntnt = document.getElementById("hugegang_cntnt"); let update7 = document.getElementById("profile_setting"); hugecntnt.classList.remove("left_divs_show"); update7.classList.remove("number_animation"); } document.getElementById("show_hugegang").addEventListener("click", huge_show); document.getElementById("remove_hugegang").addEventListener("click", huge_hide); //read receipts addclass function recipts_show(){ let receipts_cntnt = document.getElementById("receipts_cntnt"); let update8 = document.getElementById("profile_setting"); receipts_cntnt.classList.add("left_divs_show"); update8.classList.add("number_animation"); } function recipts_hide(){ let receipts_cntnt = document.getElementById("receipts_cntnt"); let update8 = document.getElementById("profile_setting"); receipts_cntnt.classList.remove("left_divs_show"); update8.classList.remove("number_animation"); } document.getElementById("show_read_receipts").addEventListener("click", recipts_show); document.getElementById("remove_receipts").addEventListener("click", recipts_hide); //swipe addclass function swipe_show(){ let swipe_cntnt = document.getElementById("swipe_cntnt"); let update9 = document.getElementById("profile_setting"); swipe_cntnt.classList.add("left_divs_show"); update9.classList.add("number_animation"); } function swipe_hide(){ let swipe_cntnt = document.getElementById("swipe_cntnt"); let update9 = document.getElementById("profile_setting"); swipe_cntnt.classList.remove("left_divs_show"); update9.classList.remove("number_animation"); } document.getElementById("show_swipe").addEventListener("click", swipe_show); document.getElementById("remove_swipe").addEventListener("click", swipe_hide); //email content addclass function email_cntnt_show(){ let email_notif = document.getElementById("email_notif_cntnt"); let update10 = document.getElementById("profile_setting"); email_notif.classList.add("left_divs_show"); update10.classList.add("number_animation"); } function email_cntnt_hide(){ let email_notif = document.getElementById("email_notif_cntnt"); let update10 = document.getElementById("profile_setting"); email_notif.classList.remove("left_divs_show"); update10.classList.remove("number_animation"); } document.getElementById("show_email_cntnt").addEventListener("click", email_cntnt_show); document.getElementById("remove_email_notif").addEventListener("click", email_cntnt_hide); //push content addclass function push_notifi_show(){ let push_notif = document.getElementById("push_notif_cntnt"); let update11 = document.getElementById("profile_setting"); push_notif.classList.add("left_divs_show"); update11.classList.add("number_animation"); } function push_notifi_hide(){ let push_notif = document.getElementById("push_notif_cntnt"); let update11 = document.getElementById("profile_setting"); push_notif.classList.remove("left_divs_show"); update11.classList.remove("number_animation"); } document.getElementById("push_notif_show").addEventListener("click", push_notifi_show); document.getElementById("remove_push_notif").addEventListener("click", push_notifi_hide); //push content addclass function team_hugegang_show(){ let team_notif = document.getElementById("team_hugegang_cntnt"); let update12 = document.getElementById("profile_setting"); team_notif.classList.add("left_divs_show"); update12.classList.add("number_animation"); } function team_hugegang_hide(){ let team_notif = document.getElementById("team_hugegang_cntnt"); let update12 = document.getElementById("profile_setting"); team_notif.classList.remove("left_divs_show"); update12.classList.remove("number_animation"); } document.getElementById("team_hugegang").addEventListener("click", team_hugegang_show); document.getElementById("remove_team").addEventListener("click", team_hugegang_hide); //add media content addclass function media_show(){ let add_media = document.getElementById("add_media_cntnt"); let home_cntnt = document.getElementById("home_animation_txt"); add_media.classList.add("left_divs_show"); home_cntnt.classList.add("number_animation"); } function media_hide(){ let add_media = document.getElementById("add_media_cntnt"); let home_cntnt = document.getElementById("home_animation_txt"); add_media.classList.remove("left_divs_show"); home_cntnt.classList.remove("number_animation"); } document.getElementById("show_media").addEventListener("click", media_show); document.querySelectorAll(".remove_addmedia_cntnt")[0].addEventListener("click", media_hide); //edit info content addclass function edit_show(){ let edit_info = document.getElementById("edit_info"); let home_cntnt2 = document.getElementById("home_animation_txt"); edit_info.classList.add("left_divs_show"); home_cntnt2.classList.add("number_animation"); } function edit_hide(){ let edit_info = document.getElementById("edit_info"); let home_cntnt2 = document.getElementById("home_animation_txt"); edit_info.classList.remove("left_divs_show"); home_cntnt2.classList.remove("number_animation"); } document.getElementById("show_edit_info").addEventListener("click", edit_show); document.getElementById("remove_edit_info").addEventListener("click", edit_hide); //anthem_setting_add content addclass function anthem_show(){ let feed_me2 = document.getElementById("feed_me"); let edit_info_ani = document.getElementById("edit_info"); feed_me2.classList.add("left_divs_show"); edit_info_ani.classList.add("number_animation"); } function anthem_hide(){ let feed_me2 = document.getElementById("feed_me"); let edit_info_ani = document.getElementById("edit_info"); feed_me2.classList.remove("left_divs_show"); edit_info_ani.classList.remove("number_animation"); } document.getElementById("anthem_setting_add").addEventListener("click", anthem_show); document.getElementById("remove_feed").addEventListener("click", anthem_hide); function anthem_show2(){ let feed_me2 = document.getElementById("feed_me"); let edit_info_ani = document.getElementById("edit_info"); feed_me2.classList.add("left_divs_show"); edit_info_ani.classList.add("number_animation"); } function anthem_hide2(){ let feed_me2 = document.getElementById("feed_me"); let edit_info_ani = document.getElementById("edit_info"); feed_me2.classList.remove("left_divs_show"); edit_info_ani.classList.remove("number_animation"); } document.getElementById("anthem_setting_add2").addEventListener("click", anthem_show2); document.getElementById("remove_feed").addEventListener("click", anthem_hide2); // show man edit function man_show(){ let edit_man = document.getElementById("edit_mans"); let edit_info_ani2 = document.getElementById("edit_info"); edit_man.classList.add("left_divs_show"); edit_info_ani2.classList.add("number_animation"); } function man_hide(){ let edit_man = document.getElementById("edit_mans"); let edit_info_ani2 = document.getElementById("edit_info"); edit_man.classList.remove("left_divs_show"); edit_info_ani2.classList.remove("number_animation"); } document.getElementById("edit_men").addEventListener("click", man_show); document.getElementById("edit_man_remove").addEventListener("click", man_hide); // Sexual edit function sexual_show(){ let edit_exual = document.getElementById("edit_sexual"); let edit_info_ani3 = document.getElementById("edit_info"); edit_exual.classList.add("left_divs_show"); edit_info_ani3.classList.add("number_animation"); } function sexual_hide(){ let edit_exual = document.getElementById("edit_sexual"); let edit_info_ani3 = document.getElementById("edit_info"); edit_exual.classList.remove("left_divs_show"); edit_info_ani3.classList.remove("number_animation"); } document.getElementById("sexual_show").addEventListener("click", sexual_show); document.getElementById("remove_sexual").addEventListener("click", sexual_hide); // Sexual edit function search_location(){ document.getElementById("location_result").style.display = "block"; document.getElementById("nearst_location").style.display = "none"; } document.getElementById("show_search_result").addEventListener("click", search_location); // Sexual edit function schools_lo_show(){ let schools_location = document.getElementById("schools_location"); let edit_info_ani4 = document.getElementById("edit_info"); schools_location.classList.add("left_divs_show"); edit_info_ani4.classList.add("number_animation"); } function schools_lo_hide(){ let schools_location = document.getElementById("schools_location"); let edit_info_ani4 = document.getElementById("edit_info"); schools_location.classList.remove("left_divs_show"); edit_info_ani4.classList.remove("number_animation"); } document.getElementById("show_schools").addEventListener("click", schools_lo_show); document.getElementById("remove_schools_loc").addEventListener("click", schools_lo_hide); // address_location edit function address_lo_show(){ let address_location = document.getElementById("address_location"); let edit_info_ani5 = document.getElementById("edit_info"); address_location.classList.add("left_divs_show"); edit_info_ani5.classList.add("number_animation"); } function address_lo_hide(){ let address_location = document.getElementById("address_location"); let edit_info_ani5 = document.getElementById("edit_info"); address_location.classList.remove("left_divs_show"); edit_info_ani5.classList.remove("number_animation"); } document.getElementById("show_adress").addEventListener("click", address_lo_show); document.getElementById("remove_address_lo").addEventListener("click", address_lo_hide); // search anthem edit function anthem2_show(){ let search_anthem2 = document.getElementById("search_anthem2"); let edit_info_ani6 = document.getElementById("edit_info"); search_anthem2.classList.add("left_divs_show"); edit_info_ani6.classList.add("number_animation"); } function anthem2_hide(){ let search_anthem2 = document.getElementById("search_anthem2"); let edit_info_ani5 = document.getElementById("edit_info"); search_anthem2.classList.remove("left_divs_show"); edit_info_ani5.classList.remove("number_animation"); } document.getElementById("show_search_anthem").addEventListener("click", anthem2_show); document.getElementById("remove_search_anthem").addEventListener("click", anthem2_hide); // show pricing modal function modal_pricing_modal(){ let pricing_modal = document.getElementById("pricing_modal"); // let edit_info_ani6 = document.getElementById("edit_info"); pricing_modal.classList.add("pricing_modalshow"); // edit_info_ani6.classList.add("number_animation"); } // function anthem2_hide(){ // let search_anthem2 = document.getElementById("search_anthem2"); // let edit_info_ani5 = document.getElementById("edit_info"); // search_anthem2.classList.remove("left_divs_show"); // edit_info_ani5.classList.remove("number_animation"); // } document.getElementById("show_pricin_modal").addEventListener("click", modal_pricing_modal); // document.getElementById("remove_search_anthem").addEventListener("click", anthem2_hide); // show my hugrgang plus function myhugegangplus_show(){ let pricing_modal2 = document.getElementById("my_hugegang_plus"); pricing_modal2.classList.add("myhgegang_plusaddclass"); } function myhugegangplus_hide(){ let pricing_modal2 = document.getElementById("my_hugegang_plus"); pricing_modal2.classList.remove("myhgegang_plusaddclass"); } document.getElementById("show_hugegang_plus").addEventListener("click", myhugegangplus_show); document.getElementById("remove_hugegang_plus").addEventListener("click", myhugegangplus_hide); // show inner page function innerpage_move_show(){ let pricing_modal2 = document.getElementById("inner_animation_div"); pricing_modal2.classList.add("inner_animation_divaddclass"); } // function innerpage_move_hide(){ // let pricing_modal2 = document.getElementById("my_hugegang_plus"); // pricing_modal2.classList.remove("myhgegang_plusaddclass"); // } document.getElementById("show_inner_page").addEventListener("click", innerpage_move_show); // document.getElementById("remove_hugegang_plus").addEventListener("click", myhugegangplus_hide); // show chating content function chatingcntnt_show(){ let chating_modal = document.getElementById("chating_cntnt"); chating_modal.classList.add("chating_cntnt_addclass"); } function chatingcntnt_hide(){ let chating_modal = document.getElementById("chating_cntnt"); chating_modal.classList.remove("chating_cntnt_addclass"); } document.getElementById("show_chating2").addEventListener("click", chatingcntnt_show); document.getElementById("remove_chating_cntnt").addEventListener("click", chatingcntnt_hide);<file_sep>// loader setTimeout(function(){ let modal_id = document.getElementById("hugegang_loader"); modal_id.style.display = "none"; ; }, 100); function first_mobile_number() { var number_value2 = document.getElementById("mobile_number").value; var number_btn2 = document.getElementById("Continue_btn1_m"); if(number_value2 == ""){ number_btn2.classList.remove("bgclr"); } else{ number_btn2.classList.add("bgclr"); } } // login with mobile number function login_with_mobile_show(){ let loginwith = document.getElementById("loginwith_page"); let mobile_form_show = document.getElementById("mobile_form_show"); loginwith.classList.add("loginwithformaddclass"); mobile_form_show.classList.add("left_divs_show"); } function login_with_mobile_hide(){ let loginwith = document.getElementById("loginwith_page"); let mobile_form_show = document.getElementById("mobile_form_show"); loginwith.classList.remove("loginwithformaddclass"); mobile_form_show.classList.remove("left_divs_show"); } document.getElementById("show_mobile_fst_form").addEventListener("click", login_with_mobile_show); document.getElementById("rm_mobile_show").addEventListener("click", login_with_mobile_hide); // mobile form email function mobile_email_show(){ let mobile_form_show2 = document.getElementById("mobile_form_show"); let mobile_form_email = document.getElementById("mobile_form_email"); mobile_form_show2.classList.add("loginwithformaddclass"); mobile_form_email.classList.add("left_divs_show"); } function mobile_email_hide(){ let mobile_form_show2 = document.getElementById("mobile_form_show"); let mobile_form_email = document.getElementById("mobile_form_email"); mobile_form_show2.classList.remove("loginwithformaddclass"); mobile_form_email.classList.remove("left_divs_show"); } document.getElementById("mobile_form_loginemail").addEventListener("click", mobile_email_show); document.getElementById("remove_mobile_form_email").addEventListener("click", mobile_email_hide); // login mobile otp function loginmobile_otp_show(){ let login_mobile_form = document.getElementById("mobile_form_show"); let login_opt = document.getElementById("login_mobile_opt"); login_mobile_form.classList.add("loginwithformaddclass"); login_opt.classList.add("left_divs_show"); } function loginmobile_otp_hide(){ let login_mobile_form = document.getElementById("mobile_form_show"); let login_opt = document.getElementById("login_mobile_opt"); login_mobile_form.classList.remove("loginwithformaddclass"); login_opt.classList.remove("left_divs_show"); } document.getElementById("show_mibile_otp").addEventListener("click", loginmobile_otp_show); document.getElementById("remove_login_mobile_opt").addEventListener("click", loginmobile_otp_hide); // start multi step form function multistepform1_show(){ let mobile_opt2 = document.getElementById("login_mobile_opt"); let multistep_1st = document.getElementById("multistep_1st"); mobile_opt2.classList.add("loginwithformaddclass"); multistep_1st.classList.add("left_divs_show"); } function multistepform1_hide(){ let mobile_opt2 = document.getElementById("login_mobile_opt"); let multistep_1st = document.getElementById("multistep_1st"); mobile_opt2.classList.remove("loginwithformaddclass"); multistep_1st.classList.remove("left_divs_show"); } document.getElementById("show_multi_stepform").addEventListener("click", multistepform1_show); document.getElementById("remove_multistepform1").addEventListener("click", multistepform1_hide); // start multi step form 2 function multistepform2_show(){ let multistep_1st = document.getElementById("multistep_1st"); let multistep_2 = document.getElementById("multistep_2"); multistep_1st.classList.add("loginwithformaddclass"); multistep_2.classList.add("left_divs_show"); } function multistepform2_hide(){ let multistep_1st = document.getElementById("multistep_1st"); let multistep_2 = document.getElementById("multistep_2"); multistep_1st.classList.remove("loginwithformaddclass"); multistep_2.classList.remove("left_divs_show"); } document.getElementById("show_multi_stepform2").addEventListener("click", multistepform2_show); document.getElementById("remove_multistepform2").addEventListener("click", multistepform2_hide); // start multi step form 3 function multistepform3_show(){ let multistep_3rd = document.getElementById("multistep_2"); let multistep_3 = document.getElementById("multistep_3"); multistep_3rd.classList.add("loginwithformaddclass"); multistep_3.classList.add("left_divs_show"); } function multistepform3_hide(){ let multistep_3rd = document.getElementById("multistep_2"); let multistep_3 = document.getElementById("multistep_3"); multistep_3rd.classList.remove("loginwithformaddclass"); multistep_3.classList.remove("left_divs_show"); } document.getElementById("show_multi_stepform3").addEventListener("click", multistepform3_show); document.getElementById("remove_multistepform3").addEventListener("click", multistepform3_hide); // start multi step form 4 function multistepform4_show(){ let multistep_3rd = document.getElementById("multistep_3"); let multistep_4 = document.getElementById("multistep_4"); multistep_3rd.classList.add("loginwithformaddclass"); multistep_4.classList.add("left_divs_show"); } function multistepform4_hide(){ let multistep_3rd = document.getElementById("multistep_3"); let multistep_4 = document.getElementById("multistep_4"); multistep_3rd.classList.remove("loginwithformaddclass"); multistep_4.classList.remove("left_divs_show"); } document.getElementById("show_multi_stepform4").addEventListener("click", multistepform4_show); document.getElementById("remove_multistepform4").addEventListener("click", multistepform4_hide); // start multi step form 5 function multistepform5_show(){ let multistep_3rd = document.getElementById("multistep_4"); let multistep_3 = document.getElementById("multistep_5"); multistep_3rd.classList.add("loginwithformaddclass"); multistep_3.classList.add("left_divs_show"); } function multistepform5_hide(){ let multistep_3rd = document.getElementById("multistep_4"); let multistep_3 = document.getElementById("multistep_5"); multistep_3rd.classList.remove("loginwithformaddclass"); multistep_3.classList.remove("left_divs_show"); } document.getElementById("show_multi_stepform5").addEventListener("click", multistepform5_show); document.getElementById("remove_multistepform5").addEventListener("click", multistepform5_hide); // start multi step form 6 function multistepform6_show(){ let multistep_3rd = document.getElementById("multistep_5"); let multistep_3 = document.getElementById("multistep_6"); multistep_3rd.classList.add("loginwithformaddclass"); multistep_3.classList.add("left_divs_show"); } function multistepform6_hide(){ let multistep_3rd = document.getElementById("multistep_5"); let multistep_3 = document.getElementById("multistep_6"); multistep_3rd.classList.remove("loginwithformaddclass"); multistep_3.classList.remove("left_divs_show"); } document.getElementById("show_multi_stepform6").addEventListener("click", multistepform6_show); document.getElementById("remove_multistepform6").addEventListener("click", multistepform6_hide); // start multi step form 7 function multistepform7_show(){ let multistep_3rd = document.getElementById("multistep_6"); let multistep_3 = document.getElementById("multistep_7"); multistep_3rd.classList.add("loginwithformaddclass"); multistep_3.classList.add("left_divs_show"); } function multistepform7_hide(){ let multistep_3rd = document.getElementById("multistep_6"); let multistep_3 = document.getElementById("multistep_7"); multistep_3rd.classList.remove("loginwithformaddclass"); multistep_3.classList.remove("left_divs_show"); } document.getElementById("show_multi_stepform7").addEventListener("click", multistepform7_show); document.getElementById("remove_multistepform7").addEventListener("click", multistepform7_hide); // start multi step form 8 function multistepform8_show(){ let multistep_3rd = document.getElementById("multistep_7"); let multistep_3 = document.getElementById("multistep_8"); multistep_3rd.classList.add("loginwithformaddclass"); multistep_3.classList.add("left_divs_show"); } function multistepform8_hide(){ let multistep_3rd = document.getElementById("multistep_7"); let multistep_3 = document.getElementById("multistep_8"); multistep_3rd.classList.remove("loginwithformaddclass"); multistep_3.classList.remove("left_divs_show"); } document.getElementById("show_multi_stepform8").addEventListener("click", multistepform8_show); document.getElementById("remove_multistepform8").addEventListener("click", multistepform8_hide); // start multi step form 9 function multistepform9_show(){ let multistep_3rd = document.getElementById("multistep_8"); let multistep_3 = document.getElementById("multistep_9"); multistep_3rd.classList.add("loginwithformaddclass"); multistep_3.classList.add("left_divs_show"); } function multistepform9_hide(){ let multistep_3rd = document.getElementById("multistep_8"); let multistep_3 = document.getElementById("multistep_9"); multistep_3rd.classList.remove("loginwithformaddclass"); multistep_3.classList.remove("left_divs_show"); } document.getElementById("show_multi_stepform9").addEventListener("click", multistepform9_show); document.getElementById("remove_multistepform9").addEventListener("click", multistepform9_hide); // start multi step form 10 function multistepform10_show(){ let multistep_3rd = document.getElementById("multistep_9"); let multistep_3 = document.getElementById("multistep_10"); multistep_3rd.classList.add("loginwithformaddclass"); multistep_3.classList.add("left_divs_show"); } function multistepform10_hide(){ let multistep_3rd = document.getElementById("multistep_9"); let multistep_3 = document.getElementById("multistep_10"); multistep_3rd.classList.remove("loginwithformaddclass"); multistep_3.classList.remove("left_divs_show"); } document.getElementById("show_multi_stepform10").addEventListener("click", multistepform10_show); document.getElementById("remove_multistepform10").addEventListener("click", multistepform10_hide); // start enbale location function multistepform11_show(){ let multistep_3rd = document.getElementById("multistep_10"); let multistep_3 = document.getElementById("multistep_11"); multistep_3rd.classList.add("loginwithformaddclass"); multistep_3.classList.add("left_divs_show"); } document.getElementById("show_multi_stepform11").addEventListener("click", multistepform11_show); // start enbale location function multistepform12_show(){ let multistep_3rd = document.getElementById("multistep_11"); let multistep_3 = document.getElementById("multistep_12"); multistep_3rd.classList.add("loginwithformaddclass"); multistep_3.classList.add("left_divs_show"); } function multistepform12_hide(){ let multistep_3rd = document.getElementById("multistep_11"); let multistep_3 = document.getElementById("multistep_12"); multistep_3rd.classList.remove("loginwithformaddclass"); multistep_3.classList.remove("left_divs_show"); } document.getElementById("show_multi_stepform12").addEventListener("click", multistepform12_show); document.getElementById("remove_multistepform12").addEventListener("click", multistepform12_hide); // account recovery function recovery_show(){ let loginwith2 = document.getElementById("loginwith_page"); let account_recovery = document.getElementById("account_recovery"); loginwith2.classList.add("loginwithformaddclass"); account_recovery.classList.add("left_divs_show"); } function recovery_hide(){ let loginwith2 = document.getElementById("loginwith_page"); let account_recovery = document.getElementById("account_recovery"); loginwith2.classList.remove("loginwithformaddclass"); account_recovery.classList.remove("left_divs_show"); } document.getElementById("login_recovery").addEventListener("click", recovery_show); document.getElementById("remove_account_recovery").addEventListener("click", recovery_hide); // account recovery email function recovery_email_show(){ let recovery = document.getElementById("account_recovery"); let account_recovery = document.getElementById("recovery_email"); recovery.classList.add("loginwithformaddclass"); account_recovery.classList.add("left_divs_show"); } function recovery_email_hide(){ let recovery = document.getElementById("account_recovery"); let account_recovery = document.getElementById("recovery_email"); recovery.classList.remove("loginwithformaddclass"); account_recovery.classList.remove("left_divs_show"); } document.getElementById("show_recovery_email").addEventListener("click", recovery_email_show); document.getElementById("remove_recovery_email").addEventListener("click", recovery_email_hide);
cf77808147902214921c203059aa549492a69078
[ "JavaScript" ]
2
JavaScript
Lalitkumarbaghel/hugegang.github.io
a23d4c83a8a25e581c48b0f4f7528d19664f2d59
0f2d955807d50189f1673c8d6d689ae8f9514fd1
refs/heads/master
<file_sep>package com.morelang.service; public class Temp { } <file_sep>package com.morelang; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class MorelangBackendApplication { public static void main(String[] args) { SpringApplication.run(MorelangBackendApplication.class, args); } } <file_sep># MoreLang ![버전](https://img.shields.io/badge/%20version-1.0-green) ## 프로젝트 소개 ### 주제 : 'YouTube' 영상을 활용한 외국어 학습 컨텐츠 > 쟤 머랭?❓ 나도 몰랑 😓 그럼 다같이 **"More lang!"** ✔ > 여러분의 더 많은 language를 위해 **More Lang** 하세요! > 즐겨보는 유튜브 영상을 통해 **언제(When)**, **어디서든(Where)**, **쉽게(Easy)** 외국어 학습을 하자! > 영어 퀴즈 및 발음 측정 등 다양한 컨텐츠를 통한 재밌는 언어학습 서비스 **🎉MoreLang** 입니다. --- ### ✔ 주요기능(구현 예정) <details> <summary>1. 로그인 / 로그아웃</summary> - *Google Api를 활용한 구글 로그인 구현예정 ( 관심 영상을 파악하기 위해)* </details> <details> <summary>2. 단어 배열</summary> - *주요 문장의 영어 단어 배열 퀴즈를 통한 학습력 향상* </details> <details> <summary>3. 발음 교정</summary> - *발음 녹음 뒤 해당 발음이 얼마나 표준 발음과 유사한지 점수제공* </details> <details> <summary>4. 번역</summary> - *영상 영어 자막 및 한글 번역 제공* </details> <details> <summary>5. 단어장</summary> - *자막 단어 Hover 시 사전 모달 우측상단에 단어장 스크랩 버튼을 통한 간단한 단어장 만들기 기능* </details> <details> <summary>6. 사전</summary> - *단어 클릭 시 해당 단어 사전 검색 정보 제공* </details> <details> <summary>7. 쉐도잉(Shadowing)</summary> - *영상의 문장단위 구간 반복 재생* </details> <details> <summary>8. 영상 스크랩</summary> - *학습할 영상(To-do list)과 학습한 영상(Review list) 제공* </details> <details> <summary>9. 영상 검색</summary> - *상단 검색바 자막 잇는 유튜브 영상(필터링) 검색* </details> <details> <summary>10 .학습 코스 (튜토리얼)</summary> - *영상 학습에 대한 튜토리얼 제공* </details> <details> <summary>11. 포인트 제도</summary> - *발음 점수 및 단어 순서 맞추기를 통해 얻은 포인트를 발음 교정 포인트로 전환* </details> <details> <summary>12. 좋아요</summary> - *학습 영상에 대해 좋아요 수 및 버튼 제공* </details> --- ## ⏰ 프로젝트 진행 현황 <details> <summary>Week 1 : 2020.10.12(월) ~ 2020.10.18(일)</summary> ### 이번주 한일 - 팀빌딩 + 아이스브레이킹 - 프로젝트 주제 선정, 필요 기술스택 선정 - 기획서 작성 ### 기타 - <del>1. 음성합성</del> - <del>2. 스냅샷 찍어주는 사진작가 매칭</del> - <del>3. 인공지능/ 빅데이터 라벨링 - 소일거리</del> - <del>4. 액티브 시니어를 위한 가벼운 자서전</del> - 5.영어 학습 서비스 => 발전시켜서 채택 ### 주제 선택 : 'YouTube' 영상을 활용한 외국어 학습 컨텐츠 ### 기술 스택 선택 - Vue + Spring ### 기획서 작성 - [프로젝트 기획서](./resource/file/프로젝트기획서.docx) </details> --- ## 📁 Project Folder ``` 📁Mongo 📁MySQL 📁client ├── 📁src │ ├── App │ ├── 📁assets │ ├── 📁components │ ├── 📁plugins │ ├── 📁components │ ├── 📁store(Vuex) │ ├── 📁Router │ └── 📁utils │ 📁server ├── 📁src │ └── 📁main │ │ ├── 📁java │ │ │ ├── 📁Application │ │ │ ├── 📁config │ │ │ ├── 📁controller │ │ │ ├── 📁dto │ │ │ ├── 📁util │ │ │ ├── 📁repository │ │ │ └── 📁service │ │ └── 📁resources │ └── 📁test │ ├── 📁java │ └── 📁resources └── pom.xml ``` --- ## 📺 화면 구성 (프로토 타이핑) --- ## 📚 DataBase 구조도 --- ## 📃 Api Reference --- ## 🔧 Tech Stack --- ## 참고파일 - [프로젝트 기획서](./resource/file/프로젝트기획서.docx) --- ## 👪Member | 이름 | 역할 | 상세 소개 | |:----------:|:----------:|:----------:| | **공필상** | FULL STACK | 팀장 | | **김지은** | FRONT END | 팀원 | | **박진용** | BACK END | 팀원 | | **박현영** | FRONT END | 팀원 | | **정성오** | BACK END | 팀원 | <file_sep>package com.morelang.config; public class Temp { }
938eb03b0ff8ad75481a0d87fb85cd4bd28ae4c7
[ "Markdown", "Java" ]
4
Java
gofeel8/morelang
c3f4e4d65db60e123b882f46a335285a5e648883
bf5d181aee80f58b3fc356c322744e3b56c7241d
refs/heads/master
<repo_name>mkorsmo/ubuntu-vim<file_sep>/ubuntu.vim.sh sudo apt remove vim-tiny sudo apt autoremove sudo apt update sudo apt install vim vim --version git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
bfae824d8dc06557e3fd003440885bfb14e6a475
[ "Shell" ]
1
Shell
mkorsmo/ubuntu-vim
c03aac1e21c0e5efbb2f822bc6ae10fa53e4fd0b
299dc7894f8087b0e965d9e0889c81eea318301c
refs/heads/master
<file_sep><?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Validator; class BillSplitterController extends Controller { // main routine for displaying Split the Check calculator public function index(Request $request) { // if there is no action or action == reset, return view with cleared/default field inputs if ( (!$request->has('act')) or (($request->has('act') and $request->input('act') == 'reset'))) { return view('index')->with([ 'totalBill' => 0, 'numPeople' => 1, 'tip' => 'good', 'roundUp' => '', ]); } $ppBill = 0; $errmsgs = null; // get inputs $totalBill = $request->input('totalBill', 0); $numPeople = $request->input('numPeople', 1); if ($request->has('roundUp')) $roundUp = 'CHECKED'; else $roundUp = ''; $tip = $request->input('tip', 'good'); // validate inputs $rules = array( 'totalBill' => 'required|numeric|min:0|max:10000', 'numPeople' => 'required|integer|min:1|max:20', ); $validator = Validator::make($request->input(), $rules); // get the error messages from the validator if any if ($validator->fails()) { $errmsgs = $validator->messages(); } else { // calculate the bill per person if (($request->has('act') and $request->input('act') == 'calculate')) { // storage array for how much to tip depending on the quality of service static $serviceType = [ "poor" => 0.10, "good" => 0.15, "great"=> 0.20, ]; $service = $serviceType[$tip]; // calculate bill per person with tip $ppBill = ($totalBill+ ($totalBill * $service)) / $numPeople; // round up to whole dollar amount, if requested if ($roundUp == 'CHECKED') $ppBill = ceil($ppBill); // format bill per person in USD notation $ppBill = number_format($ppBill, 2, ".", ""); } } return view('index')->with([ 'totalBill' => $totalBill, 'numPeople' => $numPeople, 'tip' => $tip, 'roundUp' => $roundUp, 'ppBill' => $ppBill, 'errmsgs' => $errmsgs, ]); } }
51b82f07d153860a56bd8111fdd90c32c95ffa93
[ "PHP" ]
1
PHP
janlyn7/a3
6851b96c102c4e28a3fdc347a7164c56407f5731
51ac1e340711f3f2584b054d8e86c44eb88f92fb
refs/heads/master
<repo_name>qlikstar/iot<file_sep>/iotapp/app/static/js/script.js // Add your javascript here $(function() { $("#header").load("html/header.html"); $("#footer").load("html/footer.html"); }); var piApp = angular.module('piApp', []); piApp.config(function ($routeProvider){ $routeProvider .when('/', { controller : 'DataController', templateUrl : 'html/page1.html' }) .when('/addnew', { controller : 'DataController', templateUrl : 'html/page2.html' }) .otherwise ({ redirectTo : '/'}); }); // var controllers = {}; piApp.controller('DataController', function($scope, $http){ $scope.data = [{'name' :'Sanket', 'city':'San Francisco' } , {'name' :'Chris', 'city':'San Mateo' }, {'name' :'Matt', 'city':'Phoenix' }]; //$scope.ledstatus = {led : 'OFF'}; $scope.getLedStatus = function() { $http.get('/toggle'). success(function(data, status, headers, config) { $scope.ledstatus = data; //console.log(data); }). error(function(data, status, headers, config) { console.log(status); }); }; //initial load $scope.getLedStatus(); $scope.addPerson = function(){ $scope.data.push({ name : $scope.personname , city : $scope.personcity }); $scope.personname = ''; $scope.personcity = ''; }; }); // $scope.getLedStatus = function($scope, $http) { // $http.get('http://localhost:8080/toggle'). // success(function(data, status, headers, config) { // //$scope.led = data; // console.log(status); // }). // error(function(data, status, headers, config) { // // log error // }); // } // controllers.DataController = function($scope){ // $scope.data = // [{'name' :'Sanket', 'city':'San Francisco' } , // {'name' :'Chris', 'city':'San Mateo' }, // {'name' :'Matt', 'city':'Phoenix' }]; // }; // piApp.controller(controllers); <file_sep>/authenticate/app/views/__init__.py __author__ = 'sanketmishra' <file_sep>/iotapp/app/views.py from flask import jsonify, render_template from app import app # import RPi.GPIO as GPIO state = 0 @app.route('/') @app.route('/index') def index(): user = {'nickname': 'Raspberry Pi User !'} # fake user return render_template('index.html') @app.route('/toggle') def toggle_led(): # GPIO.setwarnings(False) # GPIO.setmode(GPIO.BCM) # GPIO.setup(17, GPIO.IN) # state = GPIO.input(17) # return str(state) + "hello" # GPIO.setup(17, GPIO.OUT) global state if state == 0: # GPIO.output(17,GPIO.HIGH) # return 'LED is <font color="red"> ON </font>' output = {'led': 'ON'} state = 1 else: # GPIO.output(17,GPIO.LOW) # return 'LED is <font color="gray"> OFF </font>' output = {'led': 'OFF'} state = 0 # return render_template('iotpage.html', title = 'Welcome to IOT !', output = output) return jsonify(output) <file_sep>/iotapp/tmp/test.py import hashlib # Comes with Python. from OpenSSL.crypto import * from OpenSSL import crypto # open it, using password. Supply/read your own from stdin. p12 = load_pkcs12(file("/Users/sanketmishra/Documents/crypto/b639150c.e7bb.4b53.ae70.3f591f022f49.p12", 'rb').read(), 'notasecret') # get various properties of said file. # note these are PyOpenSSL objects, not strings although you # can convert them to PEM-encoded strings. public_key_bytes = crypto.dump_certificate(crypto.FILETYPE_PEM, p12.get_certificate()) # (signed) certificate object public_key = public_key_bytes.decode('utf-8') # private key. print public_key print "--------------------------------------" private_key_bytes = crypto.dump_privatekey(crypto.FILETYPE_PEM, p12.get_privatekey()) private_key = private_key_bytes.decode('utf-8') # private key. print private_key h = hashlib.sha1() h.update(public_key) cert_hash = h.hexdigest() print 'fingerprint :' + 'F09C52B06CFFAEE4A3723AF04B04CDD5542F2504' print cert_hash <file_sep>/authenticate/app/controllers/authentication.py class Authentication: def __init__(self): pass def authenticate(self): print "Write code here" pass <file_sep>/webtemplate/app/views.py from app import app @app.route('/') @app.route('/index') def index(): #return render_template('index.html') return '''<!-- Copyright (c) 2011 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. To run this sample, replace YOUR API KEY with your application's API key. It can be found at https://code.google.com/apis/console/?api=plus under API Access. Activate the Google+ service at https://code.google.com/apis/console/ under Services --> <!DOCTYPE html> <html> <head> <meta charset='utf-8' /> </head> <body> <!--Add a button for the user to click to initiate auth sequence --> <button id="authorize-button" style="visibility: hidden">Authorize</button> <script type="text/javascript"> // Enter a client ID for a web application from the Google Developer Console. // The provided clientId will only work if the sample is run directly from // https://google-api-javascript-client.googlecode.com/hg/samples/authSample.html // In your Developer Console project, add a JavaScript origin that corresponds to the domain // where you will be running the script. var clientId = '952026468982-2h3jh0mee76aalohjutbtp7u3njjavrs.apps.googleusercontent.com'; // Enter the API key from the Google Develoepr Console - to handle any unauthenticated // requests in the code. // The provided key works for this sample only when run from // https://google-api-javascript-client.googlecode.com/hg/samples/authSample.html // To use in your own application, replace this API key with your own. var apiKey = '<KEY>'; // To enter one or more authentication scopes, refer to the documentation for the API. var scopes = 'https://www.googleapis.com/auth/plus.me'; // Use a button to handle authentication the first time. function handleClientLoad() { //gapi.client.setApiKey(apiKey); window.setTimeout(checkAuth,1); } function checkAuth() { gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { var authorizeButton = document.getElementById('authorize-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: false}, handleAuthResult); return false; } // Load the API and make an API call. Display the results on the screen. function makeApiCall() { gapi.client.load('plus', 'v1', function() { var request = gapi.client.plus.people.get({ 'userId': 'me' }); request.execute(function(resp) { var heading = document.createElement('h4'); var image = document.createElement('img'); image.src = resp.image.url; heading.appendChild(image); heading.appendChild(document.createTextNode(resp.displayName)); document.getElementById('content').appendChild(heading); }); }); } </script> <script src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script> <div id="content"></div> <p>Retrieves your profile name using the Google Plus API.</p> </body> </html>''' <file_sep>/iotapp/app/__init__.py from flask import Flask from flask_restless import APIManager from flask_sqlalchemy import SQLAlchemy from sqlalchemy import Column, Integer, String, Float from flask.ext.cors import CORS app = Flask(__name__, static_url_path='') cors = CORS(app) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///iot.db' db = SQLAlchemy(app) class IotDevices(db.Model): id = Column(Integer, primary_key=True) title = Column(String, unique=False) price = Column(Float, nullable=False) db.create_all() api_manager = APIManager(app, flask_sqlalchemy_db=db) api_manager.create_api(IotDevices, methods=['GET', 'PUT', 'POST', 'DELETE']) from app import views <file_sep>/authenticate/app/__init__.py from flask import Flask from flask.ext.restful import Api, Resource app = Flask(__name__) api = Api(app) from app.views import views <file_sep>/README.md # iot IOT Starter <file_sep>/authenticate/app/views/views.py from app import app from app.controllers import authentication @app.route('/') @app.route('/index') def index(): auth = authentication.Authentication() auth.authenticate() return "Hello from Raspberry Pi! ... Welcome to the world of IOT :) " <file_sep>/webtemplate/run.py from app import app app.run(host= 'something.example.com',port=8080, debug=True)
299560195e58ed5db7a994ae9653852da27ee20c
[ "JavaScript", "Python", "Markdown" ]
11
JavaScript
qlikstar/iot
a5b2e89114d617995e9226b82ff44e6180a95f45
014399b38779fff615415c2b3dabffedca02f3e9
refs/heads/master
<repo_name>arispoloway/symbolicmath<file_sep>/expression/SimplifiableExpression.py from expression.Expression import Expression from abc import ABC, abstractmethod class SimplifiableExpression(Expression, ABC): """ An abstract class to represent an expression that is simplifiable """ @abstractmethod def __eq__(self, other): pass @abstractmethod def __hash__(self): pass @abstractmethod def evaluate(self, **kwargs): pass @abstractmethod def __repr__(self): pass @abstractmethod def get_simplifiers(self): pass def get_direct_transformations(self): simplifiers = self.get_simplifiers() return list(filter(lambda x: x != self, (s.simplify(self) for s in simplifiers))) <file_sep>/utils/data_structure_utils.py class Stream(object): """ A stream object supporting peek, take, and has_next """ def __init__(self, s): self._s = s self._pos = 0 self._len = len(s) def peek(self, ahead=0): idx = self._pos + ahead if idx >= self._len: return None return self._s[self._pos + ahead] def take(self): self._pos += 1 return self._s[self._pos - 1] def has_next(self): return self._pos < self._len class Queue(object): """ A queue supporting these operations: push, pop, is_empty """ def __init__(self): self._list = [] def push(self, x): self._list.append(x) def pop(self): if len(self._list) > 0: return self._list.pop(0) raise IndexError() def as_list(self): return self._list[::] def is_empty(self): return len(self._list) == 0 class Stack(object): """ A stack object supporting the push, pop, peek, and is_empty operations """ def __init__(self): self._list = [] def push(self, x): self._list.append(x) def pop(self): if len(self._list) > 0: return self._list.pop() raise IndexError() def peek(self): if len(self._list) > 0: return self._list[-1] raise IndexError() def is_empty(self): return len(self._list) == 0<file_sep>/utils/parsing_utils.py from expression.Derivative import Derivative from expression.Function import Sin, Asin, Cos, Acos, Log, Add, Subtract, Divide, Multiply, Exponent def is_alpha(s): """ Is a string composed of entirely a-zA-Z :param s: The string :return: Whether or not it is exclusively a-zA-Z """ return all(c.isalpha() for c in s) def parse_number(n): """ Parse a given number to the appropriate type :param n: The number as a string :return: A float or int version of the string """ i = int(n) f = float(n) if i == f: return i return f functions = { 'sin': (Sin, 1), 'asin': (Asin, 1), 'cos': (Cos, 1), 'acos': (Acos, 1), 'log': (Log, 2), } operators = { '^': (5, 'r', Exponent), '*': (4, 'l', Multiply), '/': (4, 'l', Divide), '+': (2, 'l', Add), '-': (2, 'l', Subtract), '//': (3, 'l', Derivative), } # TODO combine function and operator? seem similar # TODO handle negate vs subtract def get_precedence(op): """ Get the precedence of the given operator, or None if it is not an operator :param op: The operator string :return: The operator precedence, or None """ return operators.get(op, (None, None, None))[0] def get_associativity(op): """ Get the associativity of the given operator, or None if it is not an operator :param op: The operator string :return: The associativity, or None """ return operators.get(op, (None, None, None))[1] def get_operator(op): """ Get the of the given operator, or None if it is not an operator :param op: The operator string :return: The operator, or None """ return operators.get(op, (None, None, None))[2] def is_operator(s): """ Is the given string an operator :param s: The string :return: Whether or not it is an operator """ return s in operators def is_function(s): """ Is the given string a function :param s: The string :return: Whether or not it is a function """ return s in functions def get_function(s): """ Get the function associated with the string, or None if it isn't a function :param s: The string :return: The associated function """ return functions.get(s.lower(), (None, None))[0] def get_function_args(s): """ Get the number of arguments to the given function, or None if it isn't a function :param s: The string for the function :return: The argument count """ return functions.get(s.lower(), (None, None))[1] def is_numeric(s): """ Is the given string a valid number :param s: The string :return: Whether or not it is a number """ try: float(s) return True except ValueError: return False <file_sep>/samples/evaluator/main.py from parsing.Parser import parse_to_expression if __name__ == '__main__': try: exp = parse_to_expression(input("Input an expression\n")) except Exception as e: print('Could not parse expression: {}'.format(e)) quit(1) while True: i = input('Input a comma separated series of assignments, or q to quit (ex. "x=3,y=1")\n') if i == 'q': break assignments = i.replace(' ', '').split(',') mappings = {x[0]: float(x[1]) for x in map(lambda z: z.split('='), assignments)} print(exp.evaluate(**mappings)) <file_sep>/tests/test_evaluate.py import unittest from expression.Function import Sin, Add from expression.Value import Value from expression.Variable import Variable class VariableEvaluateTestCase(unittest.TestCase): def runTest(self): self.assertEqual(Variable('y').evaluate(y=Value(3)).get_numeric_value(), 3) class SinEvaluateTestCase(unittest.TestCase): def runTest(self): self.assertAlmostEqual(Sin(Value(3)).evaluate().get_numeric_value(), 0.14112) class AddEvaluateTestCase(unittest.TestCase): def runTest(self): self.assertEqual(Add(Value(3), Value(4)).evaluate().get_numeric_value(), 7) self.assertEqual(Add(Variable('x'), Value(4)).evaluate(x=Value(3)).get_numeric_value(), 7) class AddSinEvaluateTestCase(unittest.TestCase): def runTest(self): self.assertAlmostEqual(Add(Sin(Value(3)), Value(4)).evaluate().get_numeric_value(), 4.14112) self.assertAlmostEqual(Add(Sin(Value(3)), Variable('y')).evaluate(y=Value(4)).get_numeric_value(), 4.14112) self.assertAlmostEqual(Add(Sin(Variable('x')), Variable('y')) .evaluate(x=Value(3), y=Value(4)).get_numeric_value(), 4.14112)<file_sep>/expression/Function.py from abc import ABC, abstractmethod from collections import defaultdict from functools import reduce from math import sin, cos, acos, asin, pow, log, e import utils.expression_utils from expression.SimplifiableExpression import SimplifiableExpression from expression.Value import Value # Todo refactor operators vs functions class Function(SimplifiableExpression, ABC): """ An abstract class to generalize the idea of a function acting on sub expressions """ @abstractmethod def __repr__(self): pass def __init__(self, func, *expressions, commute=False): """ Args: func: The python function that acts on numeric values *expressions: The list of expressions the func acts on commute: Whether or not the order of expressions is relevant """ super().__init__() self._func = func self._expressions = tuple(map(utils.expression_utils.possibly_parse_literal, expressions)) self._commute = commute def get_expressions(self): """ Gets a list of all the expressions of this Function TODO: deprecate this in favor of individual methods on subclasses Returns: The list of expressions of this Function """ return self._expressions def evaluate(self, **kwargs): evaluated = list(map(lambda x: x.evaluate(**kwargs), self._expressions)) if all(expr.get_numeric_value() is not None for expr in evaluated): return Value(self._func(*map(lambda x: x.get_numeric_value(), evaluated))) else: return type(self)(*evaluated) def get_transformations(self): direct = self.get_direct_transformations() sub_transformations = [] for i, expr in enumerate(self.get_expressions()): for sub_transformation in expr.get_transformations(): new_args = list(self.get_expressions()) new_args[i] = sub_transformation sub_transformations.append(type(self)(*new_args)) return direct + sub_transformations def get_func(self): """ Get the python function that acts on numeric values Returns: The function """ return self._func def __eq__(self, other): if not isinstance(other, type(self)): return False if self._commute: f = defaultdict(int) for i in self.get_expressions(): f[i] += 1 o = defaultdict(int) for i in other.get_expressions(): o[i] += 1 return o == f return self.get_expressions() == other.get_expressions() def __hash__(self): hashes = sorted(hash(expression) for expression in self.get_expressions()) return hash((type(self), tuple(hashes))) class Sin(Function): """ The sin operation """ def __init__(self, expr): super().__init__(sin, expr) def get_simplifiers(self): from expression.simplifier.Simplifier import FunctionValueOnlySimplifier from expression.simplifier.TrigSimplifiers import SinAsinSimplifier return [SinAsinSimplifier(), FunctionValueOnlySimplifier()] def __repr__(self): return 'sin({})'.format(self._expressions[0].__repr__()) class Cos(Function): """ The cos operation """ def __init__(self, expr): super().__init__(cos, expr) def get_simplifiers(self): from expression.simplifier.Simplifier import FunctionValueOnlySimplifier from expression.simplifier.TrigSimplifiers import CosAcosSimplifier return [CosAcosSimplifier(), FunctionValueOnlySimplifier()] def __repr__(self): return 'cos({})'.format(self._expressions[0].__repr__()) class Asin(Function): """ The asin operation """ def __init__(self, expr): super().__init__(asin, expr) def get_simplifiers(self): from expression.simplifier.Simplifier import FunctionValueOnlySimplifier from expression.simplifier.TrigSimplifiers import AsinSinSimplifier return [AsinSinSimplifier(), FunctionValueOnlySimplifier()] def __repr__(self): return 'asin({})'.format(self._expressions[0].__repr__()) class Acos(Function): """ The acos operation """ def __init__(self, expr): super().__init__(acos, expr) def get_simplifiers(self): from expression.simplifier.Simplifier import FunctionValueOnlySimplifier from expression.simplifier.TrigSimplifiers import AcosCosSimplifier return [AcosCosSimplifier(), FunctionValueOnlySimplifier()] def __repr__(self): return 'acos({})'.format(self._expressions[0].__repr__()) class Negate(Function): """ The negate operation """ def __init__(self, expr): """ Args: expr: The expression to be negated """ super().__init__(lambda x: -x, expr) def get_simplifiers(self): from expression.simplifier.Simplifier import FunctionValueOnlySimplifier return [FunctionValueOnlySimplifier()] def __repr__(self): return '-{}'.format(self._expressions[0].__repr__()) class Add(Function): """ The addition operation """ def __init__(self, *expressions): """ Args: *expressions: A list of expressions to be summed """ super().__init__(lambda *x: sum(x), *expressions, commute=True) if len(expressions) < 2: raise ValueError('Not enough expressions') def get_simplifiers(self): from expression.simplifier.Simplifier import ( FunctionValueOnlySimplifier, ) from expression.simplifier.AddSimplifiers import ( AddCombineTermsSimplifier, AddCombineValuesSimplifier, AddNestedAddSimplifier, AddFactorSimplifier, ) return [FunctionValueOnlySimplifier(), AddNestedAddSimplifier(), AddCombineValuesSimplifier(), AddCombineTermsSimplifier(), AddFactorSimplifier()] def __repr__(self): return '(' + \ '+'.join(x.__repr__() for x in self.get_expressions()) + \ ')' class Subtract(Function): """ The subtraction operation """ def __init__(self, expr1, expr2): """ Args: expr1: The expression to subtract from expr2: The expression to be subtracted """ super().__init__(lambda a, b: a - b, expr1, expr2) def get_simplifiers(self): from expression.simplifier.Simplifier import FunctionValueOnlySimplifier from expression.simplifier.SubtractSimplifiers import SubtractWithZeroSimplifier return [FunctionValueOnlySimplifier(), SubtractWithZeroSimplifier()] def __repr__(self): return '({}-{})'.format(self._expressions[0].__repr__(), self._expressions[1].__repr__()) class Divide(Function): """ The division operation """ def __init__(self, numer, denom): """ Args: numer: The numerator denom: The denominator """ super().__init__(lambda a, b: a / b, numer, denom) def get_simplifiers(self): from expression.simplifier.Simplifier import FunctionValueOnlySimplifier from expression.simplifier.DivideSimplifiers import DivideByOneSimplifier return [FunctionValueOnlySimplifier(), DivideByOneSimplifier()] def __repr__(self): return '(({})/({}))'.format(self._expressions[0].__repr__(), self._expressions[1].__repr__()) class Multiply(Function): """ The multiplication operation """ def __init__(self, *expressions): """ Args: *expressions: A list of the expressions to multiply together """ super().__init__(lambda *l: reduce(lambda x, y: x * y, l), *expressions, commute=True) if len(expressions) < 2: raise ValueError('Not enough expressions') def get_simplifiers(self): from expression.simplifier.Simplifier import ( FunctionValueOnlySimplifier, ) from expression.simplifier.MultiplySimplifiers import ( MultiplyCombineValuesSimplifier, MultiplyCombineTermsSimplifier, MultiplyNestedMultiplySimplifier, MultiplyDistributeSimplifier ) return [FunctionValueOnlySimplifier(), MultiplyNestedMultiplySimplifier(), MultiplyCombineValuesSimplifier(), MultiplyCombineTermsSimplifier(), MultiplyDistributeSimplifier()] def __repr__(self): return '(' + '*'.join(x.__repr__() for x in self.get_expressions()) + ')' class Exponent(Function): """ The exponentiation operation """ def __init__(self, base, exponent): """ Args: base: The base of the exponent exponent: The exponent """ super().__init__(pow, base, exponent) def get_simplifiers(self): from expression.simplifier.Simplifier import FunctionValueOnlySimplifier from expression.simplifier.PowerSimplifiers import PowerOfZeroSimplifier from expression.simplifier.PowerSimplifiers import PowerOfOneSimplifier return [FunctionValueOnlySimplifier(), PowerOfOneSimplifier(), PowerOfZeroSimplifier()] def __repr__(self): exprs = self.get_expressions() return '({})^({})'.format(exprs[0], exprs[1]) class Log(Function): """ The log operation """ def __init__(self, n, base=e): """ Args: n: The number to take the log of base: The base of the log """ super().__init__(log, n, base) def get_simplifiers(self): from expression.simplifier.Simplifier import FunctionValueOnlySimplifier return [FunctionValueOnlySimplifier()] def __repr__(self): exprs = self.get_expressions() return 'Log(n={}, b={})'.format(exprs[0].__repr__(), exprs[1].__repr__()) <file_sep>/expression/Expression.py import logging from abc import ABC, abstractmethod logging.basicConfig() log = logging.getLogger() class Expression(ABC): """ Represents a mathematical expression """ def __init__(self): pass @abstractmethod def evaluate(self, **kwargs): """ Evaluate this expression and attempt to return a Value Args: **kwargs: A mapping of variable names to numeric values to be substituted in, ex: {'x':3, 'y':4.5} Returns: A Value if the substitutions were sufficient, otherwise an Expression with Variables replaced by the appropriate Values, and reduced where possible """ pass def get_numeric_value(self): """ Gets the numeric value of a Value, None otherwise Returns: The numeric value of a Value, None if any other Expression """ return None def get_transformations(self): """ Gets a list of equivalent transformations of this expression Returns: The list """ return [] @abstractmethod def __eq__(self, other): pass @abstractmethod def __hash__(self): pass @abstractmethod def __repr__(self): pass def __add__(self, other): import expression.Function from expression.simplifier.AddSimplifiers import AddNestedAddSimplifier return AddNestedAddSimplifier().simplify(expression.Function.Add(self, other)) def __mul__(self, other): import expression.Function from expression.simplifier.MultiplySimplifiers import MultiplyNestedMultiplySimplifier return MultiplyNestedMultiplySimplifier().simplify(expression.Function.Multiply(self, other)) def __sub__(self, other): import expression.Function return expression.Function.Subtract(self, other) def __neg__(self): import expression.Function return expression.Function.Negate(self) def __truediv__(self, other): import expression.Function return expression.Function.Divide(self, other) def __floordiv__(self, other): import expression.Derivative return expression.Derivative.Derivative(self, other) def __xor__(self, other): import expression.Function return expression.Function.Exponent(self, other) <file_sep>/samples/matplotlib_demo/main.py import matplotlib.pyplot as plt from parsing.Parser import parse_to_expression def frange(x, y, jump): while x < y: yield x x += jump def read_input(prompt): try: i = input("{}\n".format(prompt)) return i except Exception as e: return None def input_verify(prompt, verification): while True: try: return verification(read_input(prompt)) except Exception as e: print("Invalid input\n") num_exprs = input_verify("How many expressions?", int) exprs = [] for i in range(num_exprs): exprs.append(input_verify("Input an expression in terms of x", parse_to_expression)) xmin = input_verify("Input xmin", float) xmax = input_verify("Input xmax", float) xstep = input_verify("Input xstep", float) steps = list(frange(xmin, xmax, xstep)) values = [[exp.evaluate(x=p).get_numeric_value() for p in steps] for exp in exprs] for i, e in enumerate(values): plt.plot(steps, e, label=str(exprs[i])) plt.legend() plt.show() <file_sep>/utils/expression_utils.py from expression.Value import Value from expression.Variable import Variable def simplify_all(l, whitelist=None): """ Given a list of expressions, simplify each Args: l: The list of expressions whitelist: A whitelist of simplifiers to use Returns: The original list of expressions, simplified """ return tuple(map(lambda x: x.simplify(whitelist=whitelist), l)) def filter_split(func, l): """ Filter the given list based on a function, saving the filtered out values and returning both lists Args: func: The predicate to filter by l: The list of values Returns: Two lists, the first containing values for which the predicate returns True, the 2nd, False """ good = [] bad = [] for x in l: if func(x): good.append(x) else: bad.append(x) return good, bad def possibly_parse_literal(x): if isinstance(x, (int, float)): return Value(x) if isinstance(x, str): return Variable(x) return x<file_sep>/expression/simplifier/SubtractSimplifiers.py from expression.Function import Subtract from expression.Value import Value from expression.simplifier.Simplifier import Simplifier class SubtractWithZeroSimplifier(Simplifier): def can_simplify(self, expression): return isinstance(expression, Subtract) and any(x == Value(0) for x in expression.get_expressions()) def _simplify(self, expression): first, second = expression.get_expressions() if first == Value(0): return -second else: return first <file_sep>/parsing/Parser.py from expression.Value import Value from expression.Variable import Variable from parsing.Tokenizer import tokenize, clean_tokens from utils.parsing_utils import ( is_alpha, parse_number, is_numeric, is_operator, is_function, get_associativity, get_precedence, get_operator, get_function, get_function_args, ) from utils.data_structure_utils import Stream, Queue, Stack def shunting_yard(tokens): """ Do the shunting yard algorithm to convert the stream of tokens into a stack :param tokens: The list of tokens :return: A queue of tokens in stack form """ s = Stream(tokens) output_queue = Queue() operator_stack = Stack() while s.has_next(): t = s.take() if is_numeric(t): output_queue.push(t) elif is_function(t): operator_stack.push(t) elif is_operator(t): # TODO make this nicer while not operator_stack.is_empty(): n = operator_stack.peek() if n != '(' and \ (is_function(n) or (get_precedence(n) > get_precedence(t)) or (get_precedence(n) == get_precedence(t) and get_associativity(n) == 'l')): output_queue.push(operator_stack.pop()) else: break operator_stack.push(t) elif t == '(': operator_stack.push(t) elif t == ')': while operator_stack.peek() != '(': output_queue.push(operator_stack.pop()) operator_stack.pop() elif t == ',': pass elif is_alpha(t): output_queue.push(t) while not operator_stack.is_empty(): output_queue.push(operator_stack.pop()) return output_queue def parse_to_expression(s): """ Parse a given string expression into an Expression :param s: The string :return: The resulting Expression """ tokens = tokenize(s) tokens = clean_tokens(tokens) queue = shunting_yard(tokens) stack = Stack() while not queue.is_empty(): t = queue.pop() if is_numeric(t): stack.push(Value(parse_number(t))) elif is_function(t): arg_num = get_function_args(t) args = [stack.pop() for _ in range(arg_num)] args.reverse() stack.push(get_function(t)(*args)) elif is_operator(t): v2, v1 = stack.pop(), stack.pop() stack.push(get_operator(t)(v1, v2)) else: stack.push(Variable(t)) return stack.pop() <file_sep>/expression/simplifier/PowerSimplifiers.py from expression.Function import Exponent from expression.Value import Value from expression.simplifier.Simplifier import Simplifier class PowerOfOneSimplifier(Simplifier): def can_simplify(self, expression): return isinstance(expression, Exponent) and expression.get_expressions()[1] == Value(1) def _simplify(self, expression): return expression.get_expressions()[0] class PowerOfZeroSimplifier(Simplifier): def can_simplify(self, expression): return isinstance(expression, Exponent) and expression.get_expressions()[1] == Value(0) def _simplify(self, expression): return Value(1) <file_sep>/expression/simplifier/Simplifier.py from abc import ABC, abstractmethod from expression.Function import Function from expression.Value import Value class Simplifier(ABC): """ Represents an action that changes an expression to an equivalent form """ @abstractmethod def can_simplify(self, expression): """ Determine if this simplifier can simplify a given expression Args: expression: The expression to potentially be acted upon Returns: A boolean representing whether or not this simplifier can act on a given expression """ pass @abstractmethod def _simplify(self, expression): """ Simplify a given expression, assuming that it is already capable of being simplified by this simplifier Args: expression: The expression to simplify Returns: The simplified expression """ pass def simplify(self, expression): """ Simplifies a given expression, assuming it can be simplified, otherwise returns the input Args: expression: The expression to simplify Returns: The simplified expression, or the original if simplification is not possible """ if self.can_simplify(expression): return self._simplify(expression) return expression class FunctionValueOnlySimplifier(Simplifier): """ A simplifier that simplifies Functions where all sub expressions are Values """ def can_simplify(self, expression): return isinstance(expression, Function) and all(isinstance(e, Value) for e in expression.get_expressions()) def _simplify(self, expression): return Value(expression.get_func()(*(e.get_numeric_value() for e in expression.get_expressions()))) # TODO write Exponent and Log simplifiers <file_sep>/tests/test_derivative.py from expression.simplifier.DerivativeSimplifiers import * from tests.utils import SimplifierTest, x, y, z class DeriveSinTestCase(SimplifierTest): simplifier = DerivativeSinSimplifier() def runTest(self): self.assertSimplify(Sin(x * 2) // x, ((x * 2) // x) * Cos(x * 2)) class DeriveCosTestCase(SimplifierTest): simplifier = DerivativeCosSimplifier() def runTest(self): self.assertSimplify(Cos(x * 2) // x, ((x * 2) // x) * - Sin(x * 2)) class DeriveNegateTestCase(SimplifierTest): simplifier = DerivativeNegateSimplifier() def runTest(self): self.assertSimplify((-(x + 3)) // x, -((x + 3) // x)) class DeriveAddTestCase(SimplifierTest): simplifier = DerivativeAddSimplifier() def runTest(self): self.assertSimplify((Sin(x) + x) // x, Sin(x) // x + x // x) class DeriveSubtractTestCase(SimplifierTest): simplifier = DerivativeSubtractSimplifier() def runTest(self): self.assertSimplify((Sin(x) - x) // x, Sin(x) // x - x // x) class DeriveDivideTestCase(SimplifierTest): simplifier = DerivativeDivideSimplifier() def runTest(self): self.assertSimplify((Sin(x) / x) // x, (x * (Sin(x) // x) - Sin(x) * (x // x)) / (x ^ 2)) class DeriveMultiplyTestCase(SimplifierTest): simplifier = DerivativeMultiplySimplifier() def runTest(self): self.assertSimplify((Sin(x) * x) // x, Sin(x) * (x // x) + x * (Sin(x) // x)) self.assertSimplify((Sin(x) * x * Cos(x)) // x, (Sin(x) // x) * x * Cos(x) + Sin(x) * (x // x) * Cos(x) + Sin(x) * x * (Cos(x) // x)) class DerivePowerTestCase(SimplifierTest): simplifier = DerivativeExponentSimplifier() def runTest(self): self.assertSimplify((x ^ 2) // x, Value(2) * (x ^ (Value(2) - 1)) * (x // x)) class DeriveExponentTestCase(SimplifierTest): simplifier = DerivativeExponentSimplifier() def runTest(self): self.assertSimplify((Value(2) ^ x) // x, Multiply(Value(2) ^ x, x // x, Log(2))) class DerivativeConstantTestCase(SimplifierTest): simplifier = DerivativeConstantSimplifier() def runTest(self): self.assertSimplify(Value(2) // x, Value(0)) self.assertSimplify(Value(2) // (x * 2), Value(0)) class DerivativeVariableTestCase(SimplifierTest): simplifier = DerivativeVariableSimplifier() def runTest(self): self.assertSimplify(x // x, Value(1)) <file_sep>/expression/simplifier/AddSimplifiers.py from collections import Counter from functools import reduce from itertools import chain from expression.Function import Add, Multiply from expression.Value import Value from expression.simplifier.Simplifier import Simplifier from utils.expression_utils import filter_split class AddNestedAddSimplifier(Simplifier): def can_simplify(self, expression): return isinstance(expression, Add) and \ len([expr for expr in expression.get_expressions() if isinstance(expr, Add)]) != 0 def _simplify(self, expression): adds, other = filter_split(lambda x: isinstance(x, Add), expression.get_expressions()) adds = list(chain(*map(lambda x: x.get_expressions(), adds))) return Add(*adds, *other) class AddCombineValuesSimplifier(Simplifier): def can_simplify(self, expression): return isinstance(expression, Add) and \ len([expr for expr in expression.get_expressions() if isinstance(expr, Value)]) > 0 def _simplify(self, expression): values, other = filter_split(lambda x: isinstance(x, Value), expression.get_expressions()) value = reduce(lambda x, y: x + y, map(lambda x: x.get_numeric_value(), values)) if len(other) == 0: return Value(value) if value == 0: if len(other) == 1: return other[0] return Add(*other) return Add(value, *other) class AddCombineTermsSimplifier(Simplifier): def can_simplify(self, expression): return isinstance(expression, Add) def _simplify(self, expression): exprs = expression.get_expressions() counts = Counter(exprs) exprs = [] for term in counts: freq = counts[term] if freq == 1: exprs.append(term) else: exprs.append(Value(freq) * term) if len(exprs) == 1: return exprs[0] return Add(*exprs) class AddFactorSimplifier(Simplifier): def can_simplify(self, expression): return isinstance(expression, Add) and \ len([x for x in expression.get_expressions() if isinstance(x, Multiply)]) > 1 def _simplify(self, expression): multiplies, others = filter_split(lambda x: isinstance(x, Multiply), expression.get_expressions()) sets = [set(x.get_expressions()) for x in multiplies] c = Counter() for s in sets: c.update(s) term, count = c.most_common(1)[0] if count < 2: return expression in_terms = [] for mult in multiplies: if term in mult.get_expressions(): l = list(mult.get_expressions()) l.remove(term) if len(l) == 1: in_terms.append(l[0]) else: in_terms.append(Multiply(*l)) else: others.append(mult) if len(others) == 0: return term * Add(*in_terms) return Add(term * Add(*in_terms), *others) <file_sep>/expression/simplifier/TrigSimplifiers.py from expression.Function import Sin, Asin, Cos, Acos from expression.simplifier.Simplifier import Simplifier class SinAsinSimplifier(Simplifier): def can_simplify(self, expression): return isinstance(expression, Sin) and isinstance(expression.get_expressions()[0], Asin) def _simplify(self, expression): return expression.get_expressions()[0].get_expressions()[0] class AsinSinSimplifier(Simplifier): def can_simplify(self, expression): return isinstance(expression, Asin) and isinstance(expression.get_expressions()[0], Sin) def _simplify(self, expression): return expression.get_expressions()[0].get_expressions()[0] class CosAcosSimplifier(Simplifier): def can_simplify(self, expression): return isinstance(expression, Cos) and isinstance(expression.get_expressions()[0], Acos) def _simplify(self, expression): return expression.get_expressions()[0].get_expressions()[0] class AcosCosSimplifier(Simplifier): def can_simplify(self, expression): return isinstance(expression, Acos) and isinstance(expression.get_expressions()[0], Cos) def _simplify(self, expression): return expression.get_expressions()[0].get_expressions()[0] <file_sep>/expression/simplifier/DerivativeSimplifiers.py from expression.Derivative import Derivative from expression.Function import Sin, Cos, Negate, Add, Subtract, Multiply, Exponent, Log, Exponent, Divide from expression.Value import Value from expression.simplifier.Simplifier import Simplifier from abc import ABC, abstractmethod class DerivativeSimplifier(Simplifier, ABC): @abstractmethod def can_simplify(self, expression): pass @staticmethod def valid_if_type(e, t): return isinstance(e, Derivative) and isinstance(e.get_expression(), t) class DerivativeConstantSimplifier(DerivativeSimplifier): def can_simplify(self, expression): return DerivativeSimplifier.valid_if_type(expression, Value) def _simplify(self, expression): return Value(0) class DerivativeVariableSimplifier(DerivativeSimplifier): def can_simplify(self, expression): return isinstance(expression, Derivative) and expression.get_var() == expression.get_expression() def _simplify(self, expression): return Value(1) class DerivativeSinSimplifier(DerivativeSimplifier): def can_simplify(self, expression): return DerivativeSimplifier.valid_if_type(expression, Sin) def _simplify(self, expression): expr = expression.get_expression() var = expression.get_var() return Derivative(expr.get_expressions()[0], var) * Cos(expr.get_expressions()[0]) class DerivativeCosSimplifier(DerivativeSimplifier): def can_simplify(self, expression): return DerivativeSimplifier.valid_if_type(expression, Cos) def _simplify(self, expression): expr = expression.get_expression() var = expression.get_var() return Derivative(expr.get_expressions()[0], var) * (-Sin(expr.get_expressions()[0])) class DerivativeNegateSimplifier(DerivativeSimplifier): def can_simplify(self, expression): return DerivativeSimplifier.valid_if_type(expression, Negate) def _simplify(self, expression): expr = expression.get_expression() var = expression.get_var() return -(Derivative(expr.get_expressions()[0], var)) class DerivativeAddSimplifier(DerivativeSimplifier): def can_simplify(self, expression): return DerivativeSimplifier.valid_if_type(expression, Add) def _simplify(self, expression): expr = expression.get_expression() var = expression.get_var() exprs = expr.get_expressions() return Add(*map(lambda x: Derivative(x, var), exprs)) class DerivativeSubtractSimplifier(DerivativeSimplifier): def can_simplify(self, expression): return DerivativeSimplifier.valid_if_type(expression, Subtract) def _simplify(self, expression): expr = expression.get_expression() var = expression.get_var() exprs = expr.get_expressions() return Derivative(exprs[0], var) - Derivative(exprs[1], var) class DerivativeMultiplySimplifier(DerivativeSimplifier): def can_simplify(self, expression): return DerivativeSimplifier.valid_if_type(expression, Multiply) def _simplify(self, expression): expr = expression.get_expression() var = expression.get_var() exprs = expr.get_expressions() terms = [] for i, e in enumerate(exprs): rest = exprs[:i] + exprs[i+1:] terms.append(Multiply(Derivative(e, var), *rest)) return Add(*terms) class DerivativeExponentSimplifier(DerivativeSimplifier): def can_simplify(self, expression): return DerivativeSimplifier.valid_if_type(expression, Exponent) def _simplify(self, expression): expr = expression.get_expression() var = expression.get_var() base, exp = expr.get_expressions() if isinstance(base, Value): return (expr * Log(base)) * (exp // var) elif isinstance(exp, Value): return exp * (base ^ (exp - 1)) * (base // var) return expression class DerivativeLogSimplifier(DerivativeSimplifier): def can_simplify(self, expression): return DerivativeSimplifier.valid_if_type(expression, Log) def _simplify(self, expression): expr = expression.get_expression() var = expression.get_var() exprs = expr.get_expressions() return Divide(Value(1), Log(exprs[1]) * exprs[0]) * (exprs[0] // var) class DerivativeDivideSimplifier(DerivativeSimplifier): def can_simplify(self, expression): return DerivativeSimplifier.valid_if_type(expression, Divide) def _simplify(self, expression): expr = expression.get_expression() var = expression.get_var() num, den = expr.get_expressions() return Divide(((num // var) * den) - (num * (den // var)), den ^ 2) <file_sep>/tests/test_parser.py import unittest from parsing.Tokenizer import tokenize from parsing.Parser import parse_to_expression, shunting_yard from expression.Value import Value from expression.Variable import Variable from expression.Function import Sin, Log from expression.Derivative import Derivative class ParserTest(unittest.TestCase): def assertParsed(self, s, exp): self.assertEquals(parse_to_expression(s), exp) class OrderOfOperationsTest(ParserTest): def runTest(self): self.assertParsed("5 * 3 + 3", (Value(5) * Value(3)) + Value(3)) self.assertParsed("5 * 3 ^ 5 + 3", (Value(5) * (Value(3) ^ Value(5))) + Value(3)) class VariableTest(ParserTest): def runTest(self): self.assertParsed("5 * x", Value(5) * Variable('x')) class FunctionTest(ParserTest): def runTest(self): self.assertParsed("5 * sin(x)", Value(5) * Sin(Variable('x'))) self.assertParsed("5 * log(2, x)", Value(5) * Log(2, Variable('x'))) class DerivativeTest(ParserTest): def runTest(self): self.assertParsed("5 // x", Derivative(Value(5), Variable('x'))) self.assertParsed("sin(x) // x", Derivative(Sin('x'), Variable('x'))) class ShuntingYardTest(unittest.TestCase): def assertParsed(self, s, q): self.assertEquals(shunting_yard(tokenize(s)).as_list(), q.split()) class ShuntingOrderOperationsTest(ShuntingYardTest): def runTest(self): self.assertParsed('3 * 4', '3 4 *') self.assertParsed('3 // x + 3', '3 x // 3 +') self.assertParsed('3 * 4 + 3', '3 4 * 3 +') self.assertParsed('3 * 4 + 3 ^ 2', '3 4 * 3 2 ^ +') self.assertParsed('3 * 4 ^ 5 + 3 ^ 2', '3 4 5 ^ * 3 2 ^ +') class ShuntingFunctionTest(ShuntingYardTest): def runTest(self): self.assertParsed('3 * sin(4)', '3 4 sin *') self.assertParsed('3 * sin(4 + 3)', '3 4 3 + sin *') class ShuntingParentheses(ShuntingYardTest): def runTest(self): self.assertParsed('2 * (4 + 3)', '2 4 3 + *') self.assertParsed('(3 * 2) + 4', '3 2 * 4 +') <file_sep>/tests/utils.py import unittest from expression.Variable import Variable x, y, z = Variable('x'), Variable('y'), Variable('z') class SimplifierTest(unittest.TestCase): simplifier = None def simplify(self, expr): return self.simplifier.simplify(expr) def assertSimplify(self, expr1, expr2): self.assertEqual(self.simplify(expr1), expr2) class SimplifyTest(unittest.TestCase): def assertSimplify(self, expr1, expr2, whitelist=None): self.assertEqual(expr1.simplify(whitelist=whitelist), expr2) <file_sep>/expression/Variable.py from expression.Expression import Expression class Variable(Expression): """ An expression representing an unknown value """ def __init__(self, name): """ Args: name: Name to identify the variable by, ie 'x', 'y' """ super().__init__() self._name = name def evaluate(self, **kwargs): if self._name in kwargs: from utils.expression_utils import possibly_parse_literal return possibly_parse_literal(kwargs.get(self._name)) return self def get_name(self): """ Get the name of this variable Returns: The name of this variable """ return self._name def __eq__(self, other): return isinstance(other, Variable) and \ self.get_name() == other.get_name() def __hash__(self): return hash(self.get_name()) def __repr__(self): return '{}'.format(self._name) <file_sep>/tests/test_simplifier.py from expression.simplifier.AddSimplifiers import * from expression.simplifier.DivideSimplifiers import * from expression.simplifier.MultiplySimplifiers import * from expression.simplifier.PowerSimplifiers import * from expression.simplifier.SubtractSimplifiers import * from expression.simplifier.TrigSimplifiers import * from expression.Function import Sin, Add, Multiply, Asin, Cos, Acos from expression.Value import Value from tests.utils import SimplifierTest, x, y, z # TODO test errors class DivideByOneTest(SimplifierTest): simplifier = DivideByOneSimplifier() def runTest(self): self.assertSimplify(x / 1, x) class MultiplyNestedSimplifierTest(SimplifierTest): simplifier = MultiplyNestedMultiplySimplifier() def runTest(self): self.assertSimplify((x * y) * z, Multiply(x, y, z)) class MultiplyDistributeSimplifierTest(SimplifierTest): simplifier = MultiplyDistributeSimplifier() def runTest(self): self.assertSimplify(x * (x + x), (x * x) + (x * x)) self.assertSimplify(x * (x + x + x), (x * x) + (x * x) + (x * x)) self.assertSimplify(Multiply(x, y, (x + 1)), Multiply((x * y), x) + Multiply((x * y), 1)) class MultiplyCombineTermsSimplifierTest(SimplifierTest): simplifier = MultiplyCombineTermsSimplifier() def runTest(self): self.assertSimplify(x * x, x ^ 2) self.assertSimplify(Multiply(x, y, x), (x ^ 2) * y) class MultiplyCombineValuesSimplifierTest(SimplifierTest): simplifier = MultiplyCombineValuesSimplifier() def runTest(self): self.assertSimplify(Multiply(3, 4, x), Multiply(12, x)) self.assertSimplify(Multiply(3, 4, x - 1), Multiply(12, x - 1)) class PowerOfOneSimplifierTest(SimplifierTest): simplifier = PowerOfOneSimplifier() def runTest(self): self.assertSimplify(x ^ 1, x) self.assertSimplify((x + y) ^ 1, x + y) class PowerOfZeroSimplifierTest(SimplifierTest): simplifier = PowerOfZeroSimplifier() def runTest(self): self.assertSimplify(x ^ 0, Value(1)) self.assertSimplify((x + y) ^ 0, Value(1)) class SubtractZeroSimplifierTest(SimplifierTest): simplifier = SubtractWithZeroSimplifier() def runTest(self): self.assertSimplify(x - 0, x) self.assertSimplify((x + y) - 0, x + y) class SinAsinSimplifierTest(SimplifierTest): simplifier = SinAsinSimplifier() def runTest(self): self.assertSimplify(Sin(Asin(x - 1)), x - 1) class AsinSinSimplifierTest(SimplifierTest): simplifier = AsinSinSimplifier() def runTest(self): self.assertSimplify(Asin(Sin(x - 1)), x - 1) class CosAcosSimplifierTest(SimplifierTest): simplifier = CosAcosSimplifier() def runTest(self): self.assertSimplify(Cos(Acos(x - 1)), x - 1) class AcosCosSimplifierTest(SimplifierTest): simplifier = AcosCosSimplifier() def runTest(self): self.assertSimplify(Acos(Cos(x - 1)), x - 1) class AddNestedAddSimplifierTest(SimplifierTest): simplifier = AddNestedAddSimplifier() def runTest(self): self.assertSimplify((x + y) + z, Add(z, y, x)) class AddCombineValuesSimplifierTest(SimplifierTest): simplifier = AddCombineValuesSimplifier() def runTest(self): self.assertSimplify(Add(x, 3, 5), Add(x, 8)) self.assertSimplify(Add(x - 1, 3, 5), Add(x - 1, 8)) class AddCombineTermsSimplifierTest(SimplifierTest): simplifier = AddCombineTermsSimplifier() def runTest(self): self.assertSimplify(x + x, x * 2) self.assertSimplify(x + x + x, x * 3) self.assertSimplify(x + 4 + x + x, x * 3 + 4) class AddFactorSimplifierTest(SimplifierTest): simplifier = AddFactorSimplifier() def runTest(self): self.assertSimplify((x * 2) + (x * x), x * (x + 2)) self.assertSimplify((Cos(x) * 2) + (Cos(x) * x), Cos(x) * (x + 2)) self.assertSimplify((x * 2) + (x * x) + (x * y), x * (x + 2 + y)) self.assertSimplify((x * 2) + (y * 3), (x * 2) + (y * 3)) <file_sep>/expression/Value.py from expression.Expression import Expression class Value(Expression): """ An expression representing a literal numeric value """ def __init__(self, value): """ Args: value: The value """ super().__init__() if not isinstance(value, (int, float, complex)): raise ValueError('Invalid Value') self._value = value def evaluate(self, **kwargs): return self def get_numeric_value(self): return self._value def __eq__(self, other): return isinstance(other, Value) and \ self.get_numeric_value() == other.get_numeric_value() def __hash__(self): return hash(self.get_numeric_value()) def __repr__(self): return '{}'.format(self._value) <file_sep>/expression/simplifier/MultiplySimplifiers.py from collections import Counter from functools import reduce from itertools import chain from expression.Function import Multiply, Add from expression.Value import Value from expression.simplifier.Simplifier import Simplifier from utils.expression_utils import filter_split class MultiplyNestedMultiplySimplifier(Simplifier): def can_simplify(self, expression): return isinstance(expression, Multiply) and \ len([expr for expr in expression.get_expressions() if isinstance(expr, Multiply)]) != 0 def _simplify(self, expression): mult, other = filter_split(lambda x: isinstance(x, Multiply), expression.get_expressions()) mult = list(chain(*map(lambda x: x.get_expressions(), mult))) return Multiply(*mult, *other) class MultiplyDistributeSimplifier(Simplifier): def can_simplify(self, expression): return isinstance(expression, Multiply) and any(isinstance(x, Add) for x in expression.get_expressions()) def _simplify(self, expression): exprs = list(expression.get_expressions()) add = next(e for e in exprs if isinstance(e, Add)) exprs.remove(add) terms = [] for term in add.get_expressions(): if len(exprs) == 1: terms.append(Multiply(exprs[0], term)) else: terms.append(Multiply(Multiply(*exprs), term)) return Add(*terms) class MultiplyCombineTermsSimplifier(Simplifier): def can_simplify(self, expression): return isinstance(expression, Multiply) def _simplify(self, expression): exprs = expression.get_expressions() counts = Counter(exprs) exprs = [] for term in counts: freq = counts[term] if freq == 1: exprs.append(term) else: exprs.append(term ^ Value(freq)) if len(exprs) == 1: return exprs[0] return Multiply(*exprs) class MultiplyCombineValuesSimplifier(Simplifier): def can_simplify(self, expression): return isinstance(expression, Multiply) and len( [expr for expr in expression.get_expressions() if isinstance(expr, Value)]) > 0 def _simplify(self, expression): values, other = filter_split(lambda x: isinstance(x, Value), expression.get_expressions()) value = reduce(lambda x, y: x * y, map(lambda x: x.get_numeric_value(), values)) if value == 0: return Value(0) if value == 1: if len(other) == 1: return other[0] return Multiply(*other) if value == -1: if len(other) == 1: return -other[0] return -Multiply(*other) if len(other) == 0: return Value(value) return Multiply(value, *other) <file_sep>/requirements.txt nose >= 1.3.7 <file_sep>/tests/test_equality.py import unittest from expression.Function import * from tests.utils import x, y, z class AddCommutativeEqualityTestCase(unittest.TestCase): def runTest(self): self.assertEqual(x + y, y + x) self.assertEqual(Cos(x + y + z), Cos(z + y + x)) self.assertEqual(Value(3) + Value(2), Value(2) + Value(3)) class MultiplyCommutativeEqualityTestCase(unittest.TestCase): def runTest(self): self.assertEqual(x * y, y * x) self.assertEqual(x * y * z, z * y * x) self.assertEqual(Cos(x * y * z), Cos(z * y * x)) self.assertEqual(Value(3) * Value(2), Value(2) * Value(3)) class FunctionEqualityTestCase(unittest.TestCase): def assertSelfEquality(self, func, *args): self.assertEqual(func(*args), func(*args)) def runTest(self): self.assertSelfEquality(Sin, x) self.assertSelfEquality(Cos, x) self.assertSelfEquality(Asin, x) self.assertSelfEquality(Acos, x) self.assertSelfEquality(Negate, x) self.assertSelfEquality(Add, x, y) self.assertSelfEquality(Subtract, x, y) self.assertSelfEquality(Divide, x, y) self.assertSelfEquality(Multiply, x, y) self.assertSelfEquality(Exponent, x, y) self.assertSelfEquality(Log, x, y) <file_sep>/expression/simplifier/DivideSimplifiers.py from expression.Function import Divide from expression.Value import Value from expression.simplifier.Simplifier import Simplifier class DivideByOneSimplifier(Simplifier): def can_simplify(self, expression): return isinstance(expression, Divide) and expression.get_expressions()[1] in (Value(1), Value(-1)) def _simplify(self, expression): numer, denom = expression.get_expressions() if denom == Value(1): return numer else: return -numer <file_sep>/expression/Derivative.py from expression.SimplifiableExpression import SimplifiableExpression from expression.Value import Value from utils.expression_utils import possibly_parse_literal class Derivative(SimplifiableExpression): """ Represents a derivative operation """ def __init__(self, expr, var): """ Args: expr: The expression to take the derivative of var: The variable (or expression) to take with respect to """ super().__init__() self._expr = possibly_parse_literal(expr) self._var = possibly_parse_literal(var) if isinstance(self._var, Value): raise ValueError('Invalid respect to') def get_expression(self): """ Gets the expression Returns: The expression """ return self._expr def get_var(self): """ Gets the variable (or expression) this derivative is respect to Returns: The variable """ return self._var def evaluate(self, **kwargs): # TODO maybe rethink evaluation / simplifying here? this seems to work but questionable simplified = self.simplify() if simplified == self: return self return simplified.evaluate(**kwargs) def get_transformations(self): direct = self.get_direct_transformations() sub_transformations = [] expr_transformations = self.get_expression().get_transformations() var_transformations = self.get_var().get_transformations() for transformation in expr_transformations: sub_transformations.append(Derivative(transformation, self.get_var())) for transformation in var_transformations: sub_transformations.append(Derivative(self.get_expression(), transformation)) return direct + sub_transformations def get_simplifiers(self): from expression.simplifier.DerivativeSimplifiers import ( DerivativeConstantSimplifier, DerivativeVariableSimplifier, DerivativeSinSimplifier, DerivativeCosSimplifier, DerivativeNegateSimplifier, DerivativeAddSimplifier, DerivativeSubtractSimplifier, DerivativeMultiplySimplifier, DerivativeExponentSimplifier, DerivativeLogSimplifier, DerivativeDivideSimplifier, ) return [ DerivativeConstantSimplifier(), DerivativeVariableSimplifier(), DerivativeSinSimplifier(), DerivativeCosSimplifier(), DerivativeNegateSimplifier(), DerivativeAddSimplifier(), DerivativeSubtractSimplifier(), DerivativeMultiplySimplifier(), DerivativeExponentSimplifier(), DerivativeLogSimplifier(), DerivativeDivideSimplifier(), ] def __eq__(self, other): return isinstance(other, Derivative) and \ self.get_expression() == other.get_expression() and \ self.get_var() == other.get_var() def __hash__(self): return hash((type(self), self.get_expression(), self.get_var())) def __repr__(self): return 'd({})/d{}'.format(self._expr, self._var) <file_sep>/parsing/Tokenizer.py from utils.parsing_utils import is_alpha, is_numeric from utils.data_structure_utils import Stream def tokenize(s): stream = Stream(s.replace(' ', '')) last_token = '' tokens = [] while stream.has_next(): if len(last_token) == 0: last_token += stream.take() continue if (last_token + stream.peek()).isnumeric(): last_token += stream.take() continue if is_alpha(last_token + stream.peek()): last_token += stream.take() continue # TODO come up with cleaner way to handle multi character operators if (last_token + stream.peek()) == '/': last_token += stream.take() continue if (last_token + stream.peek()) == '//': last_token += stream.take() tokens.append(last_token) last_token = '' tokens.append(last_token) return tokens def clean_tokens(tokens): tokens = tokens[::] idx = 0 while idx < (len(tokens) - 1): if is_alpha(tokens[idx]) and is_alpha(tokens[idx + 1]): tokens.insert(idx + 1, '*') # TODO see if this is the best way to do this if (is_alpha(tokens[idx]) and is_numeric(tokens[idx + 1])) or\ (is_numeric(tokens[idx]) and is_alpha(tokens[idx + 1])): tokens.insert(idx + 1, '*') idx += 1 return tokens <file_sep>/tests/test_tokenizer.py import unittest from parsing.Tokenizer import tokenize, clean_tokens class TokenizerTest(unittest.TestCase): def runTest(self): self.assertEqual(tokenize('(34 + 3)'), ['(', '34', '+', '3', ')']) self.assertEqual(tokenize('(34 + xYz)'), ['(', '34', '+', 'xYz', ')']) self.assertEqual(tokenize('(34 - y * x+ xYz)'), ['(', '34', '-', 'y', '*', 'x', '+', 'xYz', ')']) self.assertEqual(tokenize('(34 // x)'), ['(', '34', '//', 'x', ')']) class CleanTokensTest(unittest.TestCase): def runTest(self): self.assertEquals(clean_tokens(['x', 'sin', '(', 'x', ')']), ['x', '*', 'sin', '(', 'x', ')']) <file_sep>/expression/simplifier/GraphSimplifier.py from utils.data_structure_utils import Queue, Stack from expression.Function import Sin, Asin, Cos from expression.Variable import Variable from expression.Value import Value from collections import defaultdict def simplify(expr): previous = {} queue = Queue() queue.push(expr) while not queue.is_empty(): expr = queue.pop() transformations = expr.get_transformations() print(expr) print(len(transformations)) if len(transformations) == 0: return expr for new_expr in transformations: if new_expr not in previous: previous[new_expr] = expr queue.push(new_expr) return previous def simplify2(expr): blacklist = set() while True: ts = expr.get_transformations() n = next((e for e in ts if e not in blacklist), expr) if n == expr: return expr expr = n blacklist.add(expr) print(expr) if __name__ == '__main__': x = Variable('x') expr = ((Value(2) * (x^2) + (Value(3) * Sin(x))) // x) * (x + 1) simp = simplify2(expr) print(simp)
edd98534c84d005f6866b0c1132e0f01cc6ce247
[ "Python", "Text" ]
30
Python
arispoloway/symbolicmath
55b1ac6018add143521f17aca7c5a3056992d426
09f9a27e726b43f5c2851a34b4756d113bcf1ccb
refs/heads/main
<file_sep>library(shiny) library(shinycssloaders) library(ggplot2) library(plyr) library(hrbrthemes) library(dplyr) library(waffle) library(ftplottools) library(stringr) navy = rgb(25, 62, 114, maxColorValue = 255) coral = rgb(234, 93, 78, maxColorValue = 255) orange = rgb(242, 147, 48, maxColorValue = 255) yellow = rgb(254, 212, 122, maxColorValue = 255) purple = rgb(102, 103, 173, maxColorValue = 255) aqua = rgb(46, 169, 176, maxColorValue = 255) green = rgb(70, 168, 108, maxColorValue = 255) grey = rgb(172, 188, 195, maxColorValue = 255) grey60 = rgb(206, 214, 219, maxColorValue = 255) green60 = rgb(121, 185, 137, maxColorValue = 255) navy60 = rgb(116, 124, 163, maxColorValue = 255) coral60 = rgb(242, 188, 149, maxColorValue = 255) orange60 = rgb(249, 193, 135, maxColorValue = 255) orange20 = rgb(253,235,216, maxColorValue = 255) green20 = rgb(226, 236, 227, maxColorValue = 255) grey20 = rgb(239,241,243, maxColorValue = 255) navy20 = rgb(208,208,224, maxColorValue = 255) coral20 = rgb(248,221,219, maxColorValue = 255) schemes = c("sheaf_valley_cycle_route", "crookes_active_neighbourhood", "nether_edge_active_neighbourhood", "neepsend_kelham_city_centre", "nether_edge_city_centre", "darnall_attercliffe_city_centre", "magna_tinsley" ) titles = c("Sheaf Valley\nCycle Route", "Crookes Active\nNeighbourhood", "Nether Edge\nActive\nNeighbourhood", "Neepsend Kelham\nCity", "Nether Edge\nCity", "Darnall\nAttercliffe\nCity", "Magna\nTinsley") names(titles)=schemes feeling = c(0,25,50,75,100) meaning = c("oppose","somewhat-oppose","neutral","somewhat-support","support") get_data = function(scheme){ scheme_new = str_replace_all(scheme,"_","-") print(scheme_new) url=paste0("https://connectingsheffield.commonplace.is/schemes/proposals/",scheme_new,"/comments.json?pageSize=10000") data=jsonlite::fromJSON(url) return(data) } # Define UI ---- ui <- navbarPage("Connecting Sheffield: Live Results",id = "navbarID", inverse = T, tabPanel("All", h2("Connecting Sheffield: Better Travel Choices"), p("This is an UNOFFICIAL live summary of the comments on Sheffield City Councils active travel proposals. For more information see the official site: https://connectingsheffield.commonplace.is"), h4("All Proposal Comments by Feeling"), p("This takes a a few seconds to load while the app fetches all the comments."), withSpinner(plotOutput("all_plot",height=700),color = grey)), do.call(navbarMenu, c("Individual Schemes", lapply(schemes, function(i) { tabPanel( i, h2(titles[[i]]), withSpinner(plotOutput(paste0("summary_plot_",i),width=700),color=grey), h4("Comments Over Time"), withSpinner(plotOutput(paste0("time_plot_",i),height=700),color=grey), h4("Comments Over Time - Proportion"), withSpinner(plotOutput(paste0("time_plot_prop_",i),height=700),color=grey), ) }))), tabPanel("About", h2("About"), p("This app fectches comments from the \"Connecting Sheffield: Better travel choices\" website and plots them in various ways."), p("Written by <NAME> (twitter: @bioinfomatt)") ), mainPanel( # actionButton("browser", "browser"), # tags$script("$('#browser').hide();") # Add to your server # And to show the button in your app, go # to your web browser, open the JS console, # And type: # $('#browser').show(); # h2("Connecting Sheffield: Better Travel Choices"), # p("This is an UNOFFICIAL live summary of the comments on Sheffield City Councils active travel proposals. For more information see the official site: https://connectingsheffield.commonplace.is"), # h4("All Proposal Comments by Feeling"), # withSpinner(plotOutput("all_plot",height=700),color = grey) ) ) # Define server logic ---- server <- function(input, output) { # observeEvent(input$browser,{ # browser() # }) datas=list() for(i in schemes){ print(i) assign(paste0("data_",i),get_data(i)$data) datas = c(datas,list(eval(as.name(paste0("data_",i))))) } names(datas) = schemes summary_list=list() for (i in schemes){ dat=data.frame(feeling=datas[[i]]$feeling) %>% group_by(feeling) %>% dplyr::summarise(n=n()) %>% mutate(scheme=i) summary_list[[i]] = dat } summary = do.call(rbind, summary_list) output$all_plot <- renderPlot({ ggplot(summary, aes(fill = as.factor(feeling), values = n)) + geom_waffle(color = "white", size = .25, n_rows = 10, flip = TRUE) + facet_wrap(~scheme, nrow = 1, strip.position = "bottom",labeller=as_labeller(titles)) + scale_x_discrete() + scale_y_continuous(labels = function(x) x * 10, # make this multiplyer the same as n_rows expand = c(0,0)) + ggthemes::scale_fill_tableau(name=NULL) + labs( caption = "*All active proposals, data from all live displayable comments. Color based on 'Feeling' field.", x = "Proposal", y = "Comments" ) + ft_theme() + theme(panel.grid = element_blank(), axis.ticks.y = element_line()) + # guides(fill = guide_legend(reverse = TRUE))+ # scale_fill_manual(values=c(coral,coral60,grey,green60,green))+ scale_fill_manual("Feeling",values=c(coral,coral60,grey,navy60,navy),labels=meaning,breaks=feeling) }) # observeEvent(input$navbarID, {dat=reactive(eval(as.name(paste0("data_",input$navbarID))))}) dat = reactive(eval(as.name(paste0("data_",input$navbarID)))) selected = reactive(input$navbarID) for (s in schemes){ print(paste0("plotting over time for ",s)) output[[paste0("time_plot_",s)]] = renderPlot({ ggplot(dat(),aes(as.Date(date),color=as.factor(feeling),fill=as.factor(feeling)))+ geom_bar(position="stack")+ ft_theme()+ scale_fill_manual("Feeling",values=c(coral,coral60,grey,green60,green),labels=meaning,breaks=feeling)+ scale_color_manual("Feeling",values=c(coral,coral60,grey,green60,green),labels=meaning,breaks=feeling)+ scale_x_date("Date of Comment")+ scale_y_continuous("Number of Comments") }) print(paste0("plotting over time (prop) for ",s)) output[[paste0("time_plot_prop_",s)]] = renderPlot({ ggplot(dat(),aes(as.Date(date),color=as.factor(feeling),fill=as.factor(feeling)))+ geom_bar(position="fill")+ ft_theme()+ scale_fill_manual("Feeling",values=c(coral,coral60,grey,green60,green),labels=meaning,breaks=feeling)+ scale_color_manual("Feeling",values=c(coral,coral60,grey,green60,green),labels=meaning,breaks=feeling)+ scale_x_date("Date of Comment")+ scale_y_continuous("Number of Comments") }) print(paste0("plotting summary for ",s)) output[[paste0("summary_plot_",s)]] = renderPlot({ ggplot(summary %>% filter(scheme==selected()) %>% mutate(percentage=n/sum(n)*100), aes(x = "", y = n, fill = as.factor(feeling))) + geom_bar(position = position_stack(), stat = "identity", width = .7) + geom_text(aes(label = round(percentage,1)), position = position_stack(vjust = 0.5), size = 4,color="white") + coord_flip()+ labs(fill = NULL, colour = NULL) + theme_ipsum_rc(grid="") + theme_enhance_waffle()+ scale_fill_manual("Feeling",values=c(coral,coral60,grey,green60,green),labels=meaning,breaks=feeling) }) } } # Run the app ---- shinyApp(ui = ui, server = server)
a36ba44685036c03cb450e59dc2221d78208fb70
[ "R" ]
1
R
mattdmem/active-travel
48a26943589f7f3626164cb3166be161570eb677
4df3811e1949e9118c70e603d3a99cbfb317811f
refs/heads/master
<file_sep>| Параметр | значения | описание | |-------------|--------|---------------------------------------------| |requestType|CREATE_ORDER_FOR_EMISSION_IC CHANGE_STATUS|тип генерируемого запроса| |quantity|число|число запрашиваемых кодов маркировки| |cttId|строка|идентификатор пользователя в CTT| |requestId|строка|идентификатор запроса CTT| |gtin|строка|идентификатор продукта| |status|строка|новый статус сообщения| |time|число|новое время ожидания для сообщения| |type|строка|тип routing запроса| **Применимость параметров** - PING - cttId - если не задано то "77f5ccc7bd27d7" - CREATE_ORDER_FOR_EMISSION_IC - cttId - если не задано то "77f5ccc7bd27d7" - quantity - если не задано то случайное число от 1 до 100 - GET_IC_BUFFER_STATUS - cttId - если не задано то "77f5ccc7bd27d7" - requestId - идентификатор запроса заказа на эмиссию КМ - gtin - GET_ICS_FROM_THE_ORDER - cttId - если не задано то "77f5ccc7bd27d7" - requestId - идентификатор запроса заказа на эмиссию КМ - gtin - CHANGE_STATUS - cttId - если не задано то "77f5ccc7bd27d7" - requestId - status - time для формирования правильного запроса CHANGE_STATUS необходимо указать requestId и status и/или time **Роутинг** Обязательные параметры - cttId - если не задано то "77f5ccc7bd27d7" - type Варианты значений type: - close_suborder - закрытие подзаказа по gtin - usage_report - отправка отчета об использовании - business_order_status - получение статуса бизнес заказов - get_reports_status - получение статуса обработки отчетов **Закрытие подзаказа по gtin** Параметры: - requestId - идентификатор запроса **Отправка отчета об использовании** **Получение статуса бизнес заказов** **Получение статуса обработки отчетов** пример запуска node . --requestType=CREATE_ORDER_FOR_EMISSION_IC <file_sep>const {Client} = require('pg'); const client = new Client(); const messageStackByRequestId = async requestId => { const res = await client.query(` select ms.gtin, ms.lastblockid, mio.identification_value as orderId from messages.adapter_message_identification mi join messages.adapter_message_stack ms on mi.adapter_message_id = ms.adapter_message_id join messages.adapter_message_identification mio on mi.adapter_message_id = mio.adapter_message_id where mi.system_id = 'CTT' and mi.identification_type = 'GUID' and mi.identification_value = $1 and mio.system_id = 'OMS' and mio.identification_type = 'orderId'`, [requestId]); return res.rows[0]; }; const getCodes = async requestId => { const res = await client.query(` select c.cryptocode as code from messages.cryptocodes c where exists ( select * from messages.adapter_message_stack ms where c.adapter_message_stack_id = ms.adapter_message_stack_id and exists ( select * from messages.adapter_message_identification mi where mi.adapter_message_id = ms.adapter_message_id and mi.system_id = 'CTT' and mi.identification_type = 'GUID' and mi.identification_value = $1 ) )`, [requestId]); return res.rows.map(r => r.code); }; function wrap(fn) { return async function () { let res; const args = [...arguments]; client.connect(); try { res = await fn.apply(this, args); } catch (e) {} client.end(); return res; } } module.exports = { messageStackByRequestId: wrap(messageStackByRequestId), getCodes: wrap(getCodes) };
da10973859d40b3bfed5fc60dce4740ba0146a07
[ "Markdown", "JavaScript" ]
2
Markdown
hellbelk/suz-adapter-request-generator
c43a1922fa6a3a070cab1aea4cc2378559b0c26d
0a6c8564beacbbb52213ea006ccbe9393d555a3f
refs/heads/master
<repo_name>nate-lynx-tech/manual-workflow-test<file_sep>/pre-commit_sanitize_workflow.sh #!/bin/sh # # A hook script to remove BOM headers from GitHub worfklows # Modified slightly from https://gist.github.com/rlee287/e6026243dedc38398298 , thank you rlee287 echo "Running pre-commit BOM removal" trap ctrl_c INT ctrl_c () { if [ -f $templist ]; then rm $templist; fi if [ -f $checkam ]; then rm $checkam fi if [ -f $statfile ]; then rm $statfile fi exit } isBinary() { p=$(printf '%s\t-\t' -) t=$(git diff --no-index --numstat /dev/null "$1") case "$t" in "$p"*) return 0 ;; esac return 1 } templist=$(mktemp "/tmp/git_sed_remove.XXXXXXXX") statfile=$(mktemp "/tmp/git_sed_remove.XXXXXXXX") checkam=$(mktemp "/tmp/git_sed_remove.XXXXXXXX") listchange=$(git diff --cached --name-only --diff-filter="AMRCB") stat=$(git status --porcelain) echo "${stat}" >> $statfile awk 'match($1, "*M")' $statfile > $checkam if [ -s $checkam ]; then echo "Files have been modified since they were added" echo "This script will add new modifications" echo "Please add them first" exit 1 fi echo "${listchange}" > $templist for file in $(cat $templist) do isBinary $file if [ $? != 0 ]; then echo "Checking text file $file" #grep '1 s/^\xef\xbb\xbf//' $file sed --quiet '0,/^\xef\xbb\xbf/{//q8;}' $file if [ $? = 8 ]; then #remove UTF-8 echo "Stripping UTF-8 BOM headers from $file" sed --in-place '1 s/^\xef\xbb\xbf//' $file fi sed --quiet '0,/^\xfe\xff/{//q16;}' $file if [ $? = 16 ] && [ "$file" == *".github/workflows"*]; then #remove UTF-16 echo "Stripping UTF-16 BOM headers from GitHub Workflow file $file" sed --in-place '1 s/^\xfe\xff//' $file fi git add $file &> /dev/null else echo "Skipped binary file $file" fi done # If there are whitespace errors, print the offending file names and fail. #exec git diff-index --check --cached $against -- ctrl_c<file_sep>/README.md # manual-workflow-test Testing new workflow_dispatch event in GitHub Actions
425ec0dda62eec777450bb38b92f501cc0b13929
[ "Markdown", "Shell" ]
2
Shell
nate-lynx-tech/manual-workflow-test
50a63238d73e95b99943086e268a67237e1e8a5b
66fcc52f26f22bf61d4c51e34e4ea8758767b0d2
refs/heads/master
<repo_name>arturogzzt/soccer_tournaments<file_sep>/app/views/tournaments/_tournament.json.jbuilder json.extract! tournament, :id, :name, :start_date, :end_date, :created_at, :updated_at json.url tournament_url(tournament, format: :json)<file_sep>/app/models/match.rb class Match < ApplicationRecord belongs_to :Tournament belongs_to :field end <file_sep>/db/migrate/20161021015429_add_user_id_to_team.rb class AddUserIdToTeam < ActiveRecord::Migration[5.0] def change add_column :teams, :user_id, :integer add_index :teams, :user_id end end <file_sep>/db/migrate/20161021003151_create_matches.rb class CreateMatches < ActiveRecord::Migration[5.0] def change create_table :matches do |t| t.integer :tournament_id t.datetime :schedule t.integer :field_id t.timestamps end end end <file_sep>/app/models/tournament.rb class Tournament < ApplicationRecord has_many :matches belongs_to :user end <file_sep>/config/routes.rb Rails.application.routes.draw do resources :teams do resources :players end resources :tournaments devise_for :users resources :users root 'tournaments#index' get 'my_tournaments', to: 'tournaments#my_tournaments' get 'my_teams', to: 'teams#my_teams' # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end
46a29a24163c5fd9ab5be2ca93e22d7e4abc6ed4
[ "Ruby" ]
6
Ruby
arturogzzt/soccer_tournaments
9a8f490a0cf5a64a569d24b48167cdbee7253990
cc1a6751d3d3ad3ed82716d8c0070aecfb38f452
refs/heads/main
<repo_name>JustinHenryLo/Express-Notes<file_sep>/routes/posts.js const express = require("express"); const router = express.Router(); //import post db schema from models folder const Post = require("../models/Post"); //middleware router.use("/", (req, res, next)=>{ console.log("PostJS middleware"); next(); }) //=============================================================================== //endpoints router.get('/moreEndpoints', (req,res)=>{ res.send("HELLO WORLD MORE ENDPOINTS"); }) //=============================================================================== //NOT async method of saving // router.use("/", (req, res, next)=>{ // console.log("PostJS middleware"); // const post = new Post({ // title: req.body.title, // description: req.body.description // }) // post.save() // .then(data => { // res.json(data); // }) // .catch(err => // res.json({message:err})) // next(); // }) //=============================================================================== //async version of saving //use postman to test, send a title and description //add a post router.post("/", async(req,res)=>{ const post = new Post({ title: req.body.title, description: req.body.description }) try{ const savedPost = await post.save(); res.json(savedPost); } catch(err){ res.json({message:err}) } //const Post; }) //=============================================================================== //get all posts router.get("/", async(req,res)=>{ try{ const posts = await Post.find(); res.json(posts); } catch(err){ res.json({message: err}) } }) //=============================================================================== //get one post given id router.get('/:postID',async (req,res)=>{ try{ console.log(req.params.postID); var post = await Post.findById(req.params.postID); res.json(post); } catch(err){ res.json({message:err}) } }); //=============================================================================== //delete one post given id router.delete('/:postID',async (req,res)=>{ try{ console.log(req.params.postID); var post = await Post.remove({_id: req.params.postID});//pass a querying object res.json(post); } catch(err){ res.json({message:err}) } }); module.exports = router; //=============================================================================== //update a post router.patch('/:postID',async (req,res)=>{ try{ console.log(req.params.postID); var post = await Post.updateOne( {_id: req.params.postID}, //pass a querying object {$set:{title: req.body.title}});//replace title field res.json(post); } catch(err){ res.json({message:err}) } }); module.exports = router; //req.params is URL params (get stuff) //req.body is URL body (post stuff)<file_sep>/app.js //1. run npm install express nodemon //2. add a nodemon command in the scripts of package.json //("npm start" will run the start command in scripts of package.json) //=============================================================================== //3. import express const express = require('express'); //=============================================================================== //4. execute express const app = express(); //=============================================================================== //7. middleware // will run when / is accessed app.use('/', (req, res, next)=>{ console.log("This is middleware"); next();//< will continue going to the proper endpoint }) //body parser is used to decode url data to json, install body-parser const bodyParser = require('body-parser'); app.use(bodyParser.json()); //cors allows api to be called in another domain //use if backend is not same server as front end const cors = require("cors"); app.use(cors()); //=============================================================================== //8. connect to db const mongoose = require('mongoose'); //username: user //password: <PASSWORD> //database: Cluster0 //Sample old connection string, but if this connection string is pushed to git then people can see password etc.. mongoose.connect("mongodb+srv://user:P4$$word@cluster0.g5pbb.mongodb.net/Cluster0?retryWrites=true&w=majority", { useNewUrlParser: true,//< from deprecated connection warning, just used because it was suggested useUnifiedTopology: true },//< from deprecated connection warning, just used because it was suggested ()=>{console.log("connected")}); //Sample new connection string, uses dotenv to store DB link so no leak in pushing require("dotenv/config"); mongoose.connect(process.env.DB_CONNECTION, { useNewUrlParser: true,//< from deprecated connection warning, just used because it was suggested useUnifiedTopology: true },//< from deprecated connection warning, just used because it was suggested ()=>{console.log("connected")}); //=============================================================================== //6. create api endpoints //| app.get | app.post | app.delete | app.patch | app.get('/', (req,res)=>{ res.send("HELLO WORLD"); }) //=============================================================================== //9 To make it clean, put all posts in a separate file. //- create a routes folder //- create a posts.js //refer to new file //=============================================================================== //10 Import the routes created in post.js const postRoutes = require('./routes/posts'); app.use('/posts',postRoutes); // /posts will be appended to all the endpoints in posts.js because of /posts param in app.use //i.e. /posts/moreEndpoints is a sample //=============================================================================== //5. start listening to requests app.listen(3000); //=============================================================================== //todo try using funcs //todo try using utils
d8d44f7a42310c10b54a4ffd67a6ce9b3b301999
[ "JavaScript" ]
2
JavaScript
JustinHenryLo/Express-Notes
d5c1ce1b4b9b04886d44ba99e598dffe7226a1e4
74ec2431acde90290fba702373ab6e9e9c461a6c
refs/heads/master
<file_sep>// AvanceradC++.Lab.01.cpp : Defines the entry point for the console application. // #ifdef _DEBUG #ifndef DBG_NEW #define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) #define new DBG_NEW #endif #endif // _DEBUG #include "stdafx.h" #include <iostream> #include "List.h" #include "Link.h" #include <assert.h> using namespace std; #define LOG(x) cout<<x<<endl; class Node :public Link<Node> { public: float data; Node(float v = 0) :data(v) {} bool Match(float v) { return data == v; } virtual std::ostream& Print(std::ostream& cout) const { return cout << data; } }; void TestDLL(); template Link<Node>; //Detta tvingar fram att allting i Link kompileras template List<Node>; //Detta tvingar fram att allting i List kompileras int main() { _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); TestDLL(); cin.get(); return 0; } void TestDLL() { List<Node> myList; assert(myList.Invariant()); Node * nodeA3 = myList.PushFront(new Node(3)); assert(myList.Invariant()); myList.PushFront(new Node(2)); myList.PushFront(new Node(1)); assert(myList.Invariant()); myList.PushBack(new Node(1)); myList.PushBack(new Node(2)); myList.PushBack(new Node(3)); //myList.Check(); assert(myList.Invariant()); assert(myList.Last()->Next() == nullptr); //std::cout << myList; //should be 1 2 3 1 2 3 std::cout << myList << endl; Node * tempA3 = myList.FindNext(3); assert(tempA3 == nodeA3); Node * nodeB1 = nodeA3->FindNext(1); Node * tempB1 = tempA3->DeleteAfter(); //ta bort andra 1:an assert(myList.Invariant()); assert(tempB1->data == 1); Node * nodeA2 = myList.FindFirst(2); Node * nodeB2 = nodeA2->FindNext(2); Node * temp = nodeB2->FindNext(2); assert(!temp); nodeA2->DeleteAfter(); //std::cout << myList; //1 2 2 3 std::cout << myList << endl; myList.First()->Next()->InsertAfter(tempA3)->InsertAfter(tempB1); assert(myList.Last()->Prev()->data == 2); assert(myList.Invariant()); //std::cout << myList; //should be 1 2 3 1 2 3 std::cout << myList << endl; {Node* t = myList.PopFront(); assert(t->data == 1); delete t; } {Node* t = myList.PopFront(); assert(t->data == 2); delete t; } {Node* t = myList.PopFront(); assert(t->data == 3); delete t; } {Node* t = myList.PopFront(); assert(t->data == 1); delete t; } {Node* t = myList.PopFront(); assert(t->data == 2); delete t; } {Node* t = myList.PopFront(); assert(t->data == 3); delete t; } assert(myList.PopFront() == nullptr); assert(myList.PopFront() == nullptr); std::cout << myList << "end"; assert(myList.Invariant()); std::cin.get(); } <file_sep>#include "stdafx.h" #include "VG (1).h" #include "String.h" #include "StringItt.h" //#include "ForwardSort.h" //#include "HjälpProgram.h" //#include <forward_list> //using std::forward_list; #include <iostream> using std::cout; using std::endl; //#include <vector> //using std::vector; #include <algorithm> //#ifdef ITT //#ifdef workingProgress /* *it, ++it, it++, (it+i), it[i], == och != */ void TestIttPart() { String s1("foobar"); for (auto i = s1.begin(); i != s1.end(); i++) cout << *i; cout << endl; //s1 = "raboof"; auto it = s1.begin(); assert(*it == 'f'); assert(*(it++) == 'f' && *it == 'o'); ++it; assert(*++it == 'b'); assert(*(it + 1) == 'a'); assert(it[2] == 'r'); } void TestIttPartR() { String s1("foobar"); for (auto i = s1.rbegin(); i != s1.rend(); i++) cout << *i; cout << endl; s1 = "raboof"; auto it = s1.rbegin(); assert(*it == 'f'); assert(*(it++) == 'f' && *it == 'o'); ++it; assert(*++it == 'b'); assert(*(it + 1) == 'a'); assert(it[2] == 'r'); } //#endif #ifdef VG void TestIttPartC() { String s1("foobar"); for (auto i = s1.cbegin(); i != s1.cend(); i++) cout << *i; cout << endl; // s1 = "raboof"; auto it = s1.cbegin(); assert(*it == 'f'); assert(*(it++) == 'f' && *it == 'o'); ++it; assert(*++it == 'b'); assert(*(it + 1) == 'a'); assert(it[2] == 'r'); } void TestIttPartCR() { String s1("foobar"); for (auto i = s1.crbegin(); i != s1.crend(); ++i) cout << *i; cout << endl; s1 = "raboof"; auto it = s1.crbegin(); assert(*it == 'f'); assert(*(it++) == 'f' && *it == 'o'); ++it; assert(*++it == 'b'); assert(*(it + 1) == 'a'); assert(it[2] == 'r'); } #endif VG void TestFörGodkäntItt() { String::iterator Str; String::reverse_iterator rStr; TestIttPart(); TestIttPartR(); #ifdef VG String::const_iterator cStr; String::const_reverse_iterator crStr; TestIttPartC(); TestIttPartCR(); #endif VG String s("foobar"); Str = s.begin(); rStr = s.rbegin(); #ifdef VG cStr = s.cbegin(); crStr = s.crbegin(); #endif VG *Str = 'a'; *(rStr + 2) = 'c'; assert(s == "aoocar"); cout << "\nTestFörGodkänt Itt klar\n"; #ifdef VG cout << "\nTestFörVälGodkänt Itt klar\n"; #endif VG } //#endif Itt <file_sep>#include "stdafx.h" #include "SharedPtr.h" //SharedPtr::SharedPtr() //{ //} // // //SharedPtr::~SharedPtr() //{ //} <file_sep>// AvanceradC++.Lab.05.cpp : Defines the entry point for the console application. // //kompilera och se glad ut-Olle 18 #include "stdafx.h" #include "String.h" #include <cassert> #include <iostream> #include <utility> #include "StringTest.h" #include "StringIttTest.h" #include <vector> using namespace std; #define _CRTDBG_MAP_ALLOC #ifdef _DEBUG #ifndef DBG_NEW #define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) #define new DBG_NEW #endif #endif // _DEBUG #include "StringItt.h" void Testing(); int main() { std::locale::global(std::locale("swedish")); TestFörGodkäntString(); TestFörGodkäntItt(); //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); //Testing(); return 0; } void Testing() { String str("hejsan"); cout << str.size(); assert(str.size() <= str.capacity()); } <file_sep>#include <cassert> template<typename Tint> Tint GCD(Tint A, Tint B) { A = abs(A); B = abs(B); if (A < B) return GCD(B, A); while (B != 0) { Tint temp = A%B; A = B; B = temp; } return A; } template<typename Tint> void Reduce(Tint& A, Tint& B) { Tint gcd = GCD(A, B); if (B < 0) gcd = -gcd; A /= gcd; B /= gcd; } template<typename Tint> void TestGCD() { assert(GCD(30, 42) == 6); assert(GCD(30, -42) == 6); assert(GCD(-30, 42) == 6); assert(GCD(-30, -42) == 6); assert(GCD(30, 42) == 6); } <file_sep>#include "stdafx.h" #include "Link.h" #include <iostream> //template<class T> //inline Link<T>::Link() //{ //} //Link::Link() //{ //} // // //Link::~Link() //{ //} <file_sep>My way of implemnting a shared pointer <file_sep> //#define VG //#define ITT <file_sep># Advanced-c++ *Advance programming in C++* taught at **Malmö University** ## About the assignemnt The assignemnts was formed in such a way that it was more focus on C++ as a tool rather than solving a task <file_sep>#pragma once #include <iostream> #include <memory.h> #include "StringItt.h" class String { char* cString; int length; int holds; public: typedef StringItt<char>::iterator iterator; typedef StringItt<char>::reverse_iterator reverse_iterator; iterator begin() { return iterator(cString); } iterator end() { return iterator(cString+holds); } reverse_iterator rbegin() { return reverse_iterator(&cString[holds-1]); } reverse_iterator rend() { return reverse_iterator(&cString[0]-1); } String(); String(const String& rhs); String(const char* cstr); String& operator=(const String& rhs); String& operator+=(const String& rhs); String operator+(); explicit operator bool(); int capacity() const; int size()const; bool isEmpty(); bool Invariant() const { /*if (cString == nullptr) return false; else { return 0 <= holds && holds <= length && cString[holds] == '\0'; }*/ return true; } char& at(size_t i); char& operator[](int i); const char& operator[](int i) const; const char* data() const; void reserve(size_t n); void shrink_to_fit(); void push_back(char c); void resize(size_t n); friend bool operator==(const String& lhs, const String& rhs); friend bool operator!=(const String& lhs, const String& rhs); friend std::ostream& operator<<(std::ostream& cout, String& rhs) { for (size_t i = 0; i < rhs.size(); ++i) { cout << rhs.cString[i]; } return cout; } ~String() { cString = nullptr; } }; <file_sep>#include "stdafx.h" #include "Itterator.h" Itterator::Itterator() { } Itterator::~Itterator() { } <file_sep>//#define VG template <class Tint> class Rational; //If you have called your Rational class something else //Uncomment the following lines and change "YourRationalHere" to your class name //template<typename T> //using Rational = YourRationalHere<T>; typedef Rational<short> Rshort; typedef Rational<int> Rint; typedef Rational<long long> RLL; <file_sep>#pragma once void TestFörGodkäntString(); void TestFörVälGodkäntString();<file_sep>// AvanceradC++.Lab.04.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <time.h> #include <stdlib.h> #include <vector> #include <algorithm> #include <list> #include <numeric> #include <random> #include <iostream> #include <forward_list> #include <iterator> using namespace std; vector<int> v(100); int arr[101]; forward_list<int> fList = { 20,5,15,40,50,30 }; forward_list<int>::iterator it; void SortAsc(); void SortDec(); void RemoveIf(); template<class ForwardItterator> void ForwardSort(ForwardItterator begin, ForwardItterator end); template<typename InputIt1, typename InputIt2, typename OutputIt> OutputIt my_merge(InputIt1 first1, InputIt1 end1, InputIt2 first2, InputIt2 end2, OutputIt out) { while (first1 != end1) { if (first2 == end2) return std::copy(first1, end1, out); if (*first1 < *first2) { *out = *first1; ++first1; } else { *out = *first2; ++first2; } ++out; } return std::copy(first2, end2, out); } template<typename InputIt> void mergesort(InputIt first, InputIt end) { size_t n = std::distance(first, end); if (n < 2) return; InputIt mid = first; for (size_t i = 0; i < n / 2; ++i) ++mid; std::vector<typename InputIt::value_type> res; mergesort(first, mid); mergesort(mid, end); my_merge(first, mid, mid, end, std::back_inserter(res)); std::copy(res.begin(), res.end(), first); } int main() { //Initilize containers and randomize them for (size_t i = 0; i < 101; i++) { arr[i] = i; } /*for (size_t i = 100; i > 0; i--) { fList.push_front(i); }*/ mergesort(fList.begin(), fList.end()); //fList.sort(); //it = fList.insert_after(it, fList.begin(), fList.end()); iota(v.begin(), v.end(), 0); random_shuffle(v.begin(), v.end()); random_shuffle(begin(arr), end(arr)); //-------------------------------------------------------- cout << "Array before sort:" << endl; for (size_t i = 0; i < 101; i++) { cout << arr[i] << " "; } cout << endl; cout << "Vector before sort:" << endl; for (auto i = 0; i < v.size(); i++) { cout << v[i] << " "; } cout << endl; //SortAsc(); SortDec(); RemoveIf(); cout << "Array after sort:" << endl; for (size_t i = 0; i < 101; i++) { cout << arr[i] << " "; } cout << endl; cout << "Vector after sort:" << endl; for (auto i = 0; i < v.size(); i++) { cout << v[i] << " "; } //ForwardSort(fList.begin(), fList.end()); cin.get(); return 0; } void SortAsc() { sort(v.begin(), v.end()); sort(begin(arr), end(arr)); } void SortDec() { sort(begin(arr), end(arr), [](const int a, const int b) {return a > b; }); sort(v.rbegin(), v.rend()); } void RemoveIf() { remove_if(v.begin(), v.end(), [](const int& value) {return (value % 2) == 1; }); }<file_sep># AvanceradC++.Lab.01 This is a doubly linked list that is made as a assignment for the course advanced programming in c++ The idéa is to make a DLL using templates(or rather CRTP) How does it work? Basically the magic happends in the link template, it handles all operations that are done in the DLL. The list is derived from links and just like every link it holds a next and a prev pointer, you can consider this "link" to be both the head and the tail of the list. This means that the lists next pointer will point to the first link in the list and the prev pointer to the last. <file_sep>#pragma once //link to TheChernoProject explanation of templates //https://www.youtube.com/watch?v=I-hZkUa9mIs //dynamic_cast is done in runtime //static_cast is done in compiletime #include <iostream> #include <assert.h> template<class T> class List; template<class T> class Link { Link* next; Link* prev; friend class List<T>; public: Link(); virtual ~Link() = default; T* Next(); T* Prev(); const T* Next()const; const T* Prev()const; T* InsertAfter(T* TToInsert); T* InsertBefor(T* TToInsert); T* DeleteAfter(); template<class arg> T* FindNext(const arg& searchFor); virtual std::ostream& Print(std::ostream& cout) { return cout; } bool Invariant() { return next->prev == this && prev->next == this || next == NULL && prev == NULL; } }; template<class T> inline Link<T>::Link() :next(nullptr), prev(nullptr) {} template<class T> T * Link<T>::Next() { return dynamic_cast<T*>(next); } template<class T> T * Link<T>::Prev() { return dynamic_cast<T*>(prev); } template<class T> const T * Link<T>::Next() const { return dynamic_cast<T*>(next); } template<class T> const T * Link<T>::Prev() const { return dynamic_cast<T*>(prev); } //exempel insertafter i link.h // //T* InsertAfter(T* TToInsert) //{ // assert(Invariant()); // TToInsert->next = next; // TToInsert->prev = this; // if (next != nullptr) // next->prev = TToInsert; // next = TToInsert; // assert(Invariant()); // return TToInsert; //}; template<class T> T * Link<T>::InsertAfter(T * TToInsert) { assert(Invariant()); TToInsert->next = next; TToInsert->prev = this; if (next != nullptr) { next->prev = TToInsert; } next = TToInsert; assert(Invariant()); return TToInsert; } template<class T> T * Link<T>::InsertBefor(T * TToInsert) { assert(Invariant()); TToInsert->prev = prev; TToInsert->next = this; if (prev != nullptr) { prev->next = TToInsert; } prev = TToInsert; assert(Invariant()); return TToInsert; } template<class T> T* Link<T>::DeleteAfter() { if (next == nullptr) { cout << "nothing to delete" << endl; return nullptr; } else { T* removedNode = dynamic_cast<T*>(next); next = next->next; next->prev = this; return removedNode; } } template<class T> template<class arg> T * Link<T>::FindNext(const arg & searchFor) { //recursivly tries to find what we are searching for if (next == nullptr) { return nullptr; } if (dynamic_cast<T*>(next)->Match(searchFor)) { //return (T*)(next)->Match(searchFor); return dynamic_cast<T*>(next); } else next->FindNext(searchFor); }<file_sep>#pragma once #include <iostream> class Itterator { public: Itterator(); ~Itterator(); }; <file_sep>// AvanceradC++.Lab.02.cpp : Defines the entry point for the console application. // #ifdef _DEBUG #ifndef DBG_NEW #define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) #define new DBG_NEW #endif #endif // _DEBUG #include "stdafx.h" #include "VG.h" #include "Rational.h" #include "RelOps.h" #include <cassert> #include <crtdbg.h> #include <assert.h> //#include <iostream> //using namespace std; #include <limits> #ifdef VG //Kollar att int räknar med 64 bitar internt bool TestAccuracy() { Rational<int> left(std::numeric_limits<int>::max(), 2), right(left), result; result = left + right; assert(result == Rational<int>(std::numeric_limits<int>::max(), 1)); return true; } template<class Result, class L, class R> bool CheckPlus(Result, L l, R r) { auto res = l + r; assert((std::is_same<Result, decltype(l + r)>::value)); return std::is_same<Result, decltype(l + r)>::value;; }; // Testar om Rational är komptaibelt med int, shar, long long // använder + för att prova detta. bool TestCompatibility() { bool res = true; res &= CheckPlus(Rational<short>(), Rational<short>(), Rational<short>()); res &= CheckPlus(Rational<int>(), Rational<short>(), Rational<int>()); res &= CheckPlus(Rational<long long>(), Rational<long long>(), Rational<short>()); res &= CheckPlus(Rational<long long>(), long long(), Rational<short>()); res &= CheckPlus(Rational<long long>(), Rational<short>(), long long()); res &= CheckPlus(Rational<short>(), Rational<short>(), Rational<long>()); //Rational<long> is more correct return res; } #endif VG void TestFörGodkänt() { Rational<short> rs0, rs1(1), rs2(2, 1), rs3(3); Rational<int> ri0; Rational<long long> rll0, rll1(1), rll2(2, 1), rll3(3); //Konstrueras från ”Tal” dvs. Rtal rtal(tal); RLL rllx(1); RLL rlly(rs0); //Jämföras med == dvs. if (rtal == tal) … assert(rs1 == rs1); assert(rs2 == 2); assert(rs1 == rll1); assert(rs1 == Rational<short>(rs1.P, rs1.Q)); assert(rs1 == Rational<short>(-rs1.P, -rs1.Q)); /*assert(rs1 == Rational<short>(rs1.nom, rs1.denom)); assert(rs1 == Rational<short>(-rs1.nom, -rs1.denom));*/ //Tilldelas (=) från ”Tal” dvs. rtal=tal; rs3 = Rint(13, 3); assert(rs3 == Rshort(13, 3)); rs3 = rll3 = -17; assert(rs3 == Rshort(-17)); //+= med ”Tal” dvs. rtal += tal; assert((rs3 += 4) == Rshort(-13)); //+ dvs. (rtal + tal) rs3 = Rshort(13, 3); assert(rs3 + rll2 == Rshort(19, 3)); assert(rs3 + 2 == Rshort(19, 3)); //unärt ”–” dvs. rtal1 = -rtal2; assert((rs0 = -rs1) == Rshort(-1)); //båda ++ operatorerna, dvs. ++rtal; rtal++; rll3 = RLL(1, 6); assert(++rll3 == RLL(7, 6)); assert(rll3++ == RLL(7, 6)); assert(rll3 == RLL(13, 6)); // explicit konvertering till Tal. (Kräver VS2012 och kompilator CTnom november 12. int i = static_cast<int>(rll3); assert(i == 2); // Overloading av << och >> (ut och in matning) std::cout << "Utmatning>" << rs3 << "< skriv in texten mellan > och < + retur\n"; std::cin >> rs2; assert(rs3 == rs2); } #ifdef VG void TestFörVälGodkänt() { assert(TestAccuracy()); assert(TestCompatibility()); Rshort rs(3, 2); Rint ri(2, 1); RLL rl; assert(!(1 == rs)); assert(2 == ri); } 9 #endif int main() { _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); TestFörGodkänt(); return 0; } <file_sep>#pragma once void TestIttPart(); void TestIttPartR(); void TestIttPartC(); void TestIttPartCR(); void TestFörGodkäntItt(); void TestIttInAlg(); void TestRevIttInAlg(); <file_sep>#include "stdafx.h" #include "String.h" #include "memory.h" #include <iostream> #include <utility> #include <cassert> using namespace std; String::String() : cString(""), holds(0), length(0) {} String::String(const String& rhs) : holds(rhs.holds), length(rhs.length) { cString = new char[rhs.capacity()+1]; for (size_t i = 0; i < holds + 1; i++) { cString[i] = rhs.cString[i]; } cString[holds] = 0; assert(Invariant()); } String::String(const char* cstr) { length = strlen(cstr); holds = strlen(cstr); cString = new char[holds]; for (size_t i = 0; i < holds + 1; i++) { cString[i] = cstr[i]; } cString[holds] = 0; assert(Invariant()); } String::operator bool() { return (holds > 0); } bool String::isEmpty() { return (holds == 0); } int String::capacity() const { return length; } int String::size() const { return holds; } const char * String::data() const { return cString; } char& String::operator[](int i) { return cString[i]; } const char& String::operator[](int i) const { return cString[i]; } String & String::operator=(const String & rhs) { assert(Invariant()); if (size() < rhs.size()) { char* temp = new char[rhs.size()]; for (size_t i = 0; i < rhs.size(); i++) { temp[i] = rhs.cString[i]; } cString = temp; delete[] temp; } else if (size() > rhs.size()) { for (size_t i = 0; i < rhs.size(); i++) { cString[i] = rhs.cString[i]; } } else if (size() == rhs.size()) { for (size_t i = 0; i < rhs.size(); i++) { cString[i] = rhs.cString[i]; } } assert(Invariant()); return *this; } String & String::operator+=(const String & rhs) { return *this; } String String::operator+() { return String(); } void String::reserve(size_t n) { assert(Invariant()); cString = new char[n]; for (size_t i = 0; i < n; i++) { cString[i] = char(); } length = n; assert(Invariant()); } char & String::at(size_t i) { try { if (i > holds) throw 1; else return cString[i]; } catch (int x) { cout << "out_of_range, ERROR NUMBER: " + x << endl; } return cString[i]; } void String::shrink_to_fit() { assert(Invariant()); char* temp = new char[holds + 1]; for (size_t i = 0; i < holds; i++) { temp[i] = cString[i]; } cString = temp; cString[holds] = 0; length = holds; delete[] temp; assert(Invariant()); } void String::push_back(char c) { assert(Invariant()); if (holds == capacity() || capacity() == 0) { size_t n; if (capacity() == 0) n = 1; else n = 2 * capacity(); char* temp = new char[n]; for (size_t i = 0; i < holds; i++) { temp[i] = cString[i]; } cString = temp; cString[holds] = 0; length = n; } cString[holds++] = c; cString[holds] = 0; assert(Invariant()); } void String::resize(size_t n) { assert(Invariant()); char* temp = new char[n]; for (size_t i = 0; i < n; i++) { temp[i] = cString[i]; if (i > holds) temp[i] = char(); } holds = n; length = n; cString = temp; assert(Invariant()); } bool operator==(const String & lhs, const String & rhs) { if (lhs.holds != rhs.holds) return false; else { for (size_t i = 0; i < lhs.size(); i++) { if (lhs.cString[i] != rhs.cString[i]) return false; } } return true; } bool operator!=(const String & lhs, const String & rhs) { if (lhs.size() != rhs.size()) return true; else { for (size_t i = 0; i < lhs.size(); i++) { if (lhs.cString[i] != rhs.cString[i]) return false; } } return true; } <file_sep>#pragma once #include <cassert> template<class T> class ControlBlock { int count = 0; public: T* actualObject; ControlBlock(T* obj) :actualObject(obj), count(1) {} ControlBlock() : actualObject(nullptr), count(1) {} T* getActualObj() { return actualObject; } int getCount() { return count; } void add() { count++; } void remove() { count--; } ~ControlBlock() { delete actualObject; actualObject = nullptr; } private: }; template<class T> class SharedPtr { ControlBlock<T>* m_controller; public: SharedPtr(); SharedPtr(T* realPtr); SharedPtr(const SharedPtr& rhs); SharedPtr(SharedPtr&& rhs); SharedPtr& operator=(SharedPtr<T>&); bool operator==(const SharedPtr& rhs) const; bool operator<(const SharedPtr<T>& rhs); void Reset(T* ptr = nullptr); bool Unique(); void Release(); operator bool(); T& operator*() const { return *get(); } T* operator->() const { return m_controller->getActualObj(); } T* get() const { return m_controller->getActualObj(); } bool Invariant() { return m_controller == nullptr || m_controller->getCount() > 0; } ~SharedPtr() { Reset(); } }; template<class T> SharedPtr<T>::SharedPtr() : m_controller(new ControlBlock<T>()) {} template<class T> SharedPtr<T>::SharedPtr(T * realPtr) : m_controller(new ControlBlock<T>(realPtr)) {} template<class T> SharedPtr<T>::SharedPtr(const SharedPtr & rhs) : m_controller(rhs.m_controller) { m_controller->add(); } template<class T> SharedPtr<T>::SharedPtr(SharedPtr && rhs) : m_controller(rhs.m_controller) { m_controller->add(); rhs.Reset(); } template<class T> bool SharedPtr<T>::operator==(const SharedPtr& rhs) const { return get() == rhs.get() ? true : false; } template<class T> inline SharedPtr<T>::operator bool() { return m_controller == nullptr || get() == nullptr ? false : true; } template<class T> void SharedPtr<T>::Reset(T* ptr = nullptr) { assert(Invariant()); if (m_controller != nullptr) { if (m_controller->getCount() == 1) { delete m_controller; m_controller = nullptr; } else { m_controller->remove(); m_controller = nullptr; } } assert(Invariant()); } template<class T> inline void SharedPtr<T>::Release() { assert(Invariant()); T* old = m_controller; m_controller = 0; assert(Invariant()); return old; } template<class T> SharedPtr<T>& SharedPtr<T>::operator=(SharedPtr<T>& rhs) { assert(Invariant()); if (m_controller != rhs.m_controller) { Reset(); rhs.m_controller->add(); m_controller = rhs.m_controller; } assert(Invariant()); return *this; } template<class T> bool SharedPtr<T>::Unique() { assert(Invariant()); return m_controller->getCount() <= 1 ? true : false; } template<class T> inline bool SharedPtr<T>::operator<(const SharedPtr<T>& rhs) { assert(Invariant()); return get() < rhs.get() ? true : false; }<file_sep>// Avancerad.C++.Lab.03.cpp : Defines the entry point for the console application. // #include "stdafx.h" #define _CRTDBG_MAP_ALLOC #ifdef _DEBUG #ifndef DBG_NEW #define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) #define new DBG_NEW #endif #endif // _DEBUG //#include <stdlib.h> //#include <crtdbg.h> //using std::cout; //using std::cin; //using std::shared_ptr; //#include "VG.h" #include <memory> #include <cassert> #include <iostream> #include "SharedPtr.h" #ifdef VG #include "WeakPtr.h" #endif VF class Integer { int n; public: Integer(int n) : n(n) { } ~Integer() { printf("Deleting %d\n", n); } int get() const { return n; } }; struct C { float value; C(float value) :value(value) {}; }; void TestG() { //- Konstruktor som tar: // o inget G // o En SharedPtr G // o En pekare G /*shared_ptr<Integer> a(new Integer{ 10 }); a.unique();*/ SharedPtr<C> sp11; assert(!sp11); SharedPtr<C> p15(nullptr); assert(!p15); SharedPtr<C> sp12(new C(12)); assert(sp12); SharedPtr<C> sp13(sp11); assert(!sp13); assert(sp12.Unique()); SharedPtr<C> sp14(sp12); assert(sp14); //assert(!sp12.Unique()); //- Destruktor G //It will test itself //- Tilldelning från en // o En SharedPtr G sp14 = sp12; assert(sp14); // SharedPtr<C> sp12(new C(12)); sp14 = sp14; assert(sp14); //- Jämförelse med (== och <) SharedPtr<C> sp31(new C(31)); // o En SharedPtr G assert(sp11 == nullptr); assert(sp11 < sp12); assert(!(sp12 < sp11)); assert(sp14 == sp12); assert(!(sp14 == sp31)); assert((sp14 < sp31) || (sp31 < sp14)); //get, * och -> SharedPtr<C> sp41(new C(41)); SharedPtr<C> sp42(new C(42)); assert((sp41->value) == (sp41.get()->value)); assert((sp41->value) != (sp42.get()->value)); assert(&(*sp41) == (sp41.get())); ////move SharedPtr<C> sp51(std::move(sp41)); assert(sp51->value == 41); assert(!sp41); sp51.Reset(); assert(!sp51); } #ifdef VG void TestVG() { //Weak pointer skall ha det som det står VG på nedan //- Konstruktor som tar: // o inget G VG // o En SharedPtr G VG // o En WeakPtr VG VG WeakPtr<C> wp11; assert(wp11.expired()); SharedPtr<C> sp12(new C(12)); WeakPtr<C> wp13(wp11); assert(wp13.expired()); WeakPtr<C> wp14(sp12); assert(!wp14.expired()); SharedPtr<C> sp17(wp14); assert(sp17); //- Destruktor G VG // It will test itself //- Tilldelning från en // o En SharedPtr G VG // o En WeakPtr VG WeakPtr<C> wp15; wp14 = wp11; assert(wp14.expired()); SharedPtr<C> sp33(new C(33)); wp14 = sp33; assert(!wp14.expired()); wp14 = wp14; assert(!wp14.expired()); sp33.reset(); assert(!sp33); assert(wp14.expired()); //Shared(weak) try { SharedPtr<C> slask(wp14); } catch (const char* const except) { assert(except == "std::bad_weak_ptr"); } //- funktioner: // o lock() VG auto sp51 = wp11.lock(); assert(!sp51); SharedPtr<C> sp55(new C(55)); wp14 = sp55; sp51 = wp14.lock(); assert(sp51); //// o expired() VG Redan testat //move SharedPtr<C> sp61(std::move(sp51)); assert(sp61->value == 55); assert(!sp51); sp51 = std::move(sp61); sp51 = std::move(sp51); assert(sp51->value == 55); } #endif VG int main() { _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); std::locale::global(std::locale("swedish")); TestG(); #ifdef VG TestVG(); #endif // VG std::cin.get(); } <file_sep>Made as a part of a assignment in advanced programming in c++, this solution contains two labs. The first one is a implementation of a string class, and the second one is a implementation of a itterator for that string class <file_sep>#pragma once #include <iostream> #include "GCD.h" template<typename Tint> class Rational { public: Tint P, Q; friend std::ostream& operator<<(std::ostream & cout, Rational<Tint> R) { cout << R.P << "/" << R.Q; return cout; } friend std::istream& operator >> (std::istream & cin, Rational<Tint>& R) { cin >> R.P; cin >> R.Q; return cin; } //Rational() : nom(0), denom(1) {}; Rational() : P(0), Q(1) {} Rational(Tint P) : P(P), Q(1) {} Rational(Tint P, Tint Q) : P(P), Q(Q) { Reduce(P, Q); } //Create a Rational number from a rational number template<typename Other> Rational(Rational<Other>& rhs) : P(rhs.P), Q(rhs.Q) {} template<typename Other> Rational operator-(const Rational<Other> rhs) const { Tint commonDenom = Q * rhs.Q; Tint num1 = P *rhs.P; Tint num2 = rhs.P * P; Tint diff = num1 + num2; Rational<Tint> returnTint; returnTint.P = diff; returnTint.Q = commonDenom; this = returnTint; return *this; } Rational operator=(const Rational rhs) { Q = rhs.Q; P = rhs.P; return *this; } template<typename Other> friend bool operator==(const Rational<Tint> lhs, const Rational<Other> rhs) { if (lhs.P / lhs.Q == rhs.P / rhs.Q) { return true; } else return false; } template<typename Other> Rational operator+=(const Rational<Other>& rhs) { int commonQ = Q*rhs.Q; int p1 = P*rhs.Q; int p2 = rhs.P *Q; int newP = p1 + p2; Reduce(newP, commonQ); P = newP; Q = commonQ; return *this; } Rational operator+=(const int i) { P += (Q*i); Reduce(P, Q); return *this; } Rational operator++() { return *this += 1; } Rational operator++(int) { Rational temp(*this); operator++(); return temp; } template<typename Other> Rational operator+(const Rational<Other> rhs) const { Rational temp(*this); return temp += rhs; } Rational operator+(const int i) const { Rational temp(*this); return temp += i; //return *this; } operator int() { return (P / Q); } //~Rational(); }; <file_sep>#pragma once #include "Link.h" #include <iostream> #include <assert.h> using namespace std; template<class T> class List :public Link<T> { public: List(); T* First(); T* Last(); T* PushFront(T* item); T* PopFront(); T* PushBack(T* item); template<class arg> T* FindFirst(const arg& searchFor) { return FindNext(searchFor); } friend std::ostream& operator<<(std::ostream& cout, List& list) { return list.Print(cout); } bool IsEmpty(); void Check(); //~List(); bool Invariant() { //return next->prev == prev->next; //&& next->prev == NULL && prev->next == NULL; return next->prev == this && prev->next == this || next->prev == NULL && prev->next == NULL; } private: std::ostream& Print(std::ostream& cout); }; template<class T> List<T>::List() { next = this; prev = this; } template<class T> T * List<T>::First() { return dynamic_cast<T*>(next); } template<class T> T * List<T>::Last() { return dynamic_cast<T*>(prev); } template<class T> T * List<T>::PushFront(T * item) { if (IsEmpty()) { next = item; prev = item; } else { item->next = next; next->prev = item; next = item; } cout << "sucessfully added front" << endl; return item; } template<class T> T * List<T>::PopFront() { if (IsEmpty()) { cout << "nothing to pop" << endl; return NULL; } if (next->next == NULL) { T* removedNode = dynamic_cast<T*>(next); next = this; prev = this; return removedNode; } return DeleteAfter(); } template<class T> T * List<T>::PushBack(T * item) { if (IsEmpty()) { next = item; prev = item; } else { item->prev = prev; prev->next = item; prev = item; } cout << "sucessfully added back" << endl; return item; } template<class T> bool List<T>::IsEmpty() { return (next == this && prev == this); } template<class T> void List<T>::Check() { const Link<T>*node = this, *nextNode = next; do { assert(node->next == nextNode && nextNode->prev == node); node = nextNode; nextNode = nextNode->next; } while (node != this); } template<class T> std::ostream & List<T>::Print(std::ostream & cout) { for (Node* item = First(); item != nullptr; item = item->Next()) { dynamic_cast<T*>(item)->Print(cout); } return cout; } <file_sep>#pragma once #include <iostream> #include <vector> #include <algorithm> #include <iterator> #include <cassert> template <typename T> class StringItt :public std::iterator<std::forward_iterator_tag, T> { public: typedef int size_type; class iterator { public: typedef iterator selfType; typedef T valueType; typedef T& reference; typedef T* pointer; typedef std::random_access_iterator_tag iteratorCatrgory; typedef int differntType; bool invariant() { return ptr != nullptr; } iterator() = default; iterator(pointer ptr) : ptr(ptr) {} iterator(iterator & rhs) {} iterator& operator=(const iterator& rhs) { ptr = rhs.ptr; return *this; } reference operator*() { return *ptr; } pointer operator->() { return ptr; } bool operator==(const selfType& rhs) { return ptr == rhs.ptr; } bool operator!=(const selfType& rhs) { return ptr != rhs.ptr; } reference operator[](int i) { return *(ptr + i); } selfType operator+(const int& rhs) { assert(invariant()); pointer temp = ptr; return iterator(temp += rhs); } selfType operator++() { assert(invariant()); ++ptr; return iterator(ptr); } selfType operator++(int) { assert(invariant()); pointer temp = ptr; ++ptr; return iterator(temp); } selfType operator--(int) { assert(invariant()); pointer temp = ptr; --ptr; return iterator(temp); } pointer operator--() { assert(invariant()); --ptr; return iterator(ptr); } private: pointer ptr; }; class reverse_iterator { public: typedef reverse_iterator selfType; typedef T valueType; typedef T& reference; typedef T* pointer; typedef std::random_access_iterator_tag iteratorCatrgory; typedef int differntType; bool invariant() { return ptr != nullptr; } reverse_iterator() = default; reverse_iterator(pointer ptr) : ptr(ptr) {} reverse_iterator(reverse_iterator & rhs) {} reverse_iterator& operator=(const reverse_iterator& rhs) { assert(invariant()); ptr = rhs.ptr; return *this; } reference operator[](int i) { return *(ptr - i); } selfType operator+(const int& rhs) { assert(invariant()); pointer temp = ptr; return reverse_iterator(temp -= rhs); } selfType operator++() { assert(invariant()); --ptr; return reverse_iterator(ptr); } selfType operator++(int) { assert(invariant()); pointer temp = ptr; --ptr; return reverse_iterator(temp); } selfType operator--(int) { assert(invariant()); pointer temp = ptr; ++ptr; return reverse_iterator(temp); } pointer operator--() { assert(invariant()); ++ptr; return reverse_iterator(ptr); } reference operator*() { return *ptr; } pointer operator->() { return ptr; } bool operator==(const selfType& rhs) { return ptr == rhs.ptr; } bool operator!=(const selfType& rhs) { return ptr != rhs.ptr; } private: pointer ptr; }; StringItt(size_type size) : size(size) { data = new T[size]; } StringItt(StringItt& rhs) {} StringItt& operatro = (const reverse_iterator& rhs) {} size_type size() { return size; } T& opearetor[](size_type index) { assert(index > size); return data[index]; } const T& operator[](size_type index) { assert(index > size); return data[index]; } Iterator begin() { return Iterator(data); } Iterator end() { return Iterator(data + size); } private: size_type size; T* data; };
9b835b3e698a35bdb252678f8873119c1d3a1e7b
[ "Markdown", "C", "Text", "C++" ]
26
C++
Tomdozz/Advanced-CPP
88b93fc173911f6c8706d7d744ab72495769fa2c
f554d6ba49d6029c0373b3829df71499d34b51f6
refs/heads/main
<repo_name>ortelius/store-shippingservice<file_sep>/setup.sh export BLDDATE="Tue Feb 8 22:04:42 UTC 2022" export BUILDER_OUTPUT=/builder/outputs export BUILDNUM=67 export DHURL=https://console.deployhub.com export DOCKER_CONFIG=/workspace/docker-config export GIT_REPO=ortelius/store-shippingservice export GIT_URL=https://github.com/ortelius/store-shippingservice.git export GPG_KEY=A035C8C19219BA821ECEA86B64E628F8D684696D export HOME=/builder/home export HOSTNAME=9d805c48ec07 export IMAGE_TAG=-v1.2.2.67-g export LANG=C.UTF-8 export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin export PWD=/workspace export PYTHON_GET_PIP_SHA256=7c5239cea323cadae36083079a5ee6b2b3d56f25762a0c060d2867b89e5e06c5 export PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/2caf84b14febcda8077e59e9b8a6ef9a680aa392/public/get-pip.py export PYTHON_PIP_VERSION=21.2.4 export PYTHON_SETUPTOOLS_VERSION=58.1.0 export PYTHON_VERSION=3.10.2 <file_sep>/bash.sh #!/bin/bash export COMPONENT_APPLICATION_VERSION=1.2.9.1 export DEPLOY_ENV=GLOBAL.ortelius.saas.aks-cluster export COMPONENT_OWNER_ID=$(echo $COMPONENT_OWNER_NAME | tr -d " ") export BLDDATE=`date` export HOSTNAME=e2a790b12023 export COMPONENT_CUSTOMACTION=GLOBAL.HelmChart export COMPONENT_NAME="GLOBAL.Stella Horses.Online Store Company.Purchase Processing.Shipping Service.shippingservice" export PWD=/workspace export HOME=/builder/home export COMPONENT_OWNER="GLOBAL.Stella Horses.Online Store Company.Purchase Processing.$COMPONENT_OWNER_NAME" export COMPONENT_OWNER_EMAIL=<EMAIL> export BUILDER_OUTPUT=/builder/outputs export COMPONENT_VERSION_COMMIT="v1.2.2.$(git rev-list --count master)-g93c822c" export COMPONENT_VERSION=1.2.2 export COMPONENT_OWNER_NAME=`curl http://www.pseudorandom.name` export COMPONENT_CHARTNAME=chart/shippingservice export IMAGE_TAG="master-v$COMPONENT_VERSION.$(git rev-list --count master)-g93c822c" export SHLVL=0 export COMPONENT_DOCKERREPO=quay.io/hipsterstore/shippingservice export COMPONENT_APPLICATION="GLOBAL.Stella Horses.Online Store Company.Hipster Store;July 4th Sale" export COMPONENT_CHARTNAMESPACE=stores export COMPONENT_OWNER_PHONE="312-444-5555" export COMPONENT_VARIANT=master export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin export COMPONENT_GITURL=<EMAIL>:ortelius/store-shippingservice.git export DOCKER_CONFIG=/workspace/docker-config export DEBIAN_FRONTEND=noninteractives env
d2d18dcfaecebdcdcfe8239522cc7dbaf0af2646
[ "Shell" ]
2
Shell
ortelius/store-shippingservice
c16938d48201c94d767a1302d1b715bafe9c807d
3a51a58d13e795605c3512b8778e203acf56835e
refs/heads/master
<file_sep>import os from sqlalchemy import create_engine from sqlalchemy import MetaData, Column, Table, ForeignKey from sqlalchemy import Integer, String engine = create_engine('sqlite:///users.db', echo=True) metadata = MetaData(bind=engine) users_table = Table('users', metadata, Column('id', Integer, primary_key=True), Column('username', String(40)), Column('password', String), ) # create tables in database metadata.create_all() <file_sep>In this project, you’ll be building a data-driven web application using the technologies that you have learned throughout Data Centric Development. You can either choose to to follow the example brief below, or you can use your own idea for the website. CREATE AN ONLINE COOKBOOK: Create a web application that allows users to store and easily access cooking recipes Put some effort into designing a database schema based on recipes, and any other related properties and entities (e.g. views, upvotes, ingredients, recipe authors, allergens, author’s country of origin, cuisine etc…). Make sure to put some thought into the relationships between them, and use either foreign keys (in the case of a relational database) or nesting (in the case of a document store) to connect these pieces of data Create the backend code and frontend form to allow users to add new recipes to the site (at least a basic one, if you haven’t taken the frontend course) Create the backend code to group and summarise the recipes on the site, based on their attributes such as cuisine, country of origin, allergens, ingredients, etc. and a frontend page to show this summary, and make the categories clickable to drill down into a filtered view based on that category. This frontend page can be as simple or as complex as you’d like; you can use a Python library such as matplotlib, or a JS library such as d3/dc (that you learned about if you took the frontend modules) for visualisation Create the backend code to retrieve a list of recipes, filtered based on various criteria (e.g. allergens, cuisine, etc…) and order them based on some reasonable aspect (e.g. number of views or upvotes). Create a frontend page to display these, and to show some summary statistics around the list (e.g. number of matching recipes, number of new recipes. Optionally, add support for pagination, when the number of results is large Create a detailed view for each recipes, that would just show all attributes for that recipe, and the full preparation instructions Allow for editing and deleting of the recipe records, either on separate pages, or built into the list/detail pages Optionally, you may choose to add basic user registration and authentication to the site. This can as simple as adding a username field to the recipe creation form, without a password (for this project only, this is not expected to be secure) Use the following guidelines when developing your project: Logic must be written in Python. HTML, CSS, and JavaScript can be used to enhance the look and feel of the cookbook. Whenever possible, strive to use semantic HTML5 elements to structure your HTML code better. The website must be data-driven and can rely on structured data, unstructured data or a mix of structured and unstructured data. CRUD operations can be carried out using either SQL (e.g. MySQL/SQLite/Postgres) or NoSQL (e.g. MongoDB). Use Flask, a micro-framework, to run your application. Provide instructions on how to run your project locally in your README. Make sure your site is as responsive as possible. You can test this by checking the site on different screen sizes and browsers. Share details of how you created your database schema in your README. Consider sharing working drafts or finalised versions of your database schema in a 'Database Schema' folder in your repo. Provide a link to this folder in your README. We advise that you write down user stories and create wireframes/mockups before embarking on full-blown development. The site can also make use of CSS frameworks such as Bootstrap, just make sure you maintain a clear separation between the library code and your code. Write a README.md file for your project that explains what the project does and the need that it fulfills. It should also describe the functionality of the project, as well as the technologies used. If some of the work was based on other code, explain what was kept and how it was changed to fit your need. A project submitted without a README.md file will FAIL. Use Git & GitHub for version control. Each new piece of functionality should be in a separate commit. Deploy the final version of your code to a hosting platform such as Heroku. Non-requirements for this project: Secure user authentication (e.g. via passwords) is not required for this particular project. Having each user just choose a username is sufficient. Secure authentication will be introduced in the Django module.
2e08e6c7996823f6a4c399a97317aac16f7de8da
[ "Markdown", "Python" ]
2
Python
tstauras83-zz/CookBook-Milestone-project
d64ab20101472ab9a29139ad1be5b6784d3c6f01
a3ed4347870efffd6dad5a4bcd7c2db7fea78d97
refs/heads/main
<repo_name>theoDIA06/spamming<file_sep>/README.md # fuck_you string papering <file_sep>/fuckyou.c #define _CRT_OBSOLETE_NO_WARNINGS #include <Windows.h> #include <stdbool.h> #include <stdlib.h> POINT ptMouse; HINSTANCE g_inst; MSG msg; WNDCLASSA WndClass; HANDLE fuckyou; bool fuckyoutoogle = false; LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); #define start 100 #define stop 200 DWORD WINAPI autoF5(void* lpVoid) { while (true) { if (fuckyoutoogle) { keybd_event(0x46, 0, 0x22, 0); keybd_event(0x46, 0, 0x00, 0); keybd_event(0x55, 0, 0x22, 0); keybd_event(0x55, 0, 0x00, 0); keybd_event(0x43, 0, 0x22, 0); keybd_event(0x43, 0, 0x00, 0); keybd_event(0x4B, 0, 0x22, 0); keybd_event(0x4B, 0, 0x00, 0); keybd_event(VK_SPACE, 0, 0x22, 0); keybd_event(VK_SPACE, 0, 0x00, 0); keybd_event(0x59, 0, 0x22, 0); keybd_event(0x59, 0, 0x00, 0); keybd_event(0x4F, 0, 0x22, 0); keybd_event(0x4F, 0, 0x00, 0); keybd_event(0x55, 0, 0x22, 0); keybd_event(0x55, 0, 0x00, 0); keybd_event(VK_RETURN, 0, 0x22, 0); keybd_event(VK_RETURN, 0, 0x00, 0); Sleep(5); } } } int CALLBACK WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { WndClass.lpszClassName = "win"; // CreateWindowA의 첫 번째 인자에서 정해준 이름과 같아야함. WndClass.hInstance = hinstance; WndClass.lpfnWndProc = WndProc; // 응용 프로그램 메시지 큐에서 꺼내서 처리하는 과정을 프로그래머가 직접 만들어줘야 하는데 바로 이러한 기능을 하는 함수이다. WndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); WndClass.hCursor = LoadCursor(NULL, IDC_ARROW); WndClass.cbClsExtra = 0; WndClass.cbWndExtra = 0; WndClass.lpszMenuName = NULL; RegisterClassA(&WndClass); // 윈도우를 생성 CreateWindowA("win", "fuck_you!", WS_VISIBLE | WS_OVERLAPPEDWINDOW | WS_BORDER, 300, 200, 400, 100, NULL, NULL, hinstance, NULL); while (GetMessageA(&msg, 0, 0, 0)) // 메시지를 반복적으로 꺼낸다. 이 함수를 써야 메시지큐에서 메시지를 꺼낼 수가 있다. { TranslateMessage(&msg); DispatchMessageA(&msg); // 메시지가 올 때마다 꺼내서 아래 메시지 처리 함수가 호출될 수 있도록 Dispatch 해준다. } return 0; } LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // 메시지가 올 때마다 함수처리할 수 있는 함수 { if (uMsg == WM_HOTKEY) { if (wParam == 1) { fuckyoutoogle = true; } else if (wParam == 0) { fuckyoutoogle = false; } } switch (uMsg) { case WM_CLOSE: CloseHandle(fuckyou); PostQuitMessage(0); break; case WM_CREATE: fuckyou = CreateThread(NULL, 0, autoF5, &fuckyoutoogle, 0, NULL); RegisterHotKey(hwnd, 1, 0, VK_F1); RegisterHotKey(hwnd, 0, 0, VK_F2); CreateWindowA("button", "도배 시작(F1)", WS_VISIBLE | WS_CHILD, 30, 15, 200, 30, hwnd, (HMENU)start, g_inst, NULL); CreateWindowA("button", "중단(F2)", WS_VISIBLE | WS_CHILD, 250, 15, 100, 30, hwnd, (HMENU)stop, g_inst, NULL); break; case WM_COMMAND: switch (LOWORD(wParam)) { case start: fuckyoutoogle = true; break; case stop: fuckyoutoogle = false; break; default: break; } default: break; } return DefWindowProcA(hwnd, uMsg, wParam, lParam); //기본적인 메시지(최대, 최소화 등)를 윈도우가 모두 해주는 함수 }
dab351eff95dc79598f91adf610ca78bb3d1af75
[ "Markdown", "C" ]
2
Markdown
theoDIA06/spamming
035f4524a79c227c94799b60cde73ab63596f815
9bfea6ab986192b2ddb3f8f8278c0ab7c51bef81
refs/heads/master
<repo_name>iFrey/Cryptocat-Android<file_sep>/src/net/dirbaio/cryptocat/service/OtrConversation.java package net.dirbaio.cryptocat.service; import net.dirbaio.cryptocat.ExceptionRunnable; import org.jivesoftware.smack.Chat; import org.jivesoftware.smack.MessageListener; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.Message; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.crypto.ShortBufferException; import java.io.UnsupportedEncodingException; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; /** * An OTR conversation. * TODO: Actually use OTR. (lol) */ public class OtrConversation extends Conversation implements MessageListener { public final String buddyNickname; public final MultipartyConversation parent; Chat chat; public OtrConversation(MultipartyConversation parent, String buddyNickname) throws XMPPException { super(parent.server, parent.nickname); this.parent = parent; this.buddyNickname = buddyNickname; this.id = buddyNickname; } @Override public void join() throws XMPPException { if (state != State.Left) throw new IllegalStateException("You're already joined."); if (server.getState() != CryptocatServer.State.Connected) throw new IllegalStateException("Server is not connected"); if (parent.getState() != State.Joined) throw new IllegalStateException("You haven't joined the chatroom"); state = State.Joining; CryptocatService.getInstance().post(new ExceptionRunnable() { @Override public void run() throws Exception { try { server.notifyStateChanged(); chat = parent.muc.createPrivateChat(parent.roomName +"@"+parent.server.config.conferenceServer+"/"+buddyNickname, OtrConversation.this); state = State.Joined; server.notifyStateChanged(); } catch(Exception e) { e.printStackTrace(); state = State.Error; server.notifyStateChanged(); } } }); } @Override public void leave() { if (state == State.Left) throw new IllegalStateException("You have not joined."); final Chat chatFinal = chat; CryptocatService.getInstance().post(new ExceptionRunnable() { @Override public void run() throws Exception { chatFinal.removeMessageListener(OtrConversation.this); } }); chat = null; state = State.Left; server.notifyStateChanged(); } //TODO Actual OTR implementation. @Override public void sendMessage(final String msg) throws UnsupportedEncodingException, InvalidKeyException, InvalidAlgorithmParameterException, ShortBufferException, IllegalBlockSizeException, BadPaddingException, NoSuchAlgorithmException, NoSuchProviderException, XMPPException, NoSuchPaddingException { //Check state if (getState() != State.Joined) throw new IllegalStateException("You have not joined."); CryptocatService.getInstance().post(new ExceptionRunnable() { @Override public void run() throws Exception { chat.sendMessage(msg); } }); addMessage(new CryptocatMessage(CryptocatMessage.Type.Message, nickname, msg)); } @Override public void processMessage(Chat chat, final Message message) { CryptocatService.getInstance().uiPost(new ExceptionRunnable() { @Override public void run() throws Exception { String txt = message.getBody(); addMessage(new CryptocatMessage(CryptocatMessage.Type.Message, buddyNickname, txt)); } }); } @Override public String toString() { return "[" + state + "] " + parent.roomName +":"+buddyNickname; } } <file_sep>/src/net/dirbaio/cryptocat/CreditsFragment.java package net.dirbaio.cryptocat; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class CreditsFragment extends BoundFragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { inflater = getAltInflater(inflater); View rootView = inflater.inflate(R.layout.fragment_credits, container, false); return rootView; } } <file_sep>/src/net/dirbaio/cryptocat/BuddyListFragment.java package net.dirbaio.cryptocat; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import net.dirbaio.cryptocat.service.CryptocatBuddyListener; import net.dirbaio.cryptocat.service.MultipartyConversation; import net.dirbaio.cryptocat.service.OtrConversation; import org.jivesoftware.smack.XMPPException; import java.util.ArrayList; public class BuddyListFragment extends BoundListFragment implements CryptocatBuddyListener { private String serverId; private String conversationId; private MultipartyConversation conversation; private ArrayAdapter<MultipartyConversation.Buddy> buddyArrayAdapter; /** * Mandatory empty constructor for the fragment manager to instantiate the * fragment (e.g. upon screen orientation changes). */ public BuddyListFragment() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); serverId = getArguments().getString(MainActivity.ARG_SERVER_ID); conversationId = getArguments().getString(MainActivity.ARG_CONVERSATION_ID); } @Override public void onStart() { super.onStart(); } @Override public void onResume() { super.onResume(); conversation = getService().getServer(serverId).getConversation(conversationId); buddyArrayAdapter = new BuddyAdapter(getAltContext(), R.layout.item_buddy, conversation.buddies); setListAdapter(buddyArrayAdapter); conversation.addBuddyListener(this); } @Override public void onPause() { super.onPause(); conversation.removeBuddyListener(this); } @Override public void buddyListChanged() { buddyArrayAdapter.notifyDataSetChanged(); } @Override public void onListItemClick(ListView listView, View view, int position, long id) { super.onListItemClick(listView, view, position, id); MultipartyConversation.Buddy b = buddyArrayAdapter.getItem(position); try { OtrConversation o = conversation.startPrivateConversation(b.nickname); callbacks.onItemSelected(serverId, conversationId, o.id); } catch (XMPPException e) { e.printStackTrace(); } } private class BuddyAdapter extends ArrayAdapter<MultipartyConversation.Buddy> { private Context context; public BuddyAdapter(Context context, int textViewResourceId, ArrayList<MultipartyConversation.Buddy> items) { super(context, textViewResourceId, items); this.context = context; } public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; if (view == null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.item_conversation, null); } MultipartyConversation.Buddy item = getItem(position); TextView textView = (TextView) view.findViewById(R.id.text); textView.setText(item.toString()); return view; } } } <file_sep>/README.md Cryptocat for Android ================= This is a project I've started for the 2013 Cryptocat Hackathon: a Java implementation of the Cryptocat protocol, and an Android app. **WARNING**: This is still a very early work in progress. It's under heavy development. It's not acceptably secure yet (see below) so **do NOT under ANY circumstances use it** for sensitive conversations. **NOTE**: It's compatible with the latest Cryptocat master, not the released version. There have been some protocol changes that are still pending for release. See cryptocat/cryptocat#410 for more details. Some screenshots: http://imgur.com/a/YQdpT What's done --- * Joining servers and rooms. * Sending and receiving multiParty messages * Multiple servers and rooms * User list What's not done (yet) --- * Fingerprint showing * OTR (1-to-1) chat -- in progress * File transfer * Smilies! * Custom server * Lots of navigation: * connect/disconnect servers * Join/leave rooms * Proper Back button * Proper notifications * Tablet-friendly layout (it's easy to do) * Make it not look ugly -- in progress * Many other things Known bugs (they will get fixed!) --- * No fix for the broken Android SecureRandom * SSL certificate checking is not working (I think) * No auto-reconnection. * Sometimes you get randomly disconnected and the app fails to see it (maybe it's fixed) * No way to close the service (It should close when you disconnect from all servers) How to build --- It's an IntelliJ IDEA project. Not sure how much luck you will have using it with other IDEs. (I tried to make it as a Maven project but failed miserably. Help on that would be highly welcome) It requires a few libs: * [ActionBarSherlock](http://actionbarsherlock.com) * [SlidingMenu](https://github.com/jfeinstein10/SlidingMenu) * [aSmack](https://github.com/flowdalic/asmack) * [Google Gson](https://code.google.com/p/google-gson/) * Android Support v4 If you include these libs as modules and then add them as dependancies on the Cryptocat module everything should build fine.
83bbdd771603942c1afc7c0d2a362b3e905d4289
[ "Markdown", "Java" ]
4
Java
iFrey/Cryptocat-Android
d0a6b408f87cdd44ac67b448c1721fa7515f9e16
1f8560b06d5eae2076cb200aad065e363acb36fc
refs/heads/master
<repo_name>phanidharannam/MyResume<file_sep>/js/projectjQuery.js $(document).ready(function(){ $("#nav ul li a[href^='#']").on('click',function(e){ e.preventDefault(); $('html, body').animate({scrollTop: $(this.hash).offset().top}, 300, function(){ window.location.hash = this.hash; }); }); }); $(document).ready(function(){ $("#navigating-top a[href^='#']").on('click',function(e){ e.preventDefault(); $('html, body').animate({scrollTop: $(this.hash).offset().top}, 300, function(){ window.location.hash = this.hash; }); }); });<file_sep>/README.md # -Resume-Project phani
ab21c1be53d2e7c80286b82dc836d12251952299
[ "JavaScript", "Markdown" ]
2
JavaScript
phanidharannam/MyResume
00665e0aadbdfe707d88c0ef303a9ad21da22fbe
0e8ed3b303eb80c2a581bdb727ed1f294ed597c2
refs/heads/master
<repo_name>jaxonlaing/kinrisold<file_sep>/me/kinris/manage/TextComponentTransformer.java /* */ package me.kinris.manage; /* */ /* */ import java.util.regex.Matcher; /* */ import java.util.regex.Pattern; /* */ import net.minecraft.util.text.ITextComponent; /* */ import net.minecraft.util.text.Style; /* */ import net.minecraft.util.text.TextComponentString; /* */ import net.minecraft.util.text.TextComponentTranslation; /* */ import net.minecraft.util.text.translation.I18n; /* */ /* */ public abstract class TextComponentTransformer /* */ { /* 13 */ private static final Pattern PATTERN_ARGUMENT = Pattern.compile("(?:%([0-9])\\$[sdf]|%[sdf])"); /* 14 */ private static final Matcher MATCHER_ARGUMENT = PATTERN_ARGUMENT.matcher(""); /* */ /* */ public void begin(ITextComponent chatComponent) {} /* */ /* */ public String transformText(ITextComponent component, String text) { /* 19 */ return text; /* */ } /* */ /* */ public ITextComponent transformStyle(ITextComponent component) { /* 23 */ return component; /* */ } /* */ /* */ public void finish(ITextComponent chatComponent, ITextComponent transformedComponent) {} /* */ /* */ public final ITextComponent walkTextComponent(ITextComponent chatComponent) { /* 29 */ begin(chatComponent); /* 30 */ ITextComponent transformedComponent = walkTextComponentInternal(chatComponent); /* 31 */ finish(chatComponent, transformedComponent); /* 32 */ return transformedComponent; /* */ } /* */ /* */ private ITextComponent walkTextComponentInternal(ITextComponent chatComponent) { /* 36 */ if ((chatComponent instanceof TextComponentString)) /* 37 */ return walkTextComponentString((TextComponentString)chatComponent); /* 38 */ if ((chatComponent instanceof TextComponentTranslation)) { /* 39 */ return walkTextComponentTranslation((TextComponentTranslation)chatComponent); /* */ } /* 41 */ return null; /* */ } /* */ /* */ private ITextComponent walkTextComponentString(TextComponentString chatComponent) { /* 45 */ String newText = transformText(chatComponent, chatComponent.getChatComponentText_TextValue()); /* 46 */ TextComponentString transformedComponent = new TextComponentString(newText); /* 47 */ transformedComponent.setChatStyle(chatComponent.getChatStyle()); /* 48 */ transformStyle(transformedComponent); /* 49 */ for (Object object : chatComponent.getSiblings()) { /* 50 */ ITextComponent adjustedComponent = walkTextComponentInternal((ITextComponent)object); /* 51 */ if (adjustedComponent != null) { /* 52 */ transformedComponent.appendSibling(adjustedComponent); /* */ } /* */ } /* 55 */ return transformedComponent; /* */ } /* */ /* */ private ITextComponent walkTextComponentTranslation(TextComponentTranslation chatComponent) { /* 59 */ return walkTextComponentString(convertTranslationComponent(chatComponent)); /* */ } /* */ /* */ private static TextComponentString convertTranslationComponent(TextComponentTranslation chatComponent) { /* 63 */ Object[] args = chatComponent.getFormatArgs(); /* 64 */ String[] splitKey = I18n.translateToLocal(chatComponent.getKey()).split("(?<=" + PATTERN_ARGUMENT + ")|(?=" + PATTERN_ARGUMENT + ")"); /* 65 */ TextComponentString root = null; /* 66 */ int currentArg = 0; /* 67 */ String[] arrayOfString1; int j = (arrayOfString1 = splitKey).length; for (int i = 0; i < j; i++) { String key = arrayOfString1[i]; /* 68 */ MATCHER_ARGUMENT.reset(key); /* 69 */ if (MATCHER_ARGUMENT.matches()) { /* 70 */ if (root == null) { /* 71 */ root = new TextComponentString(""); /* 72 */ root.setChatStyle(chatComponent.getChatStyle().createShallowCopy()); /* */ } /* 74 */ int thisArg = currentArg; /* 75 */ if (MATCHER_ARGUMENT.group(1) != null) { /* 76 */ thisArg = Integer.parseInt(MATCHER_ARGUMENT.group(1)) - 1; /* */ } /* 78 */ if (args.length > thisArg) { /* 79 */ if ((args[thisArg] instanceof TextComponentString)) { /* 80 */ root.appendSibling(((TextComponentString)args[thisArg]).createCopy()); /* 81 */ } else if ((args[thisArg] instanceof TextComponentTranslation)) { /* 82 */ root.appendSibling(convertTranslationComponent((TextComponentTranslation)args[thisArg])); /* */ } else { /* 84 */ root.appendText(args[thisArg] == null ? "null" : String.valueOf(args[thisArg])); /* */ } /* 86 */ if (thisArg == currentArg) { /* 87 */ currentArg++; /* */ } /* */ } /* */ } /* 91 */ else if (root == null) { /* 92 */ root = new TextComponentString(key); /* 93 */ root.setChatStyle(chatComponent.getChatStyle().createShallowCopy()); /* */ } else { /* 95 */ root.appendSibling(new TextComponentString(key)); /* */ } /* */ } /* */ /* 99 */ return root; /* */ } /* */ } /* Location: C:\Users\Jaxon\AppData\Roaming\.minecraft\versions\Kinris\Kinris.jar!\me\kinris\manage\TextComponentTransformer.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */<file_sep>/me/kinris/mod/mods/Sprint.java /* */ package me.kinris.mod.mods; /* */ /* */ import me.kinris.mod.Module; /* */ import net.minecraft.client.Minecraft; /* */ import net.minecraft.client.entity.EntityPlayerSP; /* */ /* */ public class Sprint /* */ extends Module /* */ { /* */ public Sprint() /* */ { /* 12 */ super("Sprint", 72, 16737123); /* */ } /* */ /* */ public void onUpdate() { /* 16 */ if (!this.isEnabled) { /* 17 */ mc.thePlayer.setSprinting(false); /* 18 */ return; /* */ } /* 20 */ if ((this.isEnabled) && (!mc.thePlayer.isSprinting()) && (!mc.thePlayer.isSneaking()) && (!mc.thePlayer.isCollidedHorizontally) && (mc.thePlayer.onGround)) { /* 21 */ mc.thePlayer.setSprinting(true); /* */ } /* */ } /* */ } /* Location: C:\Users\Jaxon\AppData\Roaming\.minecraft\versions\Kinris\Kinris.jar!\me\kinris\mod\mods\Sprint.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */<file_sep>/me/kinris/mod/mods/XRay.java /* */ package me.kinris.mod.mods; /* */ /* */ import java.util.ArrayList; /* */ import me.kinris.mod.Module; /* */ import net.minecraft.block.Block; /* */ import net.minecraft.client.Minecraft; /* */ import net.minecraft.client.renderer.RenderGlobal; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class XRay /* */ extends Module /* */ { /* 18 */ public static ArrayList<Block> xrayBlocks = new ArrayList(); /* */ /* */ public XRay() { /* 21 */ super("X-Ray", 45, 16737123); /* */ } /* */ /* */ public void onEnable() { /* 25 */ me.kinris.utils.XRayUtils.isXRay = true; /* 26 */ mc.renderGlobal.loadRenderers(); /* */ } /* */ /* */ public void onDisable() { /* 30 */ me.kinris.utils.XRayUtils.isXRay = false; /* 31 */ mc.renderGlobal.loadRenderers(); /* */ } /* */ /* */ public boolean isXrayBlock(Block blockToCheck) { /* 35 */ if (xrayBlocks.contains(blockToCheck)) { /* 36 */ return true; /* */ } /* 38 */ return false; /* */ } /* */ } /* Location: C:\Users\Jaxon\AppData\Roaming\.minecraft\versions\Kinris\Kinris.jar!\me\kinris\mod\mods\XRay.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */<file_sep>/me/kinris/utils/RenderUtils.java /* */ package me.kinris.utils; /* */ /* */ import java.awt.Color; /* */ import net.minecraft.client.Minecraft; /* */ import net.minecraft.client.entity.EntityPlayerSP; /* */ import net.minecraft.client.renderer.RenderGlobal; /* */ import net.minecraft.client.renderer.Tessellator; /* */ import net.minecraft.client.renderer.VertexBuffer; /* */ import net.minecraft.client.renderer.entity.RenderManager; /* */ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; /* */ import net.minecraft.entity.Entity; /* */ import net.minecraft.util.math.AxisAlignedBB; /* */ import net.minecraft.util.math.BlockPos; /* */ import net.minecraft.util.math.MathHelper; /* */ import net.minecraft.util.math.Vec3d; /* */ import org.lwjgl.opengl.GL11; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class RenderUtils /* */ { /* */ public static void box(double x, double y, double z, double x2, double y2, double z2, float red, float green, float blue, float alpha) /* */ { /* 43 */ Minecraft.getMinecraft().getRenderManager();x -= RenderManager.renderPosX; /* 44 */ Minecraft.getMinecraft().getRenderManager();y -= RenderManager.renderPosY; /* 45 */ Minecraft.getMinecraft().getRenderManager();z -= RenderManager.renderPosZ; /* 46 */ Minecraft.getMinecraft().getRenderManager();x2 -= RenderManager.renderPosX; /* 47 */ Minecraft.getMinecraft().getRenderManager();y2 -= RenderManager.renderPosY; /* 48 */ Minecraft.getMinecraft().getRenderManager();z2 -= RenderManager.renderPosZ; /* 49 */ GL11.glBlendFunc(770, 771); /* 50 */ GL11.glEnable(3042); /* 51 */ GL11.glLineWidth(2.0F); /* 52 */ GL11.glDisable(3553); /* 53 */ GL11.glDisable(2929); /* 54 */ GL11.glDepthMask(false); /* 55 */ GL11.glDepthMask(false); /* 56 */ GL11.glColor4f(red, green, blue, alpha); /* 57 */ drawColorBox(new AxisAlignedBB(x, y, z, x2, y2, z2), red, green, blue, /* 58 */ alpha); /* 59 */ GL11.glColor4d(0.0D, 0.0D, 0.0D, 0.5D); /* 60 */ RenderGlobal.drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x2, /* 61 */ y2, z2)); /* 62 */ GL11.glEnable(3553); /* 63 */ GL11.glEnable(2929); /* 64 */ GL11.glDepthMask(true); /* 65 */ GL11.glDisable(3042); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static void frame(double x, double y, double z, double x2, double y2, double z2, Color color) /* */ { /* 82 */ Minecraft.getMinecraft().getRenderManager();x -= RenderManager.renderPosX; /* 83 */ Minecraft.getMinecraft().getRenderManager();y -= RenderManager.renderPosY; /* 84 */ Minecraft.getMinecraft().getRenderManager();z -= RenderManager.renderPosZ; /* 85 */ Minecraft.getMinecraft().getRenderManager();x2 -= RenderManager.renderPosX; /* 86 */ Minecraft.getMinecraft().getRenderManager();y2 -= RenderManager.renderPosY; /* 87 */ Minecraft.getMinecraft().getRenderManager();z2 -= RenderManager.renderPosZ; /* 88 */ GL11.glBlendFunc(770, 771); /* 89 */ GL11.glEnable(3042); /* 90 */ GL11.glLineWidth(2.0F); /* 91 */ GL11.glDisable(3553); /* 92 */ GL11.glDisable(2929); /* 93 */ GL11.glDepthMask(false); /* 94 */ setColor(color); /* 95 */ RenderGlobal.drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x2, /* 96 */ y2, z2)); /* 97 */ GL11.glEnable(3553); /* 98 */ GL11.glEnable(2929); /* 99 */ GL11.glDepthMask(true); /* 100 */ GL11.glDisable(3042); /* */ } /* */ /* */ public static void drawEntityESP(double x, double y, double z, double width, double height, float red, float green, float blue, float alpha, float lineRed, float lineGreen, float lineBlue, float lineAlpha, float lineWdith) { /* 104 */ GL11.glPushMatrix(); /* 105 */ GL11.glEnable(3042); /* 106 */ GL11.glBlendFunc(770, 771); /* */ /* 108 */ GL11.glDisable(3553); /* 109 */ GL11.glEnable(2848); /* 110 */ GL11.glDisable(2929); /* 111 */ GL11.glDepthMask(false); /* 112 */ GL11.glColor4f(red, green, blue, alpha); /* 113 */ RenderGlobal.drawSelectionBoundingBox(new AxisAlignedBB(x - width, y, z - width, x + width, y + height, z + width)); /* 114 */ GL11.glLineWidth(lineWdith); /* 115 */ GL11.glColor4f(lineRed, lineGreen, lineBlue, lineAlpha); /* 116 */ RenderGlobal.drawSelectionBoundingBox(new AxisAlignedBB(x - width, y, z - width, x + width, y + height, z + width)); /* 117 */ GL11.glDisable(2848); /* 118 */ GL11.glEnable(3553); /* */ /* 120 */ GL11.glEnable(2929); /* 121 */ GL11.glDepthMask(true); /* 122 */ GL11.glDisable(3042); /* 123 */ GL11.glPopMatrix(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static void blockESPBox(BlockPos blockPos) /* */ { /* 138 */ Minecraft.getMinecraft().getRenderManager();double x = blockPos.getX() - RenderManager.renderPosX; /* */ /* */ /* 141 */ Minecraft.getMinecraft().getRenderManager();double y = blockPos.getY() - RenderManager.renderPosY; /* */ /* */ /* 144 */ Minecraft.getMinecraft().getRenderManager();double z = blockPos.getZ() - RenderManager.renderPosZ; /* 145 */ GL11.glBlendFunc(770, 771); /* 146 */ GL11.glEnable(3042); /* 147 */ GL11.glLineWidth(1.0F); /* 148 */ GL11.glDisable(3553); /* 149 */ GL11.glDisable(2929); /* 150 */ GL11.glDepthMask(false); /* 151 */ GL11.glColor4d(0.0D, 1.0D, 0.0D, 0.15000000596046448D); /* 152 */ drawColorBox(new AxisAlignedBB(x, y, z, x + 1.0D, y + 1.0D, z + 1.0D), 0.0F, /* 153 */ 1.0F, 0.0F, 0.15F); /* 154 */ GL11.glColor4d(0.0D, 0.0D, 0.0D, 0.5D); /* 155 */ RenderGlobal.drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, /* 156 */ x + 1.0D, y + 1.0D, z + 1.0D)); /* 157 */ GL11.glEnable(3553); /* 158 */ GL11.glEnable(2929); /* 159 */ GL11.glDepthMask(true); /* 160 */ GL11.glDisable(3042); /* */ } /* */ /* */ /* */ /* */ /* */ public static void framelessBlockESP(BlockPos blockPos, float red, float green, float blue) /* */ { /* 168 */ Minecraft.getMinecraft().getRenderManager();double x = blockPos.getX() - RenderManager.renderPosX; /* */ /* */ /* 171 */ Minecraft.getMinecraft().getRenderManager();double y = blockPos.getY() - RenderManager.renderPosY; /* */ /* */ /* 174 */ Minecraft.getMinecraft().getRenderManager();double z = blockPos.getZ() - RenderManager.renderPosZ; /* 175 */ GL11.glBlendFunc(770, 771); /* 176 */ GL11.glEnable(3042); /* 177 */ GL11.glLineWidth(2.0F); /* 178 */ GL11.glDisable(3553); /* 179 */ GL11.glDisable(2929); /* 180 */ GL11.glDepthMask(false); /* 181 */ GL11.glColor4f(red, green, blue, 0.15F); /* 182 */ drawColorBox(new AxisAlignedBB(x, y, z, x + 1.0D, y + 1.0D, z + 1.0D), /* 183 */ red, green, blue, 0.15F); /* 184 */ GL11.glEnable(3553); /* 185 */ GL11.glEnable(2929); /* 186 */ GL11.glDepthMask(true); /* 187 */ GL11.glDisable(3042); /* */ } /* */ /* */ /* */ /* */ public static void emptyBlockESPBox(BlockPos blockPos) /* */ { /* 194 */ Minecraft.getMinecraft().getRenderManager();double x = blockPos.getX() - RenderManager.renderPosX; /* */ /* */ /* 197 */ Minecraft.getMinecraft().getRenderManager();double y = blockPos.getY() - RenderManager.renderPosY; /* */ /* */ /* 200 */ Minecraft.getMinecraft().getRenderManager();double z = blockPos.getZ() - RenderManager.renderPosZ; /* 201 */ GL11.glBlendFunc(770, 771); /* 202 */ GL11.glEnable(3042); /* 203 */ GL11.glLineWidth(2.0F); /* 204 */ GL11.glDisable(3553); /* 205 */ GL11.glDisable(2929); /* 206 */ GL11.glDepthMask(false); /* 207 */ GL11.glColor4d(0.0D, 0.0D, 0.0D, 0.5D); /* 208 */ RenderGlobal.drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, /* 209 */ x + 1.0D, y + 1.0D, z + 1.0D)); /* 210 */ GL11.glEnable(3553); /* 211 */ GL11.glEnable(2929); /* 212 */ GL11.glDepthMask(true); /* 213 */ GL11.glDisable(3042); /* */ } /* */ /* 216 */ public static int enemy = 0; /* 217 */ public static int friend = 1; /* 218 */ public static int other = 2; /* 219 */ public static int target = 3; /* 220 */ public static int team = 4; /* */ /* */ public static void entityESPBox(Entity entity, int mode) /* */ { /* 224 */ GL11.glBlendFunc(770, 771); /* 225 */ GL11.glEnable(3042); /* 226 */ GL11.glLineWidth(2.0F); /* 227 */ GL11.glDisable(3553); /* 228 */ GL11.glDisable(2929); /* 229 */ GL11.glDepthMask(false); /* 230 */ if (mode == 0) { /* 231 */ GL11.glColor4d( /* 232 */ 1.0F - Minecraft.getMinecraft().thePlayer /* 233 */ .getDistanceToEntity(entity) / 40.0F, /* 234 */ Minecraft.getMinecraft().thePlayer.getDistanceToEntity(entity) / 40.0F, /* 235 */ 0.0D, 0.5D); /* 236 */ } else if (mode == 1) { /* 237 */ GL11.glColor4d(0.0D, 0.0D, 1.0D, 0.5D); /* 238 */ } else if (mode == 2) { /* 239 */ GL11.glColor4d(1.0D, 1.0D, 0.0D, 0.5D); /* 240 */ } else if (mode == 3) { /* 241 */ GL11.glColor4d(1.0D, 0.0D, 0.0D, 0.5D); /* 242 */ } else if (mode == 4) /* 243 */ GL11.glColor4d(0.0D, 1.0D, 0.0D, 0.5D); /* 244 */ RenderManager renderManager = /* 245 */ Minecraft.getMinecraft().getRenderManager(); /* 246 */ RenderGlobal.drawSelectionBoundingBox(new AxisAlignedBB( /* 247 */ entity.boundingBox.minX - 0.05D - entity.posX + ( /* 248 */ entity.posX - RenderManager.renderPosX), /* 249 */ entity.boundingBox.minY - entity.posY + ( /* 250 */ entity.posY - RenderManager.renderPosY), /* 251 */ entity.boundingBox.minZ - 0.05D - entity.posZ + ( /* 252 */ entity.posZ - RenderManager.renderPosZ), /* 253 */ entity.boundingBox.maxX + 0.05D - entity.posX + ( /* 254 */ entity.posX - RenderManager.renderPosX), /* 255 */ entity.boundingBox.maxY + 0.1D - entity.posY + ( /* 256 */ entity.posY - RenderManager.renderPosY), /* 257 */ entity.boundingBox.maxZ + 0.05D - entity.posZ + ( /* 258 */ entity.posZ - RenderManager.renderPosZ))); /* 259 */ GL11.glEnable(3553); /* 260 */ GL11.glEnable(2929); /* 261 */ GL11.glDepthMask(true); /* 262 */ GL11.glDisable(3042); /* */ } /* */ /* */ /* */ /* */ public static void nukerBox(BlockPos blockPos, float damage) /* */ { /* 269 */ Minecraft.getMinecraft().getRenderManager();double x = blockPos.getX() - RenderManager.renderPosX; /* */ /* */ /* 272 */ Minecraft.getMinecraft().getRenderManager();double y = blockPos.getY() - RenderManager.renderPosY; /* */ /* */ /* 275 */ Minecraft.getMinecraft().getRenderManager();double z = blockPos.getZ() - RenderManager.renderPosZ; /* 276 */ GL11.glBlendFunc(770, 771); /* 277 */ GL11.glEnable(3042); /* 278 */ GL11.glLineWidth(1.0F); /* 279 */ GL11.glDisable(3553); /* 280 */ GL11.glDisable(2929); /* 281 */ GL11.glDepthMask(false); /* 282 */ GL11.glColor4f(damage, 1.0F - damage, 0.0F, 0.15F); /* 283 */ drawColorBox(new AxisAlignedBB(x + 0.5D - damage / 2.0F, y + 0.5D - damage / /* 284 */ 2.0F, z + 0.5D - damage / 2.0F, x + 0.5D + damage / 2.0F, y + 0.5D + damage / /* 285 */ 2.0F, z + 0.5D + damage / 2.0F), damage, 1.0F - damage, 0.0F, 0.15F); /* 286 */ GL11.glColor4d(0.0D, 0.0D, 0.0D, 0.5D); /* 287 */ RenderGlobal.drawSelectionBoundingBox(new AxisAlignedBB(x + 0.5D - /* 288 */ damage / 2.0F, y + 0.5D - damage / 2.0F, z + 0.5D - damage / 2.0F, x + 0.5D + /* 289 */ damage / 2.0F, y + 0.5D + damage / 2.0F, z + 0.5D + damage / 2.0F)); /* 290 */ GL11.glEnable(3553); /* 291 */ GL11.glEnable(2929); /* 292 */ GL11.glDepthMask(true); /* 293 */ GL11.glDisable(3042); /* */ } /* */ /* */ /* */ /* */ public static void searchBox(BlockPos blockPos) /* */ { /* 300 */ Minecraft.getMinecraft().getRenderManager();double x = blockPos.getX() - RenderManager.renderPosX; /* */ /* */ /* 303 */ Minecraft.getMinecraft().getRenderManager();double y = blockPos.getY() - RenderManager.renderPosY; /* */ /* */ /* 306 */ Minecraft.getMinecraft().getRenderManager();double z = blockPos.getZ() - RenderManager.renderPosZ; /* 307 */ GL11.glBlendFunc(770, 771); /* 308 */ GL11.glEnable(3042); /* 309 */ GL11.glLineWidth(1.0F); /* 310 */ float sinus = /* 311 */ 1.0F - MathHelper.abs(MathHelper.sin( /* 312 */ (float)(Minecraft.getSystemTime() % 10000L) / 10000.0F * 3.1415927F * 4.0F) * 1.0F); /* 313 */ GL11.glDisable(3553); /* 314 */ GL11.glDisable(2929); /* 315 */ GL11.glDepthMask(false); /* 316 */ GL11.glColor4f(1.0F - sinus, sinus, 0.0F, 0.15F); /* 317 */ drawColorBox(new AxisAlignedBB(x, y, z, x + 1.0D, y + 1.0D, z + 1.0D), /* 318 */ 1.0F - sinus, sinus, 0.0F, 0.15F); /* 319 */ GL11.glColor4d(0.0D, 0.0D, 0.0D, 0.5D); /* 320 */ RenderGlobal.drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, /* 321 */ x + 1.0D, y + 1.0D, z + 1.0D)); /* 322 */ GL11.glEnable(3553); /* 323 */ GL11.glEnable(2929); /* 324 */ GL11.glDepthMask(true); /* 325 */ GL11.glDisable(3042); /* */ } /* */ /* */ /* */ public static void drawColorBox(AxisAlignedBB axisalignedbb, float red, float green, float blue, float alpha) /* */ { /* 331 */ Tessellator ts = Tessellator.getInstance(); /* 332 */ VertexBuffer vb = ts.getBuffer(); /* 333 */ vb.begin(7, DefaultVertexFormats.POSITION_TEX); /* 334 */ vb.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ) /* 335 */ .color(red, green, blue, alpha).endVertex(); /* 336 */ vb.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ) /* 337 */ .color(red, green, blue, alpha).endVertex(); /* 338 */ vb.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ) /* 339 */ .color(red, green, blue, alpha).endVertex(); /* 340 */ vb.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ) /* 341 */ .color(red, green, blue, alpha).endVertex(); /* 342 */ vb.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ) /* 343 */ .color(red, green, blue, alpha).endVertex(); /* 344 */ vb.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ) /* 345 */ .color(red, green, blue, alpha).endVertex(); /* 346 */ vb.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ) /* 347 */ .color(red, green, blue, alpha).endVertex(); /* 348 */ vb.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ) /* 349 */ .color(red, green, blue, alpha).endVertex(); /* 350 */ ts.draw(); /* 351 */ vb.begin(7, DefaultVertexFormats.POSITION_TEX); /* 352 */ vb.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ) /* 353 */ .color(red, green, blue, alpha).endVertex(); /* 354 */ vb.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ) /* 355 */ .color(red, green, blue, alpha).endVertex(); /* 356 */ vb.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ) /* 357 */ .color(red, green, blue, alpha).endVertex(); /* 358 */ vb.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ) /* 359 */ .color(red, green, blue, alpha).endVertex(); /* 360 */ vb.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ) /* 361 */ .color(red, green, blue, alpha).endVertex(); /* 362 */ vb.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ) /* 363 */ .color(red, green, blue, alpha).endVertex(); /* 364 */ vb.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ) /* 365 */ .color(red, green, blue, alpha).endVertex(); /* 366 */ vb.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ) /* 367 */ .color(red, green, blue, alpha).endVertex(); /* 368 */ ts.draw(); /* 369 */ vb.begin(7, DefaultVertexFormats.POSITION_TEX); /* 370 */ vb.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ) /* 371 */ .color(red, green, blue, alpha).endVertex(); /* 372 */ vb.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ) /* 373 */ .color(red, green, blue, alpha).endVertex(); /* 374 */ vb.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ) /* 375 */ .color(red, green, blue, alpha).endVertex(); /* 376 */ vb.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ) /* 377 */ .color(red, green, blue, alpha).endVertex(); /* 378 */ vb.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ) /* 379 */ .color(red, green, blue, alpha).endVertex(); /* 380 */ vb.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ) /* 381 */ .color(red, green, blue, alpha).endVertex(); /* 382 */ vb.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ) /* 383 */ .color(red, green, blue, alpha).endVertex(); /* 384 */ vb.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ) /* 385 */ .color(red, green, blue, alpha).endVertex(); /* 386 */ ts.draw(); /* 387 */ vb.begin(7, DefaultVertexFormats.POSITION_TEX); /* 388 */ vb.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ) /* 389 */ .color(red, green, blue, alpha).endVertex(); /* 390 */ vb.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ) /* 391 */ .color(red, green, blue, alpha).endVertex(); /* 392 */ vb.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ) /* 393 */ .color(red, green, blue, alpha).endVertex(); /* 394 */ vb.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ) /* 395 */ .color(red, green, blue, alpha).endVertex(); /* 396 */ vb.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ) /* 397 */ .color(red, green, blue, alpha).endVertex(); /* 398 */ vb.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ) /* 399 */ .color(red, green, blue, alpha).endVertex(); /* 400 */ vb.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ) /* 401 */ .color(red, green, blue, alpha).endVertex(); /* 402 */ vb.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ) /* 403 */ .color(red, green, blue, alpha).endVertex(); /* 404 */ ts.draw(); /* 405 */ vb.begin(7, DefaultVertexFormats.POSITION_TEX); /* 406 */ vb.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ) /* 407 */ .color(red, green, blue, alpha).endVertex(); /* 408 */ vb.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ) /* 409 */ .color(red, green, blue, alpha).endVertex(); /* 410 */ vb.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ) /* 411 */ .color(red, green, blue, alpha).endVertex(); /* 412 */ vb.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ) /* 413 */ .color(red, green, blue, alpha).endVertex(); /* 414 */ vb.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ) /* 415 */ .color(red, green, blue, alpha).endVertex(); /* 416 */ vb.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ) /* 417 */ .color(red, green, blue, alpha).endVertex(); /* 418 */ vb.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ) /* 419 */ .color(red, green, blue, alpha).endVertex(); /* 420 */ vb.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ) /* 421 */ .color(red, green, blue, alpha).endVertex(); /* 422 */ ts.draw(); /* 423 */ vb.begin(7, DefaultVertexFormats.POSITION_TEX); /* 424 */ vb.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ) /* 425 */ .color(red, green, blue, alpha).endVertex(); /* 426 */ vb.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ) /* 427 */ .color(red, green, blue, alpha).endVertex(); /* 428 */ vb.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ) /* 429 */ .color(red, green, blue, alpha).endVertex(); /* 430 */ vb.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ) /* 431 */ .color(red, green, blue, alpha).endVertex(); /* 432 */ vb.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ) /* 433 */ .color(red, green, blue, alpha).endVertex(); /* 434 */ vb.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ) /* 435 */ .color(red, green, blue, alpha).endVertex(); /* 436 */ vb.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ) /* 437 */ .color(red, green, blue, alpha).endVertex(); /* 438 */ vb.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ) /* 439 */ .color(red, green, blue, alpha).endVertex(); /* 440 */ ts.draw(); /* */ } /* */ /* */ /* */ /* */ public static void tracerLine(Entity entity, int mode) /* */ { /* 447 */ Minecraft.getMinecraft().getRenderManager();double x = entity.posX - RenderManager.renderPosX; /* */ /* */ /* 450 */ Minecraft.getMinecraft().getRenderManager();double y = entity.posY + entity.height / 2.0F - RenderManager.renderPosY; /* */ /* */ /* 453 */ Minecraft.getMinecraft().getRenderManager();double z = entity.posZ - RenderManager.renderPosZ; /* 454 */ GL11.glBlendFunc(770, 771); /* 455 */ GL11.glEnable(3042); /* 456 */ GL11.glLineWidth(2.0F); /* 457 */ GL11.glDisable(3553); /* 458 */ GL11.glDisable(2929); /* 459 */ GL11.glDepthMask(false); /* 460 */ if (mode == 0) { /* 461 */ GL11.glColor4d( /* 462 */ 1.0F - Minecraft.getMinecraft().thePlayer /* 463 */ .getDistanceToEntity(entity) / 40.0F, /* 464 */ Minecraft.getMinecraft().thePlayer.getDistanceToEntity(entity) / 40.0F, /* 465 */ 0.0D, 0.5D); /* 466 */ } else if (mode == 1) { /* 467 */ GL11.glColor4d(0.0D, 0.0D, 1.0D, 0.5D); /* 468 */ } else if (mode == 2) { /* 469 */ GL11.glColor4d(1.0D, 1.0D, 0.0D, 0.5D); /* 470 */ } else if (mode == 3) { /* 471 */ GL11.glColor4d(1.0D, 0.0D, 0.0D, 0.5D); /* 472 */ } else if (mode == 4) { /* 473 */ GL11.glColor4d(0.0D, 1.0D, 0.0D, 0.5D); /* */ } /* 475 */ Vec3d eyes = /* 476 */ new Vec3d(0.0D, 0.0D, 1.0D) /* 477 */ .rotatePitch( /* 478 */ -(float)Math.toRadians(Minecraft.getMinecraft().thePlayer.rotationPitch)) /* 479 */ .rotateYaw( /* 480 */ -(float)Math.toRadians(Minecraft.getMinecraft().thePlayer.rotationYaw)); /* */ /* 482 */ GL11.glBegin(1); /* */ /* 484 */ GL11.glVertex3d( /* 485 */ eyes.xCoord, /* 486 */ Minecraft.getMinecraft().thePlayer.getEyeHeight() + eyes.yCoord, /* 487 */ eyes.zCoord); /* 488 */ GL11.glVertex3d(x, y, z); /* */ /* 490 */ GL11.glEnd(); /* 491 */ GL11.glEnable(3553); /* 492 */ GL11.glEnable(2929); /* 493 */ GL11.glDepthMask(true); /* 494 */ GL11.glDisable(3042); /* */ } /* */ /* */ /* */ /* */ public static void tracerLine(Entity entity, Color color) /* */ { /* 501 */ Minecraft.getMinecraft().getRenderManager();double x = entity.posX - RenderManager.renderPosX; /* */ /* */ /* 504 */ Minecraft.getMinecraft().getRenderManager();double y = entity.posY + entity.height / 2.0F - RenderManager.renderPosY; /* */ /* */ /* 507 */ Minecraft.getMinecraft().getRenderManager();double z = entity.posZ - RenderManager.renderPosZ; /* 508 */ GL11.glBlendFunc(770, 771); /* 509 */ GL11.glEnable(3042); /* 510 */ GL11.glLineWidth(2.0F); /* 511 */ GL11.glDisable(3553); /* 512 */ GL11.glDisable(2929); /* 513 */ GL11.glDepthMask(false); /* 514 */ setColor(color); /* 515 */ GL11.glBegin(1); /* */ /* 517 */ GL11.glVertex3d(0.0D, Minecraft.getMinecraft().thePlayer.getEyeHeight(), 0.0D); /* 518 */ GL11.glVertex3d(x, y, z); /* */ /* 520 */ GL11.glEnd(); /* 521 */ GL11.glEnable(3553); /* 522 */ GL11.glEnable(2929); /* 523 */ GL11.glDepthMask(true); /* 524 */ GL11.glDisable(3042); /* */ } /* */ /* */ public static void tracerLine(int x, int y, int z, Color color) /* */ { /* 529 */ Minecraft.getMinecraft().getRenderManager();x = (int)(x + (0.5D - RenderManager.renderPosX)); /* 530 */ Minecraft.getMinecraft().getRenderManager();y = (int)(y + (0.5D - RenderManager.renderPosY)); /* 531 */ Minecraft.getMinecraft().getRenderManager();z = (int)(z + (0.5D - RenderManager.renderPosZ)); /* 532 */ GL11.glBlendFunc(770, 771); /* 533 */ GL11.glEnable(3042); /* 534 */ GL11.glLineWidth(2.0F); /* 535 */ GL11.glDisable(3553); /* 536 */ GL11.glDisable(2929); /* 537 */ GL11.glDepthMask(false); /* 538 */ setColor(color); /* 539 */ GL11.glBegin(1); /* */ /* 541 */ GL11.glVertex3d(0.0D, Minecraft.getMinecraft().thePlayer.getEyeHeight(), 0.0D); /* 542 */ GL11.glVertex3d(x, y, z); /* */ /* 544 */ GL11.glEnd(); /* 545 */ GL11.glEnable(3553); /* 546 */ GL11.glEnable(2929); /* 547 */ GL11.glDepthMask(true); /* 548 */ GL11.glDisable(3042); /* */ } /* */ /* */ public static void setColor(Color c) /* */ { /* 553 */ GL11.glColor4f(c.getRed() / 255.0F, c.getGreen() / 255.0F, c.getBlue() / 255.0F, /* 554 */ c.getAlpha() / 255.0F); /* */ } /* */ } /* Location: C:\Users\Jaxon\AppData\Roaming\.minecraft\versions\Kinris\Kinris.jar!\me\kinris\utils\RenderUtils.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */<file_sep>/me/kinris/account/DirectLogin.java /* */ package me.kinris.account; /* */ /* */ import com.mojang.authlib.Agent; /* */ import com.mojang.authlib.GameProfile; /* */ import com.mojang.authlib.exceptions.AuthenticationException; /* */ import com.mojang.authlib.exceptions.AuthenticationUnavailableException; /* */ import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; /* */ import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication; /* */ import java.io.IOException; /* */ import java.net.Proxy; /* */ import java.util.List; /* */ import java.util.UUID; /* */ import net.minecraft.client.Minecraft; /* */ import net.minecraft.client.gui.GuiButton; /* */ import net.minecraft.client.gui.GuiScreen; /* */ import net.minecraft.client.gui.GuiTextField; /* */ import net.minecraft.util.Session; /* */ import org.lwjgl.input.Keyboard; /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class DirectLogin /* */ extends GuiScreen /* */ { /* */ private GuiScreen parentScreen; /* */ private GuiTextField usernameTextField; /* */ private PassField passwordTextField; /* */ private String error; /* */ /* */ public DirectLogin(GuiScreen guiscreen) /* */ { /* 35 */ this.parentScreen = guiscreen; /* */ } /* */ /* */ public void updateScreen() { /* 39 */ this.usernameTextField.updateCursorCounter(); /* 40 */ this.passwordTextField.updateCursorCounter(); /* */ } /* */ /* */ public void onGuiClosed() { /* 44 */ Keyboard.enableRepeatEvents(false); /* */ } /* */ /* */ protected void actionPerformed(GuiButton guibutton) { /* 48 */ if (!guibutton.enabled) { /* 49 */ return; /* */ } /* 51 */ if (guibutton.id == 1) { /* 52 */ this.mc.displayGuiScreen(this.parentScreen); /* */ } /* 54 */ else if (guibutton.id == 0) { /* 55 */ if (this.passwordTextField.getText().length() > 0) { /* 56 */ String s = this.usernameTextField.getText(); /* 57 */ String s1 = this.passwordTextField.getText(); /* */ try { /* 59 */ String result = Login(s, s1).trim(); /* 60 */ if ((result == null) || (!result.contains(":"))) { /* 61 */ this.error = result; /* 62 */ return; /* */ } /* 64 */ String[] values = result.split(":"); /* 65 */ if (values.length > 1) { /* 66 */ this.mc.session = new Session(values[2], values[3], result, result); /* */ } /* */ /* */ /* 70 */ this.mc.displayGuiScreen(this.parentScreen); /* */ } catch (Exception e) { /* 72 */ e.printStackTrace(); /* */ } /* */ } /* 75 */ this.mc.session = new Session(this.usernameTextField.getText(), "", this.error, this.error); /* */ /* */ /* 78 */ this.mc.displayGuiScreen(this.parentScreen); /* */ } /* */ } /* */ /* */ protected void keyTyped(char c, int i) { /* 83 */ this.usernameTextField.textboxKeyTyped(c, i); /* 84 */ this.passwordTextField.textboxKeyTyped(c, i); /* 85 */ if (c == '\t') { /* 86 */ if (this.usernameTextField.isFocused) { /* 87 */ this.usernameTextField.isFocused = false; /* 88 */ this.passwordTextField.isFocused = true; /* */ } /* */ else { /* 91 */ this.usernameTextField.isFocused = true; /* 92 */ this.passwordTextField.isFocused = false; /* */ } /* */ } /* 95 */ if (c == '\r') { /* 96 */ actionPerformed((GuiButton)this.buttonList.get(0)); /* */ } /* */ } /* */ /* */ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { /* 101 */ super.mouseClicked(mouseX, mouseY, mouseButton); /* 102 */ this.usernameTextField.mouseClicked(mouseX, mouseY, mouseButton); /* 103 */ this.passwordTextField.mouseClicked(mouseX, mouseY, mouseButton); /* */ } /* */ /* */ public void initGui() { /* 107 */ Keyboard.enableRepeatEvents(true); /* 108 */ this.buttonList.clear(); /* 109 */ this.buttonList.add(new GuiButton(0, width / 2 - 100, height / 4 + 96 + 12, "Done")); /* 110 */ this.buttonList.add(new GuiButton(1, width / 2 - 100, height / 4 + 120 + 12, "Cancel")); /* 111 */ this.usernameTextField = new GuiTextField(this.eventButton, this.fontRendererObj, width / 2 - 100, 76, 200, 20); /* 112 */ this.passwordTextField = new PassField(this, this.fontRendererObj, width / 2 - 100, 116, 200, 20, ""); /* 113 */ this.usernameTextField.setMaxStringLength(512); /* */ } /* */ /* */ public void drawScreen(int i, int j, float f) { /* 117 */ drawDefaultBackground(); /* 118 */ drawCenteredString(this.fontRendererObj, "Change Username", width / 2, height / 4 - 60 + 20, 16777215); /* 119 */ drawString(this.fontRendererObj, "Email", width / 2 - 100, 63, 10526880); /* 120 */ drawString(this.fontRendererObj, "Password", width / 2 - 100, 104, 10526880); /* 121 */ this.usernameTextField.drawTextBox(); /* 122 */ this.passwordTextField.drawTextBox(); /* 123 */ if (this.error != null) { /* 124 */ drawCenteredString(this.fontRendererObj, "§c Login Failed:" + this.error, width / 2, height / 4 + 72 + 12, 16777215); /* */ } /* 126 */ super.drawScreen(i, j, f); /* */ } /* */ /* */ public String Login(String username, String password) { /* 130 */ YggdrasilUserAuthentication auth = /* 131 */ (YggdrasilUserAuthentication)new YggdrasilAuthenticationService( /* 132 */ Proxy.NO_PROXY, "").createUserAuthentication(Agent.MINECRAFT); /* */ /* 134 */ auth.setUsername(username); /* 135 */ auth.setPassword(<PASSWORD>); /* */ /* */ try /* */ { /* 139 */ auth.logIn(); /* 140 */ Minecraft.getMinecraft().session = /* 141 */ new Session(auth.getSelectedProfile().getName(), auth /* 142 */ .getSelectedProfile().getId().toString(), /* 143 */ auth.getAuthenticatedToken(), "mojang"); /* 144 */ return ""; /* */ } /* */ catch (AuthenticationUnavailableException e) /* */ { /* 148 */ return "§4§lCannot contact authentication server!"; /* */ } /* */ catch (AuthenticationException e) /* */ { /* 152 */ e.printStackTrace(); /* 153 */ if ((e.getMessage().contains("Invalid username or password.")) || /* 154 */ (e.getMessage().toLowerCase().contains("account migrated"))) { /* 155 */ return "§4§lWrong password!"; /* */ } /* 157 */ return "§4§lCannot contact authentication server!"; /* */ } /* */ catch (NullPointerException e) {} /* */ /* 161 */ return "§4§lWrong password!"; /* */ } /* */ } /* Location: C:\Users\Jaxon\AppData\Roaming\.minecraft\versions\Kinris\Kinris.jar!\me\kinris\account\DirectLogin.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */<file_sep>/me/kinris/event/Listener.java package me.kinris.event; import java.util.EventListener; public abstract interface Listener extends EventListener {} /* Location: C:\Users\Jaxon\AppData\Roaming\.minecraft\versions\Kinris\Kinris.jar!\me\kinris\event\Listener.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */<file_sep>/me/kinris/utils/XRayUtils.java /* */ package me.kinris.utils; /* */ /* */ public class XRayUtils /* */ { /* 5 */ public static int xrayOpacity = 110; /* */ public static boolean isXRay; /* */ } /* Location: C:\Users\Jaxon\AppData\Roaming\.minecraft\versions\Kinris\Kinris.jar!\me\kinris\utils\XRayUtils.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */<file_sep>/me/kinris/mod/mods/AutoMine.java /* */ package me.kinris.mod.mods; /* */ /* */ import net.minecraft.client.Minecraft; /* */ import net.minecraft.client.settings.GameSettings; /* */ /* */ public class AutoMine extends me.kinris.mod.Module /* */ { /* */ public AutoMine() /* */ { /* 10 */ super("AutoMine", 79, 16737123); /* */ } /* */ /* */ public void onUpdate() { /* 14 */ if (this.isEnabled) { /* 15 */ mc.gameSettings.keyBindAttack.pressed = true; /* */ } else { /* 17 */ mc.gameSettings.keyBindAttack.pressed = false; /* */ } /* */ } /* */ } /* Location: C:\Users\Jaxon\AppData\Roaming\.minecraft\versions\Kinris\Kinris.jar!\me\kinris\mod\mods\AutoMine.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */<file_sep>/me/kinris/event/events/EventLiquidCollide.java /* */ package me.kinris.event.events; /* */ /* */ import net.minecraft.util.math.AxisAlignedBB; /* */ /* */ public class EventLiquidCollide extends me.kinris.event.Event { /* */ public AxisAlignedBB bound; /* */ public int x; /* */ public int y; /* */ public int z; /* */ /* */ public EventLiquidCollide(AxisAlignedBB bound, int x, int y, int z) { /* 12 */ this.bound = bound; /* 13 */ this.x = x; /* 14 */ this.y = y; /* 15 */ this.z = z; /* */ } /* */ } /* Location: C:\Users\Jaxon\AppData\Roaming\.minecraft\versions\Kinris\Kinris.jar!\me\kinris\event\events\EventLiquidCollide.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */<file_sep>/me/kinris/mod/mods/Step.java /* */ package me.kinris.mod.mods; /* */ /* */ import me.kinris.mod.Module; /* */ import net.minecraft.client.Minecraft; /* */ /* */ public class Step extends Module /* */ { /* */ public Step() /* */ { /* 10 */ super("Step", 47, 16737123); /* */ } /* */ /* */ public void onUpdate() { /* 14 */ if (this.isEnabled) { /* 15 */ mc.thePlayer.stepHeight = 1.0F; /* */ } else { /* 17 */ mc.thePlayer.stepHeight = 0.5F; /* */ } /* */ } /* */ } /* Location: C:\Users\Jaxon\AppData\Roaming\.minecraft\versions\Kinris\Kinris.jar!\me\kinris\mod\mods\Step.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */<file_sep>/me/kinris/account/PassField.java /* */ package me.kinris.account; /* */ /* */ import net.minecraft.client.gui.FontRenderer; /* */ import net.minecraft.client.gui.Gui; /* */ import net.minecraft.client.gui.GuiScreen; /* */ /* */ public class PassField extends Gui /* */ { /* */ private final FontRenderer fontRenderer; /* */ private final int xPos; /* */ private final int yPos; /* */ private final int width; /* */ private final int height; /* */ private String text; /* */ private int maxStringLength; /* */ private int cursorCounter; /* 17 */ public boolean isFocused = false; /* 18 */ public boolean isEnabled = true; /* */ private GuiScreen parentGuiScreen; /* */ /* */ public PassField(GuiScreen var1, FontRenderer var2, int var3, int var4, int var5, int var6, String var7) { /* 22 */ this.parentGuiScreen = var1; /* 23 */ this.fontRenderer = var2; /* 24 */ this.xPos = var3; /* 25 */ this.yPos = var4; /* 26 */ this.width = var5; /* 27 */ this.height = var6; /* 28 */ setText(var7); /* */ } /* */ /* */ public void setText(String var1) { /* 32 */ this.text = var1; /* */ } /* */ /* */ public String getText() { /* 36 */ return this.text; /* */ } /* */ /* */ public void updateCursorCounter() { /* 40 */ this.cursorCounter += 1; /* */ } /* */ /* */ public void textboxKeyTyped(char var1, int var2) { /* 44 */ if ((this.isEnabled) && (this.isFocused)) { /* 45 */ if (var1 == '\t') /* 46 */ this.parentGuiScreen.confirmClicked(this.isEnabled, var2); /* 47 */ if (var1 == '\026') { /* 48 */ String var3 = GuiScreen.getClipboardString(); /* 49 */ if (var3 == null) /* 50 */ var3 = ""; /* 51 */ int var4 = 32 - this.text.length(); /* 52 */ if (var4 > var3.length()) /* 53 */ var4 = var3.length(); /* 54 */ if (var4 > 0) /* 55 */ this.text += var3.substring(0, var4); /* */ } /* 57 */ if ((var2 == 14) && (this.text.length() > 0)) /* 58 */ this.text = this.text.substring(0, this.text.length() - 1); /* 59 */ if (((net.minecraft.util.ChatAllowedCharacters.allowedCharacters.indexOf(var1) >= 0) || (var1 > ' ')) && ((this.text.length() < this.maxStringLength) || (this.maxStringLength == 0))) /* 60 */ this.text += var1; /* */ } /* */ } /* */ /* */ public void mouseClicked(int var1, int var2, int var3) { /* 65 */ boolean var4 = (this.isEnabled) && (var1 >= this.xPos) && (var1 < this.xPos + this.width) && (var2 >= this.yPos) && (var2 < this.yPos + this.height); /* 66 */ setFocused(var4); /* */ } /* */ /* */ public void setFocused(boolean var1) { /* 70 */ if ((var1) && (!this.isFocused)) /* 71 */ this.cursorCounter = 0; /* 72 */ this.isFocused = var1; /* */ } /* */ /* */ public void drawTextBox() { /* 76 */ drawRect(this.xPos - 1, this.yPos - 1, this.xPos + this.width + 1, this.yPos + this.height + 1, -13382401); /* 77 */ drawRect(this.xPos, this.yPos, this.xPos + this.width, this.yPos + this.height, -13421773); /* 78 */ String s = this.text.replaceAll(".", "*"); /* 79 */ if (this.isEnabled) { /* 80 */ boolean var1 = (this.isFocused) && (this.cursorCounter / 6 % 2 == 0); /* 81 */ drawString(this.fontRenderer, s + (var1 ? "_" : ""), this.xPos + 4, this.yPos + (this.height - 8) / 2, 14737632); /* */ } else { /* 83 */ drawString(this.fontRenderer, s, this.xPos + 4, this.yPos + (this.height - 8) / 2, 7368816); /* */ } /* */ } /* */ /* */ public void setMaxStringLength(int var1) { /* 88 */ this.maxStringLength = var1; /* */ } /* */ } /* Location: C:\Users\Jaxon\AppData\Roaming\.minecraft\versions\Kinris\Kinris.jar!\me\kinris\account\PassField.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */<file_sep>/me/kinris/gui/screen/KinrisInfo.java /* */ package me.kinris.gui.screen; /* */ /* */ import java.io.IOException; /* */ import java.util.List; /* */ import net.minecraft.client.Minecraft; /* */ import net.minecraft.client.gui.GuiButton; /* */ import net.minecraft.client.gui.GuiScreen; /* */ import org.lwjgl.input.Keyboard; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class KinrisInfo /* */ extends GuiScreen /* */ { /* */ private GuiScreen parentScreen; /* */ /* */ public KinrisInfo(GuiScreen guiscreen) {} /* */ /* */ public void updateScreen() {} /* */ /* */ public void onGuiClosed() /* */ { /* 37 */ Keyboard.enableRepeatEvents(false); /* */ } /* */ /* */ protected void actionPerformed(GuiButton guibutton) { /* 41 */ if (!guibutton.enabled) { /* 42 */ return; /* */ } /* 44 */ if (guibutton.id == 1) { /* 45 */ this.mc.displayGuiScreen(this.parentScreen); /* */ } /* */ } /* */ /* */ protected void keyTyped(char c, int i) { /* 50 */ if (c == '\r') { /* 51 */ actionPerformed((GuiButton)this.buttonList.get(0)); /* */ } /* */ } /* */ /* */ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { /* 56 */ super.mouseClicked(mouseX, mouseY, mouseButton); /* */ } /* */ /* */ public void initGui() { /* 60 */ Keyboard.enableRepeatEvents(true); /* 61 */ this.buttonList.clear(); /* 62 */ this.buttonList.add(new GuiButton(1, width / 2 - 100, height / 4 + 120 + 12, "Back")); /* */ } /* */ /* */ public void drawScreen(int i, int j, float f) { /* 66 */ drawDefaultBackground(); /* 67 */ super.drawScreen(i, j, f); /* */ } /* */ } /* Location: C:\Users\Jaxon\AppData\Roaming\.minecraft\versions\Kinris\Kinris.jar!\me\kinris\gui\screen\KinrisInfo.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */<file_sep>/me/kinris/event/Event.java package me.kinris.event; public abstract class Event {} /* Location: C:\Users\Jaxon\AppData\Roaming\.minecraft\versions\Kinris\Kinris.jar!\me\kinris\event\Event.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */<file_sep>/me/kinris/manage/FriendManager.java /* */ package me.kinris.manage; /* */ /* */ import java.util.ArrayList; /* */ import me.kinris.friend.Friend; /* */ import net.minecraft.util.StringUtils; /* */ /* */ /* */ /* */ /* */ public class FriendManager /* */ { /* 12 */ public static ArrayList<Friend> friendsList = new ArrayList(); /* */ /* */ public void addFriend(String name, String alias) /* */ { /* 16 */ friendsList.add(new Friend(name, alias)); /* */ } /* */ /* */ public String getFriends() { /* 20 */ String friends = friendsList.toString(); /* 21 */ return friends; /* */ } /* */ /* */ public void removeFriend(String name) /* */ { /* 26 */ for (Friend friend : friendsList) /* */ { /* 28 */ if (Friend.getName().equalsIgnoreCase(name)) /* */ { /* 30 */ friendsList.remove(friend); /* 31 */ break; /* */ } /* */ } /* */ } /* */ /* */ public boolean isFriend(String name) /* */ { /* 38 */ boolean isFriend = false; /* 39 */ for (Friend friend : friendsList) /* */ { /* 41 */ if (Friend.getName().equalsIgnoreCase(StringUtils.stripControlCodes(name))) /* */ { /* 43 */ isFriend = true; /* 44 */ break; /* */ } /* */ } /* 47 */ return isFriend; /* */ } /* */ } /* Location: C:\Users\Jaxon\AppData\Roaming\.minecraft\versions\Kinris\Kinris.jar!\me\kinris\manage\FriendManager.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */<file_sep>/me/kinris/event/LeftClickListener.java package me.kinris.event; public abstract interface LeftClickListener extends Listener { public abstract void onLeftClick(); } /* Location: C:\Users\Jaxon\AppData\Roaming\.minecraft\versions\Kinris\Kinris.jar!\me\kinris\event\LeftClickListener.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */<file_sep>/me/kinris/mod/mods/AutoWalk.java /* */ package me.kinris.mod.mods; /* */ /* */ import net.minecraft.client.Minecraft; /* */ import net.minecraft.client.settings.GameSettings; /* */ /* */ public class AutoWalk extends me.kinris.mod.Module /* */ { /* */ public AutoWalk() /* */ { /* 10 */ super("AutoWalk", 80, 16737123); /* */ } /* */ /* */ public void onUpdate() { /* 14 */ if (this.isEnabled) { /* 15 */ mc.gameSettings.keyBindForward.pressed = true; /* */ } /* */ } /* */ /* */ public void onDisable() /* */ { /* 21 */ mc.gameSettings.keyBindForward.pressed = false; /* */ } /* */ } /* Location: C:\Users\Jaxon\AppData\Roaming\.minecraft\versions\Kinris\Kinris.jar!\me\kinris\mod\mods\AutoWalk.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */<file_sep>/me/kinris/mod/mods/KillAura.java /* */ package me.kinris.mod.mods; /* */ /* */ import me.kinris.main.Kinris; /* */ import me.kinris.manage.FriendManager; /* */ import me.kinris.mod.Module; /* */ import net.minecraft.client.Minecraft; /* */ import net.minecraft.client.entity.EntityPlayerSP; /* */ import net.minecraft.client.multiplayer.PlayerControllerMP; /* */ import net.minecraft.client.multiplayer.WorldClient; /* */ import net.minecraft.entity.player.EntityPlayer; /* */ import net.minecraft.util.EnumHand; /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class KillAura /* */ extends Module /* */ { /* */ public KillAura() /* */ { /* 23 */ super("KillAura", 52, 16737123); /* */ } /* */ /* 26 */ private float hitspeed = 8.0F; /* 27 */ private long currentMS = 0L; /* 28 */ private long lastMS = -1L; /* */ /* */ public boolean hasDelayRun(long time) { /* 31 */ return this.currentMS - this.lastMS >= time; /* */ } /* */ /* */ public void onUpdate() { /* 35 */ if (!this.isEnabled) return; /* 36 */ if (this.isEnabled) { /* 37 */ this.currentMS = (System.nanoTime() / 1000000L); /* 38 */ if (hasDelayRun((1000.0F / this.hitspeed))) { /* 39 */ for (Object o : mc.theWorld.loadedEntityList) { /* 40 */ if ((o instanceof EntityPlayer)) { /* 41 */ EntityPlayer ep = (EntityPlayer)o; /* 42 */ if ((!(ep instanceof EntityPlayerSP)) && (mc.thePlayer.getDistanceToEntity(ep) <= 6.0D) && (!ep.isDead) && (mc.thePlayer.canEntityBeSeen(ep)) && (!Kinris.getFriendManager().isFriend(ep.getName()))) { /* 43 */ mc.thePlayer.setSprinting(false); /* 44 */ mc.playerController.attackEntity(mc.thePlayer, ep); /* 45 */ mc.thePlayer.swingArm(EnumHand.MAIN_HAND); /* 46 */ this.lastMS = (System.nanoTime() / 1000000L); /* 47 */ break; /* */ } /* */ } /* */ } /* */ } /* */ } /* */ } /* */ } /* Location: C:\Users\Jaxon\AppData\Roaming\.minecraft\versions\Kinris\Kinris.jar!\me\kinris\mod\mods\KillAura.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */<file_sep>/me/kinris/command/commands/Friend.java /* */ package me.kinris.command.commands; /* */ /* */ import me.kinris.command.Command; /* */ import me.kinris.main.Kinris; /* */ import me.kinris.manage.FriendManager; /* */ /* */ public class Friend /* */ extends Command /* */ { /* */ public String getAlias() /* */ { /* 12 */ return "friend"; /* */ } /* */ /* */ public String getDescription() /* */ { /* 17 */ return "Allows user to set friends so no negative hacks have an effect to them."; /* */ } /* */ /* */ public String getSyntax() /* */ { /* 22 */ return ".friend add [NAME] [ALIAS] | .friend del [NAME] [ALIAS]"; /* */ } /* */ /* */ public void onCommand(String command, String[] args) throws Exception /* */ { /* 27 */ if (args[0].equalsIgnoreCase("add")) { /* 28 */ String name = args[1]; /* 29 */ String alias = args[2]; /* 30 */ if (!Kinris.getFriendManager().isFriend(name)) { /* 31 */ Kinris.getFriendManager().addFriend(name, alias); /* 32 */ Kinris.addChatMessage("§9" + name + " §7has been added to your friends list under alias §9" + alias + "§7."); /* */ } else { /* 34 */ Kinris.addChatMessage("§9" + name + " §7is already your friend."); /* */ } /* */ } /* 37 */ if (args[0].equalsIgnoreCase("del")) { /* 38 */ String name = args[1]; /* 39 */ if (Kinris.getFriendManager().isFriend(name)) { /* 40 */ Kinris.getFriendManager().removeFriend(name); /* 41 */ Kinris.addChatMessage("§9" + name + " §7has been removed from your friends list."); /* */ } else { /* 43 */ Kinris.addChatMessage("§9" + name + " §7is not your friend."); /* */ } /* */ } /* */ } /* */ } /* Location: C:\Users\Jaxon\AppData\Roaming\.minecraft\versions\Kinris\Kinris.jar!\me\kinris\command\commands\Friend.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
19e51f04fc1c7a2f74eef76e6b15f3105e725290
[ "Java" ]
18
Java
jaxonlaing/kinrisold
3b9de85194b92a5be70fd412e72f31d0e7b054e6
2b9ff494318ad007be5930b4db2d2f4064b96b04
refs/heads/master
<file_sep># Age-Calculator---python Calculate your age in Months, Weeks, Days, Hours, Minutes, or Seconds! <file_sep>import tkinter from tkinter import * from tkinter import ttk def age_calc(): user_choice = users_choice.get() user_age = int(users_age.get()) if user_choice == '1': months = user_age * 12 age = "Your age in months is {}".format(months) elif user_choice == '2': weeks = user_age * 52 age = "Your age in weeks is {}".format(weeks) elif user_choice == '3': days = user_age * 365 age = "Your age in days is {}".format(days) elif user_choice == '4': hours = user_age * 365 * 24 age = "Your age in hours is {}".format(hours) elif user_choice == '5': minute = user_age * 365 * 24 * 60 age = "Your age in minutes is {}".format(minute) elif user_choice == '6': seconds = user_age * 365 * 24 * 60 * 60 age = "Your age in seconds is {}".format(seconds) else: age = "That's not a valid choice" results.delete(0.0, END) results.insert(0.0, age) instructions = "Tell me what your age is and I'll translate it into months, weeks, days, hours, minutes, or seconds, depending on your choice." choices = " 1. Months\n 2. Weeks\n 3. Days\n 4. Hours\n 5. Minutes\n 6. Seconds" root = tkinter.Tk() root.title("Age Calculator") root.geometry("1000x700") frame_1 = Frame() frame_1.pack() # create the widgets to appear instr = Text(frame_1, width=40, height=7, wrap=WORD) instr.pack(side = LEFT) instr.delete(0.0, END) instr.insert(0.0, instructions) choice = Text(frame_1, width=40, height=7, wrap=WORD) choice.pack(side = RIGHT) choice.delete(0.0, END) choice.insert(0.0, choices) # user entered widgets age_lbl = ttk.Label(root, text="How old are you?") age_lbl.pack() users_age = ttk.Entry(root) users_age.pack() choice_lbl = Label(root, text="How would you like to calculate your age?") choice_lbl.pack() users_choice = Entry(root) users_choice.pack() # calculate age results widget generate_btn = ttk.Button(root, text = "Calculate your age!", command = age_calc) generate_btn.place(x = 200, y = 500) # display results widget results = Text(root, width=50, height=5, wrap=WORD) results.place(x = 200, y = 400) root.mainloop()
327946c072186f950ac85e978aa12d27e9af6dc8
[ "Markdown", "Python" ]
2
Markdown
rdhammack88/Age-Calculator---python
cf26cd004ab9f12aa911d3ca49a478d32f6d209d
c3e7dca78565e114075b5480c4ff6b02caa172a1
refs/heads/main
<file_sep><?php foreach ($_COOKIE as $key => $value) { setcookie($key, false); } header("Location: ./login.php"); die(); <file_sep><header> <div class="row"> <div class="col"> <div><a href="./title.php" style="cursor: pointer;"><img src="../assets/Logo.png" alt="Logo"></a> </div> </div> <div class="extraWide"> <a href="title.php"> <img src="../assets/Title.png" alt="banner logo" /> </a> </div> <div class="col"> <div class="row"> <?php if (!isset($_COOKIE["name"])) { ?> <div class="col right"> <a class="login" href="login.php">Login</a> </div> <?php } else { ?> <div class="infoColLeft"> <div class="text"><label class="leftLab">User:&nbsp;</label><label class="rightLab"><?php echo $_COOKIE["name"] ?></label></div> <div class="text"><label class="leftLab">Difficulty:&nbsp;</label><label class="rightLab"><?php echo $_COOKIE["difficulty"] ?></label></div> </div> <div class="infoColRight"> <a class="login" href="cookie-delete.php">Logout</a> </div> <?php } ?> </div> </div> </div> </header><file_sep># webdevproject2 Remember to: -push any changes -Review Pull request -Include comments This is to ensure that we are working on the same code base and nothing gets lost when commiting to the repo. Thank you! :) <file_sep><?php if (!empty($_COOKIE['name'])) { $fileName = ""; if ($_COOKIE['difficulty'] == 'Beginner') { $fileName = "../textfile/b-leaderboard.txt"; } else if ($_COOKIE['difficulty'] == 'Intermediate') { $fileName = "../textfile/i-leaderboard.txt"; } else if ($_COOKIE['difficulty'] == 'Expert') { $fileName = "../textfile/e-leaderboard.txt"; } else if ($_COOKIE['difficulty'] == 'Master') { $fileName = "../textfile/m-leaderboard.txt"; } if (file_exists($fileName)) { chmod($fileName, 0777); } else { $file = fopen($fileName, "w"); fclose($file); chmod($fileName, 0777); } $line = $_COOKIE['name'] . "|" . $_COOKIE['time_elapsed'] . PHP_EOL; file_put_contents($fileName, $line, FILE_APPEND); shell_exec("sort -t'|' -nk2 $fileName | head -10 > ../textfile/test.out"); shell_exec("mv ../textfile/test.out $fileName"); chmod($fileName, 0777); } <file_sep><!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Hangman Game</title> <link rel="stylesheet" href="../css/format.css" /> <link rel="icon" href="../assets/Logo.png" type="image/x-icon" /> </head> <body class = "background"> <?php include("top.php"); ?> <div class="gamespace"> <div class="pdisplay"> <div class="playlevels"> <p>Choose your level...</p> </div> <div class="gameplay-sel"> <a href="./maingame-submit.php?theme=marvel" class="button level btn"> Beginner </a><!-- marvel theme --> <a href="./maingame-submit.php?theme=starwar" class="button level btn"> Intermediate </a><!-- star wars theme --> <a href="./maingame-submit.php?theme=anime" class="button level btn"> Expert </a><!-- anime/cartoon theme--> <a href="./maingame-submit.php?theme=mashup" class="button level btn"> Master </a><!-- mashup --> </div> </div> </div> <?php include("bottom.html"); ?> </body> </html><file_sep><!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Hangman Game</title> <link rel="stylesheet" href="../css/format.css" /> <link rel="icon" href="../assets/Logo.png" type="image/x-icon" /> </head> <body class="background"> <?php $history = json_decode($_COOKIE['history'], true); ?> <?php include("top.php"); ?> <!-- <div id="timer"> Timer: </div> --> <!-- hint pop up --> <div class="gamespace"> <div class="gamelayout"> <form action="./maingame-submit.php" method="POST"> <div class="row"> <div id="letterbox"> <div id="availLetter"> Available Letters </div> <table id="letters"> <tr> <td class="<?php if (in_array('A', $history)) { echo 'crossout'; } ?>">A</td> <td class="<?php if (in_array('B', $history)) { echo 'crossout'; } ?>">B</td> <td class="<?php if (in_array('C', $history)) { echo 'crossout'; } ?>">C</td> <td class="<?php if (in_array('D', $history)) { echo 'crossout'; } ?>">D</td> <td class="<?php if (in_array('E', $history)) { echo 'crossout'; } ?>">E</td> <td class="<?php if (in_array('F', $history)) { echo 'crossout'; } ?>">F</td> </tr> <tr> <td class="<?php if (in_array('G', $history)) { echo 'crossout'; } ?>">G</td> <td class="<?php if (in_array('H', $history)) { echo 'crossout'; } ?>">H</td> <td class="<?php if (in_array('I', $history)) { echo 'crossout'; } ?>">I</td> <td class="<?php if (in_array('J', $history)) { echo 'crossout'; } ?>">J</td> <td class="<?php if (in_array('K', $history)) { echo 'crossout'; } ?>">K</td> <td class="<?php if (in_array('L', $history)) { echo 'crossout'; } ?>">L</td> </tr> <tr> <td class="<?php if (in_array('M', $history)) { echo 'crossout'; } ?>">M</td> <td class="<?php if (in_array('N', $history)) { echo 'crossout'; } ?>">N</td> <td class="<?php if (in_array('O', $history)) { echo 'crossout'; } ?>">O</td> <td class="<?php if (in_array('P', $history)) { echo 'crossout'; } ?>">P</td> <td class="<?php if (in_array('Q', $history)) { echo 'crossout'; } ?>">Q</td> <td class="<?php if (in_array('R', $history)) { echo 'crossout'; } ?>">R</td> </tr> <tr> <td class="<?php if (in_array('S', $history)) { echo 'crossout'; } ?>">S</td> <td class="<?php if (in_array('T', $history)) { echo 'crossout'; } ?>">T</td> <td class="<?php if (in_array('U', $history)) { echo 'crossout'; } ?>">U</td> <td class="<?php if (in_array('V', $history)) { echo 'crossout'; } ?>">V</td> <td class="<?php if (in_array('W', $history)) { echo 'crossout'; } ?>">W</td> <td class="<?php if (in_array('X', $history)) { echo 'crossout'; } ?>">X</td> </tr> <tr> <td class="crossout" colspan="2"></td> <td class="<?php if (in_array('Y', $history)) { echo 'crossout'; } ?>">Y</td> <td class="<?php if (in_array('Z', $history)) { echo 'crossout'; } ?>">Z</td> </tr> </table> </div> <div id="man"> <img src="<?php if ($_COOKIE['wrong'] == 0) { echo "../assets/gallow.png"; } else { echo "../assets/" . $_COOKIE['theme'] . $_COOKIE['wrong'] . ".png"; } ?>" alt="hangman" /> </div> </div> <div id="word"> <?php $display = $_COOKIE['display']; for ($i = 0; $i < strlen($display); $i++) { echo "<div class='letter'>" . $display[$i] . "</div>"; } ?> </div> <div class="error"> <?php if ($_COOKIE['repeat'] == "true") { echo "<label>" . $_COOKIE['lastGuess'] . " was already guessed!</label>"; } ?> </div> <div class="row shiftdown"> <div class="empty"> </div> <div class="empty"> </div> <div class="textbox"> <input type="text" placeholder="Enter 1 Character or a Word" name="guess" size="22" autofocus /> </div> <div class="textbox submit"> <input name="form" type="submit" value="Guess" /> </div> <a class="hbutton" href="#popup">Hint</a> </div> <div id="popup" class="overlay"> <div class="popup"> <div class="alignRight"> <a class="close" href="#">&times;</a> </div> <div> <p><?php echo $_COOKIE['hint']; ?> </p> </div> </div> </div> </form> </div> </div> <?php include("bottom.html"); ?> </body> </html><file_sep><?php $difficulties = array('beginner', 'intermediate', 'expert', 'master'); if(!empty($_GET['difficulty']) && in_array($_GET['difficulty'], $difficulties)) { $difficulty = $_GET['difficulty']; } else { $difficulty = "beginner"; } $fileData = file_get_contents("../textfile/leaderboard-$difficulty.txt"); $fileArray = explode(PHP_EOL, $fileData); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Leaderboard</title> <link rel="icon" href="../assets/Logo.png" type="image/x-icon" /> <link rel="stylesheet" href="../css/format.css" /> <link rel="stylesheet" href="../css/leaderboard.css" /> </head> <body class="background"> <div id="Background"> <?php include("top.php"); ?> <div id="main-container"> <div id="middle-row"> <div id="levels"> <a href="./leaderboard.php?difficulty=beginner" class="lvl <?php if($difficulty == 'beginner') { echo 'selected'; }?>">BEGINNER</a> <a href="./leaderboard.php?difficulty=intermediate" class="lvl <?php if($difficulty == 'intermediate') { echo 'selected'; }?>">INTERMEDIATE</a> <a href="./leaderboard.php?difficulty=expert" class="lvl <?php if($difficulty == 'expert') { echo 'selected'; }?>">EXPERT</a> <a href="./leaderboard.php?difficulty=master" class="lvl <?php if($difficulty == 'master') { echo 'selected'; }?>">MASTER</a> </div> </div> <div id="bottom-row"> <div id="play-container"> <a href="./play.php" id="play-button"> PLAY NOW! </a> </div> <div id="leaders-container"> <?php $count = 1; foreach($fileArray as $leader) { if($leader != '') { $data = explode('|', $leader); ?> <div class="leader"> <div class="leader-num"><?php echo $count?></div> <div class="leader-name"><?php echo $data[0]; ?></div> <div class="leader-time"><?php echo gmdate("H:i:s", $data[1]) . substr(round(substr($data[1], strpos($data[1], '.')), 4), 1); ?></div> </div> <?php } $count++; } ?> </div> </div> <?php include("bottom.html"); ?> </div> </div> </body> </html><file_sep><!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Hangman Game</title> <link rel="stylesheet" href="../css/format.css" /> <link rel="icon" href="../assets/Logo.png" type="image/x-icon" /> </head> <body class="background"> <?php include("top.php"); include("organize-leaderboard.php"); ?> <div class="gamespace"> <div class="pdisplay"> <div class="playlevels"> <?php echo "<p>You won! Congrats! Welcome to the club, " . $_COOKIE["name"] . "!</p>"; ?> <?php echo "<br><p>This is your time: " . gmdate("H:i:s", $_COOKIE["time_elapsed"]) . substr(round(substr($_COOKIE["time_elapsed"], strpos($_COOKIE["time_elapsed"], '.')), 4), 1) . "<p>"; ?> </div> <div class="gameplay-sel"> <a href="./play.php"><button class="button level btn"> Play Again </button></a> <a href="./leaderboard.php"><button class="button level btn"> Leaderboard </button></a> </div> </div> </div> <?php include("bottom.html"); ?> </body> </html><file_sep><?php if (!empty($_COOKIE['name'])) { $fileName = ""; if($_COOKIE['difficulty'] == 'Beginner') { $fileName = "../textfile/leaderboard-beginner.txt"; } else if($_COOKIE['difficulty'] == 'Intermediate') { $fileName = "../textfile/leaderboard-intermediate.txt"; } else if($_COOKIE['difficulty'] == 'Expert') { $fileName = "../textfile/leaderboard-expert.txt"; } else if($_COOKIE['difficulty'] == 'Master') { $fileName = "../textfile/leaderboard-master.txt"; } if(file_exists($fileName)) { chmod($fileName, 0777); } else { $file = fopen($fileName, "w"); fclose($file); chmod($fileName, 0777); } $line = $_COOKIE['name'] . "|" . $_COOKIE['time_elapsed'] . PHP_EOL; file_put_contents($fileName, $line, FILE_APPEND); shell_exec("sort -t'|' -nk2 $fileName | head -10 > ../textfile/test.out"); shell_exec("mv ../textfile/test.out $fileName"); chmod($fileName, 0777); } header("Location:./congrats.php"); die(); <file_sep><?php if (isset($_POST['guess'])) { $data = strtoupper($_POST['guess']); $word = strtoupper($_COOKIE['word']); $wrong = $_COOKIE['wrong']; $repeat = false; if($data != '') { if (isset($_COOKIE['history'])) { $history = json_decode($_COOKIE['history'], true); //gets contents of history cookies and converts it to an array. } else { $history = array(); //if no history, creates empty array. } if (strlen($data) == 1) { if (!in_array($data, $history)) { // if data not found in history $history[] = $data; //adds the latest guess to the end of the history array. setcookie("history", json_encode($history)); //sets the cookie $display = $_COOKIE['display']; $found = false; for ($i = 0; $i < strlen($word); $i++) { if ($data == $word[$i]) { $display[$i] = $data; setcookie("display", $display); $found = true; } } if($display == $word) { setcookie("time_elapsed", microtime(true) - $_COOKIE['start']); //redirect to congrats page header("Location: ./leaderboard-submit.php"); die(); } if(!$found) { $wrong++; if($wrong > 6) { header("Location:./gameover.php"); die(); } setcookie("wrong", $wrong); } } else { $repeat = true; //repeat is to notify user "You've guessed this letter" ; not in use yet. } } else { if($data == $word) { //end timer setcookie("time_elapsed", microtime(true) - $_COOKIE['start']); //redirect to congrats page header("Location: ./leaderboard-submit.php"); die(); } else { $wrong++; if($wrong > 6) { header("Location: ./gameover.php"); die(); } setcookie("wrong", $wrong); } } } } else { //runs when its a new game //deleting cookies setcookie("word", false); setcookie("hint", false); setcookie("display", false); setcookie("theme", false); setcookie("history", false); setcookie("wrong", false); setcookie("start", false); setcookie("time_elapsed", false); /* random word and hint generated from text file */ $theme = $_GET['theme']; if($theme == "marvel") { $rand = '../textfile/marvel.txt'; setcookie('difficulty', 'Beginner'); } else if ($theme == "starwar") { $rand = '../textfile/star-wars.txt'; setcookie('difficulty', 'Intermediate'); } else if ($theme == "anime") { $rand = '../textfile/anime-cartoon.txt'; setcookie('difficulty', 'Expert'); } else if ($theme == "mashup") { $rand = '../textfile/mashup.txt'; setcookie('difficulty', 'Master'); } else { $rand = "../textfile/star-wars.txt"; setcookie('difficulty', 'Beginner'); $theme = "wrong"; // header("Location:./play.php"); // die(); } $fop = fopen($rand, 'a+'); $f_contents = file($rand); $info = $f_contents[rand(0, count($f_contents) - 1)]; $line = explode("|", $info); $word = $line[0]; $hint = $line[1]; $pattern = '/[A-Za-z]/'; $display = preg_replace($pattern, '_', $word); setcookie("word", $word); setcookie("hint", $hint); setcookie("display", $display); setcookie("theme", $theme); setcookie("wrong", 0); //start timer code setcookie("start", microtime(true)); } if($repeat) { setcookie("repeat", "true"); setcookie("lastGuess", $data); } else { setcookie("repeat", false); setcookie("lastGuess", false); } header("Location:./maingame.php"); die(); <file_sep><!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Hangman Game</title> <link rel="stylesheet" href="../css/format.css" /> <link rel="icon" href="../assets/Logo.png" type="image/x-icon" /> </head> <body class="background"> <?php include("top.php"); ?> <div class="summary"> <br> <br> <h1>Team Animimaniacs </h1> <p>This version of Hangman incorporates hints and has three different levels of play.</p> </div> <div class="gamespace"> <div class="row"> <div class="column"> <h1><NAME></h1> <ul> <li>Programmer</li> <li>Developed main game page</li> <li>Created pictures for hangman themes</li> <li>Connected all the pages together</li> <li>Worked on UI/UX for pages</li> <li>Backend development for the gameplay</li> </ul> <br> <br> <br> <h1><NAME></h1> <ul> <li>Programmer</li> <li>Log In Forms</li> <li>Game Header/Footer</li> <li>Created UML</li> <li>Generated Logo</li> </ul> <br> <br> <br> </div> <div class="column"> <h1><NAME></h1> <ul> <li>Programmer</li> <li>Created leaderboard page</li> <li>Updated contents of leaderboard page</li> <li>Sorted contents of leaderboard page</li> <li>CSS for Leaderboard</li> </ul> <br> <br> <br> <h1><NAME><br>(Project Leader)</h1> <ul> <li>Template for buttons</li> <li>CSS Animations/Transitions</li> <li>Word/Phrase Generator</li> <li>Template for Hint/Rule Pop-ups</li> <li>Timer</li> <li>Text file game information</li> </ul> </div> </div> </div> <?php include("bottom.html"); ?> </body> </html> <file_sep><!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Hangman Game</title> <link rel="stylesheet" href="../css/format.css" /> <link rel="icon" href="../assets/Logo.png" type="image/x-icon" /> </head> <body class="background"> <?php include("top.php"); ?> <div class="gamespace"> <div class="tdisplay"> <a href="./play.php" class="button level btn"> PLAY </a> <a class=" button level btn" href="#popup">RULES</a> <div id="popup" class="overlay1"> <div class="popup popup1"> <div class="alignRight"> <a class="close" href="#">&times;</a> </div> <h2>Rules for Hangman:</h2> <div class="rules"> <ul> <li> You (the player) will try to guess a letter or word to fill<br>in the blank. </li> <li> With each correct letter, the dashes will start filling in. </li> <li> Each wrong letter or word is guessed, a piece of the figure<br>is placed on the gallows. </li> <li> Win by filling in the whole word before the stick figure is<br>drawn out! </li> <li> Fastest time will be placed on the leader board. </li> </ul> </div> </div> </div> <a href="./leaderboard.php" class="button level btn"> LEADERBOARD </a> <a href="./credits.php" class="button level btn"> CREDITS </a> </div> </div> <?php include("bottom.html"); ?> </body> </html><file_sep><!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Hangman Game</title> <link rel="stylesheet" href="../css/format.css" /> </head> <body class="background"> <?php include("top.php"); ?> <div class="gamespace"> <div class="gamelayout"> <form action="cookie-submit.php" method="post"> <fieldset> <legend> Enter Username: </legend> <label class="loginColumn"> Name: </label> <input type="text" name="name" maxlength="16"><br><br> <input type="submit" value="Start The Game"> </fieldset> </form> </div> </div> <?php include("bottom.html"); ?> </body> </html> <file_sep><?php if(!empty($_POST["name"])) { setcookie ("name",$_POST["name"]); header("Location: play.php"); die(); //add game php here }else{ setcookie ("name", false); setcookie ("score", false); setcookie ("difficulty", false); header("Location: login.php"); die(); }//For refrence how to change score //setcookie ("score",$_COOKIE["score"]-5,time()+ 8700); ?>
059f4616f9cf931e26e8a4ebe477e087db6973fb
[ "Markdown", "PHP" ]
14
PHP
lornahokoth/webdevproject2
fbe1418a4a0e631abde254a478d5b8a72fe253de
f34b70072205432e771c1ad8397b680bb53594f9
refs/heads/master
<file_sep># A função abaixo recebe uma frase(string) como parâmetro e devolve um string com as letras maiúsculas que exitem nesta frase, na ordem em que elas aparecem. def maiusculas(frase): tamanho_frase = len(frase) - 1 i = 0 so_maiuscula = "" while i <= tamanho_frase: ord_caracter = ord(frase[i]) if ord_caracter >= 65 and ord_caracter <= 90: so_maiuscula = so_maiuscula + frase[i] i += 1 return so_maiuscula<file_sep>entradaSegundos = int(input("Por favor, entre com o número de segundos que deseja converter:")) dias = entradaSegundos // (24 * 3600) restoDias = entradaSegundos % (24 * 3600) horas = restoDias // 3600 restoHoras = restoDias % 3600 minutos = restoHoras // 60 segundos = restoHoras % 60 print(dias, "dias,", horas,"horas,", minutos, "minutos e", segundos, "segundos.") <file_sep>import re def sum_number_doc(): total_sum = 0 list_num = [] handle = open("texts/regex_sum_38460.txt") for line in handle: list_num.extend(re.findall("[0-9]+", line)) for i in list_num: total_sum += int(i) return total_sum print(sum_number_doc()) <file_sep>def change(n, coin_array): if n == 0: return 0 best = - 1 for coin in coin_array: if coin <= n: next_try = change(n - coin, coin_array) if best < 0 or best > next_try + 1: best = next_try + 1 return best<file_sep># Uses python3 import sys def get_change(m): cont_coins = 0 cont_coins += (m // 10) m = m % 10 cont_coins += (m // 5) m = m % 5 cont_coins += (m // 1) return cont_coins if __name__ == '__main__': m = int(sys.stdin.read()) print(get_change(m)) <file_sep># coursera_courses Activities developed in coursera courses <file_sep>def lcs(s1, s2, x = None, y = None): if x == None: x = len(s1) - 1 y = len(s2) - 1 if x == - 1 or y == -1: return 0 else: if s1[x] == s2[y]: return 1 + lcs(s1, s2, x - 1, y - 1) else: return max(lcs(s1,s2,x - 1, y), lcs(s1, s2, x, y - 1))<file_sep>def fatorial(n): fatorial = 1 while n > 1: fatorial = fatorial * n n = n - 1 return fatorial n = int(input("Digite o valor de n: ")) k = int(input("Digite o valor de k: ")) coeficiente_binominal = (fatorial(n)) / (fatorial(k) * fatorial(n - k)) print("O coediciente binominal é:", coeficiente_binominal) <file_sep># Uses python3 def evalt(a, b, op): if op == '+': return a + b elif op == '-': return a - b elif op == '*': return a * b else: assert False def get_maximum_value(dataset): return dataset if __name__ == "__main__": print(get_maximum_value(input())) <file_sep>def maior_elemento(lista): maior_elemento = lista[0] for elemento in lista: if elemento > maior_elemento: maior_elemento = elemento return maior_elemento <file_sep># Uses python3 n = int(input()) a = [int(x) for x in input().split()] assert(len(a) == n) first_largest = 0 second_largest = 0 position_first = 0 for i in range(len(a)): if a[i] > first_largest: first_largest = a[i] position_first = i for i in range(len(a)): if a[i] > second_largest and i != position_first: second_largest = a[i] print(first_largest * second_largest) <file_sep>def dimensoes(matriz): num_linhas = len(matriz) num_colunas = len(matriz[0]) print(str(num_linhas) + "X" + str(num_colunas)) <file_sep># Uses python3 def fibonacci_last_digit(n): list_fibonacci = list(range(n + 2)) list_fibonacci[0] = 0 list_fibonacci[1] = 1 for i in range(2,n + 1): list_fibonacci[i] = (list_fibonacci[i - 1] + list_fibonacci[i - 2]) % 10 return list_fibonacci[n] % 10 if __name__ == '__main__': n = int(input()) print(fibonacci_last_digit(n)) <file_sep>import math class Triangulo: def __init__(self, a, b, c): self.a = a self.b = b self.c = c def perimetro(self): return self.a + self.b + self.c def tipo_lado(self): if self.a == self.b and self.b == self.c: return "equilátero" else: if self.a != self.b and self.a != self.c and self.b != self.c: return "escaleno" else: return "isósceles" def retangulo(self): a = self.a b = self.b c = self.c if a == math.sqrt(b ** 2 + c ** 2): return True else: if b == math.sqrt(a ** 2 + c ** 2): return True else: if c == math.sqrt(a ** 2 + b ** 2): return True else: return False <file_sep>def sao_multiplicaveis(m1, m2): num_linhas_m2 = len(m2) num_colunas_m1 = len(m1[0]) if num_colunas_m1 == num_linhas_m2: return True else: return False<file_sep># python3 import heapq class JobQueue: def read_data(self): self.num_workers, m = map(int, input().split()) self.jobs = list(map(int, input().split())) assert m == len(self.jobs) def write_response(self): for i in range(len(self.jobs)): print(self.assigned_workers[i], self.start_times[i]) def assign_jobs(self): # TODO: replace this code with a faster algorithm. self.assigned_workers = [None] * len(self.jobs) self.start_times = [None] * len(self.jobs) times_workers = [(0,w) for w in range(self.num_workers)] heapq.heapify(times_workers) for i in range(len(self.jobs)): (self.start_times[i], self.assigned_workers[i]) = heapq.heappop(times_workers) heapq.heappush(times_workers, (self.start_times[i] + self.jobs[i], self.assigned_workers[i])) def solve(self): self.read_data() self.assign_jobs() self.write_response() if __name__ == '__main__': job_queue = JobQueue() job_queue.solve() <file_sep>valor = int(input("Digite um número inteiro: ")) if valor == 2 or valor == 3 or valor == 5 or valor == 7: print("primo") else: if (valor % 2 == 0 or valor % 3 == 0 or valor % 5 == 0 or valor % 7 == 0): print("não primo") else: print("primo") <file_sep>def max_funcao(valor1, valor2, restricao1_quantidade, restricao2_quantidade, tempo1, tempo2, restricao_tempo): lucro_maximo = 0 receita = 0 produto1 = 0 produto2 = 0 q1_max = 0 q2_max = 0 while produto1 <= restricao1_quantidade: while produto2 <= restricao2_quantidade: if tempo1 * produto1 + tempo2 * produto2 <= restricao_tempo: receita = produto1 * valor1 + produto2 * valor2 if receita > lucro_maximo: lucro_maximo = receita q1_max = produto1 q2_max = produto2 produto2 += 1 produto2 = 0 produto1 +=1 return lucro_maximo, q1_max, q2_max <file_sep>a = int(input("Digite o primeiro numero: ")) b = int(input("Digite o segundo numero: ")) c = int(input("Digite o último numero: ")) if a < b < c: print("crescente") else: print("não está em ordem crescente") <file_sep>def fizzbuzz(valor): if (valor % 3 == 0) and not(valor % 5 == 0): return "Fizz" else: if (valor % 5 == 0) and not(valor % 3 == 0): return "Buzz" else: if (valor % 3 == 0) and (valor % 5 == 0): return "FizzBuzz" else: return valor <file_sep>def imprime_retangulo_oco(): largura = int(input("digite a largura: ")) altura = int(input("digite a altura: ")) cont_altura = 1 cont_largura = 1 while cont_altura <= altura: if cont_altura == 1 or cont_altura == altura: while cont_largura <= largura: print("#", end = "" ) cont_largura = cont_largura + 1 else: print("#", end = "") while cont_largura < largura - 1 : print(end = " ") cont_largura = cont_largura + 1 print("#", end = "") print() cont_largura = 1 cont_altura = cont_altura + 1 imprime_retangulo_oco() <file_sep>class Node: def __init__(self, key, parent_node = None): self.left = None self.right = None self.height = 0 self.key = key self.parent = parent_node o = Node(8) o.left = Node(6, o) o.left.right = Node(7, o.left) node = o.left r = node.right p = node.parent r.parent = p p.left = r r.left = node node.parent = r node.right = None del node node = o l = node.left p = node.parent if p == None: l.parent = None l.right = node node.parent = l node.left = None del node else: l.parent = p p.right = l l.right = node node.parent = l node.left = None del node print(o.key) <file_sep># Uses python3 import sys def fibonacci_partial_sum(m, n): n1 = 0 n2 = 1 last_fibonacci = 0 if m < 2: sum_last_digit = 1 else: sum_last_digit = 0 len_max = n + 1 for i in range(2, len_max): last_fibonacci = (n2 + n1) % 10 n1, n2 = n2, last_fibonacci if i >= m: sum_last_digit += last_fibonacci return sum_last_digit % 10 if __name__ == '__main__': input = sys.stdin.read(); m, n = map(int, input.split()) print(fibonacci_partial_sum(m, n)) <file_sep># Class for construct the nodes of the tree. (Subtrees) class Node: def __init__(self, key, parent_node = None): self.left = None self.right = None self.height = 0 self.key = key self.parent = parent_node # Class with the structure of the AVL tree. class Tree: def __init__(self): self.root = None # Insert a sigle element and rebalance the tree def avl_insert(self, x): self.insert(x) node = self.find(x) self._rebalance(node) # Insert a single element def insert(self, x): if(self.root == None): self.root = Node(x) else: self._insert(x, self.root) def _insert(self, x, node): if(x < node.key): if(node.left == None): node.left = Node(x, node) else: self._insert(x, node.left) else: if(node.right == None): node.right = Node(x, node) else: self._insert(x, node.right) # Rebalance the tree def _rebalance(self, node): p = node.parent if (node.left and node.right) != None: if node.left.height > node.right.height + 1: self._rebalance_right(node) if node.right.height > node.left.height + 1: self._rebalance_left(node) elif node.right == None and node.left != None: if node.left.height >= 2: self._rebalance_right(node) elif node.left == None and node.right != None: if node.right.height >= 2: self._rebalance_left(node) self._adjust_height(node) if p != None: self._rebalance(p) # Adjust the height of the node def _adjust_height(self, node): if (node.left and node.right) != None: node.height = 1 + max(node.left.height, node.right.height) elif node.right == None and node.left != None: node.height = 1 + node.left.height elif node.left == None and node.right != None: node.height = 1 + node.right.height else: node.height = 1 def _rebalance_right(self, node): l = node.left if (l.left and l.right) != None: if l.right.height > l.left.height: self._rotate_left(l) elif l.left == None and l.right != None: if l.right.height > 0: self._rotate_left(l) self._rotate_right(node) def _rebalance_left(self, node): r = node.right if (r.right and r.left) != None: if r.left.height > r.right.height: self._rotate_right(r) elif r.right == None and r.left != None: if r.left.height > 0: self._rotate_right(r) self._rotate_left(node) def _rotate_right(self, node): l = node.left p = node.parent lr = l.right l.parent = p if p != None: if p.key <= l.key: p.right = l else: p.left = l if lr != None: lr.parent = node node.left = lr l.right = node node.parent = l del node else: p = self.root if lr != None: lr.parent = node p.left = lr l.right = node node.parent = l self.root = l del node self._adjust_height(l.right) self._adjust_height(l) def _rotate_left(self, node): r = node.right p = node.parent rl = r.left r.parent = p if p != None: if p.key > r.key: p.left = r else: p.right = r if rl != None: rl.parent = node node.right = rl r.left = node node.parent = r del node else: p = self.root if rl != None: rl.parent = node p.right = rl r.left = p node.parent = r self.root = r del node self._adjust_height(r.left) self._adjust_height(r) # Given a element, return a node in the tree with key x. def find(self, x): if(self.root == None): return None else: return self._find(x, self.root) def _find(self, x, node): if(x == node.key): return node elif(x < node.key): if(node.left == None): return None else: return self._find(x, node.left) elif(x > node.key): if(node.right == None): return None else: return self._find(x, node.right) # Given a node, return the node in the tree with the next largest element. def next(self, node): if node.right != None: return self._left_descendant(node.right) else: return self._right_ancestor(node) def _left_descendant(self, node): if node.left == None: return node else: return self._left_descendant(node.left) def _right_ancestor(self, node): if node.key <= node.parent.key: return node.parent else: return self._right_ancestor(node.parent) # Delete an element and rebalance the tree def avl_delete(self, x): node = self.find(x) if node.parent != None: p = node.parent self.delete(x) if node.parent == None: p = self.root self._rebalance(p) # Delete an element of the tree def delete(self, x): node = self.find(x) if node == None: print(x, "isn't in the tree") else: if node.right == None: if node.left == None: if node.key < node.parent.key: node.parent.left = None else: node.parent.right = None else: if node.key < node.parent.key: if node.left != None: node.left.parent = node.parent node.parent.left = node.left else: if node.left != None: node.left.parent = node.parent node.parent.right = node.left else: x = self.next(node) node.key = x.key if x.key < x.parent.key: if x.right != None: x.right.parent = x.parent x.parent.left = x.right else: if x.right != None: x.right.parent = x.parent x.parent.right = x.right # tests t = Tree() t.avl_insert(15) t.avl_insert(9) t.avl_insert(8) t.avl_insert(25) t.avl_insert(26) t.avl_insert(32) t.avl_insert(2) t.avl_insert(7) print(t.find(26).right.key) <file_sep>def soma_elementos(lista): soma = 0 for x in lista: soma = x + soma return soma <file_sep>#A função abaixo recebe uma lista de strings como parâmetro e devolve o primeiro string na ordem lexicográfica. def primeiro_lex(lista_palavras): primeiro = lista_palavras[0] for i in lista_palavras: if i < primeiro: primeiro = i return primeiro <file_sep># A função abaixo recebe uma lista de nomes como parâmetros e devolve o primeiro nome mais curto da presente na lista, de forma capitalizada. def menor_nome(lista_de_nomes): menor_nome = lista_de_nomes[0].strip() for i in lista_de_nomes: nome_atual = i.strip() if len(nome_atual) < len(menor_nome): menor_nome = nome_atual return menor_nome.capitalize() <file_sep># python3 def read_input(): return (input().rstrip(), input().rstrip()) def print_occurrences(output): print(' '.join(map(str, output))) def get_occurrences(pattern, text): d = 8933 q = 988 positions = [] m = len(pattern) n = len(text) h = pow(d,m-1) % q p = 0 t = 0 for i in range(m): p = (d * p+ord(pattern[i])) % q t = (d * t+ord(text[i])) % q for s in range(n - m + 1): if p == t: match = True for i in range(m): if pattern[i] != text[s + i]: match = False break if match: positions.append(s) if s < n-m: t = (t - h * ord(text[s])) % q t = (t * d + ord(text[s + m])) % q t = (t + q) % q return positions if __name__ == '__main__': print_occurrences(get_occurrences(*read_input())) <file_sep>def incomodam(n): if n <= 0: return "" else: return "incomodam " + incomodam(n - 1) def elefantes(n, i = int(1)): if i == n or n < 1: return "" else: if i > 1: j = i + 1 str_j = str(j) str_i = str(i) return str_i + " elefantes " + incomodam(i) + "muita gente "\ + str_j + " elefantes " + incomodam(j) + "muito mais "\ + elefantes(n, i + 1) else: j = i + 1 str_j = str(j) str_i = str(i) return "Um elefante incomoda muita gente " + str_j + " elefantes " + incomodam(j) + "muito mais " + elefantes(n, i + 1) <file_sep>numero = int(input("Digite um número inteiro: ")) comparador_ant = numero % 10 existem_adjacentes_iguais = False while numero // 10 != 0 and not existem_adjacentes_iguais: numero = numero // 10 comparador_pos = numero % 10 if comparador_ant == comparador_pos: existem_adjacentes_iguais = True comparador_ant = comparador_pos if existem_adjacentes_iguais: print("sim") else: print("não") <file_sep>def main(): n = int(input("Digite o valor de n(negativo para finalizar): ")) while n >= 0: print(fatorial(n)) n = int(input("Digite o valor de n(negativo para finalizar: ")) def fatorial(n): fatorial = 1 while n > 1: fatorial = fatorial * n n = n - 1 return fatorial <file_sep>import math import re def le_assinatura(): #A funcao le os valores dos tracos linguisticos do modelo e devolve uma assinatura a ser comparada com os textos fornecidos print("Bem-vindo ao detector automático de COH-PIAH.") wal = float(input("Entre o tamanho medio de palavra:")) ttr = float(input("Entre a relação Type-Token:")) hlr = float(input("Entre a Razão Hapax Legomana:")) sal = float(input("Entre o tamanho médio de sentença:")) sac = float(input("Entre a complexidade média da sentença:")) pal = float(input("Entre o tamanho medio de frase:")) return [wal, ttr, hlr, sal, sac, pal] def le_textos(): i = 1 textos = [] texto = input("Digite o texto " + str(i) +" (aperte enter para sair):") while texto: textos.append(texto) i += 1 texto = input("Digite o texto " + str(i) +" (aperte enter para sair):") return textos def separa_sentencas(texto): '''A funcao recebe um texto e devolve uma lista das sentencas dentro do texto''' sentencas = re.split(r'[.!?]+', texto) if sentencas[-1] == '': del sentencas[-1] return sentencas def separa_frases(sentenca): '''A funcao recebe uma sentenca e devolve uma lista das frases dentro da sentenca''' return re.split(r'[,:;]+', sentenca) def separa_palavras(frase): '''A funcao recebe uma frase e devolve uma lista das palavras dentro da frase''' return frase.split() def n_palavras_unicas(lista_palavras): '''Essa funcao recebe uma lista de palavras e devolve o numero de palavras que aparecem uma unica vez''' freq = dict() unicas = 0 for palavra in lista_palavras: p = palavra.lower() if p in freq: if freq[p] == 1: unicas -= 1 freq[p] += 1 else: freq[p] = 1 unicas += 1 return unicas def n_palavras_diferentes(lista_palavras): '''Essa funcao recebe uma lista de palavras e devolve o numero de palavras diferentes utilizadas''' freq = dict() for palavra in lista_palavras: p = palavra.lower() if p in freq: freq[p] += 1 else: freq[p] = 1 return len(freq) def compara_assinatura(as_a, as_b): '''IMPLEMENTAR. Essa funcao recebe duas assinaturas de texto e deve devolver o grau de similaridade nas assinaturas.''' cont = 0 grau_similaridade = 0 while cont < 6: grau_similaridade = math.sqrt((as_a[cont] - as_b[cont]) ** 2) + grau_similaridade cont = cont + 1 grau_similaridade = grau_similaridade / 6 return grau_similaridade def calcula_assinatura(texto): '''IMPLEMENTAR. Essa funcao recebe um texto e deve devolver a assinatura do texto.''' wal = tamanho_medio_palavra(texto) ttr = type_token(texto) hlr = razao_hapax_legomana(texto) sal = tamanho_medio_sentenca(texto) sac = complexidade_media_sentenca(texto) pal = tamanho_medio_frase(texto) return [wal, ttr, hlr, sal, sac, pal] def avalia_textos(textos, ass_cp): '''IMPLEMENTAR. Essa funcao recebe uma lista de textos e deve devolver o numero (1 a n) do texto com maior probabilidade de ter sido infectado por COH-PIAH.''' assinatura_aux = [] grau_similaridade = 0 cont = 1 possivel_plagio = 1000000 autor = 0 for i in textos: assinatura_aux = calcula_assinatura(i) grau_similaridade = compara_assinatura(ass_cp, assinatura_aux) if grau_similaridade < possivel_plagio: possivel_plagio = grau_similaridade autor = cont cont = cont + 1 print("\n""O autor do texto", autor, "está infectado com o COH-PIAH") return autor def tamanho_medio_palavra(texto): lista_sentencas = separa_sentencas(texto) lista_frases = [] for i in lista_sentencas: lista_frases = separa_frases(i) + lista_frases lista_palavras = [] for n in lista_frases: lista_palavras = separa_palavras(n) + lista_palavras quantidade_palavras = len(lista_palavras) soma_caracteres = 0 for j in lista_palavras: soma_caracteres = len(j) + soma_caracteres return soma_caracteres / quantidade_palavras def type_token(texto): lista_sentencas = separa_sentencas(texto) lista_frases = [] for i in lista_sentencas: lista_frases = separa_frases(i) + lista_frases lista_palavras = [] for n in lista_frases: lista_palavras = separa_palavras(n) + lista_palavras quantidade_palavras = len(lista_palavras) numero_palavras_diferentes = n_palavras_diferentes(lista_palavras) return numero_palavras_diferentes / quantidade_palavras def razao_hapax_legomana(texto): lista_sentencas = separa_sentencas(texto) lista_frases = [] for i in lista_sentencas: lista_frases = separa_frases(i) + lista_frases lista_palavras = [] for n in lista_frases: lista_palavras = separa_palavras(n) + lista_palavras quantidade_palavras = len(lista_palavras) numero_palavras_unicas = n_palavras_unicas(lista_palavras) return numero_palavras_unicas / quantidade_palavras def tamanho_medio_sentenca(texto): lista_sentencas = separa_sentencas(texto) quantidade_sentencas = len(lista_sentencas) soma_caracteres = 0 for i in lista_sentencas: soma_caracteres = len(i) + soma_caracteres return soma_caracteres / quantidade_sentencas def complexidade_media_sentenca(texto): lista_sentencas = separa_sentencas(texto) lista_frases = [] for i in lista_sentencas: lista_frases = separa_frases(i) + lista_frases quantidade_sentencas = len(lista_sentencas) quantidade_frases = len(lista_frases) return quantidade_frases / quantidade_sentencas def tamanho_medio_frase(texto): lista_sentencas = separa_sentencas(texto) lista_frases = [] for i in lista_sentencas: lista_frases = separa_frases(i) + lista_frases quantidade_frases = len(lista_frases) soma_caracteres = 0 for i in lista_frases: soma_caracteres = len(i) + soma_caracteres return soma_caracteres / quantidade_frases def main(): assinatura_modelo = le_assinatura() lista_de_textos = le_textos() avalia_textos(lista_de_textos, assinatura_modelo) main() <file_sep>def lista_grande(n): from random import randrange lista = [] for i in range(n): lista.append(randrange(n)) return lista <file_sep># Uses python3 import sys def get_optimal_value(capacity, weights, values): value = 0 len_weights = len(weights) max_value = 0 value_per_weights = 0 product = 0 i = 1 while i <= len_weights and capacity > 0: for k in range(len_weights): value_per_weights = values[k] / weights[k] if value_per_weights > max_value: max_value = value_per_weights product = k if weights[product] < capacity: value += max_value * weights[product] capacity -= weights[product] else: value += max_value * capacity capacity = 0 values[product] = 0 max_value = 0 i += 1 return value if __name__ == "__main__": data = list(map(int, sys.stdin.read().split())) n, capacity = data[0:2] values = data[2:(2 * n + 2):2] weights = data[3:(2 * n + 2):2] opt_value = get_optimal_value(capacity, weights, values) print("{:.4f}".format(opt_value)) <file_sep>#Uses python3 import sys def largest_number(a): res = "" max_digit = 0 while len(a) > 0: for i in a: if int(i[0]) >= max_digit: max_digit = int(i) res = res + str(max_digit) a.remove(str(max_digit)) max_digit = 0 return res if __name__ == '__main__': input = sys.stdin.read() data = input.split() a = data[1:] print(largest_number(a)) <file_sep>def ordena(lista): for i in range(len(lista)): for j in range(i,len(lista)): if lista[i] > lista[j]: lista[i], lista[j] = lista[j], lista[i] return lista <file_sep>import urllib.request, urllib.parse, urllib.error from bs4 import BeautifulSoup import ssl def sum_number_url(url): # Ignore SSL certificate errors ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE html = urllib.request.urlopen(url, context = ctx).read() soup = BeautifulSoup(html, 'html.parser') total_sum = 0 span_tags = soup('span') for num in span_tags: total_sum += int(num.contents[0]) return total_sum if __name__ == '__main__': url = input('Enter - ') print(sum_number_url(url)) <file_sep>import math def soma_hipotenusas(n): cont = 1 soma_h = 0 while cont <= n: if e_hipotenusa(cont) == True: soma_h = soma_h + cont cont = cont + 1 return soma_h def e_hipotenusa(h): cateto_1 = 1 cateto_2 = 1 achou_hipotenusa = False while cateto_1 <= h and achou_hipotenusa == False: while cateto_2 <= h and achou_hipotenusa == False: hipotenusa = math.sqrt(cateto_1 ** 2 + cateto_2 ** 2) if hipotenusa == h: achou_hipotenusa = True cateto_2 = cateto_2 + 1 cateto_1 = cateto_1 + 1 cateto_2 = 1 return achou_hipotenusa def test_e_hipotenusa(): assert e_hipotenusa(5) == True assert e_hipotenusa(10) == True assert e_hipotenusa(13) == True assert e_hipotenusa(15) == True assert e_hipotenusa(17) == True assert e_hipotenusa(20) == True assert e_hipotenusa(25) == True assert e_hipotenusa(4) == False assert e_hipotenusa(16) == False assert e_hipotenusa(24) == False <file_sep>def n_primos(x): cont = 1 cont_primo = 0 while cont <= x: if e_primo(cont) == True: cont_primo = cont_primo + 1 cont = cont + 1 return cont_primo def e_primo(valor): fator = 2 while valor % fator != 0 and fator <= valor / 2: fator = fator + 1 if valor % fator == 0: return False else: return True def test_e_primo(): assert e_primo(3) == True assert e_primo(5) == True assert e_primo(7) == True assert e_primo(39) == False assert e_primo(21) == False assert e_primo(25) == False assert e_primo(49) == False <file_sep>def min_funcao(valor1, valor2, restricao1_quantidade, restricao2_quantidade, tempo1, tempo2, restricao_tempo): custo_minimo = produto1 * valor1 + produto2 * valor2 receita = 0 produto1 = 0 produto2 = 0 q1_min = 0 q2_min = 0 while produto1 <= restricao1_quantidade: while produto2 <= restricao2_quantidade: if tempo1 * produto1 + tempo2 * produto2 <= restricao_tempo: receita = produto1 * valor1 + produto2 * valor2 if receita < custo_minimo: custo_minimo = receita q1_min = produto1 q2_min = produto2 produto2 += 1 produto2 = 0 produto1 +=1 return custo_minimo, q1_min, q2_min <file_sep>def soma_lista(lista, n = 0): if n == len(lista) - 1: return lista[n] else: return lista[n] + soma_lista(lista, n + 1)<file_sep># Uses python3 def cria_matriz(num_linhas, num_colunas, valor): matriz = [] for i in range(num_linhas): linha= [] for j in range(num_colunas): linha.append(valor) matriz.append(linha) return matriz def edit_distance(a , b): d = cria_matriz(len(a) + 1, len(b) + 1, 1) for k in range(len(a) + 1): d[k][0] = k for z in range(len(b) + 1): d[0][z] = z for j in range(1, len(b) + 1): for i in range(1, len(a) + 1): insertion = d[i][j - 1] + 1 deletion = d[i - 1][j] + 1 match = d[i - 1][j - 1] mismatch = d[i - 1][j - 1] + 1 if a[i - 1] == b[j - 1]: d[i][j] = min(insertion, deletion, match) else: d[i][j] = min(insertion, deletion, mismatch) return d[len(a)][len(b)] if __name__ == "__main__": print(edit_distance(input(), input())) <file_sep>import random import time import ordenador class ContaTempos: def lista_aleatoria(self, n): lista = [0 for x in range(n)] for i in range(n): lista[i] = random.randrange(1000) return lista def lista_quase_ordenada(self, n): lista = [x for x in range(n)] lista[n//10] = - 500 return lista def compara (self, n): lista1 = self.lista_aleatoria(n) lista2 = lista1[:] o = ordenador.Ordenador() antes = time.time() o.bubble_sort(lista1) depois = time.time() print("Método bubble_sort demorou:", depois - antes) antes = time.time() o.selection_sort(lista2) depois = time.time() print("Método selection_sort demorou:", depois - antes) <file_sep>def min_max(temperatura): print("A menor temperatura mínima do mês foi: ", minima(temperatura), "C.") print("A menor temperatura maxima do mês foi: ", maxima(temperatura), "C.") def minima(temps): min = temps[0] i = 0 while i < len(temps): if temps[i] < min: min = temps[i] i += 1 return min def maxima(temps): max = temps[0] i = 0 while i < len(temps): if temps[i] > max: max = temps[i] i += 1 return max <file_sep>numero = int(input("Digite um número inteiro: ")) if (numero % 5 or numero % 3) == 0: print("FizzBuzz") else: print(numero) <file_sep># A função abaixo recebe como parâmetro uma string contendo uma frase e como segundo parâmetro uma outra string opcional com valor padrão sendo "vogais". Quando o segundo parâmetro for definido como "vogais", a função devolve o número de vogais presente na frase, quando for definido como "consoantes", develve o número de consoantes na frase. def conta_letras(frase, contar = "vogais"): assert contar == "vogais" or contar == "consoantes" tamanho_frase = len(frase) - 1 letra_atual = frase[0] i = 0 if contar == "vogais": cont_vogais = 0 while i <= tamanho_frase: letra_atual = frase[i].lower() if letra_atual == "a" or letra_atual == "e" or letra_atual == "i" or letra_atual == "o" or letra_atual == "u": cont_vogais += 1 i += 1 return cont_vogais else: cont_consoantes = 0 while i <= tamanho_frase: letra_atual = frase[i].lower() if letra_atual != "a" and letra_atual != "e" and letra_atual != "i" and letra_atual != "o" and letra_atual != "u" and letra_atual != " ": cont_consoantes += 1 i += 1 return cont_consoantes <file_sep>import math x1 = int(input("Digite o valor para x1: ")) y1 = int(input("Digite o valor para y1: ")) x2 = int(input("Digite o valor para x2: ")) y2 = int(input("Digite o valor para y2: ")) distancia = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2) if distancia >= 10: print("longe") else: print("perto") <file_sep># Uses python3 import sys def fibonacci_huge(n, m): x = n % len_pisano_period(n, m) return fibonacci(x) % m def len_pisano_period(n, m): pisano1 = 0 pisano2 = 1 last_pisano = 0 len_pisano = 2 n1 = 0 n2 = 1 if n == 0: last_fibonacci = 0 else: last_fibonacci = 1 i = 2 len_max = n * m ind = False while i <= len_max and ind == False: last_fibonacci = n2 + n1 n1 = n2 n2 = last_fibonacci last_pisano = last_fibonacci % m len_pisano += 1 if last_pisano == 1 and pisano2 == 0: ind = True len_pisano -= 2 pisano1 = pisano2 pisano2 = last_pisano i += 1 len_pisano += 1 return len_pisano def fibonacci(n): n1 = 0 n2 = 1 if n == 0: last_fibonacci = 0 else: last_fibonacci = 1 i = 2 while i <= n: last_fibonacci = n2 + n1 n1 = n2 n2 = last_fibonacci i += 1 return last_fibonacci if __name__ == '__main__': input = sys.stdin.read(); n, m = map(int, input.split()) print(fibonacci_huge(n, m)) <file_sep>#This is how to import another file import sys sys.path.insert(0, 'bubble_sort.py') sys.path.insert(0, 'classe_triangulo.py') from bubble_sort import bubble_sort from classe_triangulo import Triangulo l = bubble_sort([5,4,3,1]) print(l, '\n') k = Triangulo(1,1,1) s = k.perimetro() r = k.quadrado(1) print(s, r)<file_sep>def imprime_retangulo(): largura = int(input("digite a largura: ")) altura = int(input("digite a altura: ")) cont_altura = 1 cont_largura = 1 while cont_altura <= altura: while cont_largura <= largura: print("#", end = "" ) cont_largura = cont_largura + 1 print() cont_largura = 1 cont_altura = cont_altura + 1 imprime_retangulo() <file_sep># python3 from collections import deque class Query: def __init__(self, query): self.type = query[0] if self.type == 'check': self.ind = int(query[1]) else: self.s = query[1] class QueryProcessor: _multiplier = 263 _prime = 1000000007 def __init__(self, bucket_count): self.bucket_count = bucket_count # store all strings in one list self.elems = dict() self.responses = [] def _hash_func(self, s): ans = 0 for c in reversed(s): ans = (ans * self._multiplier + ord(c)) % self._prime return ans % self.bucket_count def write_responses(self): for i in self.responses: print(i) def read_query(self): return Query(input().split()) def process_query(self, query): if query.type == "add": hash_value = self._hash_func(query.s) if hash_value in self.elems: if query.s not in self.elems[hash_value]: self.elems[hash_value].appendleft(query.s) else: self.elems[hash_value] = deque([query.s]) elif query.type == "del": hash_value = self._hash_func(query.s) if hash_value in self.elems: if query.s in self.elems[hash_value]: self.elems[hash_value].remove(query.s) elif query.type == "find": hash_value = self._hash_func(query.s) if hash_value in self.elems: if query.s in self.elems[hash_value]: self.responses.append("yes") else: self.responses.append("no") else: self.responses.append("no") else: if query.ind in self.elems and len(self.elems[query.ind])> 0: response = self.elems[query.ind][0] for i in range(1,len(self.elems[query.ind])): response += " " + self.elems[query.ind][i] self.responses.append(response) else: self.responses.append("") def process_queries(self): n = int(input()) for i in range(n): self.process_query(self.read_query()) self.write_responses() if __name__ == '__main__': bucket_count = int(input()) proc = QueryProcessor(bucket_count) proc.process_queries() <file_sep># Uses python3 def brackets_match(s): len_s = len(s) bracket_array = [] for i in range(len_s): if s[i] == "(" or s[i] == "[" or s[i] == "{": bracket_array.append(s[i]) first = i + 1 if s[i] == ")" or s[i] == "]" or s[i] == "}": if len(bracket_array) == 0: return i + 1 top = bracket_array.pop() first -= 1 if (top == "[" and s[i] != "]") or (top == "(" and s[i] != ")") or (top == "{" and s[i] != "}"): return i + 1 if len(bracket_array) != 0: return first return "Success" if __name__ == '__main__': s = input() print(brackets_match(s))<file_sep>#Uses python3 import sys def insertion_sort(lista): lista_ordenada = [] for i in lista: lista_ordenada.append(i) j = len(lista_ordenada) - 1 lista_atual_ordenada = False while j > 0 and lista_atual_ordenada == False: if lista_ordenada[j] < lista_ordenada[j - 1]: lista_ordenada[j], lista_ordenada[j - 1] = lista_ordenada[j - 1], lista_ordenada[j] else: lista_atual_ordenada = True j -= 1 return lista_ordenada def max_dot_product(a, b): a = insertion_sort(a) b = insertion_sort(b) res = 0 for i in range(len(a)): res += a[i] * b[i] return res if __name__ == '__main__': input = sys.stdin.read() data = list(map(int, input.split())) n = data[0] a = data[1:(n + 1)] b = data[(n + 1):] print(max_dot_product(a, b)) <file_sep># Uses python3 def fibonacci(n): n1 = 0 n2 = 1 if n == 0: last_fibonacci = 0 else: last_fibonacci = 1 i = 2 while i <= n: last_fibonacci = n2 + n1 n1 = n2 n2 = last_fibonacci i += 1 return last_fibonacci n = int(input()) print(fibonacci(n))<file_sep>linha = 1 coluna = 1 while linha <=10: while coluna <= 10: print(linha * coluna, end = "") coluna = coluna + 1 linha = linha + 1 print("\n") coluna = 1 <file_sep># Class for a heap base on maximum element unlike a minimum element like heapq Class in python class HeapMax(): # Method for sort a array using heap in O(n log n) # Given an unsorted array its return a sorted array def heap_sort(self, arr): sorted_arr = [0 for i in range(len(arr))] self.build_heap(arr) for j in range(len(arr) - 1, -1, -1): sorted_arr[j] = self.extract_max(arr) return sorted_arr # Turn a array into a heap def build_heap(self, arr): for i in range((len(arr) - 1) // 2, -1, -1): self.sift_down(i, arr) # Get the max element without remove them def get_max(heap): return heap[0] # return the parent position def parent(self, position): return (position - 1) // 2 # return the left child def left_child(self, position): return 2 * position + 1 # return the right child def righ_child(self, position): return 2 * position + 2 # swap the problematic node with its parent until the property is satisfied def sift_up(self, position, arr): while(position > 0 and arr[self.parent(position)] < arr[position]): arr[self.parent(position)], arr[position] = arr[position], arr[self.parent(position)] position = self.parent(position) # swap the problematic node with larger child until heap property is satisfied def sift_down(self, position, arr): max_index = position left = self.left_child(position) right = self.righ_child(position) size = len(arr) if left < size: if(arr[left] > arr[max_index]): max_index = left if right < size: if(arr[right] > arr[max_index]): max_index = right if position != max_index: arr[position], arr[max_index] = arr[max_index], arr[position] self.sift_down(max_index, arr) # insert a new element into the heap. Must be a heap for work def insert(self, element, heap): heap.append(element) self.sift_up(len(heap) - 1, heap) # Extract the maximum element and replace the root with the last leaf def extract_max(self, heap): max_element = heap[0] if len(heap) > 1: heap[0] = heap.pop() self.sift_down(0, heap) return max_element # change the priority of an element. Needed a position of element, the new value and the heap. def change_priority(self, position, new_element, heap): if (position < len(heap)): old_element = heap[position] heap[position] = new_element if (new_element > old_element): self.sift_up(position, heap) else: self.sift_down(position, heap) else: print('Index out of range. Impossible change priority.') # remove an element. Needed position of element and the heap def remove(self, position, heap): if (position < len(heap)): heap[position] = float('inf') #change the priority to infinit self.sift_up(position, heap) self.extract_max(heap) else: print('Index out of range. Impossible remove.') # tests new_heap = [1,57,5,3,2,2,45,9,30,5,39,22] HeapMax().build_heap(new_heap) print(new_heap) HeapMax().insert(21, new_heap) print(new_heap) HeapMax().change_priority(12, 23, new_heap) print(new_heap) HeapMax().remove(5, new_heap) print(new_heap) max_e = HeapMax().extract_max(new_heap) print(max_e) print(new_heap) any_arr = [4,5,79,7,34,5,3,1,4,5,65,7,67] arr_sorted = HeapMax().heap_sort(any_arr) print(arr_sorted) <file_sep>import urllib.request, urllib.parse, urllib.error from bs4 import BeautifulSoup import ssl def following_links(): # Ignore SSL certificate errors ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE url = input('Enter URL- ') position = int(input('Enter position link - ')) loop = int(input('Enter number of loops - ')) html = urllib.request.urlopen(url, context = ctx).read() soup = BeautifulSoup(html, 'html.parser') tags = soup('a') cont = 0 while cont < loop: last_name = tags[position - 1].contents[0] new_url = tags[position - 1].get('href', None) html = urllib.request.urlopen(new_url, context = ctx).read() soup = BeautifulSoup(html, 'html.parser') tags = soup('a') cont += 1 return last_name print(following_links()) <file_sep>def multiplicacao_matrizes(m1, m2): num_linhas_m1, num_colunas_m1 = len(m1), len(m1[0]) num_linhas_m2, num_colunas_m2 = len(m2), len(m2[0]) assert num_colunas_m1 == num_linhas_m2 matriz_resultante = [] for linha in range(num_linhas_m1): matriz_resultante.append([]) for coluna in range(num_colunas_m2): matriz_resultante[linha].append(0) for k in range(num_colunas_m1): matriz_resultante[linha][coluna] += m1[linha][k] * m2[k][coluna] return matriz_resultante <file_sep>class DisjointSets: def __init__(self, n): self.parent = [0 for x in range(n + 1)] self.rank = [0 for x in range(n + 1)] def Make_set(self, i): self.parent[i] = i self.rank[i] = 0 def Find(self, i): if i != self.parent[i]: self.parent[i] = self.Find(self.parent[i]) return self.parent[i] def Union(self, i, j): i_id = self.Find(i) j_id = self.Find(j) if i_id == j_id: return if self.rank[i_id] > self.rank[j_id]: self.parent[j_id] = i_id else: self.parent[i_id] = j_id if self.rank[i_id] == self.rank[j_id]: self.rank[j_id] = self.rank[i_id] + 1 def output(self): return self.rank #Execution s = DisjointSets(61) for i in range(1,61): s.Make_set(i) for i in range(1,31): s.Union(i, 2*i) for i in range(1,21): s.Union(i,i*3) for i in range(1,13): s.Union(i,i*5) for i in range(1,61): s.Find(i) print(s.output()) print(s.parent)<file_sep>import matriz def soma_matrizes(m1,m2): num_linhas = len(m1) num_colunas = len(m2[0]) matriz_somada = matriz.cria_matriz(num_linhas, num_colunas,0) for lin in range(num_linhas): for col in range(num_colunas): matriz_somada[lin][col] = m1[lin][col] + m2[lin][col] return matriz_somada <file_sep> soma = 0 valor = 1 while valor != 0: valor = int(input("Digite um valor a ser somado(0 para finalizar): ")) soma = soma + valor print("A soma dos valores digitados é:", soma) <file_sep>def main(): print("Bem vindo ao jogo do NIM! Escolha:") tipo_de_jogo = 0 print("1 - para jogar uma partida isolada") tipo_de_jogo = int(input("2 - para jogar um campeonato ")) if tipo_de_jogo == 1: print("Você escolheu uma partida isolada!") partida() else: print("Você escolheu um campeonato!") campeonato() def partida(): n = int(input("Quantas peças? ")) m = int(input("Limite de peças por jogada? ")) vez_do_usuario = False vez_do_computador = False pecas_tiradas = 0 if n % (m + 1) == 0: print("Você começa!") pecas_tiradas = usuario_escolhe_jogada(n, m) n = n - pecas_tiradas if pecas_tiradas == 1: print("Você tirou uma peça.") else: print("Você tirou", pecas_tiradas, "peças.") if n > 1: print("Agora restam", n, "peças no tabuleiro.") else: if n == 1: print("Agora resta apenas uma peça no tabuleiro.") else: print("Fim de jogo! Você ganhou!") vez_do_usuario = True else: print("Computador começa!") pecas_tiradas = computador_escolhe_jogada(n, m) n = n - pecas_tiradas if pecas_tiradas == 1: print("Computador tirou uma peça.") else: print("Computador tirou", pecas_tiradas, "peças.") if n > 1: print("Agora restam", n, "peças no tabuleiro.") else: if n == 1: print("Agora resta apenas uma peça no tabuleiro.") else: print("Fim de jogo! O computador ganhou!") vez_do_computador = True while n > 0: if vez_do_computador == False: pecas_tiradas = computador_escolhe_jogada(n, m) n = n - pecas_tiradas if pecas_tiradas == 1: print("Computador tirou uma peça.") else: print("Computador tirou", pecas_tiradas, "peças.") if n > 1: print("Agora restam", n, "peças no tabuleiro.") else: if n == 1: print("Agora resta apenas uma peça no tabuleiro.") else: print("Fim de jogo! O computador ganhou!") vez_do_usuario = False vez_do_computador =True else: pecas_tiradas = usuario_escolhe_jogada(n, m) n = n - pecas_tiradas if pecas_tiradas == 1: print("Você tirou uma peça.") else: print("Você tirou", pecas_tiradas, "peças.") if n > 1: print("Agora restam", n, "peças no tabuleiro.") else: if n ==1: print("Agora resta apenas uma peça no tabuleiro.") else: print("Fim de jogo! Você ganhou!") vez_do_computador = False vez_do_usuario = True if vez_do_usuario == True: return 0 else: return 1 def computador_escolhe_jogada(n, m): resposta_computador = 1 resposta_valida = False while resposta_computador <= m and resposta_valida == False: if ((n - resposta_computador) % (m+1)) == 0: resposta_valida = True resposta_computador = resposta_computador + 1 if resposta_valida == True: return resposta_computador - 1 else: if m <= n: return m else: return n def usuario_escolhe_jogada(n, m): pecas_tiradas = int(input("Quantas peças você vai tirar? ")) while pecas_tiradas > m or pecas_tiradas < 1: print("Oops! Jogada inválida! Tente de novo.") pecas_tiradas = int(input("Quantas peças você vai tirar? ")) return pecas_tiradas def campeonato(): cont_partidas = 1 vitorias_usuario = 0 vitorias_computador = 0 while cont_partidas <= 3: print("**** Rodada", cont_partidas, "****") if partida() == 0: vitorias_usuario = vitorias_usuario + 1 cont_partidas = cont_partidas + 1 else: vitorias_computador = vitorias_computador + 1 cont_partidas = cont_partidas + 1 print("Placar: Você", vitorias_usuario, "X", vitorias_computador, "Computador") main() <file_sep># Uses python3 import sys def cria_matriz(num_linhas, num_colunas, valor): matriz = [] for i in range(num_linhas): linha= [] for j in range(num_colunas): linha.append(valor) matriz.append(linha) return matriz def optimal_weight(W, w): value = cria_matriz(W + 1, len(w) + 1, 0) for i in range(1, len(w) + 1): for j in range(1, W + 1): value[j][i] = value[j][i - 1] if w[i - 1] <= j: val = value[j - w[i - 1]][i - 1] + w[i - 1] if value[j][i] < val: value[j][i] = val return value[W][len(w)] if __name__ == '__main__': input = sys.stdin.read() W, n, *w = list(map(int, input.split())) print(optimal_weight(W, w)) <file_sep>numero = int(input("Digite um número inteiro: ")) aux = numero #utilizada para atualizar o número no processo da soma soma = 0 ultimo_numero = 0 while aux != 0: ultimo_numero = aux % 10 soma = soma + ultimo_numero aux = aux // 10 print(soma) <file_sep>import fatorial import pytest def test_fatorial_0(): assert fatorial.fatorial(0) == 1 def test_fatorial_1(): assert fatorial.fatorial(1) == 1 def test_fatorial_2(): assert fatorial.fatorial(2) == 2 def test_fatorial_3(): assert fatorial.fatorial(3) == 6 def test_fatorial_4(): assert fatorial.fatorial(4) == 24 def test_fatorial_5(): assert fatorial.fatorial(5) == 120 <file_sep># Uses python3 def height_tree(nodes, n): max_height = 0 j = 0 while j < n: if nodes[j] == nodes[j - 1]: j += 1 else: height = 0 k = nodes[j] while k != - 1: height += 1 k = nodes[k] max_height = max(max_height, height) j += 1 return max_height + 1 if __name__ == "__main__": n = int(input()) nodes = list(map(int, input().split())) print(height_tree(nodes, n)) <file_sep>def main(): lista_inteiros = [] x = int(input("Digite um número inteiro: ")) cont_reverso = 0 while x != 0: lista_inteiros.append(x) x = int(input("Digite um número inteiro: ")) cont_reverso = len(lista_inteiros) while cont_reverso > 0: cont_reverso = cont_reverso - 1 print(lista_inteiros[cont_reverso]) main() <file_sep>def insertion_sort(lista): lista_ordenada = [] for i in lista: lista_ordenada.append(i) j = len(lista_ordenada) - 1 lista_atual_ordenada = False while j > 0 and lista_atual_ordenada == False: if lista_ordenada[j] < lista_ordenada[j - 1]: lista_ordenada[j], lista_ordenada[j - 1] = lista_ordenada[j - 1], lista_ordenada[j] else: lista_atual_ordenada = True j -= 1 return lista_ordenada <file_sep>numero = int(input("Digite um numero inteiro para saber se é impar ou par: ")) if (numero % 2) == 0: print("par") else: print("ímpar") <file_sep># Uses python3 def fibonacci_sum_last_digit(n): n1 = 0 n2 = 1 if n == 0: last_fibonacci = 0 sum_last_digit = 0 else: last_fibonacci = 1 sum_last_digit = 1 len_max = n + 1 for i in range(2, len_max): last_fibonacci = (n2 + n1) % 10 n1, n2 = n2, last_fibonacci sum_last_digit += last_fibonacci return sum_last_digit if __name__ == '__main__': n = int(input()) print(fibonacci_sum_last_digit(n))<file_sep># python3 def left_child(i): return 2*i + 1 def right_child(i): return 2*i + 2 def sift_down(i, size, arr, swaps_arr): max_index = i l = left_child(i) if l <= size and arr[max_index] > arr[l]: max_index = l r = right_child(i) if r <= size and arr[max_index] > arr[r]: max_index = r if i != max_index: arr[i], arr[max_index] = arr[max_index], arr[i] swaps_arr.extend([i, max_index]) sift_down(max_index, size, arr, swaps_arr) def build_heap(arr): swaps_arr = [] size = len(arr) - 1 for i in range(size // 2, -1, -1): sift_down(i, size, arr, swaps_arr) return swaps_arr if __name__ == "__main__": n = int(input()) arr = list(map(int, input().split())) swaps_arr = build_heap(arr) print(len(swaps_arr) // 2) for i in range(0, len(swaps_arr), 2): print(swaps_arr[i], swaps_arr[i + 1]) <file_sep>import urllib.request, urllib.parse, urllib.error import xml.etree.ElementTree as ET import ssl def get_xml_data(url): # Ignore SSL certificate errors ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE xml = urllib.request.urlopen(url, context = ctx).read() return xml def sum_number_xml(url): total_sum = 0 xml = get_xml_data(url) tree = ET.fromstring(xml) comment_list = tree.findall('comments/comment') for item in comment_list: total_sum += int(item.find('count').text) return total_sum if __name__ == '__main__': url = input('Enter URL - ') print(sum_number_xml(url)) <file_sep># Class for construct the nodes of the tree. (Subtrees) class Node: def __init__(self, key, parent_node = None): self.left = None self.right = None self.key = key if parent_node == None: self.parent = self else: self.parent = parent_node # Class with the structure of the tree. # This Tree is not balanced. class Tree: def __init__(self): self.root = None # Insert a single element def insert(self, x): if(self.root == None): self.root = Node(x) else: self._insert(x, self.root) def _insert(self, x, node): if(x < node.key): if(node.left == None): node.left = Node(x, node) else: self._insert(x, node.left) else: if(node.right == None): node.right = Node(x, node) else: self._insert(x, node.right) # Given a element, return a node in the tree with key x. def find(self, x): if(self.root == None): return None else: return self._find(x, self.root) def _find(self, x, node): if(x == node.key): return node elif(x < node.key): if(node.left == None): return None else: return self._find(x, node.left) elif(x > node.key): if(node.right == None): return None else: return self._find(x, node.right) # Given a node, return the node in the tree with the next largest element. def next(self, node): if node.right != None: return self._left_descendant(node.right) else: return self._right_ancestor(node) def _left_descendant(self, node): if node.left == None: return node else: return self._left_descendant(node.left) def _right_ancestor(self, node): if node.key <= node.parent.key: return node.parent else: return self._right_ancestor(node.parent) # Delete an element of the tree def delete(self, x): node = self.find(x) if node == None: print(x, "isn't in the tree") else: if node.right == None: if node.left == None: if node.key < node.parent.key: node.parent.left = None del node # Clean garbage else: node.parent.right = None del Node # Clean garbage else: node.key = node.left.key node.left = None else: x = self.next(node) node.key = x.key x = None # tests t = Tree() t.insert(5) t.insert(8) t.insert(3) t.insert(4) t.insert(6) t.insert(2) t.delete(8) t.delete(5) t.insert(9) t.insert(1) t.delete(2) t.delete(100) print(t.find(5)) print(t.find(8)) print(t.find(4)) print(t.find(6)) print(t.find(9)) <file_sep># Uses python3 import sys import math def optimal_sequence(n, x= None): if n < 1: return 1 if n % 3 == 0: x += optimal_sequence(n // 3, x) elif n % 2 == 0: x += optimal_sequence(n // 2, x) else: x += optimal_sequence(n - 1, x) return x input = sys.stdin.read() n = int(input) #sequence = list(optimal_sequence(n)) #print(len(sequence) - 1) #for x in sequence: # print(x, end=' ') print(optimal_sequence(n))<file_sep>def imprime_matriz(matriz): lin = len(matriz) col = len(matriz[0]) for i in range(lin): for j in range(col): valor = matriz[i][j] if j < col - 1: print(valor, end = " ") else: print(valor) <file_sep>def funcao(): fafsa dasd dasdda def fefefdafsa(): sfcas <file_sep># Uses python3 import sys from collections import namedtuple Segment = namedtuple('Segment', 'start end') def optimal_points(segments): points = [] list_segments = [] #write your code here for s in segments: list_segments.append(s.start) list_segments.append(s.end) min_right = 10 ** 10 position_min_right = 0 cont_segments = 0 i = 0 while i < len(list_segments) and (cont_segments < len(list_segments) / 2): for j in range(1, len(list_segments), 2): if min_right > list_segments[j]: min_right = list_segments[j] position_min_right = j points.append(min_right) for k in range(0, len(list_segments), 2): if list_segments[k] <= min_right and min_right <= list_segments[k + 1]: list_segments[k] = 10 ** 10 list_segments[k + 1] = 10 ** 10 cont_segments += 1 min_right = 10 ** 10 return points if __name__ == '__main__': input = sys.stdin.read() n, *data = map(int, input.split()) segments = list(map(lambda x: Segment(x[0], x[1]), zip(data[::2], data[1::2]))) points = optimal_points(segments) print(len(points)) for p in points: print(p, end=' ') <file_sep>import math class Triangulo: def __init__(self, a, b, c): self.a = a self.b = b self.c = c def perimetro(self): return self.a + self.b + self.c def tipo_lado(self): if self.a == self.b and self.b == self.c: return "equilátero" else: if self.a != self.b and self.a != self.c and self.b != self.c: return "escaleno" else: return "isósceles" def retangulo(self): a = self.a b = self.b c = self.c if a == math.sqrt(b ** 2 + c ** 2): return True else: if b == math.sqrt(a ** 2 + c ** 2): return True else: if c == math.sqrt(a ** 2 + b ** 2): return True else: return False def semelhantes(self, triangulo): lista1 = [self.a, self.b, self.c] lista2 = [triangulo.a, triangulo.b, triangulo.c] tamanho_lista = len(lista1) - 1 cont = 0 indicador = True semelhanca = lista1[0] / lista2[0] while cont <= tamanho_lista and indicador == True: if lista1[cont] / lista2[cont] == semelhanca: indicador = True else: indicador = False cont += 1 return indicador <file_sep># python3 # There are two ways of running this program: # 1. Run # python3 APlusB.py # then enter two numbers and press ctrl-d/ctrl-z # 2. Save two numbers to a file -- say, dataset.txt. # Then run # python3 APlusB.py < dataset.txt import sys list_input = list(map(int, input().split())) print(list_input[0] + list_input[1]) <file_sep>def ordenada(lista): anterior = lista[0] for i in lista: if anterior > i: return False anterior = i return True <file_sep>n = int(input("Digite o valor de n: ")) cont = 0 while cont < 2 * n: if cont % 2 != 0: print(cont) cont = cont + 1
da5d541a28fa41aa08b74cef1b4830b4e5e0b5d4
[ "Markdown", "Python" ]
81
Python
leonardo-lorenzon/coursera_courses
d0e91fa9e2b291db343a31d4268a74226c3d44f5
d8edd8ebf4f41d223e715ddddac051934eee809a
refs/heads/main
<repo_name>oumaimaboumarte48/jwt-auth-frontend<file_sep>/src/components/layout/Header.jsx import React, { useContext } from 'react' import { NavLink, Link } from 'react-router-dom' import { UserContext } from '../../contextApi/MyContext' const Header = (props) => { const {title} = props const { infos:{isAuth }} = useContext(UserContext) return ( <nav className="navbar navbar-expand-sm navbar-info bg-info mb-2 py0"> <div className="container"> <Link to= '/' className= 'navbar-brand'> {title}</Link> <div> <ul className="navbar-nav mr-auto"> <li className="nav-item"> <NavLink to="/" className="nav-link"> Home </NavLink> </li> { !isAuth ? ( <> <li className="nav-item"> <Link to="/signUp" className="nav-link"> Sign Up </Link> </li> <li className="nav-item"> <Link to="/signIn" className="nav-link"> Sign In </Link> </li> </>) : ( <> <li className="nav-item"> <Link to="/logout" className="nav-link"> Logout </Link> </li> </> ) } </ul> </div> </div> </nav> ) } export default Header <file_sep>/src/routes/Router.jsx import React, { useContext } from 'react' import {Route, Switch } from 'react-router-dom' import Header from '../components/layout/Header' import Home from '../components/Home' import DashboardAdmin from '../components/Dashboard' import DashboardTechnic from '../components/DashboardTechnic' import ProfileUser from '../components/ProfileUser' import SignUp from '../components/SignUp' import SignIn from '../components/SignIn' import Logout from '../components/Logout' import { AdminRoute, TechnicianRoute, UserRoute, IsAuthenticate } from './ProtectedRoutes' import { UserContext } from '../contextApi/MyContext' const Router = () => { const { infos:{isAuth , role}} = useContext(UserContext) console.table({isAuth , role}); return ( <div className=""> <Header title = 'Api JWT' /> <div> <Switch> <Route exact path='/' component={Home} /> <Route exact path='/logout' component={Logout} /> <IsAuthenticate path='/signUp' isAuth={isAuth} role={role} component={SignUp} /> <IsAuthenticate path='/signIn' isAuth={isAuth} role={role} component={SignIn} /> <AdminRoute path='/dashboard' isAuth={isAuth} role={role} component={DashboardAdmin} /> <TechnicianRoute path='/technician' isAuth={isAuth} role={role} component={DashboardTechnic} /> <UserRoute path='/profileUser' isAuth={isAuth} role={role} component={ProfileUser} /> </Switch> </div> </div> ) } // const AdminRoute = ({ component:Component, isAuth, role, ...rest}) =>( // <Route // {...rest} // render={() => ( // (isAuth && role === 'admin') // ? <Component/> : <Redirect to="/signIn" /> // )} // /> // ) // const TechnicianRoute = ({component:Component,isAuth,role,...rest})=>( // <Route // {...rest} // render={() => ( // (isAuth && role === 'technician' ) // ? <Component/> : <Redirect to="/signIn" /> // )} // /> // ) // const UserRoute = ({component:Component,isAuth,role,...rest})=>( // <Route // {...rest} // render={() => ( // (isAuth && role === 'user' ) // ? <Component/> : <Redirect to="/singIn" /> // )} // /> // ) // const IsAuthenticate = ({component:Component,role,isAuth,...rest})=>( // <Route // {...rest} // render={() => ( // !isAuth ? <Component/> // : (role === "admin" // ? <Redirect to="/dashboard" /> // : ( role === "technician" // ? <Redirect to="/technician" /> // : <Redirect to="/profileUser" />) // ) // )} // /> // ) export default Router <file_sep>/src/components/DashboardTechnic.jsx import React from 'react' const DashboardTechnic = () => { return ( <div> <h1>welcome Technician</h1> </div> ) } export default DashboardTechnic <file_sep>/README.md On vous demande de créer une api d’authentification et d’autorisation jwt avec nodejs/express/mongodb. Et de développer une application Reactjs pour la consommer. Votre API doit fournir 3 types d’utilisateurs: Admin, user et technicien. Les utilisateurs seront redirigés vers des Home pages différentes selon leurs types. Votre solution doit respecter le MVC pattern.
8a19176813e7e0b91170a9e9adc02e7ea4d0dcbd
[ "JavaScript", "Markdown" ]
4
JavaScript
oumaimaboumarte48/jwt-auth-frontend
99c90552a7b87e87432876ea6a6fa803fb66356b
560c1610e0c38c835cdd44b8898a013324dc00aa
refs/heads/master
<repo_name>joshvillahermosa/Learning-Lab--Streaming-Adventure<file_sep>/sampleStd.js /** * Sample process in */ process.stdin.setEncoding('utf8'); function run (){ var numOne, numTwo; process.stdin.resume(); process.stdout.write('> Enter first number: ') process.stdin.once('data', function (data){ numOne = data; console.log('> Data recieved: ' + data); }) console.log('> Enter second number'); process.stdin.once('data', function(data){ numTwo = data; console.log('> Data recieved: ' + data); console.log('> Sum is: ' + numOne+numTwo); }) } run(); //console.log(process.stdin);<file_sep>/program3.js var argsCheck = require('./checkArgs.js'); var fs = require('fs'); function run() { process.stdin.pipe(process.stdout); /** * Lesson leanred: * `pipe()` will just pass the results in a function */ } run();<file_sep>/README.md Learning Lab: Streaming Adventure === Learning lab from Nodeschool<file_sep>/checkArgs.js module.exports = function(num) { var argsExists = true; for (var i = 2; i < num + 2; i++){// if(process.argv[i] == null) { argsExists = false; } } return argsExists; }
8bf3772c04f817d14ecaae4b44a85e5da186c8cc
[ "JavaScript", "Markdown" ]
4
JavaScript
joshvillahermosa/Learning-Lab--Streaming-Adventure
fe801cfdf96c0a4a1e092fbac9c2c931021441ff
dc6f3080e3734b625c8e1c54de25fb0833d930d3
refs/heads/master
<repo_name>techmemories/openresty-buildpack<file_sep>/bin/compile #!/usr/bin/env bash # bin/compile <build-dir> <cache-dir> set -e # fail fast set -o pipefail # do not ignore exit codes when piping output set -x # enable debugging # Configure directories build_dir=$1 cache_dir=$2 compile_buildpack_dir=$(cd $(dirname $0); cd ..; pwd) compile_buildpack_bin=$compile_buildpack_dir/bin # Load some convenience functions like status(), echo(), and indent() source $compile_buildpack_dir/bin/common.sh mv $compile_buildpack_dir/openresty.tar.gz /tmp compile_nginx_tgz="/tmp/openresty.tar.gz" cd $build_dir root_dir=${root_dir:-.} status "Copying project files into scripts/" shopt -s extglob root_dir_absolute=`cd $root_dir 2>/dev/null && pwd -P` if [ ${build_dir}/scripts != ${root_dir_absolute} ]; then tmp_dir=`mktemp -d /tmp/XXXXX` if [[ "$host_dotfiles" = true ]]; then shopt -s dotglob mv $root_dir_absolute/!(Staticfile|Staticfile.auth|manifest.yml|stackato.yml|.profile|.|..) $tmp_dir || true else mv $root_dir_absolute/!(Staticfile|Staticfile.auth|manifest.yml|stackato.yml) $tmp_dir || true fi rm -rf $build_dir/scripts mv $tmp_dir $build_dir/scripts fi shopt -u extglob shopt -u dotglob status "Setting up nginx" status "compile_buildpack_dir $compile_buildpack_dir $compile_nginx_tgz" tar tvf $compile_nginx_tgz tar xzf $compile_nginx_tgz #cp -fr $compile_buildpack_dir/conf/* openresty/nginx/nginx/conf/* mkdir -p openresty/nginx/cache/tmp cp $compile_buildpack_bin/boot.sh . <file_sep>/bin/boot.sh export APP_ROOT=$HOME export LD_LIBRARY_PATH=$APP_ROOT/openresty/lib:$LD_LIBRARY_PATH:$APP_ROOT/openresty/luajit/lib:$APP_ROOT/openresty/nginx/lib:$LD_LIBRARY_PATH:$APP_ROOT/openresty/nginx/luajit/lib find $APP_ROOT mkdir -p $APP_ROOT/openresty/nginx/logs touch $APP_ROOT/openresty/nginx/logs/error.log touch $APP_ROOT/openresty/nginx/logs/access.log conf_file=$APP_ROOT/openresty/nginx/nginx/conf/nginx.conf erb $conf_file > $APP_ROOT/openresty/nginx/nginx/conf/nginx-final.conf # ------------------------------------------------------------------------------------------------ mkfifo $APP_ROOT/openresty/nginx/logs/access.log mkfifo $APP_ROOT/openresty/nginx/logs/error.log cat < $APP_ROOT/openresty/nginx/logs/access.log & (>&2 cat) < $APP_ROOT/openresty/nginx/logs/error.log & exec $APP_ROOT/openresty/nginx/nginx/sbin/nginx -p $APP_ROOT/openresty/nginx/nginx/ -c $APP_ROOT/openresty/nginx/nginx/conf/nginx-final.conf # ------------------------------------------------------------------------------------------------
a992b9fb0d422c1368af48bda03c087a3075a285
[ "Shell" ]
2
Shell
techmemories/openresty-buildpack
2b0fa8eab54499c0e6b7ee947d69b8a449bbc65d
3def5dcbcfcd9aaf541453817f49e196de8b1159
refs/heads/master
<repo_name>alican-k/mobxUnizone<file_sep>/App/components/cafe/UniSelector.ios.js import React, {Component} from 'react' import {Button, Text, Picker, StyleSheet, View} from 'react-native' import Modal from 'react-native-root-modal' import Icon from 'react-native-vector-icons/FontAwesome'; import universities from "../../utils/universities" import { observer, inject } from 'mobx-react/native' //var StyleSheet = require('react-native-debug-stylesheet'); const Item = Picker.Item @inject("appStore") @observer export default class UniSelector extends Component { isUniUpdated = false render(){ const {cafeStore} = this.props.appStore const pickedUniName = universities.filter((item) => item.id === cafeStore.pickedUniId)[0].name const uniItems = universities.map(item => <Item label={item.name} color="#333333" value={item.id} key={item.id} />) return ( <View style={styles.container}> <Modal style={styles.modal} visible={cafeStore.uniSelectorShown}> <Picker style={styles.picker} mode="dialog" selectedValue={cafeStore.pickedUniId} onValueChange={(val) => { this.isUniUpdated = true cafeStore.setPickedUniId(val) }} > {uniItems} </Picker> <Button title='kapat' onPress={() => { cafeStore.setUniSelectorShown(false) if (this.isUniUpdated) { cafeStore.refreshCheckins() } this.isUniUpdated = false }} /> </Modal> <Icon.Button name='sort-down' style={styles.selectorButton} backgroundColor = 'grey' onPress = { () => cafeStore.setUniSelectorShown(true) } > {pickedUniName} </Icon.Button> </View> ) } } const styles = StyleSheet.create({ container: { padding: 10, alignItems:'center' }, modal: { top: 0, right: 0, bottom: 0, left: 0, backgroundColor: 'white', }, selectorButton: { }, picker: { alignSelf: 'stretch' } }) <file_sep>/App/components/conversations/ConversationsScreen.js import React, { Component } from 'react'; import {ActivityIndicator, Button, View, Text, TextInput, StyleSheet } from 'react-native'; import ConversationsList from './ConversationsList' //var StyleSheet = require('react-native-debug-stylesheet'); import { observer, inject } from 'mobx-react/native' @inject("appStore") @observer export default class ConversationsScreen extends Component { render() { const {conversationStore} = this.props.appStore let comp = null if (conversationStore) { if (conversationStore.conversations.size) { comp = <ConversationsList /> } else { comp = ( <View style={styles.noMessageWarningView}> <Text style={styles.noMessageWarning}>Hiç mesajınız yok gibi görünüyor.</Text> <Text style={styles.noMessageWarning}>Cafe bölümünden etrafındaki insanlara ulaş!</Text> </View> ) } } else { comp = <Text style={{marginTop: 50}}>..</Text> } return ( <View style={[ styles.container, conversationStore && conversationStore.conversations.size ? {} : {alignItems: 'center'} ]}> {comp} </View> ); } } const styles = StyleSheet.create({ container: { flex: 1, }, noMessageWarningView: { marginTop: 130, }, noMessageWarning: { textAlign: 'center', fontSize: 16, marginTop: 5, } }); <file_sep>/App/store/store.js import { observable, computed, autorun, action } from 'mobx' import { NavigationActions } from 'react-navigation' import { nav } from '../App' import AuthStore from './authStore2' import CheckinStore from './checkinStore' import CafeStore from './cafeStore' import ConversationStore from './conversationStore' import IgnoreStore from './ignoreStore' import NotificationStore from './notificationStore' export default class AppStore { authStore = null checkinStore = null @observable cafeStore = null @observable conversationStore = null @observable ignoreStore = null @observable notificationStore = null constructor(){ this.authStore = new AuthStore(this) this.checkinStore = new CheckinStore(this) autorun('autorun cafeStore initializer', () => { if(this.authStore.isUid && this.authStore.isUniId){ this.cafeStore = new CafeStore(this) this.conversationStore = new ConversationStore(this) this.ignoreStore = new IgnoreStore(this) this.notificationStore = new NotificationStore(this) } else { this.cafeStore = null this.conversationStore = null this.ignoreStore = null if (this.notificationStore) { this.notificationStore.unwatchTokens() this.notificationStore = null } } }) } @action gotoScreen(routeName){ const {index, routes} = nav.state.nav const previousRouteName = routes[index].routeName if(routeName === 'BACK'){ nav.dispatch(NavigationActions.back()) } else if (previousRouteName === 'Login' || previousRouteName === 'SetProfile' || routeName === 'Login' || routeName === 'SetProfile' || routeName === 'MainTabs' ) { nav.dispatch(NavigationActions.reset({ index: 0, actions: [ NavigationActions.navigate({ routeName }) ] })) } else { nav.dispatch(NavigationActions.navigate({ routeName })) } } } <file_sep>/App/components/cafe/checkin/Venue.js import React from "react"; import { Text, View, StyleSheet } from "react-native"; //import Icon from 'react-native-vector-icons/FontAwesome'; import { observer, inject } from 'mobx-react/native' //var StyleSheet = require('react-native-debug-stylesheet') /**********************************************************************/ @observer export default class Venue extends React.Component { render(){ const {venue} = this.props const selectedStyles = venue.selected ? { backgroundColor: '#ccccdd', } : { } return ( <View style = {[styles.container, selectedStyles]}> <View style={styles.top}> <Text style={styles.name}>{venue.name}</Text> <Text style={styles.distance}>{venue.distance}m</Text> </View> <View style={styles.bottom}> <Text style={styles.address}>{venue.address}</Text> <Text style={styles.category}>{venue.category}</Text> </View> </View> ) } } const styles = StyleSheet.create({ container: { flex: 1, padding: 8, paddingLeft: 14, borderBottomWidth: 1, borderBottomColor: '#cccccc' }, top: { flex: 1, flexDirection: 'row', }, name: { flex: 5, color: 'darksalmon', fontSize: 16, }, distance: { flex: 1, fontStyle: 'italic', fontSize: 12, paddingTop: 3, }, bottom: { flex: 1, flexDirection: 'row', justifyContent: 'space-between', marginTop: 3, }, category: { //flex: 1, fontWeight: 'bold', }, address: { //flex: 3, fontSize: 11, marginTop: 3, //marginLeft: 18, }, }); <file_sep>/App/components/cafe/checkin/CheckinTitle.js import React, { Component } from 'react'; import { Button, View, Text, StyleSheet } from 'react-native'; import { observer, inject } from 'mobx-react/native' @inject("appStore") @observer export default class CheckinTitle extends Component { render() { const {checkinStore} = this.props.appStore let title = '' if (checkinStore.selectedVenueIndex) { const name = checkinStore.venues[checkinStore.selectedVenueIndex].name title = name.length > 20 ? name.substring(0, 20) + '...' : name } else { title = "<NAME>" } return ( <Text style={styles.container}>{title}</Text> ) } } const styles = StyleSheet.create({ container: { fontSize: 20, color: 'black', marginLeft: 10 }, }); <file_sep>/App/components/cafe/checkin/VenueList.js import React, { Component } from 'react'; import { ActivityIndicator, ListView, TouchableOpacity, View, Text, StyleSheet } from 'react-native'; import { observer, inject } from 'mobx-react/native' import Venue from './Venue' @inject("appStore") @observer export default class CheckinScreen extends Component { ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1.id !== r2.id}); render() { const {checkinStore} = this.props.appStore return ( <View style={styles.container}> <ListView style={styles.listView} dataSource={this.ds.cloneWithRows(checkinStore.venues.toJS())} renderRow={(venue, sectionID, rowID, highlightRow) => ( <TouchableOpacity activeOpacity = {0.6} onPress={() => { checkinStore.selectVenue(rowID) //console.log(rowID); }}> <Venue venue={venue} /> </TouchableOpacity> )}/> </View> ) } } const styles = StyleSheet.create({ container: { flex: 1, }, listView: { } }); <file_sep>/App/components/conversations/Conversation.js import React from "react"; import { Image, Text, View, StyleSheet} from "react-native"; //import Icon from 'react-native-vector-icons/FontAwesome'; import { observer, inject } from 'mobx-react/native' import { cropLastWord } from "../../utils/string" //var StyleSheet = require('react-native-debug-stylesheet') var moment = require('moment') var trLocale = require('moment/locale/tr') moment.locale('tr', trLocale) /**********************************************************************/ @observer export default class Conversation extends React.Component { render(){ const {convId, convData} = this.props const lastMessage = convData.lastMessage.length > 23 ? convData.lastMessage.substring(0, 23) + '...' : convData.lastMessage return ( <View style = {[styles.container, /* selectedStyles */]}> <Image style={styles.photoFromFacebook} source={{ uri: convData.receiverPhotoURL }} /> <View style={styles.right}> <Text style={styles.name}>{cropLastWord(convData.receiverDisplayName)}</Text> <View style={styles.altContainer}> {/*<Text style={styles.lastMessageTime}>{new Date(convData.lastMessageTime).toUTCString()}</Text>*/} <Text style={styles.lastMessage}>{lastMessage}</Text> <Text style={ convData.unreadCount > 0 ? styles.unRead : {}}> {convData.unreadCount === 0 ? '' : convData.unreadCount} </Text> </View> <Text style={styles.lastMessageTime}>{moment(convData.lastMessageTime).format('dddd, H:mm')}</Text> </View> </View> ) } } const styles = StyleSheet.create({ container: { flex: 1, padding: 8, paddingLeft: 14, borderBottomWidth: 1, borderBottomColor: '#cccccc', flexDirection: 'row' }, photoFromFacebook: { width: 70, height: 70, borderRadius: 35, }, right: { flexGrow: 1, paddingLeft: 13 }, name: { color: 'cornflowerblue', fontSize: 20, }, altContainer: { flexDirection: 'row', justifyContent: 'space-between', flexGrow:1 }, lastMessageTime: { fontSize: 12 }, lastMessage: { paddingTop: 3, fontSize: 14, fontWeight: 'bold', }, unRead: { color: 'white', backgroundColor: 'green', fontWeight: 'bold', height: 20, width: 20, textAlign: 'center', borderRadius: 10, paddingTop: 0, } }); <file_sep>/App/components/conversations/conversation/ModalProfile2.js import React, {Component} from 'react' import {ActivityIndicator, Button, Modal, Image, Text, View, TouchableOpacity, ScrollView, StyleSheet} from 'react-native' import Icon from 'react-native-vector-icons/MaterialIcons'; import { observer, inject } from 'mobx-react/native' import universities from "../../../utils/universities" import { cropLastWord } from "../../../utils/string" //var StyleSheet = require('react-native-debug-stylesheet'); @inject("appStore") @observer export default class ModalProfile2 extends Component{ render(){ const {conversationStore, ignoreStore} = this.props.appStore let ignoreTitle = '' let ignoreFunc = null if (ignoreStore.usersIgnoredMe.get(conversationStore.modalProfileUser.uid)) { } else if (ignoreStore.usersIIgnored.get(conversationStore.modalProfileUser.uid)) { ignoreTitle = 'Engeli Kaldır' ignoreFunc = () => ignoreStore.unIgnore(conversationStore.modalProfileUser.uid) } else { ignoreTitle = 'Engelle' ignoreFunc = () => ignoreStore.ignore(conversationStore.modalProfileUser.uid) } const ignoreComp = ( <View style = {styles.sendMessageView}> <Icon.Button name='message' style={styles.sendMessageButton} onPress={ignoreFunc}> <Text style={styles.sendMessageButtonText}>{ignoreTitle}</Text> </Icon.Button> </View> ) const comp = conversationStore.modalProfileLoaded ? ( <ScrollView contentContainerStyle={styles.container}> <Image style={styles.photoFromFacebook} source={{ uri: conversationStore.modalProfileUser.photoURL }} /> <Text style={styles.displayNameText}> {" "}{cropLastWord(conversationStore.modalProfileUser.displayName)}{" "} </Text> <Text style={styles.uniName}> {universities.filter((item) => item.id === conversationStore.modalProfileUser.uniId)[0].name} </Text> <Text style = {styles.about}>{conversationStore.modalProfileUser.about}</Text> {ignoreComp} </ScrollView> ) : <ActivityIndicator animating={true} style={[{height: 40}]} size="large" /> return( <Modal style={styles.modal} onRequestClose={()=>{}} visible={conversationStore.modalProfileShown}> <TouchableOpacity style={ styles.closeButton } onPress={() => conversationStore.closeModalProfile()} > <Icon name="close" size={20} color="white" /> </TouchableOpacity> {comp} </Modal> ) } } const styles = StyleSheet.create({ modal: { flex: 1, top: 0, right: 0, bottom: 0, left: 0, backgroundColor: '#eeeeee', }, closeButton: { backgroundColor: 'red', width: 30, height: 30, margin: 8, marginBottom: 0, alignSelf: 'flex-end', justifyContent: 'center', alignItems: 'center', }, container: { padding: 30, paddingTop: 0, alignItems: 'center', }, photoFromFacebook: { width: 160, height: 160, borderRadius: 80, }, displayNameText: { marginTop: 20, fontSize: 24, color: "#222222", backgroundColor: 'white', textAlign: 'center', padding: 5, borderBottomWidth: 1, borderBottomColor: '#dddddd', borderRadius: 8, }, uniName: { marginTop: 15, fontSize: 18, color: "#222222", backgroundColor: 'white', textAlign: 'center', padding: 5, borderBottomWidth: 1, borderBottomColor: '#dddddd', borderRadius: 8, }, about: { marginTop: 15, fontSize: 14, color: "#222222", backgroundColor: 'white', textAlign: 'center', padding: 5, borderBottomWidth: 1, borderBottomColor: '#dddddd', borderRadius: 8, }, sendMessageView: { alignSelf: 'center', marginTop: 30, marginBottom: 30, }, sendMessageButtonText: { color: 'white', fontWeight: 'bold', marginBottom: 3, } }) <file_sep>/App/components/profile/EditAboutScreen.js import React, { Component } from 'react'; import { View, Text, TextInput, Button, Picker, StyleSheet } from 'react-native'; //var StyleSheet = require('react-native-debug-stylesheet'); import Icon2 from 'react-native-vector-icons/Ionicons'; import { observer, inject } from 'mobx-react/native' import { observable } from 'mobx' @inject("appStore") @observer export default class EditAboutScreen extends Component { constructor(props) { super(props); this.state = { about: this.props.appStore.authStore.about }; } render() { const {authStore} = this.props.appStore return ( <View style={styles.container}> <TextInput placeholder="Hakkımda" style={styles.about} autoFocus={true} multiline={true} value={this.state.about} onChangeText={(value) => this.setState({about: value})}/> <Icon2.Button name='md-checkmark' style={styles.save} onPress={ () => authStore.updateAbout(this.state.about)} > <Text style={styles.saveText}>Kaydet</Text> </Icon2.Button> </View> ); } } const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', padding: 20 }, about: { marginTop: 10, marginBottom: 15, alignSelf: 'stretch', backgroundColor: 'white', height: 100, }, saveText: { color: 'white', fontWeight: 'bold', marginBottom: 3, } }); <file_sep>/App/RootNavigator.js import React, { Component } from 'react'; import {Text, View} from 'react-native' import { StackNavigator, TabNavigator, TabView } from "react-navigation"; import { observer, inject } from 'mobx-react/native' import Icon from 'react-native-vector-icons/FontAwesome'; import LoginScreen from './components/auth/LoginScreen' import SetProfileScreen from './components/auth/SetProfileScreen' import CafeScreen from './components/cafe/CafeScreen' import AnnouncementsScreen from './components/announcement/AnnouncementsScreen' import ProfileScreen from './components/profile/ProfileScreen' import ConversationsScreen from './components/conversations/ConversationsScreen.js' import ConversationScreen from './components/conversations/conversation/ConversationScreen.js' import EditAboutScreen from './components/profile/EditAboutScreen.js' import CheckinScreen from './components/cafe/checkin/CheckinScreen' import CheckinHeader from './components/cafe/checkin/CheckinHeader' import CheckinTitle from './components/cafe/checkin/CheckinTitle' import ConversationHeader from './components/conversations/conversation/ConversationHeader' import MessageTabIcon from './components/conversations/MessageTabIcon' export default RootNavigator = StackNavigator( { Login: { screen: LoginScreen, navigationOptions: { header: { visible: false } } }, SetProfile: { screen: SetProfileScreen, navigationOptions: { header: { title: 'Üniversiteni Seç' } } }, EditAbout: { screen: EditAboutScreen, navigationOptions: { header: { title: 'Hakkımda' } } }, Checkin: { screen: CheckinScreen, navigationOptions: { header: { title: (<CheckinTitle />), right: (<CheckinHeader/>) } }}, Conversation: { screen: ConversationScreen, navigationOptions: { //headerTitle: (<ConversationHeader />), header: { title: (<ConversationHeader />), } } }, MainTabs: { screen: TabNavigator( { Cafe: { screen: CafeScreen, navigationOptions: { tabBar: ({ state, setParams }) =>({ label: 'Cafe', icon: ({ tintColor }) => ( <Icon name='coffee' color={tintColor} size={20}/> ), }), } }, Conversations: { screen: ConversationsScreen, navigationOptions: { tabBar: ({ state, setParams }) =>({ label: 'Mesaj', icon: ({ tintColor }) => ( <MessageTabIcon tintColor={tintColor}/> ), // icon: ({ tintColor }) => ( // <Icon name='comments-o' color={tintColor} size={20}/> // ), }), } }, Announcements: { screen: AnnouncementsScreen, navigationOptions: { tabBar: ({ state, setParams }) =>({ label: 'İlanlar', icon: ({ tintColor }) => ( <Icon name='bullhorn' color={tintColor} size={20}/> ), }), } }, Profile: { screen: ProfileScreen, navigationOptions: { tabBar: ({ state, setParams }) =>({ label: 'Profil', icon: ({ tintColor }) => ( <Icon name='user' color={tintColor} size={20}/> ), }), } } }, { //swipeEnabled: false, navigationOptions: { header: { visible: false, }, }, tabBarOptions: { showIcon: true, labelStyle: { fontSize: 11, fontWeight: "bold" } } } ) }, }, { headerMode: 'screen', header: { visible: false } } ); <file_sep>/App/App.js import React, { Component } from 'react' import { Provider } from 'mobx-react/native' import {autorun} from 'mobx' import AppStore from './store/store' import RootNavigator from './RootNavigator' import codePush from "react-native-code-push" // import {enableLogging} from 'mobx-logger'; // const config = {}; // enableLogging(/*config*/); let nav //const appStore = new AppStore() class App extends Component{ appStore = null componentWillMount(){ this.appStore = new AppStore() } render(){ return ( <Provider appStore={this.appStore}> <RootNavigator ref={n => nav = n} /> </Provider> ) } } const codePushOptions = { checkFrequency: codePush.CheckFrequency.ON_APP_RESUME } export default codePush(codePushOptions)(App); export {nav} /* <RootNavigator ref={n => nav = n} onNavigationStateChange={ (prevState, newState) => { console.log('prevState:', prevState); console.log('newState:', newState); } }/> */ <file_sep>/App/components/conversations/ConversationsList.js import React, { Component } from 'react'; import { ActivityIndicator, ListView, TouchableOpacity, View, Text, StyleSheet } from 'react-native'; import { observer, inject } from 'mobx-react/native' import Conversation from './Conversation' @inject("appStore") @observer export default class ConversationsList extends Component { ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1[0] !== r2[0]}); render() { const {conversationStore} = this.props.appStore return ( <View style={styles.container}> <ListView style={styles.listView} enableEmptySections={true} dataSource={this.ds.cloneWithRows(conversationStore.conversations.entries().sort( function(a, b){ return b[1].lastMessageTime - a[1].lastMessageTime }))} renderRow={ (entry, sectionID, rowID, highlightRow) => { //console.log('e:',entry); return ( <TouchableOpacity activeOpacity = {0.6} onPress={() => { conversationStore.openConversationWith({ uid: entry[1].receiverId, /*uniId: cafeStore.modalProfileUser.uniId,*/ photoURL: entry[1].receiverPhotoURL, displayName: entry[1].receiverDisplayName }) }}> <Conversation convId={entry[0]} convData={entry[1]} /> </TouchableOpacity> ) } }/> </View> ) } } const styles = StyleSheet.create({ container: { alignItems: 'stretch', marginTop: 20 }, listView: { } }); <file_sep>/App/utils/string.js export function cropLastWord(text){ if (!text) { return '' } const x1 = text.split(' ') x1.splice(-1, 1) return x1.reduce(function(acc, val, i, arr){ return acc + (i > 0 ? ' ' + val : val) }, '') } <file_sep>/android/settings.gradle rootProject.name = 'unizone' include ':react-native-code-push' project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app') include ':react-native-fcm' project(':react-native-fcm').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fcm/android') include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') include ':app' include ':react-native-social-auth' project(':react-native-social-auth').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-social-auth/android') <file_sep>/App/components/cafe/checkin/CheckinScreen.js import React, { Component } from 'react'; import { ActivityIndicator, View, Text, StyleSheet } from 'react-native'; import { observer, inject } from 'mobx-react/native' import VenueList from './VenueList' @inject("appStore") @observer export default class CheckinScreen extends Component { render() { const {authstore, checkinStore} = this.props.appStore let comp = null; if (!this.props.appStore.checkinStore.isLocation) { comp = <Text style={{marginTop: 50}}>cihazınızın konum bilgisine erişilemedi..</Text> } else if (checkinStore.venuesStatus === 'VENUES_LOADED') { if (checkinStore.venues.length) { comp = <VenueList /> } else { comp = <Text style={{marginTop: 50}}>venue yok..</Text> } } else if(checkinStore.venuesStatus === 'VENUES_LOADING'){ comp = <ActivityIndicator animating={true} style={[{height: 120}]} size="large" /> } else{throw new Error()} return ( <View style={styles.container}> {comp} </View> ) } componentWillMount(){ if (this.props.appStore.checkinStore.isLocation) { this.props.appStore.checkinStore.updateVenuesStatus('VENUES_EXPECTED') } } componentWillUnmount(){ this.props.appStore.checkinStore.updateVenuesStatus('VENUES_NOT_EXPECTED') this.props.appStore.cafeStore.setIsCheckinRequested(false) } } const styles = StyleSheet.create({ container: { flex: 1, }, }); <file_sep>/App/components/auth/LoginScreen.js import React, { Component } from 'react'; import { ActivityIndicator, Button, View, Text, TextInput, Image, StyleSheet } from 'react-native'; //var StyleSheet = require('react-native-debug-stylesheet'); import Icon from 'react-native-vector-icons/FontAwesome'; import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view' import { observer, inject } from 'mobx-react/native' import { observable } from "mobx" @inject("appStore") @observer export default class LoginScreen extends Component { render() { const { authStore } = this.props.appStore const comp = authStore.showLogin && !authStore.logingIn ? ( <Icon.Button name='facebook' style={styles.loginButton} backgroundColor = 'navy' onPress = { () => authStore.login() } > <Text style={styles.loginButtonText}>Facebook ile giriş</Text> </Icon.Button> ) : <ActivityIndicator animating={true} style={[{height: 40}]} size="large" /> return ( <Image style={styles.container} source={require('../../assets/images/background2.jpeg')} > <View style={styles.top}> <View style={styles.altTop}> <Image source={require('../../assets/images/yenilogo.png')} style={styles.logo}/> <Text style={styles.appName}>UNIZONE</Text> </View> <Text style={styles.desc}>MOBİL KAMPÜS</Text> <Text style={styles.desc}>Kampüste kim, nerede? Tanış, sosyalleş!</Text> <Text style={styles.desc}>Ev Arkadaşı - Kafa dengini bul</Text> <Text style={styles.desc}>Aktivite, Eğlence - Spor arkadaşı, parti, ortamlar..</Text> <Text style={styles.desc}>Ders Notu, Ödev - Ön sırada oturan arkadaşlara ulaş!</Text> </View> {comp} </Image> ) } } const styles = StyleSheet.create({ container: { flex: 1, // alignItems: 'center', justifyContent: 'space-between', //resizeMode: Image.resizeMode.contain, width: null, height: null }, top: { }, altTop: { flexDirection: 'row', justifyContent: 'center', alignItems: 'center', paddingTop: 8, paddingBottom: 8, backgroundColor: 'navy', marginBottom: 8, }, logo: { height: 40, width: 40, borderRadius: 5, marginRight: 15 }, appName: { color: '#eeeeee', fontSize: 36 }, desc: { color: '#555555', marginTop: 7, fontWeight: 'bold', textAlign: 'center' }, loginButton: { borderRadius: 0, alignItems: 'center', justifyContent: 'center', }, loginButtonText: { fontSize: 20, color: 'white' } }); <file_sep>/App/components/cafe/UniSelector.android.js import React, {Component} from 'react' import {Picker, View, StyleSheet} from 'react-native' import universities from "../../utils/universities" import { observer, inject } from 'mobx-react/native' //var StyleSheet = require('react-native-debug-stylesheet'); const Item = Picker.Item @inject("appStore") @observer export default class UniSelector extends Component { render(){ const {cafeStore} = this.props.appStore const pickedUniName = universities.filter((item) => item.id === cafeStore.pickedUniId)[0].name const uniItems = universities.map(item => <Item label={item.name} color="#333333" value={item.id} key={item.id} /> ); return ( <View style={styles.container}> <Picker style={styles.picker} mode="dialog" selectedValue={cafeStore.pickedUniId} onValueChange={(val) => { cafeStore.setPickedUniId(val) cafeStore.refreshCheckins() }}> {uniItems} </Picker> </View> ) } } const styles = StyleSheet.create({ container: { alignSelf: 'center', //backgroundColor: '#ccccc1', borderColor: 'steelblue', borderWidth: 2, borderRadius: 20, height: 40, paddingLeft: 15 }, picker: { width: 250, height: 40, color: 'steelblue' } }) <file_sep>/App/components/cafe/checkin/CheckinHeader.js import React, { Component } from 'react'; import { Button, View, Text, StyleSheet } from 'react-native'; import { observer, inject } from 'mobx-react/native' @inject("appStore") @observer export default class CheckinHeader extends Component { render() { const {checkinStore} = this.props.appStore const comp = checkinStore.selectedVenueIndex ? ( <Button title='Checkin!' style={styles.container} onPress={ () => checkinStore.checkin() } /> ) : null return <View>{comp}</View> } } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', }, }); <file_sep>/App/firebase.js import * as firebase from 'firebase'; const firebaseConfig = { apiKey: "<KEY>", authDomain: "unizone-95e26.firebaseapp.com", databaseURL: "https://unizone-95e26.firebaseio.com", projectId: "unizone-95e26", storageBucket: "unizone-95e26.appspot.com", messagingSenderId: "160926205040" } export default firebase.initializeApp(firebaseConfig) <file_sep>/App/store/checkinStore.js import { observable, computed, autorun, action } from 'mobx' import fir from '../firebase' import foursquare from '../foursquare' export default class CheckinStore { constructor(appStore){ this.appStore = appStore this.watchLocation() this.searchWhenNecessary() } @observable location = { longitude: null, latitude: null } @computed get isLocation() { return Boolean(this.location.longitude && this.location.latitude)} @observable venues = [] @observable venuesStatus = 'VENUES_NOT_EXPECTED' // 'VENUES_EXPECTED' 'VENUES_LOADING' 'VENUES_LOADED' @computed get isSearchNecessary () { return this.isLocation && this.venuesStatus === 'VENUES_EXPECTED' } @observable selectedVenueIndex = null watchLocationId = null appStore = null watchLocation(){ const successFunc = (position) => { //console.log('location alındı: ', position); this.updateLocation(position.coords.longitude, position.coords.latitude) } const errorFunc = (error) => { //console.error(error) } //const config = { enableHighAccuracy: true, timeout: 20000, maximumAge: 20000 } //const config = { enableHighAccuracy: true, maximumAge: 20000 } //navigator.geolocation.getCurrentPosition(successFunc, errorFunc, config); navigator.geolocation.getCurrentPosition(successFunc, errorFunc, {}); //watchLocationId = navigator.geolocation.watchPosition(successFunc, errorFunc, config); watchLocationId = navigator.geolocation.watchPosition(successFunc, errorFunc, {}); } dispose = null searchWhenNecessary(){ this.dispose = autorun('search venue autorun', () => { if (this.isSearchNecessary) { this.searchVenues() } }) } @action updateLocation(longitude, latitude){ this.location = {longitude, latitude} } @action updateVenuesStatus(status){ this.venuesStatus = status if (status === 'VENUES_NOT_EXPECTED') { //this.dispose() } } @action searchVenues(){ const params = { "ll": this.location.latitude + ', ' + this.location.longitude //"ll": "38.404895, 27.119901", //"query": "nargile" }; this.updateVenuesStatus('VENUES_LOADING') this.selectedVenueIndex = null foursquare.venues.getVenues(params) .then(action('actionVenuesLoaded', (r) => { this.venues = r.response.venues.map((venue) => { let {id, name, categories, location} = venue let {distance, lat:latitude, lng:longitude, formattedAddress, city} = location let category = categories.length ? categories[0].name : '' let address = formattedAddress.length ? formattedAddress[0] : '' return {id, name, category, address, latitude, longitude, city, distance, selected: false} }) this.venuesStatus = 'VENUES_LOADED' })) .catch( error => { //console.error(error) }) } @action selectVenue(idx){ if (this.selectedVenueIndex) { this.venues[this.selectedVenueIndex].selected = false } //console.log(this.venues[idx]); this.venues[idx].selected = true this.selectedVenueIndex = idx } checkin(){ let {id: frsqrId, name,category='',address='',latitude='',longitude='', city=''} = this.venues[this.selectedVenueIndex] let data = {frsqrId, name, category, address, latitude, longitude, city} this.appStore.cafeStore.checkin(data) } } <file_sep>/App/components/cafe/ModalProfile.js import React, {Component} from 'react' import {ActivityIndicator, Modal, Image, Text, View, ScrollView, TouchableOpacity, StyleSheet} from 'react-native' import Icon from 'react-native-vector-icons/MaterialIcons'; import { observer, inject } from 'mobx-react/native' import universities from "../../utils/universities" import { cropLastWord } from "../../utils/string" //var StyleSheet = require('react-native-debug-stylesheet'); @inject("appStore") @observer export default class ModalProfile extends Component{ render(){ const {cafeStore} = this.props.appStore const comp = cafeStore.modalProfileLoaded ? ( <ScrollView contentContainerStyle={styles.container}> <Image style={styles.photoFromFacebook} source={{ uri: cafeStore.modalProfileUser.photoURL }} /> <Text style={styles.displayNameText}> {" "}{cropLastWord(cafeStore.modalProfileUser.displayName)}{" "} </Text> <Text style={styles.uniName}> {universities.filter((item) => item.id === cafeStore.modalProfileUser.uniId)[0].name} </Text> <Text style = {styles.about}>{cafeStore.modalProfileUser.about}</Text> <View style = {styles.sendMessageView}> <Icon.Button name='message' style={styles.sendMessageButton} onPress={()=> cafeStore.openConversationWith({ uid: cafeStore.modalProfileUser.uid, uniId: cafeStore.modalProfileUser.uniId, photoURL: cafeStore.modalProfileUser.photoURL, displayName: cafeStore.modalProfileUser.displayName })}> <Text style={styles.sendMessageButtonText}>Mesajlaş</Text> </Icon.Button> </View> {/*<Button title='Mesaj' onPress={()=> cafeStore.openConversationWith({ uid: cafeStore.modalProfileUser.uid, uniId: cafeStore.modalProfileUser.uniId, photoURL: cafeStore.modalProfileUser.photoURL, displayName: cafeStore.modalProfileUser.displayName })}/>*/} </ScrollView> ) : <ActivityIndicator animating={true} style={[{height: 40}]} size="large" /> return( <Modal style={styles.modal} onRequestClose={()=>{}} visible={cafeStore.modalProfileShown}> <TouchableOpacity style={ styles.closeButton } onPress={() => cafeStore.closeModalProfile()} > <Icon name="close" size={20} color="white" /> </TouchableOpacity> {/*<Button style={styles.closeButton} title='kapat' onPress={() => cafeStore.closeModalProfile()} />*/} {comp} </Modal> ) } } const styles = StyleSheet.create({ modal: { flex: 1, top: 0, right: 0, bottom: 0, left: 0, backgroundColor: '#eeeeee', }, closeButton: { backgroundColor: 'red', width: 30, height: 30, margin: 8, marginBottom: 0, alignSelf: 'flex-end', justifyContent: 'center', alignItems: 'center', }, container: { padding: 30, paddingTop: 0, alignItems: 'center', }, photoFromFacebook: { width: 160, height: 160, borderRadius: 80, }, displayNameText: { marginTop: 20, fontSize: 24, color: "#222222", backgroundColor: 'white', textAlign: 'center', padding: 5, borderBottomWidth: 1, borderBottomColor: '#dddddd', borderRadius: 8, }, uniName: { marginTop: 15, fontSize: 18, color: "#222222", backgroundColor: 'white', textAlign: 'center', padding: 5, borderBottomWidth: 1, borderBottomColor: '#dddddd', borderRadius: 8, }, about: { marginTop: 15, fontSize: 14, color: "#222222", backgroundColor: 'white', textAlign: 'center', padding: 5, borderBottomWidth: 1, borderBottomColor: '#dddddd', borderRadius: 8, }, sendMessageView: { alignSelf: 'center', marginTop: 30, marginBottom: 30, }, sendMessageButtonText: { color: 'white', fontWeight: 'bold', marginBottom: 3, }, checkinWarning: { padding: 5, textAlign: 'center', fontSize: 16, backgroundColor: 'steelblue', borderRadius: 8 } }) <file_sep>/App/foursquare.js import foursquare from 'react-native-foursquare-api' export default foursquare({ clientID: 'WIQIJOGYPD350DOKBLGTMPRIOZPQCOTCXECQSNG54DPMBHL0', clientSecret: '<KEY>', style: 'foursquare', version: '20140806' }) /* var foursquare = require('react-native-foursquare-api')({ clientID: 'WIQIJOGYPD350DOKBLGTMPRIOZPQCOTCXECQSNG54DPMBHL0', clientSecret: '<KEY>', style: 'foursquare', version: '20140806' }); */ <file_sep>/App/components/profile/ProfileScreen.js import React, { Component } from 'react'; import { Button, Image, View, Text, Picker, ScrollView, TouchableOpacity, StyleSheet } from 'react-native'; //var StyleSheet = require('react-native-debug-stylesheet'); import Icon from 'react-native-vector-icons/MaterialIcons'; import Icon2 from 'react-native-vector-icons/Ionicons'; import { observer, inject } from 'mobx-react/native' import universities from "../../utils/universities"; import { cropLastWord } from "../../utils/string" const Item = Picker.Item @inject("appStore") @observer export default class ProfileScreen extends Component { render() { const {authStore} = this.props.appStore const uniItems = universities.map(item => <Item label={item.name} color="#333333" value={item.id} key={item.id} /> ); return ( <ScrollView contentContainerStyle={styles.container}> <Image style={styles.photoFromFacebook} source={{ uri: authStore.photoURL }} /> <Text style={styles.displayNameText}> {" "}{cropLastWord(authStore.displayName)}{" "} </Text> <View style={styles.pickerContainer}> <Picker style={styles.picker} mode="dialog" selectedValue={authStore.uniId} onValueChange={(val) => authStore.updateUniId(val)} > {uniItems} </Picker> </View> <View style = {styles.aboutView}> <View style = {styles.aboutTopView}> <Text style = {styles.aboutViewTitle}>Hakkımda: </Text> <TouchableOpacity style={ styles.editAboutButton } onPress={ () => this.props.appStore.gotoScreen('EditAbout') } > <Icon name="mode-edit" size={20} color="steelblue" /> </TouchableOpacity> </View> <Text style = {styles.about}>{authStore.about}</Text> </View> <View style = {styles.logoutView}> <Icon2.Button name='md-log-out' style={styles.logout} onPress={ () => authStore.logout()} > <Text style={styles.logOutText}>Çıkış yap</Text> </Icon2.Button> </View> </ScrollView> ); } } const styles = StyleSheet.create({ container: { //flex: 1, flexGrow: 1, alignItems: 'stretch', padding: 15, paddingTop: 0, }, pickerContainer: { alignSelf: 'stretch', backgroundColor: 'white', paddingLeft: 50, paddingRight: 50, marginTop: 20, borderBottomWidth: 1, borderBottomColor: '#dddddd', borderRadius: 8, }, photoFromFacebook: { width: 160, height: 160, borderRadius: 80, marginTop: 20, alignSelf: 'center' }, displayNameText: { marginTop: 20, fontSize: 24, color: "#222222", backgroundColor: 'white', textAlign: 'center', padding: 5, borderBottomWidth: 1, borderBottomColor: '#dddddd', borderRadius: 8, }, aboutView: { marginTop: 20, alignSelf: 'stretch', backgroundColor: 'white', borderBottomWidth: 1, borderBottomColor: '#dddddd', borderRadius: 8, padding: 20, }, aboutTopView: { flexDirection: 'row', alignSelf: 'stretch', justifyContent: 'space-between', marginBottom: 8, borderBottomWidth: 1, borderBottomColor: '#dddddd', }, aboutViewTitle: { fontSize: 18, paddingTop: 6, }, editAboutButton: { //backgroundColor: 'yellow', padding: 8 }, logoutView: { alignSelf: 'center', marginTop: 30, marginBottom: 30, }, logOutText: { color: 'white', fontWeight: 'bold', marginBottom: 3, } }); <file_sep>/App/components/cafe/CheckinList.js import React, { Component } from 'react'; import { ActivityIndicator, RefreshControl, ListView, TouchableOpacity, View, Text, StyleSheet } from 'react-native'; import { observer, inject } from 'mobx-react/native' import Checkin from './Checkin' import UniSelector from './UniSelector' import ModalProfile from './ModalProfile' //var StyleSheet = require('react-native-debug-stylesheet'); @inject("appStore") @observer export default class CheckinList extends Component { ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1.uid !== r2.uid}); render() { const {cafeStore} = this.props.appStore const {uid} = this.props.appStore.authStore let refreshing = cafeStore.checkinsStatus === 'LOADING' ? true : false return ( <View style={styles.container}> <UniSelector style={styles.uniSelector} /> <ModalProfile /> <ListView style={styles.listView} enableEmptySections={true} dataSource={this.ds.cloneWithRows(cafeStore.checkins.toJS())} refreshControl={ <RefreshControl refreshing={ refreshing } onRefresh={ () => cafeStore.refreshCheckins() } /> } renderRow={(checkin, sectionID, rowID, highlightRow) => ( <TouchableOpacity activeOpacity = {0.6} onPress={() => { if (uid !== checkin.uid) { cafeStore.openModalProfile(checkin.uid) } }}> <Checkin checkin={checkin} /> </TouchableOpacity> )}/> </View> ) } } const styles = StyleSheet.create({ container: { flex: 1, }, listView: { marginTop: 2 }, uniSelector: { alignSelf: 'center' } }); <file_sep>/App/components/cafe/CafeScreen.js import React, { Component } from 'react'; import { ActivityIndicator, View, Text, TouchableHighlight, StyleSheet } from 'react-native'; import Icon from 'react-native-vector-icons/FontAwesome' import ActionButton from 'react-native-action-button'; import { observer, inject } from 'mobx-react/native' import CheckinList from './CheckinList' //var StyleSheet = require('react-native-debug-stylesheet'); @inject("appStore") @observer export default class CafeScreen extends Component { render() { const {conversationStore} = this.props.appStore let comp = null const {cafeStore} = this.props.appStore if (cafeStore) { if (cafeStore.isCheckingin) { //comp = <Text>checkin yapılıyor ..</Text> comp = <ActivityIndicator animating={true} style={[{height: 40}]} size="large" /> } else if (cafeStore.lastCheckinStatus === 'LOADING') { //comp = <Text>last checkins geliyor..</Text> comp = <ActivityIndicator animating={true} style={[{height: 40}]} size="large" /> } else if (cafeStore.lastCheckinStatus === 'NOT_EXIST') { comp = <Text style={styles.checkinWarning}>Checkin yap, yakın çevreni keşfet!</Text> //comp = <CheckinList /> } else if (cafeStore.checkinsStatus === 'LOADING') { //comp = <Text>checkin ler gelecek yenilenecek</Text> } else { comp = <CheckinList /> } } else { //comp = <Text> cafeStore oluşturuluyor </Text> comp = <ActivityIndicator animating={true} style={[{height: 40}]} size="large" /> } // buttonColor="rgba(231,76,60,1)" return ( <View style={styles.container}> {comp} <ActionButton buttonColor='steelblue' onPress={() => cafeStore.checkinRequested() } icon={<Icon name="map-marker" style={styles.actionButton} />} /> </View> ); } componenWillMount(){ this.appStore.cafeStore.refreshCheckins() } actionButton = null } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'stretch', paddingTop: 10, }, actionButton: { color: 'white', fontSize: 35, }, checkinWarning: { textAlign: 'center', fontSize: 18, marginBottom: 150, } }); <file_sep>/package.json { "name": "unizone", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest" }, "dependencies": { "babel-cli": "^6.24.0", "babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-preset-es2015": "^6.24.0", "firebase": "^3.7.4", "mobx": "^3.1.9", "mobx-logger": "^0.5.0", "mobx-react": "^4.1.5", "mobx-react-devtools": "^4.2.11", "moment": "^2.18.1", "react": "~15.4.1", "react-native": "0.42.3", "react-native-action-button": "^2.6.5", "react-native-code-push": "^1.17.3-beta", "react-native-debug-stylesheet": "^0.1.1", "react-native-fcm": "^6.2.3", "react-native-foursquare-api": "^0.0.4", "react-native-gifted-chat": "^0.1.4", "react-native-keyboard-aware-scroll-view": "^0.2.8", "react-native-mobx": "^0.3.1", "react-native-root-modal": "^1.1.0", "react-native-social-auth": "^1.0.0", "react-native-vector-icons": "^4.0.0", "react-navigation": "^1.0.0-beta.7" }, "devDependencies": { "babel-jest": "19.0.0", "babel-preset-react-native": "1.9.1", "jest": "19.0.2", "react-test-renderer": "~15.4.1" }, "jest": { "preset": "react-native" } }
581c0244839f44243709c0e111aba6c17873d423
[ "JavaScript", "JSON", "Gradle" ]
26
JavaScript
alican-k/mobxUnizone
365dee8d1cc05e0a4dd89671ca889bc0724e5fd1
3b88f5aa2b28ea56b7d9075dfbe28c96d63d5203
refs/heads/master
<repo_name>WesleySerrano/AirMeshApplication<file_sep>/SoftBody.cpp #include "SoftBody.h" SoftBody::SoftBody() : GameObject() { } SoftBody::SoftBody(int numberOfNodes, double startX, double startY, double startOffset, double maxOffset, double nodesMass, btDiscreteDynamicsWorld* dynamicsWorld, bool fixed) { this->numberOfNodes = numberOfNodes; this->nodes = new GameObject*[numberOfNodes]; const float HALF_WIDTH = 2.0, HALF_HEIGHT = 2.0; for(int i = 0; i < numberOfNodes; i++) { this->nodes[i] = new GameObject(HALF_WIDTH, HALF_HEIGHT, startX + i*startOffset, startY, nodesMass); this->nodes[i]->setActiveStatus(true); if(i > 0) { btPoint2PointConstraint* c = new btPoint2PointConstraint(*this->nodes[i - 1], *this->nodes[i], btVector3(maxOffset, 0, 0), btVector3(-maxOffset, 0, 0)); dynamicsWorld->addConstraint(c); } dynamicsWorld->addRigidBody(this->nodes[i]); } if(fixed) { dynamicsWorld->addConstraint(new btPoint2PointConstraint(*this->nodes[0], btVector3(0,0,0))); dynamicsWorld->addConstraint(new btPoint2PointConstraint(*this->nodes[numberOfNodes - 1], btVector3(0,0,0))); } } void SoftBody::render() { for(int i = 1; i < this->numberOfNodes; i++) { btVector3 p0 = this->nodes[i - 1]->getPosition(); btVector3 p1 = this->nodes[i]->getPosition(); const double X0 = p0.getX(), Y0 = -p0.getY() + Allegro::HEIGHT; const double X1 = p1.getX(), Y1 = -p1.getY() + Allegro::HEIGHT; al_draw_line(X0,Y0,X1,Y1,al_map_rgb(255,255,0),2); } } <file_sep>/GameObject.cpp #include "GameObject.h" GameObject::GameObject() : btRigidBody(btScalar(0), NULL, NULL, btVector3(0,0,0)) { this->halfWidth = 0; this->halfHeight = 0; } GameObject::GameObject(double halfWidth, double halfHeight, double x, double y, double mass) : btRigidBody(createRigidBody(halfWidth, halfHeight, x, y, mass)) { this->halfWidth = halfWidth; this->halfHeight = halfHeight; this->mass = mass; this->color.setValue(0, 255, 0); this->active = false; this->visible = false; this->setLinearFactor(btVector3(1, 1, 0)); this->setAngularFactor(btVector3(0, 0, 1)); } void GameObject::render() { btVector3 position = this->getPosition(); const double X = position.getX(), Y = -position.getY() + Allegro::HEIGHT; al_draw_rectangle(X - this->halfWidth, Y - this->halfHeight, X + this->halfWidth, Y + this->halfHeight, al_map_rgb(this->color.getX(), this->color.getY(), this->color.getZ()), 0); } void GameObject::setSprite(float r, float g, float b) { this->color.setValue(r, g, b); } void GameObject::setSprite(btVector3 color) { this->color = color; } void GameObject::update() { } btRigidBody::btRigidBodyConstructionInfo GameObject::createRigidBody(double halfWidth, double halfHeight, double x, double y, double mass) { btBoxShape* shape = new btBoxShape(btVector3(halfWidth, halfHeight, 10)); btTransform transform; transform.setIdentity(); transform.setOrigin(btVector3(x, y, 0)); this->setWorldTransform(transform); btAssert((!shape || shape->getShapeType() != INVALID_SHAPE_PROXYTYPE)); bool isDynamic = (mass != 0.f); btVector3 localInertia(0, 0, 0); if(isDynamic) { shape->calculateLocalInertia(mass, localInertia); } btDefaultMotionState *motionState = new btDefaultMotionState(btTransform(btQuaternion(0, 0, 0, 1), btVector3(x, y, 0))); btRigidBody::btRigidBodyConstructionInfo constructionInfo(mass, motionState, shape, localInertia); if(!isDynamic) { constructionInfo.m_friction = 1.5; constructionInfo.m_restitution = 1.3; } return constructionInfo; } btVector3 GameObject::getPosition() { btTransform trans; this->getMotionState()->getWorldTransform(trans); return trans.getOrigin(); } void GameObject::setPosition(int x, int y) { btTransform transform; transform.setIdentity(); transform.setOrigin(btVector3(x, y, 0)); this->setWorldTransform(transform); } btVector3* GameObject::getCorners() { btVector3 position = this->getPosition(); double X = position.getX(), Y = position.getY(); btVector3* results = new btVector3[4]; //std::cout << X << ", " << Y << ", " << position.getZ() << ", " << halfWidth << ", " << halfHeight << std::endl; /* 3 - 2 | | 0 - 1 */ results[0] = btVector3(X - halfWidth, Y - halfHeight,0); results[1] = btVector3(X + halfWidth, Y - halfHeight,0); results[2] = btVector3(X + halfWidth, Y + halfHeight,0); results[3] = btVector3(X - halfWidth, Y + halfHeight,0); return results; } bool GameObject::isActive() { return this->active; } void GameObject::setActiveStatus(bool status) { this->active = status; } bool GameObject::isVisible() { return this->visible; } void GameObject::setVisibleStatus(bool status) { this->visible = status; } double GameObject::getHalfWidth() { return this->halfWidth; } double GameObject::getHalfHeight() { return this->halfHeight; } double GameObject::getMass() { return this->mass; }<file_sep>/GameScene.h #ifndef GAMESCENE_H #define GAMESCENE_H #define BIT(x) (1<<(x)) #include <cstdio> #include "Player.h" #include "Spawner.h" #include "SoftBody.h" using namespace std; class GameScene { public: /** * Constructor. Initializes Allegro directives, the simulation step, * the Physics world and the objects on scene */ GameScene(); /** * The game/scene's main loop. Updates each object's properties * each frame and the event queue. */ void loop(); /** * Gets the variable describing the physics world * @return The informations about the physics world */ btDiscreteDynamicsWorld* getDynamicsWorld() {return this->dynamicsWorld;} private: void addObjectToTriangulation(btVector3, btVector3*); void createGameObjects(); void createDynamicsWorld(); void initializeTetGen(); void outputTriangulation(); void processEvent(ALLEGRO_EVENT&); void render(); void setGravity(btVector3); void tick(btScalar timeStep); void triangulateObjects(); void update(); btDiscreteDynamicsWorld *dynamicsWorld; float TIME_STEP; Player *player; Spawner *enemySpawner; SoftBody* sb; enum collisionTypes {COLLIDES_WITH_WALL = 0, COLLIDES_WITH_OBJECTS = BIT(0)}; }; #endif<file_sep>/Enemy.cpp #include "Enemy.h" Enemy::Enemy() : GameObject() { } Enemy::Enemy(double halfWidth, double halfHeight, double x, double y, double mass) : GameObject(halfWidth, halfHeight, x, y, mass) { }<file_sep>/makefile COMPILER = g++ -std=c++11 C_COMPILER = gcc C_SWITCHES = -O -DLINUX -I/usr/X11R6/include -L/usr/X11R6/lib TRILIBDEFS = -DTRILIBRARY -DANSI_DECLARATORS ALLEGRO_PATH = /usr/local/include/allegro5 ALLEGRO_LIBRARIES_PATHS = -I $(ALLEGRO_PATH) BULLET_INCLUDE_PATH = /usr/local/include/bullet BULLET_LINK_PATH = /usr/local/lib BULLET_LIBRARIES_PATHS = -I$(BULLET_INCLUDE_PATH) -L$(BULLET_LINK_PATH) -Wl,-rpath=$(BULLET_LINK_PATH) EIGEN_LIBRARIES = /usr/local/include/eigen3/ BULLET_LIBRARIES = -lBulletDynamics -lBulletCollision -lBulletSoftBody -lLinearMath ALLEGRO_LIBRARIES = -lallegro -lallegro_image -lallegro_primitives -lallegro_font -lallegro_ttf -lallegro_audio -lallegro_acodec LIBRARIES = $(BULLET_LIBRARIES) $(ALLEGRO_LIBRARIES) INCLUDE_PATHS = $(BULLET_LIBRARIES_PATHS) main: main.cpp GameObject GameScene Spawner Player Enemy Allegro SoftBody triangle $(COMPILER) $(C_SWITCHES) main.cpp GameObject.o Spawner.o Player.o Enemy.o SoftBody.o GameScene.o Allegro.o triangle.o -o main $(LIBRARIES) $(INCLUDE_PATHS) debug: main.cpp GameObject GameScene Spawner Player Enemy Allegro SoftBody triangle $(COMPILER) $(C_SWITCHES) main.cpp GameObject.o Spawner.o Player.o Enemy.o SoftBody.o GameScene.o Allegro.o triangle.o -g $(LIBRARIES) $(INCLUDE_PATHS) Spawner: Spawner.h $(COMPILER) $(LIBRARIES) $(INCLUDE_PATHS) -c Spawner.cpp Player: Player.h $(COMPILER) $(LIBRARIES) $(INCLUDE_PATHS) -c Player.cpp Enemy: Enemy.h $(COMPILER) $(LIBRARIES) $(INCLUDE_PATHS) -c Enemy.cpp SoftBody: SoftBody.h $(COMPILER) $(LIBRARIES) $(INCLUDE_PATHS) -c SoftBody.cpp GameObject: GameObject.h $(COMPILER) $(LIBRARIES) $(INCLUDE_PATHS) -c GameObject.cpp GameScene: GameScene.h $(COMPILER) $(LIBRARIES) $(INCLUDE_PATHS) -c GameScene.cpp Allegro: Allegro.h $(COMPILER) $(ALLEGRO_LIBRARIES) -c Allegro.cpp trilibrary: triangle tricall triangle: triangle.h $(COMPILER) $(C_SWITCHES) $(TRILIBDEFS) -c triangle.cpp tricall: tricall.c triangle $(C_COMPILER) $(C_SWITCHES) -o tricall tricall.c triangle.o -lm clean: rm main *.o <file_sep>/SoftBody.h #ifndef SOFTBODY_H #define SOFTBODY_H #include "GameObject.h" class SoftBody : public GameObject { public: SoftBody(); SoftBody(int, double, double , double, double, double, btDiscreteDynamicsWorld*, bool fixed = false); void render(); private: GameObject** nodes; int numberOfNodes; }; #endif<file_sep>/GameScene.cpp #include "GameScene.h" #define REAL double #include "triangle.h" void tickCallback(btDynamicsWorld *world, btScalar timeStep) { long numManifolds = world->getDispatcher()->getNumManifolds(); if(numManifolds) { } } void printTriangleIO(triangulateio data) { std::cout << "Number of points: " << data.numberofpoints << std::endl; std::cout << "Number of holes: " << data.numberofholes << std::endl; std::cout << "Number of segments: " << data.numberofsegments << std::endl; std::cout << "Number of regions: " << data.numberofregions << std::endl; std::cout << "Number of points attributes: " << data.numberofpointattributes << std::endl; std::cout << "Points:" << std::endl; for(int i = 0; i < 2*data.numberofpoints; i++) { if(i%2==0) std::cout << "(" << data.pointlist[i] << ","; else std::cout << data.pointlist[i] << ") "; } std::cout<<std::endl; std::cout << "Holes:" << std::endl; for(int i = 0; i < 2*data.numberofholes; i++) { if(i%2==0) std::cout << "(" << data.holelist[i] << ","; else std::cout << data.holelist[i] << ") "; } std::cout<<std::endl; std::cout << "Segments:" << std::endl; for(int i = 0; i < 2*data.numberofsegments; i++) { if(i%2==0) std::cout << "(" << data.segmentlist[i] << " - "; else std::cout << data.segmentlist[i] << ") "; } std::cout<<std::endl<<std::endl; } void GameScene::addObjectToTriangulation(btVector3 position, btVector3* corners) { const short NUMBER_OF_COORDINATES = 3; const short NUMBER_OF_NEW_OBJECTS = 4; //const long PREVIOUS_NUMBER_OF_POINTS = this->verticesOnScene->numberofpoints; } GameScene::GameScene() { this->TIME_STEP = 1.0/Allegro::FPS; const int NUMBER_OF_ENEMIES = 100; const int OBJECTS_PER_ROUND = 5; const int WIDTH = 400; const int HORIZONTAL_POSITION = 50; const int VERTICAL_POSITION = 400; const double TIME_INTERVAL = 1.0; this->enemySpawner = new Spawner(NUMBER_OF_ENEMIES, OBJECTS_PER_ROUND, WIDTH, HORIZONTAL_POSITION, VERTICAL_POSITION, TIME_INTERVAL); Allegro::initialize(Allegro::WIDTH, Allegro::HEIGHT, "AirMeshApplication"); this->createDynamicsWorld(); this->createGameObjects(); } void GameScene::loop() { bool refresh = true; ALLEGRO_EVENT event; while(42) { al_wait_for_event(Allegro::eventQueue, &event); if(event.type == ALLEGRO_EVENT_TIMER) { refresh = true; this->update(); } else if(event.type != ALLEGRO_EVENT_DISPLAY_CLOSE) { this->processEvent(event); } else { break; } if(refresh && al_is_event_queue_empty(Allegro::eventQueue)) { refresh = false; this->triangulateObjects(); this->render(); al_flip_display(); al_clear_to_color(al_map_rgb(0, 0, 0)); } } } void GameScene::processEvent(ALLEGRO_EVENT& event) { this->player->processEvent(event); } void GameScene::createGameObjects() { const int PLAYER_COLLIDES_WITH = COLLIDES_WITH_WALL | COLLIDES_WITH_OBJECTS; const int WALL_COLLIDES_WITH = COLLIDES_WITH_OBJECTS; this->player = new Player(10, 10, 140, 300, 0); this->player->setActiveStatus(true); this->player->setVisibleStatus(true); Enemy *enemy = new Enemy(5, 5, -100, -100, 1); this->enemySpawner->setTemplateParameters(enemy); this->enemySpawner->setTemplateSprite(255, 0, 0); const int NUM_CHAIN_NODES = 30; float startX = 100, startY = 400, halfWidth = 4, halfHeight = 4, mass = 1; const float DISTANCE_CONSTRAINT = 4; const float OFFSET = 8; this->sb = new SoftBody(NUM_CHAIN_NODES,startX,startY,OFFSET,DISTANCE_CONSTRAINT, 1, this->dynamicsWorld, false); GameObject *ground = new GameObject(400, 4, 400, 10, 0); ground->setActiveStatus(true); ground->setVisibleStatus(true); btVector3* playerCorners = player->getCorners(); btVector3* groundCorners = ground->getCorners(); this->addObjectToTriangulation(this->player->getPosition(),playerCorners); this->addObjectToTriangulation(ground->getPosition(),groundCorners); /* for(short i = 0; i < 8; i++) { cout << "(x,y,z) = (" << this->verticesOnScene->pointlist[3*i] << " "<< this->verticesOnScene->pointlist[3*i + 1] << " "<< this->verticesOnScene->pointlist[3*i + 2] << ")\n"; } */ this->dynamicsWorld->addRigidBody(player); this->dynamicsWorld->addRigidBody(ground); } void GameScene::createDynamicsWorld() { const double GRAVITY = -98.0f; btDbvtBroadphase *broadphase = new btDbvtBroadphase(); btDefaultCollisionConfiguration *collisionConfiguration = new btDefaultCollisionConfiguration(); btCollisionDispatcher *dispatcher = new btCollisionDispatcher(collisionConfiguration); btSequentialImpulseConstraintSolver *solver = new btSequentialImpulseConstraintSolver; this->dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration); //this->dynamicsWorld->setInternalTickCallback(tickCallback); this->setGravity(btVector3(0, GRAVITY, 0)); } void GameScene::setGravity(btVector3 gravity) { this->dynamicsWorld->setGravity(gravity); } void GameScene::render() { this->sb->render(); for (int j = this->getDynamicsWorld()->getNumCollisionObjects() - 1; j >= 0; --j) { GameObject *obj = (GameObject*)this->getDynamicsWorld()->getCollisionObjectArray()[j]; if(obj->isVisible())obj->render(); } } void GameScene::triangulateObjects() { char* triswitches; struct triangulateio in, out, vorout; const long NUMBER_OF_OBJECTS = this->getDynamicsWorld()->getNumCollisionObjects(); long pointsCount = 0, segmentsCount = 0; in.numberofpoints = 4*(NUMBER_OF_OBJECTS + 1); in.numberofpointattributes = 0; in.numberofsegments = 4*(NUMBER_OF_OBJECTS + 1); in.numberofholes = NUMBER_OF_OBJECTS; in.numberofregions = 0; in.pointlist = (REAL *) malloc(in.numberofpoints * 2 * sizeof(REAL)); in.segmentlist = (int *) malloc(in.numberofsegments*2*sizeof(int)); in.holelist = (REAL *) malloc(in.numberofholes*2*sizeof(REAL)); in.pointattributelist = (REAL *) NULL; in.pointmarkerlist = (int *) NULL; in.segmentmarkerlist = (int *) NULL; for (int j = NUMBER_OF_OBJECTS - 1; j >= 0; --j) { GameObject *obj = (GameObject*)this->getDynamicsWorld()->getCollisionObjectArray()[j]; btVector3 objPosition = obj->getPosition(); const double X = objPosition.getX(); const double Y = objPosition.getY(); const double halfHeight = obj->getHalfHeight(); const double halfWidth = obj->getHalfWidth(); if(in.numberofsegments > 0) { const long BASE_INDEX = pointsCount/2; in.segmentlist[segmentsCount++] = BASE_INDEX; in.segmentlist[segmentsCount++] = BASE_INDEX+1; in.segmentlist[segmentsCount++] = BASE_INDEX+1; in.segmentlist[segmentsCount++] = BASE_INDEX+2; in.segmentlist[segmentsCount++] = BASE_INDEX+2; in.segmentlist[segmentsCount++] = BASE_INDEX+3; in.segmentlist[segmentsCount++] = BASE_INDEX+3; in.segmentlist[segmentsCount++] = BASE_INDEX; } in.pointlist[pointsCount++] = X - halfWidth; in.pointlist[pointsCount++] = Y - halfHeight; in.pointlist[pointsCount++] = X + halfWidth; in.pointlist[pointsCount++] = Y - halfHeight; in.pointlist[pointsCount++] = X + halfWidth; in.pointlist[pointsCount++] = Y + halfHeight; in.pointlist[pointsCount++] = X - halfWidth; in.pointlist[pointsCount++] = Y + halfHeight; if(in.numberofholes > 0) { in.holelist[2 * j] = X; in.holelist[2 * j + 1] = Y; } } if(in.numberofsegments > 0) { const long BASE_INDEX = pointsCount/2; in.segmentlist[segmentsCount++] = BASE_INDEX; in.segmentlist[segmentsCount++] = BASE_INDEX+1; in.segmentlist[segmentsCount++] = BASE_INDEX+1; in.segmentlist[segmentsCount++] = BASE_INDEX+2; in.segmentlist[segmentsCount++] = BASE_INDEX+2; in.segmentlist[segmentsCount++] = BASE_INDEX+3; in.segmentlist[segmentsCount++] = BASE_INDEX+3; in.segmentlist[segmentsCount++] = BASE_INDEX; } in.pointlist[pointsCount++] = 0.0; in.pointlist[pointsCount++] = 0.0; in.pointlist[pointsCount++] = Allegro::WIDTH; in.pointlist[pointsCount++] = 0.0; in.pointlist[pointsCount++] = Allegro::WIDTH; in.pointlist[pointsCount++] = Allegro::HEIGHT; in.pointlist[pointsCount++] = 0.0; in.pointlist[pointsCount++] = Allegro::HEIGHT; out.pointlist = (REAL *) NULL; out.pointattributelist = (REAL *) NULL; out.pointmarkerlist = (int *) NULL; out.trianglelist = (int *) NULL; out.triangleattributelist = (REAL *) NULL; out.neighborlist = (int *) NULL; out.segmentlist = (int *) NULL; out.segmentmarkerlist = (int *) NULL; out.edgelist = (int *) NULL; out.edgemarkerlist = (int *) NULL; vorout.pointlist = (REAL *) NULL; vorout.pointattributelist = (REAL *) NULL; vorout.edgelist = (int *) NULL; vorout.normlist = (REAL *) NULL; std::string switchesStr = "pQz"; char *switches = new char[switchesStr.length() + 1]; strcpy(switches,switchesStr.c_str()); //printTriangleIO(in); triangulate(switches, &in, &out, &vorout); for(int i = 0; i < out.numberoftriangles; i++) { const long P0 = out.trianglelist[3*i]; const long P1 = out.trianglelist[3*i+1]; const long P2 = out.trianglelist[3*i+2]; const double X0 = out.pointlist[2*P0], Y0 = Allegro::HEIGHT-out.pointlist[2*P0 + 1]; const double X1 = out.pointlist[2*P1], Y1 = Allegro::HEIGHT-out.pointlist[2*P1 + 1]; const double X2 = out.pointlist[2*P2], Y2 = Allegro::HEIGHT-out.pointlist[2*P2 + 1]; al_draw_triangle(X0, Y0, X1, Y1, X2, Y2, al_map_rgb(255,255,255),0); } } void GameScene::update() { this->getDynamicsWorld()->stepSimulation(TIME_STEP, 10); this->enemySpawner->spawn(this->dynamicsWorld); for (int j = this->getDynamicsWorld()->getNumCollisionObjects() - 1; j >= 0; --j) { if(dynamic_cast<Player*>(this->getDynamicsWorld()->getCollisionObjectArray()[j])) { Player* obj = dynamic_cast<Player*>(this->getDynamicsWorld()->getCollisionObjectArray()[j]); if(obj->isActive())obj->update(); } else if(dynamic_cast<Enemy*>(this->getDynamicsWorld()->getCollisionObjectArray()[j])) { Enemy *obj = dynamic_cast<Enemy*>(this->getDynamicsWorld()->getCollisionObjectArray()[j]); if(obj->isActive())obj->update(); } } }<file_sep>/GameObject.h #ifndef GAMEOBJECT_H #define GAMEOBJECT_H #include <iostream> #include "Allegro.h" #include <btBulletDynamicsCommon.h> #include <LinearMath/btVector3.h> #include <LinearMath/btAlignedObjectArray.h> class GameObject : public btRigidBody { public: GameObject(); GameObject(double, double , double, double, double); bool isActive(); bool isVisible(); btVector3 getPosition(); btVector3* getCorners(); double getHalfWidth(); double getHalfHeight(); double getMass(); void render(); void setActiveStatus(bool); void setPosition(int, int); void setSprite(btVector3); void setSprite(float, float , float); void setVisibleStatus(bool); void update(); protected: btRigidBody::btRigidBodyConstructionInfo createRigidBody(double, double , double, double, double); double halfWidth; double halfHeight; double mass; btVector3 color; bool active; bool visible; }; #endif <file_sep>/README.md # AirMeshApplication A Demo Application using Air Meshes Physics system. Made as a MsC. thesis
26d66815ba68fccf357431652688e0efcd7d2812
[ "Markdown", "Makefile", "C++" ]
9
C++
WesleySerrano/AirMeshApplication
4e7f52c95caa6ac1a57b98cb1f7e2c37914c9724
3b82065aecad47c08023788f43ee221295f0bd2d
refs/heads/main
<repo_name>Arose-Niazi/FA18-BSE-078-S2-WT<file_sep>/index.php <?php includ_once("users.html"); ?>
cd4f0955725a48343352e1fd8d9d815d82080d33
[ "PHP" ]
1
PHP
Arose-Niazi/FA18-BSE-078-S2-WT
26daa65ff92e048247aa599349951d3518ac3592
77e0ca6476a410bc8c1ebf35fb0de31026fd3b8f
refs/heads/master
<repo_name>aetilley/sigclust<file_sep>/tests/sigclust_tests.py # from nose.tools import * import numpy as np from sigclust.sigclust import sigclust def sig_test_1(shape=(50, 50), iters=20): """ Run sigclust on randomly generated datasets and print results. :Parameters: shape : tuple Shape of randomly generated datasets iters : int Number of iterations """ result = np.zeros(iters) for i in np.arange(iters): print("Simulating random data of shape %r..." % str(shape)) X = np.random.rand(shape[0], shape[1]) print("Running sigclust on generated data...") p = sigclust(X)[0] result[i] = p mu = np.mean(result) sig = np.std(result) print("The set of %d p-values had\nmean: %f and\n" "standard deviation: %f\n" % (iters, mu, sig)) assert(mu < .98, "Warning: High average p-value for input matrices of random " "normal data.") assert(mu > .01, "Warning: Low average p-value for input matrices of random " "normal data.") def sig_test_2(shape=(50, 50), iters=20): """ Run sigclust on randomly generated datasets and print results. :Parameters: shape : tuple Shape of randomly generated datasets iters : int Number of iterations """ result = np.zeros(iters) for i in np.arange(iters): print("Simulating random data of shape %r..." % str(shape)) X = np.random.rand(shape[0], shape[1]) print("Running sigclust on generated data...") p = sigclust(X, method = 0)[0] result[i] = p mu = np.mean(result) sig = np.std(result) print("The set of %d p-values had\nmean: %f and\n" "standard deviation: %f\n" % (iters, mu, sig)) assert(mu < .98, "Warning: High average p-value for input matrices of random " "normal data.") assert(mu > .01, "Warning: Low average p-value for input matrices of random " "normal data.") <file_sep>/README.txt This package contains a Python implementation of the SigClust algorithm originally proposed in [1] and whose soft-thresholding variant is given in [2]. See /docs for papers giving a formal description of the SigClust algorithm and for the official R documentation on the R package sigclust. /sigclust contains the module sigclust.py in which the sigclust function is defined as are the functions MAD, cluster_index_2, comp_sim_var, comp_sim_tau used by the sigclust function. /sigclust also contains a module recclust.py containing a function recclust, which recursively applies sigclust to a data matrix and then to all sub-clusters, sub-sub-clusters, etc., until all further clusterings would correspond to a p-value above a certain user-defined cutoff. /enwiki_data contains data2.tsv whose near 20,000 rows each represent feature values for English Wikipedia article revisions and whose last column gives target labels of "damaging / non-damaging." /enwiki_data also contains a module read.py containing a utility "get_mat" for reading tsv files into numpy arrays to be passed to sigclust. /tests is limited at this point, but contains some nose tests that runs sigclust on randomly generated data and makes sure the mean p-value returned is not too small or large. There is also an R script R_read.R which runs the R sigclust function on the enwiki_data and some randomly generated data. This package was developed by <NAME> and sprung out of interest in clustering Wikipedia article revisions while funded by an Individual Engagement Grant from the Wikimedia Foundation. Arthur can be reached at aetilley at gmail. [1] <NAME>, <NAME>, <NAME> and <NAME>, Statistical Significance of Clustering for High-Dimension, Low-Sample Size Data, Journal of the American Statistical Association, Vol. 103, No. 483 (Sep., 2008), pp. 1281-1293 [2] <NAME>, <NAME>, <NAME>, <NAME>, Statistical Significance of Clustering using Soft Thresholding, Journal of Computational and Graphical Statistics, 2014 (DOI:10.1080/10618600.2014.948179) <file_sep>/enwiki_data/similarity.py import numpy as np from enwiki_data.read import get_mat from sigclust.sigclust import sigclust DFILE = "enwiki_data/data2.tsv" """Data File Name""" def pos_labels(i): """A predicate to define a default subset of the set of row indices.""" return labels[i] == 1 SUB_PRED = pos_labels """ Set a one place predicate (boolean valued) defining the subpopulation of interest. """ ITERS_S = 50 ITERS_B = 100 """Number of iterations for the monte carlo step of the sigclust algorithm to be run on the subset (_S) and whole population (_B)""" ids, features, labels = get_mat(DFILE) # Sets of row indices for the whole set # and for the subset of interest. popul_ind = (np.arange(ids.shape[0])) subpop_bool = SUB_PRED(popul_ind) subpop_ind = popul_ind[subpop_bool] # Sizes of two populations BIG = ids.shape[0] SMALL = subpop_ind.shape[0] # The incoming data restricted # to the subpopulation ids_sub = ids[subpop_bool] features_sub = features[subpop_bool, :] labels_sub = labels[subpop_bool] # First we cluster the whole population print("Computing p-value for population.") p, clust = sigclust(features, mc_iters=ITERS_B) print("p-value for population: %f" % p) clust0_bool = clust == 0 clust0_ind = popul_ind[clust0_bool] clust1_bool = ~clust0_bool clust1_ind = popul_ind[clust1_bool] ss_of_clust0_bool = clust0_bool & subpop_bool ss_of_clust1_bool = clust1_bool & subpop_bool """ The clusters of the whole population determine two subsets (their respective intersections with the subpopulation)""" # Now to cluster the smaller set directly print("Computing p-value for sub-population.") p_sub, clust_sub = sigclust(features_sub, mc_iters=ITERS_S) print("p-value for subpopulation: %f" % p_sub) # ndarrays to hold boolean representation of # two clusters of subpopulation subclust0_bool = np.zeros(BIG).astype(bool) subclust1_bool = np.zeros(BIG).astype(bool) for j in np.arange(SMALL): i = subpop_ind[j] if clust_sub[j] == 0: subclust0_bool[i] = True else: subclust1_bool[i] = True subclust0_ind = popul_ind[subclust0_bool] subclust1_ind = popul_ind[subclust1_bool] # Now want to test the extent to which # subclust{0,1}_ind contained in clust{0,1}_ind inter_0_0 = subclust0_bool & ss_of_clust0_bool inter_0_1 = subclust0_bool & ss_of_clust1_bool inter_1_0 = subclust1_bool & ss_of_clust0_bool inter_1_1 = subclust1_bool & ss_of_clust1_bool union_0_0 = subclust0_bool | ss_of_clust0_bool union_0_1 = subclust0_bool | ss_of_clust1_bool union_1_0 = subclust1_bool | ss_of_clust0_bool union_1_1 = subclust1_bool | ss_of_clust1_bool jac_0_0 = inter_0_0.sum() / union_0_0.sum() jac_0_1 = inter_0_1.sum() / union_0_1.sum() jac_1_0 = inter_1_0.sum() / union_1_0.sum() jac_1_1 = inter_1_1.sum() / union_1_1.sum() print("Clustering and then taking the respective intersections " "of the clusters with the subset in question gives a " "partition of size (%d, %d)." % (ss_of_clust0_bool.astype(int).sum(), ss_of_clust1_bool.astype(int).sum())) print("On the other hand, clustering the subset in question " "directly gives a partition of size (%d, %d)." % (subclust0_bool.astype(int).sum(), subclust1_bool.astype(int).sum())) print(""" These two partitions determine a four member partition refinement. Specifically, letting S = the defined subset of indices A = The intersection of S with the first outer cluster B = The intersection of S with the second outer cluster C = First (inner) cluster of S D = Second (inner) cluster of S The four possible intersections have sizes |A&C|: %d, |A&D|: %d, |B&C|: %d, |B&D|: %d.""" % (inter_0_0.astype(int).sum(), inter_0_1.astype(int).sum(), inter_1_0.astype(int).sum(), inter_1_1.astype(int).sum())) print("""The four possible unions have sizes |A|C|: %d, |A|D|: %d, |B|C|: %d, |B|D|: %d.""" % (union_0_0.astype(int).sum(), union_0_1.astype(int).sum(), union_1_0.astype(int).sum(), union_1_1.astype(int).sum())) print("""And so the four corresponding Jaccard indices are J(A,C): %f, J(A,D): %f, J(B,C): %f, J(B,D): %f""" % (jac_0_0, jac_0_1, jac_1_0, jac_1_1)) <file_sep>/sigclust/recclust.py import numpy as np from .sigclust import sigclust def recclust(X, threshold=.01, mc_iters=100, verbose=True, prefix="/", IDS=np.arange(0)): """ Recursively apply sigclust to subclusters of X until all remaining clusters have sigclust p-value below threshold. Returns dictionary with entries having keys "prefix", "pval", "subclust0", "subclust1", and "ids". "prefix" is a string representation for a path from the root cluster consisting of all samples in the input X. "pval" is the p-value of cluster 'prefix' "subclust{0,1}" are dictionaries of the same form as this, representing the two primary subclusters of the cluster 'prefix'. Note that these may be None if pval greater than threshold. "ids" is a numpy array of keys to use to record the cluster elements themselves. Note that this may be None if pval is greater than threshold. "tot" is the total number of samples in the cluster. """ if IDS.shape[0] == 0: IDS = np.arange(X.shape[0]) assert IDS.shape[0] == X.shape[0], """Input data and tag list must have compatible dimensions (or tag list must be None).""" data = { "prefix": prefix, "pval": None, "subclust0": None, "subclust1": None, "ids": None, "tot": 1} if X.shape[0] == 1: data["ids"] = IDS print("Cluster %s has exactly one element." % prefix) else: p, clust = sigclust( X, mc_iters=mc_iters, verbose=verbose) print("The p value for\n" "subcluster id %s is %f" % (prefix, p)) data["pval"] = p if p >= threshold: data["ids"] = IDS else: pref0 = prefix + "0" pref1 = prefix + "1" print("Examining sub-clusters\n" "%s and %s" % (pref0, pref1)) data_0 = X[clust == 0, :] data_1 = X[clust == 1, :] print("Computing RecClust data\n" "for first cluster.\nPlease wait...") dict0 = recclust(data_0, prefix=prefix + "0", IDS=IDS[clust == 0]) print("Computing Recclust data\n" "for second cluster.\nPlease wait...") dict1 = recclust(data_1, prefix=prefix + "1", IDS=IDS[clust == 1]) data["subclust0"] = dict0 data["subclust1"] = dict1 data["tot"] = dict0["tot"] + dict1["tot"] return data <file_sep>/enwiki_data/read.py import numpy as np from editquality.feature_lists import enwiki from sigclust.sigclust import sigclust def read_data(f, features, rids=False): """ Expect f to have tsv format. Reads a set of features and a label from a file one row at a time. rids says to expect the first column to be id numbers. """ # Implicitly splits rows on \n for line in f: # Splits columns on \t parts = line.strip().split("\t") if rids: rev_id = parts[0] parts = parts[1:] # All but the last column are feature values. values = parts[:-1] # Last column is a label label = parts[-1] feature_values = [] for feature, value in zip(features, values): # Each feature knows its type and will perform the right conversion if feature.returns == bool: # Booleans are weird. bool("False") == True. # so you need to string match "True" feature_values.append(value == "True") else: feature_values.append(feature.returns(value)) row = feature_values[:] row.append(label == "True") if rids: row.insert(0, int(rev_id)) yield row def get_mat(file_name, rids=True): """ Read data in file_name into a np. array. When rids == False, assumes all columns of the file from file_name are feature values except for the last column, which is assumed to contain labels. Returns two element tuple (values, labels). When rids == True, assumes in addition that the first column is rev_ids and returns a three element tuple (ids, values, labels). """ f = open(file_name) rows = list(read_data(f, enwiki.damaging, rids)) mat = np.array(rows).astype(float) # Last column is the label labels = mat[:, -1] result = mat[:, :-1] # If rids then expect first column to be rev_ids if rids: rid_col = result[:, 0] return rid_col, result[:, 1:], labels else: return result, labels <file_sep>/sigclust/sigclust.py """ Defs for sigclust, cluster_index2, MAD, comp_sim_var, comp_sim_tau. """ import numpy as np from sklearn.cluster import k_means from sklearn.preprocessing import scale as pp_scale def sigclust(X, mc_iters=100, method=2, verbose=True, scale=True, p_op=True, ngrains=100): """ Return tuple (p, clust) where p is the p-value for k-means++ clustering of data matrix X with k==2, and clust is a (binary) array of length num_samples = X.shape[0] whose Nth value is the cluster assigned to the Nth sample (row) of X at the k-means step. Equivalently, clust == k_means(X,2)[1]. mc_iters is an integer giving the number of iterations in the Monte Carlo step. method = 0 uses the sample covariance matrix eigenvalues directly for simulation. method = 1 applies hard thresholding. method = 2 applies soft thresholding. scale = True applies mean centering and variance normalization (sigma = 1) preprocessing to the input X. verbose = True prints some additional statistics of input data. When method == 2 (solf-thresholding), p_op indicates to perform some addiitonal optimization on the parameter tau. If p_op == False, the parameter tau is set to that which best preserves the trace of the sample covariance matrix (this is just the output of comp_sim_tau): sum_{i}lambda_i == sum_{i}({lambda_i - tau - sigma^2}_{+} + sigma^2). If p_op == True, tau is set to some value between 0 and the output of comp_sim_tau which maximizes the relative size of the largest simulation variance. ngrains is then number of values checked in this optimization. p_op and ngrains are ignored for method != 2. """ if scale: print("Scaling and centering input matrix.") X = pp_scale(X) num_samples, num_features = X.shape if verbose: print("""Number of samples: %d\nNumber of features: %d""" % (num_samples, num_features)) ci, labels = cluster_index_2(X) print("Cluster index of input data: %f" % ci) mad = MAD(X) if verbose: print("Median absolute deviation from the median of input data: %f" % mad) bg_noise_var = (mad * normalizer) ** 2 print("Estimated variance for background noise: %f" % bg_noise_var) sample_cov_mat = np.cov(X.T) eig_vals = np.linalg.eigvals(sample_cov_mat) sim_vars = comp_sim_vars(eig_vals, bg_noise_var, method, p_op, ngrains) if verbose: print("The %d variances for simulation have\nmean: %f\n" "standard deviation: %f." % (X.shape[1], np.mean(sim_vars), np.std(sim_vars))) sim_cov_mat = np.diag(sim_vars) # MONTE CARLO STEP # Counter for simulated cluster indices less than or equal to ci. lte = 0 print("""Simulating %d cluster indices. Please wait...""" % mc_iters) CIs = np.zeros(mc_iters) for i in np.arange(mc_iters): # Generate mc_iters datasets # each of the same size as # the original input. sim_data = np.random.multivariate_normal( np.zeros(num_features), sim_cov_mat, num_samples) ci_sim = (cluster_index_2(sim_data))[0] CIs[i] = ci_sim if ci_sim <= ci: lte += 1 print("Simulation complete.") print("The simulated cluster indices had\n" "mean: %f\nstandard deviation: %f." % (np.mean(CIs), np.std(CIs))) p = lte / mc_iters print("In %d iterations there were\n" "%d cluster indices <= the cluster index %f\n" "of the input data." % (mc_iters, lte, ci)) print("p-value: %f" % p) return p, labels def cluster_index_2(X): global_mean = np.mean(X, axis=0) sum_squared_distances = (((X - global_mean) ** 2).sum(axis=1)).sum() # Sum of squared distances of each sample from the global mean centroids, labels, inertia = k_means(X, 2) ci = inertia / sum_squared_distances return ci, labels normalizer = 1.48257969 """ Equal to 1/(Phi^{-1}(3/4)) where Phi is the CDF of the standard normal distribution N(0, 1) """ def MAD(X): """ Returns the median absolute deviation from the median for (a flattened version of) the input data array X. """ return np.median(np.abs(X - np.median(X))) def comp_sim_vars(eig_vals, bg_noise_var, method, p_op, ngrains): """ Compute variances for simlulation given sample variances and background noise variance. method in {0, 1, 2} determines raw, hard, or soft thresholding methods. When method is 2 (solf-thresholding), p_op indicates to perform some addiitonal optimization on the parameter tau. If p_op is False, the parameter tau is set to that which best preserves the trace of the sample covariance matrix. This is just the output of comp_sim_tau. sum_{i}lambda_i == sum_{i}{lambda_i - tau - sigma^2}_{+} + sigma^2). If p_op is True, tau is set to some value between 0 and the output of comp_sim_tau which maximizes the relative size of the largest simulation variance. """ rev_sorted_vals = np.array(sorted(eig_vals, reverse = True)) assert method in {0, 1, 2}, "method parameter must be one of 0,1,2" if method == 0: print("Ignoring background noise and using\n" "raw sample covariance estimates...") return rev_sorted_vals elif method == 1: print("Applying hard thresholding...") return np.maximum(rev_sorted_vals, bg_noise_var * np.ones(len(eig_vals))) else: print("Applying soft thresholding...") tau = comp_sim_tau(rev_sorted_vals, bg_noise_var, p_op, ngrains) sim_vars = rev_sorted_vals - tau return np.maximum(sim_vars, bg_noise_var * np.ones(len(eig_vals))) def comp_sim_tau(rsrtd_vals, bg_noise_var, p_op, ngrains): """ Find tau to preserve trace of sample cov matrix in the simulation cov matrix. sum_{i}(lambda_i) = sum_{i}{(lambda_i - tau - bg_noise_var)_{+} + bg_noise_var} """ diffs = rsrtd_vals - bg_noise_var first_nonpos_ind = len(diffs) - len(diffs[diffs <=0]) expended = -diffs[first_nonpos_ind:].sum() possible_returns = np.sort(diffs[:first_nonpos_ind]).cumsum()[::-1] tau_bonuses = np.arange(first_nonpos_ind) * diffs[:first_nonpos_ind] deficits = expended - possible_returns - tau_bonuses pos_defic = deficits > 0 if pos_defic.sum() == 0: tau = expended / first_nonpos_ind else: ind = np.where(pos_defic)[0][0] if ind == 0: tau = diffs[0] else: tau = diffs[ind] + deficits[ind] / ind if p_op: tau = opt_tau(0, tau, rsrtd_vals, bg_noise_var, ngrains) return tau def opt_tau(L, U, vals, sig2, ngrains=100): """Find tau between L and U that optimizes TCI.""" d_tau = (U - L)/ngrains rel_sizes = np.zeros(ngrains) for i in np.arange(ngrains): tau_cand = L + i * d_tau vals0 = vals - tau_cand vals0[vals0 < sig2] = sig2 rel_sizes[i] = vals0[0] / vals0.sum() armax = np.argmax(rel_sizes) tau = L + armax * d_tau return tau <file_sep>/tests/R_read.R library(sigclust) print(sprintf("First the data in data2.tsv")) print(sprintf("Please wait...")) #set 1 for Soft thresholding, 2 for no dimensionality reduction, 3 for hard thresholding version <- 1 scale <- TRUE data_2 = read.table("enwiki_data/data2.tsv", stringsAsFactors = FALSE) features_2 = data_2[2:(ncol(data_2)-1)] features_2[features_2 == "True"] <- 1 features_2[features_2 == "False"] <- 0 data_mat = data.matrix(features_2) if (scale) {data_mat = scale(data_mat)} sig_obj = sigclust(data_mat, nsim = 100, icovest = version) sims = sig_obj@simcindex mean = mean(sims) sd = sd(sims) print(sprintf("pval : %f", sig_obj@pval)) print(sprintf("cluster index for input data: %f", sig_obj@xcindex)) print(sprintf("The simulated cluster indices had a mean of %f and a standard deviation of %f.", mean, sd)) ##Run sigclust on random data of same dim. print(sprintf("Now for a matrix of the same dimensions with rnorm entries")) print(sprintf("Please wait...")) nrow = dim(data_mat)[1] ncol = dim(data_mat)[2] tot_vals = length(data_mat) rand_mat_0 = matrix(rnorm(tot_vals, mean = 0, sd = 1), nrow = nrow, ncol=ncol) sig_obj_0 = sigclust(rand_mat_0, nsim = 100, icovest = version) sims0 = sig_obj_0@simcindex mean0 = mean(sims0) sd0 = sd(sims0) print(sprintf("pval: %f", sig_obj_0@pval)) print(sprintf("cluster index of input: %f", sig_obj_0@xcindex)) print(sprintf("The simulated cluster indices had a mean of %f and a standard deviation of %f.", mean0, sd0)) ## Two halves from their own normal print(sprintf("Letting half of input data be from N(0,1) and hald be from N(.5, 1)")) print(sprintf("Please wait...")) ncol_1_1 = floor(ncol / 2) ncol_1_2 = ncol - ncol_1_1 rand_mat_1_1 = matrix(rnorm(nrow*ncol_1_1, mean = 0, sd = 1), nrow = nrow, ncol = ncol_1_1) rand_mat_1_2 = matrix(rnorm(nrow*ncol_1_2, mean = .5, sd = 1), nrow = nrow, ncol = ncol_1_2) rand_mat_1 = rbind(rand_mat_1_1, rand_mat_1_2) sig_obj_1 = sigclust(rand_mat_1, nsim= 100, icovest = version) sims1 = sig_obj_1@simcindex mean1 = mean(sims1) sd1 = sd(sims1) print(sprintf("p-value: %f", sig_obj_1@pval)) print(sprintf("cluster index of input: %f", sig_obj_1@xcindex)) print(sprintf("The simulated cluster indices had a mean of %f and a standard deviation of %f.", mean1, sd1))
5339b70da32f7888ec19eda0e7d598e74de024f6
[ "Python", "Text", "R" ]
7
Python
aetilley/sigclust
0d94516d7228e9c2ada69e0c1f193c54dee94aa6
113357a52c6c17b75eb4792468c2e68b9a5fc6f9
refs/heads/master
<file_sep>package minerva; import java.util.Hashtable; import minerva.exceptions.DBAppException; public class DBAppTest { public static void main(String[] args) throws DBAppException { String strTableName = "Student"; DBApp dbApp = new DBApp(); Hashtable<String, String> htblColNameType = new Hashtable<String, String>(); htblColNameType.put("id", "java.lang.Integer"); htblColNameType.put("name", "java.lang.String"); htblColNameType.put("gpa", "java.lang.double"); dbApp.createTable(strTableName, "id", htblColNameType); Hashtable<String, Object> htblColNameValue = new Hashtable<String, Object>(); htblColNameValue.put("id", 2343432); htblColNameValue.put("name", new String("<NAME>")); htblColNameValue.put("gpa", 0.95); dbApp.insertIntoTable(strTableName, htblColNameValue); htblColNameValue.clear(); htblColNameValue.put("id", 453455); htblColNameValue.put("name", new String("<NAME>")); htblColNameValue.put("gpa", 0.95); dbApp.insertIntoTable(strTableName, htblColNameValue); htblColNameValue.clear(); htblColNameValue.put("id", 5674567); htblColNameValue.put("name", new String("<NAME>")); htblColNameValue.put("gpa", 1.25); dbApp.insertIntoTable(strTableName, htblColNameValue); htblColNameValue.clear(); htblColNameValue.put("id", 23498); htblColNameValue.put("name", new String("<NAME>")); htblColNameValue.put("gpa", 1.5); dbApp.insertIntoTable(strTableName, htblColNameValue); htblColNameValue.clear(); htblColNameValue.put("id", 78452); htblColNameValue.put("name", new String("<NAME>")); htblColNameValue.put("gpa", 0.88); dbApp.insertIntoTable(strTableName, htblColNameValue); /* SQLTerm[] arrSQLTerms; arrSQLTerms = new SQLTerm[2]; arrSQLTerms[0]._strTableName = "Student"; arrSQLTerms[0]._strColumnName= "name"; arrSQLTerms[0]._strOperator = "="; arrSQLTerms[0]._objValue = "<NAME>"; arrSQLTerms[1]._strTableName = "Student"; arrSQLTerms[1]._strColumnName= "gpa"; arrSQLTerms[1]._strOperator = "="; arrSQLTerms[1]._objValue = new Double(1.5); String[]strarrOperators = new String[1]; strarrOperators[0] = "OR"; // select * from Student where name = “<NAME>” or gpa = 1.5; Iterator resultSet = dbApp.selectFromTable(arrSQLTerms, strarrOperators); */ } } <file_sep>package minerva.exceptions; public class DBAppException extends Exception { private static final long serialVersionUID = 7252164158144118816L; public DBAppException(String message) { super(message); } } <file_sep># Minerva A simple Java Data-Base Engine. <file_sep> JC = javac #variable holding javac (java compiler) CLASSPATH = ./classes/ #variable holding a path to your classes SRCPATH = ./src/ test: find ./src -name '*.java' ! -name "*Test*" | xargs $(JC) -d $(CLASSPATH) # here test is being called when ever all is called all: test clean: rm -Rf $(CLASSPATH) <file_sep>package minerva; import java.io.IOException; import java.util.Hashtable; import java.util.Iterator; import minerva.exceptions.DBAppException; import minerva.schema.Record; import minerva.schema.SQLTerm; import minerva.schema.Schema; import minerva.schema.Table; import minerva.util.FileManager; public class DBApp { // Attributes ------------------------------------------------------------------------------------ public Hashtable<String, Table> htblCachedTables = new Hashtable<String, Table>(); // Methods --------------------------------------------------------------------------------------- public void init() { // TODO: Think of Something } public void createTable(String strTableName, String strClusteringKeyCol, Hashtable<String, String> htblColNameType) throws DBAppException { if(Schema.checkTableExists(strTableName)) throw new DBAppException("Table " + strTableName + " already exists!"); Table table = new Table(strTableName, htblColNameType, strClusteringKeyCol); this.htblCachedTables.put(strTableName, table); } public void insertIntoTable(String strTableName, Hashtable<String, Object> htblColNameValue) throws DBAppException { if(!Schema.checkTableExists(strTableName)) throw new DBAppException("Table " + strTableName + " does not exists."); if(!htblCachedTables.contains(strTableName)) htblCachedTables.put(strTableName, new Table(strTableName)); Table table = htblCachedTables.get(strTableName); table.insertIntoTable(htblColNameValue); saveAll(); } public void createBTreeIndex(String strTableName, String strColName) throws DBAppException { // TODO in Milestone 2 } public void createRTreeIndex(String strTableName, String strColName) throws DBAppException { // TODO in Milestone 2 } // TODO public void updateTable(String strTableName, String strClusteringKey, Hashtable<String,Object> htblColNameValue) throws DBAppException { // updateTable notes: // htblColNameValue holds the key and new value // htblColNameValue will not include clustering key as column name // htblColNameValue enteries are ANDED together if(!Schema.checkTableExists(strTableName)) throw new DBAppException("Table " + strTableName + "does not exists."); if(!htblCachedTables.contains(strTableName)) htblCachedTables.put(strTableName, new Table(strTableName)); Table table = htblCachedTables.get(strTableName); Record record = table.selectFromTable(strClusteringKey); if(record == null) return; record.update(htblColNameValue); saveAll(); } public void deleteFromTable(String strTableName, Hashtable<String, Object> htblColNameValue) throws DBAppException { // deleteFromTable notes: // htblColNameValue holds the key and value. This will be used in search to identify which rows/tuples to delete. // htblColNameValue enteries are ANDED together if(!Schema.checkTableExists(strTableName)) throw new DBAppException("Table " + strTableName + " does not exists."); if(!htblCachedTables.contains(strTableName)) htblCachedTables.put(strTableName, new Table(strTableName)); Table table = htblCachedTables.get(strTableName); table.deleteFromTable(htblColNameValue, "AND"); saveAll(); } @SuppressWarnings("rawtypes") public Iterator selectFromTable(SQLTerm[] arrSQLTerms, String[] strarrOperators) throws DBAppException { return null; // For Milestone 2 } @SuppressWarnings("rawtypes") public Iterator selectFromTable(String strTableName, Hashtable<String, Object> htblColNameValue, String strOperator) throws DBAppException { if(!Schema.checkTableExists(strTableName)) throw new DBAppException("Table " + strTableName + " does not exists."); if(!htblCachedTables.contains(strTableName)) htblCachedTables.put(strTableName, new Table(strTableName)); Table table = htblCachedTables.get(strTableName); saveAll(); return table.selectFromTable(htblColNameValue, strOperator); } public void saveAll() throws DBAppException { try { FileManager.writeSchema(); } catch (IOException e) { e.printStackTrace(); } Iterator<Table> it = htblCachedTables.values().iterator(); while(it.hasNext()) it.next().saveAllPages(); } // Panel Render ---------------------------------------------------------------------------------- public String renderPanel() { String r = ""; r += " ____ ____ _____ ____ _____ ________ _______ ____ ____ _ \n"; r += "|_ \\ / _||_ _||_ \\|_ _||_ __ ||_ __ \\|_ _| |_ _|/ \\ \n"; r += " | \\/ | | | | \\ | | | |_ \\_| | |__) | \\ \\ / / / _ \\ \n"; r += " | |\\ /| | | | | |\\ \\| | | _| _ | __ / \\ \\ / / / ___ \\ \n"; r += " _| |_\\/_| |_ _| |_ _| |_\\ |_ _| |__/ | _| | \\ \\_ \\ ' /_/ / \\ \\_ \n"; r += "|_____||_____||_____||_____|\\____||________||____| |___| \\_/|____| |____| \n"; r += " \n"; return r; } } <file_sep>package minerva.util; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.Properties; public class PropertiesReader { // Attributes ------------------------------------------------------------------------------------ public static final int MAX_ROW_COUNT_IN_PAGE = readPropertyIntValue("MaximumRowsCountinPage"); private static FileReader propertiesFile; private static Properties properties; private static boolean initialized = false; // Methods --------------------------------------------------------------------------------------- public static String readProperty(String property) { if(!initialized) init(); return properties.getProperty(property); } public static int readPropertyIntValue(String property) { int n = Integer.parseInt(readProperty(property)); return n; } private static void init() { try { propertiesFile = new FileReader(new File(FileManager.strUserDirectory + "/config/DBApp.properties")); properties = new Properties(); properties.load(propertiesFile); initialized = true; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } <file_sep>package minerva.schema; import java.io.IOException; import java.util.ArrayList; import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; import minerva.exceptions.DBAppException; import minerva.util.FileManager; import minerva.util.ObjectManager; public class Table { // Attributes ------------------------------------------------------------------------------------ private int pageCount; private String strTableName; private String strClusteringKeyColName; private Page pgCurr; private Vector<Page> vecTablePages; @SuppressWarnings("unused") private static Hashtable<String, Column> htblTableSchema; // Constructor ----------------------------------------------------------------------------------- public Table(String strTableName, Hashtable<String, String> htblColNameType, String strClusteringKeyColName) { /** * Creates a Table and inizializes it's files (This constructor will only be * called once a table is created for the first time) * * @param strTableName * Table name (the folder of the table will be named as this * value) * @param htblColNameType * Table Columns which will be stored in the metadata.csv file * @param strClusteringKeyName * @throws DBAppException */ this.vecTablePages = new Vector<Page>(); this.strTableName = strTableName; this.strClusteringKeyColName = strClusteringKeyColName; this.pageCount = 0; FileManager.createNewTable(strTableName); // Creating Directories and Files Schema.addNewTable(strTableName, htblColNameType, strClusteringKeyColName); // Saving the meta-data try { FileManager.writeSchema(); // Writing the meta-data in metadata.csv } catch (IOException e) { e.printStackTrace(); } htblTableSchema = Schema.getTableSchema(strTableName); pgCurr = new Page(strTableName, pageCount); ObjectManager.writePage(strTableName, pageCount, pgCurr); } public Table(String strTableName) { /** * This constructor is called to create a table that already exists in the * data file * * @param strTableName */ this.strTableName = strTableName; this.pageCount = FileManager.getPageFileCount(strTableName) - 1; this.vecTablePages = new Vector<Page>(); htblTableSchema = Schema.getTableSchema(strTableName); this.pgCurr = ObjectManager.readPage(strTableName, pageCount); this.vecTablePages.add(pageCount, pgCurr); this.strClusteringKeyColName = Schema.getClusteringKeyColName(strTableName); } // Methods --------------------------------------------------------------------------------------- public void insertIntoTable(Hashtable<String, Object> htblColNameValue) throws DBAppException { if(pgCurr.isFull()) { pgCurr = new Page(strTableName, ++pageCount); ObjectManager.writePage(strTableName, pageCount, pgCurr); } try { pgCurr.insertInPage(new Record(htblColNameValue, strClusteringKeyColName)); pgCurr.save(); } catch(DBAppException e) { // Since there is one exception only ! e.printStackTrace(); } } public void deleteFromTable(Hashtable<String, Object> htblColNameValue, String strOperator) throws DBAppException { for(int i = 0; i <= pageCount; i++) { Page page; if(vecTablePages.elementAt(i) == null) { page = ObjectManager.readPage(strTableName, i); vecTablePages.add(i, page); } else page = vecTablePages.get(i); page.deleteFromPage(htblColNameValue, strOperator); if(page.getRowCount() == 0) { vecTablePages.remove(page); FileManager.deleteDirectory(FileManager.getTablesDirectory() + "/" + strTableName + "/pages/" + pgCurr.getPageNumber() + ".ser"); pgCurr = vecTablePages.lastElement(); } else page.save(); } } public Record selectFromTable(String strClusteringKey) { //return pgCurr.selectFromPage(strClusteringKey); for(int i = 0; i <= pageCount; i++) { Page page; if(vecTablePages.elementAt(i) == null) { page = ObjectManager.readPage(strTableName, i); vecTablePages.add(i, page); } else page = vecTablePages.get(i); Record record = page.selectFromPage(strClusteringKey); if(record != null) return record; } return null; } public Iterator<Record> selectFromTable(Hashtable<String, Object> htblColNameValue, String strOperator) throws DBAppException { ArrayList<Record> recResult = new ArrayList<Record>(); for(int i = 0; i <= pageCount; i++) { Page page; if(vecTablePages.elementAt(i) == null) { page = ObjectManager.readPage(strTableName, i); vecTablePages.add(i, page); } else page = vecTablePages.get(i); Iterator<Record> temp = page.selectFromPage(htblColNameValue, strOperator); while(temp.hasNext()) recResult.add(temp.next()); } return recResult.iterator(); } public void deletePage(int pageNumber) throws DBAppException { if(vecTablePages.elementAt(pageNumber) == null) throw new DBAppException("Page " + strTableName + "/" + pageNumber + ".ser. Does not exists."); vecTablePages.remove(vecTablePages.get(pageNumber)); FileManager.deleteDirectory(FileManager.getTablesDirectory() + "/" + strTableName + "/pages/" + pgCurr.getPageNumber() + ".ser"); pgCurr = vecTablePages.lastElement(); } public void clear() throws DBAppException { for(Page page : vecTablePages) { deletePage(page.getPageNumber()); } } public void saveAllPages() { Iterator<Page> pgItr = vecTablePages.iterator(); while(pgItr.hasNext()) pgItr.next().save(); } } <file_sep>package minerva.schema; import java.io.IOException; import java.util.Hashtable; import java.util.Iterator; import java.util.Map.Entry; import minerva.util.FileManager; public class Schema { // Attributes ------------------------------------------------------------------------------------ private static Hashtable<String, Hashtable<String, Column>> htblSchema; private static boolean initialized; // Constructor ----------------------------------------------------------------------------------- public Schema() { init(); } /* public static void main(String[] args) { Hashtable<String, String> ColNameType; ColNameType = new Hashtable<String, String>(); ColNameType.put("Specialization", "java.lang.String"); ColNameType.put("Name", "java.lang.String"); ColNameType.put("ID", "java.lang.Double"); ColNameType.put("Z", "java.lang.Double"); ColNameType.put("Y", "java.lang.String"); ColNameType.put("Address", "java.lang.String"); ColNameType.put("X", "java.lang.Double"); Schema schema = new Schema(); addNewTable("CityShop", ColNameType, "ID"); print(); System.out.println("==========================================================================\n"); String[] strSchema = getSchemaCSV(); for(int i = 0; i < strSchema.length; i++) System.out.println("schema[" + i + "]:\t" + strSchema[i]); System.out.println("checkTableExists(\"CityShop\"): " + checkTableExists("CityShop")); //System.out.println(getTableSchema("CityShop")); System.out.println("getClusteringKeyColName(\"CityShop\"): " + getClusteringKeyColName("CityShop")); } */ // Methods --------------------------------------------------------------------------------------- public static void init() { try { htblSchema = FileManager.readSchema(); initialized = true; } catch (IOException e) { e.printStackTrace(); } } public static void print() { if(!initialized) init(); Iterator<String> itTables = htblSchema.keySet().iterator(); while(itTables.hasNext()) { String strTableName = itTables.next(); System.out.println(strTableName + ", Columns: "); Hashtable<String, Column> currColumns = htblSchema.get(strTableName); Iterator<String> itColumn = currColumns.keySet().iterator(); while(itColumn.hasNext()) System.out.println("\t" + currColumns.get(itColumn.next())); System.out.println("-----------------------------------------------------------------------"); } } public static boolean checkTableExists(String strTableName) { if(!initialized) init(); return htblSchema.containsKey(strTableName); } public static boolean checkColExists(String strTableName, String strColName) { if(!initialized) init(); if(!checkTableExists(strTableName)) return false; return htblSchema.get(strTableName).containsKey(strColName); } public static Hashtable<String, Column> getTableSchema(String strTableName) { if(!initialized) init(); return htblSchema.get(strTableName); } public static String getClusteringKeyColName(String strTableName) { Iterator<Column> it = getTableSchema(strTableName).values().iterator(); while(it.hasNext()) { Column temp = it.next(); if(temp.isClusteringKey()) return temp.getColName(); } return null; } public static String[] getSchemaCSV() { if (!initialized) init(); int resultLen = 0; Iterator<Hashtable<String, Column>> itrSizeCounter = htblSchema.values().iterator(); while (itrSizeCounter.hasNext()) resultLen += itrSizeCounter.next().size(); String[] strResult = new String[resultLen]; int index = 0; Iterator<String> itrTable = htblSchema.keySet().iterator(); while (itrTable.hasNext()) { String strTableName = itrTable.next(); Hashtable<String, Column> htblCurrColumns = htblSchema.get(strTableName); Iterator<String> itrColumn = htblCurrColumns.keySet().iterator(); while (itrColumn.hasNext()) strResult[index++] = strTableName + ", " + htblCurrColumns.get(itrColumn.next()); } return strResult; } public static void addNewTable(String strTableName, Hashtable<String, String> htblColNameType, String strClusteringKeyCol) { Hashtable<String, Column> htblTable = new Hashtable<String, Column>(); Iterator<Entry<String, String>> itrColNameType = htblColNameType.entrySet().iterator(); while (itrColNameType.hasNext()) { Entry<String, String> entCurr = itrColNameType.next(); htblTable.put(entCurr.getKey(), new Column(entCurr.getKey(), entCurr.getValue(), entCurr.getKey().equals(strClusteringKeyCol), false)); // False for indexed; Milestone 2 } htblSchema.put(strTableName, htblTable); } }
fdea3128924e313affad8b7c3200223c1e7201df
[ "Markdown", "Java", "Makefile" ]
8
Java
Ote-Leo/Minerva
98876fde15be618cdb3a461008370d593ed82525
3d508f0953ae63007918299373ebe0f1471bbf5c
refs/heads/master
<file_sep>console.log(data); window.addEventListener("load", () => { moreEvents(); initIsotope(); filterItems(); }); let iso = null; const moreEvents = () => { const moreToggle = document.querySelector(".more_toggle"); const moreMenu = document.querySelector(".more_navi"); moreToggle.addEventListener("click", (ev) => { ev.stopPropagation(); moreMenu.classList.add("opened"); }); window.addEventListener("click", (ev) => { if (!ev.path.includes(moreMenu)) { moreMenu.classList.remove("opened"); } }); }; const initIsotope = () => { const workList = document.querySelector(".work_list"); iso = new Isotope(workList, { percentPosition: true, layoutMode: "masonry", }); }; const filterItems = () => { const filterItems = document.querySelectorAll(".filter_item"); filterItems.forEach((filterItem) => { filterItem.addEventListener("click", (ev) => { // filter const catToFilter = filterItem.dataset.category; if (catToFilter == "cat_all") { iso.arrange({ filter: "*" }); } else { iso.arrange({ filter: "." + catToFilter }); } // ui ev.stopPropagation(); filterItems.forEach(filterItem_ => filterItem_.classList.remove("active")); filterItem.classList.add("active"); }); }); };
caec8fc4d70ed4ecefeff61de93339494bfcfe03
[ "JavaScript" ]
1
JavaScript
caparicio-esd/test
5ba8f7726b3bbb260636ef251e5115f69995f8ea
8f21a9d12f626fa135e0d41b4dc69715a2933c3b
refs/heads/master
<repo_name>tranv94/SimpleLogAndReg<file_sep>/README.md SimpleLogAndReg =============== Secure login and registration Obnoxious but theoretically secure login front end and back end. <file_sep>/config.php <?php error_reporting(E_ALL); define( "DB_DSN", "mysql:host=localhost;dbname=my_db" ); define( "DB_USERNAME", "root" ); define( "DB_PASSWORD", "" ); define( "CLS_PATH", "class" ); include_once( CLS_PATH . "/user.php" ); ?><file_sep>/index.php <?php include_once("config.php"); ?> <?php if( !(isset( $_POST['login'] ) ) ) { ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Main</title> <!-- Bootstrap --> <link rel="stylesheet" href="css/web2.css"> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="col-md-6" id="login_box"> <a href="login.php" class="index_login">Login</a> </div> <div class="col-md-6" id="register_box"> <a href="register.php" class="index_register">Register</a> </div> </div> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="js/bootstrap.min.js"></script> <script src="js/web2.js"></script> </body> </html> <?php } else { $usr = new Users; $usr->storeFormValues( $_POST ); if( $usr->userLogin() ) { echo "Welcome"; } else { echo "Incorrect Username/Password"; } } ?> <file_sep>/login.php <?php include_once("config.php"); ?> <?php if( !(isset( $_POST['login'] ) ) ) { ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Obnoxious Login</title> <!-- Bootstrap --> <link rel="stylesheet" href="css/web2.css"> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="col-md-12" id="sweg">Login Page</div> <div class="col-md-12">Username</div> <div class="col-mid-12"> <form action='<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>' method="POST"><input type="text" class="username" name="username"> </div> <div class="col-md-12">Password</div> <div class="col-mid-12"> <input type="password" class="password" name="password"> </div> <div class="col-mid-12" id="submit"><input type="submit" name="login" value="Log me in" /></div> </form> </div> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="js/bootstrap.min.js"></script> </body> </html> <?php } else { $usr = new Users; $usr->storeFormValues( $_POST ); if( $usr->userLogin() ) { echo "Welcome"; } else { echo "Incorrect Username/Password"; } } ?><file_sep>/register.php <?php include_once("config.php"); ?> <?php if( !(isset( $_POST['register'] ) ) ) { ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Obnoxious Registration</title> <!-- Bootstrap --> <link rel="stylesheet" href="css/web2.css"> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <?php $nameErr = $passErr = $mailErr = ""; $username = $email = $password = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["username"])) { $nameErr = "<br>ERROR WITH INPUT"; } else { $username = $_POST["username"]; } if (empty($_POST["password"])) { $passErr = "<br>ERROR WITH INPUT"; } else { $password = $POST["password"]; } } ?> <div class="container"> <div class="col-md-12" id="sweg">Register</div> <div class="col-md-12">Enter Username <span class="error"> <?php echo $nameErr;?> </span> </div> <div class="col-mid-12"> <form action='<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>' method="post"> <input type="text" class="username" name="username"> </div> <div class="col-md-12">Enter Password <span class="error"> <?php echo $passErr;?> </span> </div> <div class="col-mid-12"> <input type="password" class="password" name="password"> </div> <div class="col-mid-12" id="submit"> <input type="submit" name="register" value="Register" /> </div> </form> </div> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="js/bootstrap.min.js"></script> <script type="text/javascript" src="js/web2.js"></script> </body> </html> <?php } else { $usr = new Users; $usr->storeFormValues( $_POST ); if( $_POST['password'] == $_POST['password'] ) { echo $usr->register($_POST); } } ?><file_sep>/js/web2.js $(document).ready(function() { $(".index_login").hover(function() { $('#login_box').css('background-color', 'red'); }, function() { $('.col-md-6').css('background-color', 'blue'); }) $(".index_register").hover(function() { $().fadeIn('slow/400/fast', function() { $('#register_box').css('background-color', 'red'); }, function() { $('.col-md-6').css('background-color', 'blue'); }) });
6c28b5c2f0e3f3cfb4263380f1e12a13a77b01bf
[ "Markdown", "JavaScript", "PHP" ]
6
Markdown
tranv94/SimpleLogAndReg
0bd44259f114a2ac69d6338f9ead3c1e8499ee90
21ed8d3770b0db9dd9375f65485f8d80492afde3
refs/heads/main
<repo_name>anno73/tt-rss-plugins<file_sep>/plugins.local/tumblr_gdpr_ua/README.md # ttrss-tumblr-gdpr-ua Plugin for the RSS Reader [Tiny Tiny RSS](https://tt-rss.org/) to handle RSS feeds from Tumblr in Europe. See [README-hkockerbeck.md](README-original.md) from [hkockerbeck's effort](https://github.com/hkockerbeck/ttrss-tumblr-gdpr-ua) for initial reason for this plugin. # What has changed? As it looks like, Tumbler now delivers RSS feeds again, regardless of blog status and user agent string. Unfortunately this is appended to the HTTP 302 response in addition to a HTTP location header, pointing to a consent page. TT-RSS tries to resolve the redirects and forwards and therefore fails in getting the content. This version of the plugin does not use fetch_file_content() but runs its own curl fetch and post processing. The basic structure incl user agent configuration of the initial plugin is left in place, just in case. # Installation Copy to tt-rss/plugin.local directory Enable in Preferences If desired adapt the user agent string - but this is not necessary any more - at least not for me. # Thanks [hkockerbeck](https://github.com/hkockerbeck) for the initial effort. <file_sep>/plugins.local/bindmount.sh #!/bin/bash files=() files+=( orf_at/init.php ) files+=( hackaday_com/init.php ) files+=( debug_feed/init.php ) files+=( tumblr_gdpr_ua/init.php ) ttrssBase=/usr/share/tt2rss/plugins.local echo ${files[@]} for i in ${files[@]} ; do echo "Work for $i" s="$ttrssBase/$i" t="$i" if [ ! -f "$s" ]; then echo "Missing source: $s" continue fi if [ ! -f "$t" ]; then echo "Missing target: $t" continue fi if [ $( stat -c %G "$t" ) == users ]; then mount --bind "$s" "$t" fi done chown -R $USER . <file_sep>/plugins.local/hackaday_com/init.php <?php class hackaday_com extends Plugin { // define domains here for running on articles on private $domains = [ "hackaday.com" ]; private $host; public function about() { return array( 1.0, "Try to enhance hackaday.com content with missing entry images. Requires curl.", "anno" ); } public function flags() { return array("needs_curl" => true); } public function api_version() { return 2; } public function init($host) { // _debug("Initialize hackaday_com plugin"); // store the provided reference to host $this->host = $host; // hook on some hooks ;) // if (function_exists("curl_init")) { // $host->add_hook($host::HOOK_FETCH_FEED, $this); // $host->add_hook($host::HOOK_FEED_FETCHED, $this); // $host->add_hook($host::HOOK_FEED_PARSED, $this); $host->add_hook($host::HOOK_ARTICLE_FILTER, $this); // } } // init public function hook_article_filter($article) { // _debug("hook_article_filter: article: " . var_export($article, true)); // _debug("hook_article_filter: article: " . $article["feed"]["fetch_url"]); // _debug("hook_article_filter: article: " . $article["link"]); if (! $this->is_valid_domain($article["feed"]["fetch_url"])) { return $article; } // _debug("hook_article_filter: article: " . var_export($article, true)); $content = $article["content"]; // _debug("hook_article_filter: content[" . mb_strlen($content) . "]: '" . htmlspecialchars($content) . "'"); // Get full article page for image link and insert it to article content. $tmp = fetch_file_contents(["url" => $article["link"]]); if (! $tmp) { return $article; } // Image link is encoded like this: // <div class="entry-featured-image"><img itemprop="image" content="https://hackaday.com/wp-content/uploads/2020/12/flipdot-clock-thumbnail.jpg?w=600&amp;h=600" // src="https://hackaday.com/wp-content/uploads/2020/12/flipdot-clock-featured.jpg?w=800" alt=""></div> if (preg_match('/<div class="entry-featured-image">.+?src="(?<imagelink>.+?)".+?div>/', $tmp, $matches) !== 1) { return $article; } // _debug("hook_article_filter: matches: " . var_export($matches, true)); // _debug("hook_article_filter: matches: " . htmlspecialchars(implode("|||", $matches))); $link = $matches["imagelink"]; // _debug("hook_article_filter: imagelink: " . htmlspecialchars($link)); $link = '<img src="' . $link. '">'; // _debug("hook_article_filter: imagelink to insert: " . htmlspecialchars($link)); // <html><body> $content = preg_replace('/<html><body>/', '<html><body><p>' . $link . '</p>', $content); // _debug("hook_article_filter: content[" . mb_strlen($content) . "]: '" . htmlspecialchars($content) . "'"); $article["content"] = $content; return $article; } // hook_article_filter // helper function: does string $haystack end with string $needle? private function ends_with($haystack, $needle) { // _debug("ends_with: " . $haystack . " v.s. " . $needle); return mb_substr($haystack, -mb_strlen($needle)) === $needle; } // ends_with // is the domain in question one of the configured domains? private function is_valid_domain($fetch_url) { // extract domain from whole url $url = parse_url($fetch_url, PHP_URL_HOST); // _debug("is_valid_domain: URL: " . $url); // _debug("is_valid_domain: domains: " . implode(",", $this->domains)); $found = array_filter( $this->domains, function ($t) use ($url) { // does the domain in question end with a given url? $res = $this->ends_with($url, $t); // _debug("is_valid_domain: Loop: " . $t . " " . $url . " res: " . $res); return $res; } ); // _debug("is_valid_domain: found: " . implode(",", $found)); return !empty($found); } // is_valid_domain } <file_sep>/plugins.local/tumblr_gdpr_ua/README-hkockerbeck.md # ttrss-tumblr-gdpr-ua Plugin for the RSS Reader [Tiny Tiny RSS](https://tt-rss.org/) to handle RSS feeds from Tumblr in Europe. # What does it do? Because of European laws for the protection of data privacy ([GDPR](https://en.wikipedia.org/wiki/General_Data_Protection_Regulation)), Tumblr's parent company Oath doesn't directly deliver its contents to users in Europe. Instead, the users are redirected to a page where they're asked to give Oath permission to handle, process etc. their data. Once that permission is given, the users can access the content they came for. For future visits, the permission is stored in a cookie. Obviously, an automated system like TT-RSS gets tripped up if it can't just get a feed from an url like normal, but has to jump through some hoops instead. A few months ago, GregThib published [a plugin](https://github.com/GregThib/ttrss-tumblr-gdpr) that basically provided Oath with the permission cookie it expected, so TT-RSS could get to the feed. But a short while ago, the plugin stopped working. It looks like Oath changed some detail of the permission process somewhere, so the cookie provided by Greg's plugin doesn't work anymore. Instead of delving into the murky details of the plugin (and repeating that every time Oath modifies its process), this plugin uses another "trick": If Oath thinks the request comes not from a "real" user, but a search engine's crawler, it doesn't bother with the permission page and delivers the content directly. Hopefully, they will continue to do so in the long run. So this plugin checks whether the feed that TT-RSS needs to handle is from _tumblr.com_ or a subdomain of it. If it is, the plugin switches the user agent to the UA specified in the plugin's settings. If no UA is specified, the plugin uses GoogleBot's UA. Additionally to _tumblr.com_, you can add other domains that are hosted by Tumblr in the preferences. # How to install? - Download the plugin and put it into the `plugins.local` directory of your TT-RSS installation. Alternatively, you can put it into the `plugins` directory. The directory containing the plugin _must_ be named `tumblr_gdpr_ua`. - Activate the plugin in TT-RSS' settings. - In case you want to subscribe to a feed that's hosted by Tumblr, but at a domain _other_ than _tumblr.com_ or its subdomains, add that domain to the plugin's settings. - In case you want to use a different user agent for feeds hosted by Tumblr than GoogleBot's UA, add that UA in the plugin's settings. - In case you want to subscribe to feeds from TT-RSS's public backend, you need to register the plugin as a system plugin with your TT-RSS installation. The public backend is everything using `https://your/tt-rss/installation.tld/public.php`. It's for example used when TT-RSS is registered with Firefox as a feed reader. Requests to the public backend don't authenticate any user, so no user plugins are loaded. You need to add `tumblr_gdpr_ua` to the list of system plugins in `config.php`, so it looks something like this: `define('PLUGINS', 'auth_internal, note, tumblr_gdpr_ua');` # Thanks Big thanks to - [GregThib](https://github.com/GregThib) for writing the original plugin. This plugin is, you may say, largely inspired by his. - [homlett](https://discourse.tt-rss.org/t/change-on-tumblr-rss-feeds-not-working/1158/96) for pointing out that the right user agent make Oath deliver the goods directly. <file_sep>/README.md # tt-rss-plugins Some plugins for tt-rss. Install to plugins.local folder of your tt-rss instance. # Plugin Development Ressources [Unofficial documentation for hooks in TT-RSS ](https://gist.github.com/Fmstrat/a5adc35633725d9369b50d8524b450ca) [tt-rss-samples](https://git.tt-rss.org/fox/tt-rss-samples) by fox himself. Not so comprehensive [Making Plugins](https://tt-rss.org/wiki/MakingPlugins) introduction. Mainly telling that there is none. A [list of plugins](https://tt-rss.org/wiki/Plugins) provided by various sources. Use the Feed Debug feature of tt-rss. (right click on feed->debug) Check the event log. Trigger updates manually by `sudo -u www-data php update.php --force-rehash --debug-feed feed_number_from_feed_debug` Bindmount init.php from tt-rss installation to your home directory for direct access. ``` sudo mount --bind source_file target_file sudo chown user target_file ``` # Check Feed Validity https://validator.w3.org/feed/check.cgi https://tt-rss.org/myfeedsucks/ <file_sep>/plugins.local/orf_at/README.md # orf_at This plugin tries to extract the meaningful information of articles from www.orf.at RSS feed. Many if not most articles have no article content given. For these the content of article link will be fetched, formatted and added instead. Some articles do have content. But they do not have a link to the full article page. In this case the article link is injected to the existing content at the bottom. # Installation Place whole directory orf_at to plugins.local subdirectory on your tt-rss instance and enable the plugin in tt-rss/Preferences/Plugins page. <file_sep>/plugins.local/tumblr_gdpr_ua/init.php <?php /** * Tumblr RSS feed * * Due to GDPR, tumblr made breaking changes to their RSS feeds for european customers. * This plugin tries to fix this. * In addition it changes all RSS feed URLs to https protocol. * * The plugin rolls it's own curl download as tt-rss is not able to handle result in non HTTP 200 responses. * * Based on https://github.com/hkockerbeck/ttrss-tumblr-gdpr-ua * Therefore the User Agent switching code is still there, albeit not needed any more. * * Copy to ${tt-rss install directory}/plugins.local/class name in lower case * */ class Tumblr_GDPR_UA extends Plugin { private $host; public function about() { return array( 1.0, "Fixes Tumblr feeds for GDPR compliance. Can set alternate user agent. Requires curl.", "alex"); } public function flags() { return array("needs_curl" => true); } public function api_version() { return 2; } public function init($host) { // store the provided reference to host $this->host = $host; // hook on some hooks ;) if (function_exists("curl_init")) { $host->add_hook($host::HOOK_SUBSCRIBE_FEED, $this); $host->add_hook($host::HOOK_FEED_BASIC_INFO, $this); $host->add_hook($host::HOOK_FETCH_FEED, $this); $host->add_hook($host::HOOK_FEED_FETCHED, $this); $host->add_hook($host::HOOK_PREFS_TAB, $this); } } // when subscribing to a new feed public function hook_subscribe_feed( $feed_data, $fetch_url, $auth_login, $auth_pass ) { // if the feed is hosted by Tumblr if ($this->is_tumblr_domain($fetch_url)) { // re-fetch the feed data with changed user agent // $feed_data = $this->fetch_contents($fetch_url, $auth_login, $auth_pass); $feed_data = $this->fetch_contents_ch($fetch_url, $auth_login, $auth_pass); } return $feed_data; } // get basic info about a feed (title and site url, mostly) public function hook_feed_basic_info( $basic_info, $fetch_url, $owner_uid, $feed, $auth_login, $auth_pass ) { // if the feed is hosted by Tumblr if ($this->is_tumblr_domain($fetch_url)) { // re-fetch the feed data with changed user agent // $contents = $this->fetch_contents($fetch_url, $auth_login, $auth_pass); $contents = $this->fetch_contents_ch($fetch_url, $auth_login, $auth_pass); // extract info we need from the feed data $parser = new FeedParser($contents); $parser->init(); if (!$parser->error()) { $basic_info = array( 'title' => mb_substr($parser->get_title(), 0, 199), 'site_url' => mb_substr(rewrite_relative_url($fetch_url, $parser->get_link()), 0, 245) ); } } return $basic_info; } // fetch feed to look for new articles public function hook_fetch_feed( $feed_data, $fetch_url, $owner_uid, $feed, $last_article_timestamp, $auth_login, $auth_pass ) { global $fetch_last_error; global $fetch_last_error_code; global $fetch_last_error_content; global $fetch_last_content_type; global $fetch_last_modified; global $fetch_effective_url; global $fetch_effective_ip_addr; global $fetch_curl_used; global $fetch_domain_hits; // if the feed is hosted by Tumblr if ($this->is_tumblr_domain($fetch_url)) { // re-fetch the feed data with changed user agent // $feed_data = $this->fetch_contents($fetch_url, $auth_login, $auth_pass); $feed_data = $this->fetch_contents_ch($fetch_url, $auth_login, $auth_pass); // _debug("HOOK_FETCH_FEED: fetched feed_data:\n" . htmlspecialchars($feed_data)); if ($this->begins_with($feed_data, '<!DOCTYPE html>')) { $feed_data = '<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"></rss>'; _debug("HOOK_FETCH_FEED: Feed $fetch_url did not return RSS data. Faking it to suppress subsequent error messages."); } // _debug("HOOK_FETCH_FEED: fetch_last_error: $fetch_last_error"); // _debug("HOOK_FETCH_FEED: fetch_last_error_code: $fetch_last_error_code"); // _debug("HOOK_FETCH_FEED: fetch_last_error_content[" . strlen($fetch_last_error_content) . "]:\n" . $this->hex_dump($fetch_last_error_content)); // _debug("HOOK_FETCH_FEED: fetch_last_error_content[" . strlen($fetch_last_error_content) . "]: intentionally suppressed."); // _debug("HOOK_FETCH_FEED: fetch_last_content_type: $fetch_last_content_type"); // _debug("HOOK_FETCH_FEED: fetch_last_modified: $fetch_last_modified"); // _debug("HOOK_FETCH_FEED: fetch_effective_url: $fetch_effective_url"); // _debug("HOOK_FETCH_FEED: fetch_effective_ip_addr: $fetch_effective_ip_addr"); // _debug("HOOK_FETCH_FEED: fetch_curl_used: $fetch_curl_used"); // _debug("HOOK_FETCH_FEED: fetch_domain_hits: [ " . implode(",", $fetch_domain_hits) . " ]"); // _debug("hook_fetch_feed: feed_data: " . htmlspecialchars($feed_data)); // tumblr redirects because of GDPR but should deliver valid RSS in current response. // if ($fetch_last_error_code == 302) { // _debug("got 302"); // } // $feed_data = $this->ungzipSafe($fetch_last_error_content); // _debug("HOOK_FETCH_FEED: final feed_data[" . strlen($feed_data) . "]:\n" . $this->hex_dump($feed_data)); } return $feed_data; } // hook_fetch_feed // just some debugging public function hook_feed_fetched( $feed_data, $fetch_url, $owner_uid, $feed ) { // if the feed is hosted by Tumblr if ($this->is_tumblr_domain($fetch_url)) { if ($this->begins_with($feed_data, '<!DOCTYPE html>')) { $feed_data = '<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"></rss>'; _debug("HOOK_FEED_FETCHED: Feed $fetch_url did not return RSS data. Faking it to suppress subsequent error messages."); } // _debug("HOOK_FEED_FETCHED: FEED_DATA: " . htmlspecialchars($feed_data)); } return $feed_data; } // hook_feed_fetched // segment in TT-RSS' prefs to add additional domains public function hook_prefs_tab($args) { if ($args != "prefPrefs") { return; } // replacements in the template $replacements = array( '{title}' => 'Tumblr GDPR UA', '{domainlist}' => implode(PHP_EOL, $this->host->get($this, 'tumblr_domains', array())).PHP_EOL, '{user_agent}' => $this->host->get($this, 'user_agent'), ); // set up a _very_ basic template engine // so we don't have print out everything $template = file_get_contents(__DIR__."/pref_template.html"); $template = str_replace(array_keys($replacements), array_values($replacements), $template); print $template; } // save data from prefs segment public function save() { $tumblr_domains = explode("\r\n", $_POST['tumblr_domains']); $tumblr_domains = array_unique(array_filter($tumblr_domains)); $this->host->set($this, 'tumblr_domains', $tumblr_domains); $user_agent = $_POST['user_agent']; $this->host->set($this, 'user_agent', $user_agent); } // fetch feed data with changed user agent private function fetch_contents( $fetch_url, $auth_login = false, $auth_pass = false ) { $fetch_url = str_replace("http://", "https://", $fetch_url); $options = array( 'url' => $fetch_url, 'login' => $auth_login, 'pass' => $auth_<PASSWORD>, 'useragent' => $this->user_agent(), 'followlocation' => false, ); $contents = fetch_file_contents($options); $contents = $this->ungzipSafe($contents); // _debug("FETCH_CONTENTS: " . var_export($options, true)); _debug("FETCH_CONTENTS: contents:\n" . htmlspecialchars($contents) . "\n#######"); return $contents; } // fetch feed data with changed user agent // reference implementation taken from https://git.tt-rss.org/fox/tt-rss/src/master/classes/urlhelper.php private function fetch_contents_ch( $fetch_url, $auth_login = false, $auth_pass = false ) { global $fetch_last_error; // Save me a migration to https $fetch_url = str_replace("http://", "https://", $fetch_url); // Can most likely be omitted as tumbler changed its behaviour. // Leave it for now for consistency $useragent = $this->user_agent(); $ch = curl_init($fetch_url); // curl_setopt($ch, CURLOPT_VERBOSE, true); // true to output verbose information. Writes output to STDERR, or the file specified using CURLOPT_STDERR. // curl_setopt($ch, CURLINFO_HEADER_OUT, true); // true to track the handle's request string. curl_setopt($ch, CURLOPT_HEADER, true); // true to include the header in the output. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // true to return the transfer as a string of the return value of curl_exec() instead of outputting it directly. curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); // curl_setopt($ch, CURLOPT_ENCODING, ""); // curl_setopt($ch, CURLOPT_COOKIEJAR, "/dev/null"); // return false; if ($auth_login && $auth_pass) { curl_setopt($ch, CURLOPT_USERPWD, <PASSWORD>"); } $ret = @curl_exec($ch); // _debug("FETCH_CONTENTS_CH: curl_error: " . curl_error($ch)); // https://curl.se/libcurl/c/libcurl-errors.html // _debug("FETCH_CONTENTS_CH: ret[" . strlen($ret) . "]:\n" . $this->str2hex($ret)); // _debug("FETCH_CONTENTS_CH: ret[" . strlen($ret) . "]:\n" . $this->hex_dump($ret)); // _debug("FETCH_CONTENTS_CH: CURL_GETINFO: " . var_export(curl_getinfo($ch), true)); $headers_length = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $headers = explode("\r\n", substr($ret, 0, $headers_length)); $contents = substr($ret, $headers_length); // _debug("FETCH_CONTENTS_CH: headers: " . var_export($headers, true)); // _debug("FETCH_CONTENTS_CH: contents[" . strlen($contents) . "]:\n" . $this->hex_dump($contents)); if (! $contents) { $fetch_last_error = curl_errno($ch) . " " . curl_error($ch); curl_close($ch); return false; } curl_close($ch); $contents = $this->ungzipSafe($contents); // _debug("FETCH_CONTENTS_CH: final contents[" . strlen($contents) . "]:\n" . htmlspecialchars($contents)); return $contents; } // fetch_contents_ch /** * Check if string is gz encoded. If so, decode and return * * @parm string * @return string */ private function ungzipSafe($s) { $is_gzipped = RSSUtils::is_gzipped($s); if ($is_gzipped) { // _debug("ungzipSafe: is gzipped: $s"); $tmp = @gzdecode($s); if ($tmp) { $s = $tmp; } } else { // _debug("ungzipSafe: is NOT gzipped: $s"); } return $s; } private function str2hex( $str ) { $res = implode( ' ', array_map( function ($char) { // return sprintf('%02s', $char); return str_pad($char, 2, '0', STR_PAD_LEFT); }, array_map( 'dechex', unpack('C*', $str) ) ) ); return $res; } /** * Dumps a string into a traditional hex dump for programmers, * in a format similar to the output of the BSD command hexdump -C file. * The default result is a string. * https://stackoverflow.com/a/34279537 * Supported options: * <pre> * line_sep - line separator char, default = "\n" * bytes_per_line - default = 64 * pad_char - character to replace non-readable characters with, default = '.' * </pre> * * @param string $string * @param array $options * @param string|array */ public function hex_dump($string, array $options = null) { if (!is_scalar($string)) { throw new InvalidArgumentException('$string argument must be a string'); } if (!is_array($options)) { $options = array(); } $line_sep = isset($options['line_sep']) ? $options['line_sep'] : "\n"; $bytes_per_line = @$options['bytes_per_line'] ? $options['bytes_per_line'] : 64; $pad_char = isset($options['pad_char']) ? $options['pad_char'] : '.'; # padding for non-readable characters $text_lines = str_split($string, $bytes_per_line); $hex_lines = str_split(bin2hex($string), $bytes_per_line * 2); $offset = 0; $output = array(); $bytes_per_line_div_2 = (int)($bytes_per_line / 2); foreach ($hex_lines as $i => $hex_line) { $text_line = $text_lines[$i]; $output []= sprintf('%08X', $offset) . ' ' . str_pad( strlen($text_line) > $bytes_per_line_div_2 ? implode(' ', str_split(substr($hex_line, 0, $bytes_per_line), 2)) . ' ' . implode(' ', str_split(substr($hex_line, $bytes_per_line), 2)) : implode(' ', str_split($hex_line, 2)), $bytes_per_line * 3 ) . ' |' . preg_replace('/[^\x20-\x7E]/', $pad_char, $text_line) . '|'; $offset += $bytes_per_line; } $output []= sprintf('%08X', strlen($string)); return @$options['want_array'] ? $output : join($line_sep, $output) . $line_sep; } // helper function: does string $haystack end with string $needle? private function ends_with($haystack, $needle) { return mb_substr($haystack, -mb_strlen($needle)) === $needle; } private function begins_with($haystack, $needle) { return mb_substr($haystack, 0, mb_strlen($needle)) === $needle; } // is the domain in question on tumblr.com or one of the additional domains? private function is_tumblr_domain($fetch_url) { // extract domain from whole url $url = parse_url($fetch_url, PHP_URL_HOST); // look through list of "known tumblr" urls $domains = $this->host->get($this, 'tumblr_domains', array()); array_push($domains, 'tumblr.com'); $found = array_filter($domains, function ($t) use ($url) { // does the domain in question end with a tumblr url? return $this->ends_with($url, $t); }); return !empty($found); } // if the user provided a custom user agent in the settings, use that // otherwise, fall back to Googlebot private function user_agent() { // $fallback_ua = 'Mozilla/5.0 (compatible; Googlebot/4.51; +http://www.google.com/bot.html)'; // $fallback_ua = 'Mozilla/5.0 (compatible; Googlebot/4.51; +http://www.google.com/bot.html)'; // $fallback_ua = 'facebookexternalhit/1.0 (+http://www.facebook.com/externalhit_uatext.php)'; $fallback_ua = 'curl/7.72.0'; $ua = $this->host->get($this, 'user_agent'); return ($ua == '') ? $fallback_ua : $ua; // anno: use this useragent only return $fallback_ua; } } <file_sep>/plugins.local/hackaday_com/README.md # hackaday_com This plugin injects the image link of the entry-featured-image from the main article to article content. # Installation Place whole directory hackaday_com to plugins.local subdirectory on your tt-rss instance and enable the plugin in tt-rss/Preferences/Plugins page. <file_sep>/plugins.local/orf_at/init.php <?php class orf_at extends Plugin { // define domains here for running on articles on private $domains = [ "rss.orf.at" ]; private $host; public function about() { return array( 1.0, "Try to enhance orf.at content when missing. Requires curl.", "anno" ); } public function flags() { return array("needs_curl" => true); } public function api_version() { return 2; } public function init($host) { // _debug("Initialize orf_at plugin"); // store the provided reference to host $this->host = $host; // hook on some hooks ;) // if (function_exists("curl_init")) // { // $host->add_hook($host::HOOK_FETCH_FEED, $this); // $host->add_hook($host::HOOK_FEED_FETCHED, $this); // $host->add_hook($host::HOOK_FEED_PARSED, $this); $host->add_hook($host::HOOK_ARTICLE_FILTER, $this); // } } // fetch feed to look for new articles public function hook_fetch_feed( $feed_data, $fetch_url, $owner_uid, $feed, $last_article_timestamp, $auth_login, $auth_pass ) { // _debug("hook_fetch_feed: fetch_url: " . $fetch_url); if (! $this->is_valid_domain($fetch_url)) { return $feed_data; } // _debug("hook_fetch_feed: feed: " . $feed); // _debug("hook_fetch_feed: fetch_url: " . $fetch_url); return $feed_data; } // hook_fetch_feed public function hook_feed_fetched( $feed_data, $fetch_url, $owner_uid, $feed ) { _debug("hook_feed_fetched: fetch_url: " . $fetch_url); if (! $this->is_valid_domain($fetch_url)) { return $feed_data; } _debug("hook_feed_fetched: feed: " . $feed); return $feed_data; } // hook_feed_fetched public function hook_feed_parsed($feed) { _debug("hook_feed_parsed: get_title: " . $feed->get_title()); _debug("hook_feed_parsed: get_link: " . $feed->get_link()); } // hook_feed_parsed public function hook_article_filter($article) { // _debug("hook_article_filter: article: " . var_export($article, true)); // _debug("hook_article_filter: article: " . $article["feed"]["fetch_url"]); // _debug("hook_article_filter: article: " . $article["link"]); if (! $this->is_valid_domain($article["feed"]["fetch_url"])) { return $article; } // _debug("hook_article_filter: article: " . var_export($article, true)); // _debug("hook_article_filter: article: " . $article["title"]); $content = $article["content"]; // _debug("hook_article_filter: content[" . mb_strlen($content) . "]: '" . htmlspecialchars($content) . "'"); /* If string is long enough lets assume we have meaningful data Even empty content is filled with 131 bytes (incl \n ...): <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><?xml encoding="UTF-8"> Alternatively check for <html><body>.+</body></html> Predelivered content is only abstract and lacks reference to long article which makes it unclear to the reader that there is more. So insert link before </body></html> and return updated article. */ // if ( strlen($content) > 135 ) if (mb_stripos($content, "<html><body>") !== false) { $link = "<p><a href=\"" . $article["link"] . "\">Ganzer Artikel...</a></p>"; // _debug("hook_article_filter: insert link: " . htmlspecialchars($link)); $content = preg_replace("/<\/body>/", $link . "</body>", $content); // _debug("hook_article_filter: final content: " . htmlspecialchars($content)); $article["content"] = $content; return $article; } // Fetch data from URL and insert to content //_debug("hook_article_filter: fetch new content from " . $article["link"]); $tmp = fetch_file_contents(["url" => $article["link"]]); if (! $tmp) { // seems we got an error. Be gracefull and continue with what we already have. return $article; } // _debug("hook_article_filter: new content: " . htmlspecialchars($tmp)); // select and format content to suit displaying in web and mobile app // $article["content"] = $tmp; return $article; $doc = new DOMDocument("1.0", "UTF-8"); if (!@$doc->loadHTML($tmp)) { return false; } $xpath = new DOMXPath($doc); //*// 1st try: extract the data we really want $base_node = $xpath->query('//div[@class="story-content"]')->item(0); if ($base_node) { $content = $article["content"] = $doc->saveHTML($base_node); } // */ /* // 2nd try: delete data we do not want foreach ($xpath->query('//nav[@id="skiplinks"]') as $e) { $e->parentNode->removeChild($e); } foreach ($xpath->query('//header[@class="header"]') as $e) { $e->parentNode->removeChild($e); } foreach ($xpath->query('//div[@class="story-lead"]') as $e) { $e->parentNode->removeChild($e); } foreach ($xpath->query('//div[@class="story-meta"]') as $e) { $e->parentNode->removeChild($e); } // foreach ($xpath->query('//div[@class="story-footer"]') as $e) { $e->parentNode->removeChild($e); } foreach ($xpath->query('//div[@id="more-to-read-anchor"]') as $e) { $e->parentNode->removeChild($e); } foreach ($xpath->query('//footer[@id="page-footer"]') as $e) { $e->parentNode->removeChild($e); } foreach ($xpath->query('//div[@class="print-warning"]') as $e) { $e->parentNode->removeChild($e); } foreach ($xpath->query('//a[@title="Zurück"]') as $e) { $e->parentNode->removeChild($e); } foreach ($xpath->query('//a[@title="Weiter"]') as $e) { $e->parentNode->removeChild($e); } $article["content"] = $doc->saveHTML(); // */ // _debug("hook_article_filter: final content: " . htmlspecialchars($article["content"])); return $article; } // hook_article_filter // helper function: does string $haystack end with string $needle? private function ends_with($haystack, $needle) { // _debug("ends_with: " . $haystack . " v.s. " . $needle); return mb_substr($haystack, -mb_strlen($needle)) === $needle; } // ends_with // is the domain in question one of the configured domains? private function is_valid_domain($fetch_url) { // extract domain from whole url $url = parse_url($fetch_url, PHP_URL_HOST); // _debug("is_valid_domain: URL: " . $url); // _debug("is_valid_domain: domains: " . implode(",", $this->domains)); $found = array_filter( $this->domains, function ($t) use ($url) { // does the domain in question end with a given url? $res = $this->ends_with($url, $t); // _debug("is_valid_domain: Loop: " . $t . " " . $url . " res: " . $res); return $res; } ); // _debug("is_valid_domain: found: " . implode(",", $found)); return !empty($found); } // is_valid_domain }
f34b120f89a3a8702d539011485ab286decaf20e
[ "Markdown", "PHP", "Shell" ]
9
Markdown
anno73/tt-rss-plugins
10474389330b6109b13e058874d047339abd8693
0a5e981d8ab89d22290621d858a8321b93ceee01
refs/heads/master
<repo_name>ofedo/angular-utopian-plant<file_sep>/src/app/ngbd-collapse-navbar/ngbd-collapse-navbar.component.ts import { Component } from '@angular/core'; @Component({ selector: 'app-ngbd-collapse-navbar', templateUrl: './ngbd-collapse-navbar.component.html', styleUrls: ['./ngbd-collapse-navbar.component.css'] }) export class NgbdCollapseNavbarComponent { constructor() { } public isMenuCollapsed = true; } <file_sep>/src/app/model/raw-materials.ts export class RawMaterials { cost: number = 300; } <file_sep>/src/app/model/staff.ts export class Staff { cost: number = 100; productivity: number = Math.round(Math.random() * 100) / 100; } <file_sep>/src/app/model/plan.ts export class Plan { years: number; budget: number; products: number; constructor(_years: number, _budget: number, _products: number) { this.years = _years; this.budget = _budget; this.products = _products; } } <file_sep>/src/app/app.component.ts import { Component, AfterViewInit, ChangeDetectorRef, ViewChild } from '@angular/core'; import { Machine } from './model/machine'; import { Staff } from './model/staff'; import { RawMaterials } from './model/raw-materials'; import { Plan } from './model/plan'; import { NgbdModalComponent } from './ngbd-modal/ngbd-modal.component'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent implements AfterViewInit { @ViewChild(NgbdModalComponent) yearModal: NgbdModalComponent; year: number; plan: Plan; products: number; machines: Machine[]; gameEnded: boolean; constructor(private ref: ChangeDetectorRef) { } ngAfterViewInit() { this.initNewGame(); this.ref.detectChanges(); } initPlan(): Plan { const years = Math.ceil(Math.random() * 4) + 1; const budget = Math.ceil(Math.random() * 4) * 1000 + 1000; const products = Math.ceil(budget / years); return new Plan(years, budget, products); } initNewGame() { this.year = 1; this.plan = this.initPlan(); this.products = 0; this.machines = []; this.gameEnded = false; } buyMachine() { let m = new Machine(); if (this.plan.budget >= m.cost) { this.plan.budget -= m.cost; this.machines.push(m); } else { alert('You are out of budget!'); } } hireWorker(machine: Machine) { let s = new Staff(); machine.staff.push(s); // if (this.plan.budget >= s.cost) { // this.plan.budget -= s.cost; // machine.staff.push(s); // } else { // alert('You are out of budget!'); // } } assignRawMaterial(machine: Machine) { let m = new RawMaterials(); if (this.plan.budget >= m.cost) { this.plan.budget -= m.cost; machine.rawMaterials.push(m); } else { alert('You are out of budget!'); } } advanceYear() { this.gotoNextYear(); if (this.plan.budget < 0) { this.endGame(); } if (this.year >= this.plan.years) { this.endGame(); } } gotoNextYear() { let storageRawMaterials = 0; let staffSalaries = 0; let products = 0; let spoilage = 0; this.machines.forEach(m => { const process = m.process(); products += process[0]; spoilage += process[1]; storageRawMaterials += m.rawMaterials.length; staffSalaries += m.staff.length * 100; }); const rawMaterialsStorageCosts = storageRawMaterials * 100; this.plan.budget -= rawMaterialsStorageCosts + staffSalaries; this.yearModal.year = ++this.year; this.yearModal.rawMaterialsStorageCosts = rawMaterialsStorageCosts; this.yearModal.staffSalaries = staffSalaries; this.yearModal.products = products; this.yearModal.spoilage = spoilage; this.yearModal.open(); this.products += products; // alert('Year is ' + this.year); } endGame() { this.gameEnded = true; // alert('end game!'); } } <file_sep>/src/app/model/machine.ts import { RawMaterials } from './raw-materials'; import { Staff } from './staff'; export class Machine { cost: number = 1000; rawMaterials: RawMaterials[] = []; staff: Staff[] = []; process() { let totalProductivity = 0; this.staff.forEach(s => totalProductivity += s.productivity); totalProductivity = Math.min(1, totalProductivity); const products = Math.round(totalProductivity * this.rawMaterials.length * 1000); const spoilage = this.rawMaterials.length * 1000 - products; this.rawMaterials.length = Math.max(0, this.rawMaterials.length - this.staff.length); return [products, spoilage]; } } <file_sep>/src/app/machine-card/machine-card.component.ts import { Component, Input, Output, EventEmitter } from '@angular/core'; @Component({ selector: 'app-machine-card', templateUrl: './machine-card.component.html', styleUrls: ['./machine-card.component.css'] }) export class MachineCardComponent { @Input() machine: any; @Input() index: number; @Output() assignRawMaterialEmitter = new EventEmitter(); @Output() hireWorkerEmitter = new EventEmitter(); constructor() { } assignRawMaterial() { this.assignRawMaterialEmitter.emit(this.machine); } hireWorker() { this.hireWorkerEmitter.emit(this.machine); } }
971684153bc8a1635ca9d81085881fc37136b843
[ "TypeScript" ]
7
TypeScript
ofedo/angular-utopian-plant
75f48a98854521d0b83be1010747b52cf84d65f3
b3fd67d4f881d9a777e572807713d1e6a101e04a
refs/heads/master
<repo_name>manasgupta5001/Android-Data-Storage<file_sep>/MainActivity.java package com.example.storage; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import android.os.Environment; import android.view.View.OnClickListener; import android.widget.TextView; public class MainActivity extends AppCompatActivity { EditText uname, pwd; Button saveBtn,rdBtn; FileOutputStream fstream; FileInputStream ifstream; EditText inputText; TextView response; Button saveButton,readButton; String filename = "File.txt"; String filepath = "MyFileStorage"; File myExternalFile; String myData = ""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); uname = (EditText)findViewById(R.id.txtName); pwd = (EditText)findViewById(R.id.txtPwd); saveBtn = (Button)findViewById(R.id.btnSave); rdBtn=(Button)findViewById(R.id.rdFile); saveBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String username = uname.getText().toString()+"\n"; String password = pwd.getText().toString(); try { fstream = openFileOutput("user_details", Context.MODE_PRIVATE); fstream.write(username.getBytes()); fstream.write(password.getBytes()); fstream.close(); Toast.makeText(getApplicationContext(), "Details Saved Successfully",Toast.LENGTH_SHORT).show(); uname.setText(""); pwd.setText(""); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }); rdBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { ifstream = openFileInput("user_details"); StringBuffer sbuffer = new StringBuffer(); int i; while ((i = ifstream.read())!= -1){ sbuffer.append((char)i); } fstream.close(); String details[] = sbuffer.toString().split("\n"); uname.setText(details[0]); pwd.setText(details[1]); Toast.makeText(getApplicationContext(), "Details Retrieved Successfully",Toast.LENGTH_LONG).show(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }); inputText = (EditText) findViewById(R.id.myInputText); response = (TextView) findViewById(R.id.response); saveButton = (Button) findViewById(R.id.saveExternalStorage); saveButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { final FileOutputStream fos = new FileOutputStream(myExternalFile); fos.write(inputText.getText().toString().getBytes()); fos.close(); } catch (IOException e) { e.printStackTrace(); } inputText.setText(""); response.setText("Saved to External Storage..."); } }); readButton = (Button) findViewById(R.id.getExternalStorage); readButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { FileInputStream fis = new FileInputStream(myExternalFile); DataInputStream in = new DataInputStream(fis); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; while ((strLine = br.readLine()) != null) { myData = myData + strLine; } in.close(); } catch (IOException e) { e.printStackTrace(); } inputText.setText(myData); response.setText("Data retrieved from Internal Storage..."); } }); if (!isExternalStorageAvailable() || isExternalStorageReadOnly()) { saveButton.setEnabled(false); } else { myExternalFile = new File(getExternalFilesDir(filepath), filename); } } private static boolean isExternalStorageReadOnly() { String extStorageState = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(extStorageState)) { return true; } return false; } private static boolean isExternalStorageAvailable() { String extStorageState = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(extStorageState)) { return true; } return false; } }
052c8acad540660f25b17c73d5ef1cb5336eb2ad
[ "Java" ]
1
Java
manasgupta5001/Android-Data-Storage
5bf7b23407d100d2be0c449998e426e9f7826b95
4f6c1466c38f837f8bca191cd3fd677d3e7fb4c5
refs/heads/master
<repo_name>chuakid/PersonalFileTransfer-Vue<file_sep>/src/store.js import api from "./api" api.defaults.headers.common["authorization"] = localStorage.getItem("token") export default { previousFiles: JSON.parse(localStorage.getItem("previousFiles")) || [], token: localStorage.getItem("token"), addFileToStore(fileid) { this.previousFiles.push(fileid) localStorage.setItem("previousFiles", JSON.stringify(this.previousFiles)) }, removeFileFromStore(fileid) { this.previousFiles = this.previousFiles.filter((file) => { return file != fileid }) localStorage.setItem("previousFiles", JSON.stringify(this.previousFiles)) }, setToken(token) { localStorage.setItem("token", token) this.token = token api.defaults.headers.common["authorization"] = token } }<file_sep>/src/main.js import { createApp } from 'vue' import { createRouter, createWebHistory } from 'vue-router'; import "./assets/index.css" import UploadComponent from "./components/UploadComponent.vue" import DownloadComponent from "./components/DownloadComponent.vue" import LoginComponent from "./components/LoginComponent.vue" import App from "./App.vue" import store from "./store"; import api from "./api" const routes = [ { path: '/', component: LoginComponent, name: "login" }, { path: '/upload', component: UploadComponent, name: "upload" }, { path: '/download/:file_id', component: DownloadComponent, name: "download" }, { path: "/:catchAll(.*)", redirect: "/upload" } ]; const router = createRouter({ routes, history: createWebHistory() }) router.beforeEach(async (to, from) => { if (to.path != "/") { if (!store.token) { return { name: "login", query: { redirect: to.path } } } try { let response = await api.post("sitetokenvalidity") if (!response.data.validity) { return { name: "login", query: { redirect: to.path } } } } catch (error) { console.log(error); } } }) createApp(App).use(router).mount('#app') <file_sep>/.envexample VITE_HOST=http://localhost:8000<file_sep>/src/api.js import axios from "axios" export default axios.create({ baseURL: import.meta.env.VITE_HOST + "/api" })
eb146db599f8e5859b226f0bc14f6acfd4243c6a
[ "JavaScript", "Shell" ]
4
JavaScript
chuakid/PersonalFileTransfer-Vue
849a0fd19d1b13a11d710acfaafed3c5ed2cb0bf
4a21787d5d39aeb7efbb3ac8946ab27bb1f53c0a
refs/heads/master
<repo_name>sangbeomyou/Qpet_Server<file_sep>/app/Http/Controllers/DoctorAppController.php <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Storage; class DoctorAppController extends Controller { public function __construct() { // 이용 정지 회원인지 확인 function check($id){ $stop = \App\doctor_info::where('id',$id)->first(); if($stop['on/off'] == 'off'){ return response()->json([ 'result' => false ]); } } } /*의사 등록 (회원가입)*/ public function register(Request $request) { $message = ""; $check_doctor = \App\license::where('img_name',$request['doctor_license_name'])->first(); $check_user = \App\license::where('img_name',$request['user_license_name'])->first(); if(isset($check_doctor) && isset($check_user)){ if(isset($check_doctor) && !isset($check_user)){ $result = false; $message = $request['doctor_license_name']." 파일이 이름이 서버에 존재합니다. 다른 이름의 파일을 업로드 해주세요."; }elseif (!isset($check_doctor) && isset($check_user)) { $result = false; $message = $request['user_license_name']." 파일이 이름이 서버에 존재합니다. 다른 이름의 파일을 업로드 해주세요."; } $result = false; $message = $request['doctor_license_name']." , ".$request['user_license_name']." 파일이 이름이 서버에 존재합니다. 다른 이름의 파일을 업로드 해주세요."; }else{ if($request['user_license_name'] == $request['doctor_license_name']){ $result = false; $message = "서로 같은 이름의 파일을 업로드 할 수 없습니다."; }else{ $insert_doctor = base64_decode($request['doctor_license']); // 파일 디코딩 $file_doctor = Storage::disk('license')->put($request['doctor_license_name'], $insert_doctor); // 파일 저장 $insert_user = base64_decode($request['user_license']); // 파일 디코딩 $file_user = Storage::disk('license')->put($request['user_license_name'], $insert_user); // 파일 저장 if($file_doctor && $file_user) { if($request->type == "kakao"){ $create = \App\doctor_info::create([ 'doctor_kakao'=> $request->input('doctor_id'), 'doctor_name'=> $request->input('doctor_name'), 'doctor_phone'=> $request->input('doctor_phone'), ]); }elseif($request->type == "naver"){ $create = \App\doctor_info::create([ 'doctor_naver'=> $request->input('doctor_id'), 'doctor_name'=> $request->input('doctor_name'), 'doctor_phone'=> $request->input('doctor_phone'), ]); } elseif($request->type == "google"){ $create = \App\doctor_info::create([ 'doctor_google'=> $request->input('doctor_id'), 'doctor_name'=> $request->input('doctor_name'), 'doctor_phone'=> $request->input('doctor_phone'), ]); } elseif($request->type == "facebook"){ $create = \App\doctor_info::create([ 'doctor_facebook'=> $request->input('doctor_id'), 'doctor_name'=> $request->input('doctor_name'), 'doctor_phone'=> $request->input('doctor_phone'), ]); } elseif($request->type == "twitter"){ $create = \App\doctor_info::create([ 'doctor_twitter'=> $request->input('doctor_id'), 'doctor_name'=> $request->input('doctor_name'), 'doctor_phone'=> $request->input('doctor_phone'), ]); }else{ $create = \App\doctor_info::create([ 'doctor_id'=> $request->input('doctor_id'), 'doctor_pw'=> bcrypt($request->input('doctor_pw')), 'doctor_name'=> $request->input('doctor_name'), 'doctor_phone'=> $request->input('doctor_phone'), ]); } $doctor = \App\doctor_info::where('doctor_phone',$request->input('doctor_phone'))->first(); $create_license_user = \App\license::create([ 'doctor_id' => $doctor->id, 'img_name' => $request->input('user_license_name'), 'division' => "user", ]); $create_license_doctor = \App\license::create([ 'doctor_id' => $doctor->id, 'img_name' => $request->input('doctor_license_name'), 'division' => "doctor", ]); $result = true; }else{ $delete = Storage::disk('license')->delete([$request['doctor_license_name'], $request['user_license_name']]); // 파일 삭제 $result = false; $message = "서버 오류로 인해 파일 업로드에 실패했습니다. 잠시후 다시 시도해주세요."; } } } return response()->json([ 'result' => $result, 'message' => $message, ]); } /*전화번호 중복확인*/ public function check_phone(Request $request) { $doctor = \App\doctor_info::where('doctor_phone',$request['doctor_phone'])->first(); if(isset($doctor->id)){ $result = false; }else{ $result = true; } return response()->json([ 'result' => $result, ]); } /*아이디 중복확인*/ public function check_id(Request $request) { $doctor = \App\doctor_info::where('doctor_id',$request['doctor_id'])->first(); if(isset($doctor->id)){ $result = false; }else{ $result = true; } return response()->json([ 'result' => $result, ]); } /*아아디 찾기*/ public function find_id(Request $request) { $doctor = \App\doctor_info::where([['doctor_phone',$request['doctor_phone']],['doctor_name',$request['doctor_name']]])->first(); if(isset($doctor->id)){ return response()->json([ 'result' => true, 'doctor_id' => $doctor->doctor_id, 'doctor_kakao' => $doctor->doctor_kakao, 'doctor_naver' => $doctor->doctor_naver, 'doctor_google' => $doctor->doctor_google, 'doctor_facebook' => $doctor->doctor_facebook, 'doctor_twitter' => $doctor->doctor_twitter, ]); }else{ return response()->json([ 'result' => false, /// 아이디 없음 ]); } } /*비밀번호 찾기*/ public function find_pw(Request $request) { function Random($length) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; } $pw = Random(6); /// 새로운 랜덤 pw 설정 $doctor = \App\doctor_info::where([['doctor_id',$request['doctor_id']],['doctor_phone',$request['doctor_phone']]])->update(['doctor_pw' => bcrypt($pw)]); if($doctor != "0"){ //전화번호 형식 $recv = preg_replace("/(^02.{0}|^01.{1}|[0-9]{3})([0-9]+)([0-9]{4})/", "$1-$2-$3", $request['doctor_phone']); $msg = "[MerDog] 회원님의 임시 비밀번호는 [".$pw."] 입니다."; $sms_url = "https://sslsms.cafe24.com/sms_sender.php"; // HTTPS 전송요청 URL $sms['user_id'] = base64_encode("ccitsms"); //SMS 아이디. $sms['secure'] = base64_encode("1cc4bc9ea5d24c9811d2cf30d430276f") ;//인증키 $sms['msg'] = base64_encode(stripslashes($msg)); $sms['rphone'] = base64_encode($recv); // 수신번호 $sms['sphone1'] = base64_encode('010'); // 발신번호 $sms['sphone2'] = base64_encode('7375'); $sms['sphone3'] = base64_encode('6544'); $sms['mode'] = base64_encode("1"); // base64 사용시 반드시 모드값을 1로 주셔야 합니다. $host_info = explode("/", $sms_url); $host = $host_info[2]; $path = $host_info[3]; srand((double)microtime()*1000000); $boundary = "---------------------".substr(md5(rand(0,32000)),0,10); // 헤더 생성 $header = "POST /".$path ." HTTP/1.0\r\n"; $header .= "Host: ".$host."\r\n"; $header .= "Content-type: multipart/form-data, boundary=".$boundary."\r\n"; // 본문 생성 $data = ""; foreach($sms AS $index => $value){ $data .="--$boundary\r\n"; $data .= "Content-Disposition: form-data; name=\"".$index."\"\r\n"; $data .= "\r\n".$value."\r\n"; $data .="--$boundary\r\n"; } $header .= "Content-length: " . strlen($data) . "\r\n\r\n"; $fp = fsockopen($host, 80); if ($fp) { fputs($fp, $header.$data); $rsp = ''; while(!feof($fp)) { $rsp .= fgets($fp,8192); } fclose($fp); $msg = explode("\r\n\r\n",trim($rsp)); $rMsg = explode(",", $msg[1]); $RESULT= $rMsg[0]; //발송결과 $Count= $rMsg[1]; //잔여건수 //발송결과 알림 if($RESULT=="success") { $result = true; $log = \App\sms_log::create([ 'phone' => $request['doctor_phone'], 'type' => "pw 변경", 'ip_address' => $_SERVER["REMOTE_ADDR"], ]); }else{ $result = false; } }else { $result = false; } }else{ $result = false; } return response()->json([ 'result' => $result, ]); } /*거부 상태 자격증 정보 변경*/ public function re_register(Request $request) { if(isset($request['doctor_license_name']) && isset($request['doctor_license']) && isset($request['user_license_name']) && isset($request['user_license']) && isset($request->doctor_id)){ // 기존이미지 삭제 $del_imgs = \App\license::where('doctor_id',$request->doctor_id)->get(); $del_img_1 = $del_imgs[0]->img_name; $del_img_2 = $del_imgs[1]->img_name; $delete = Storage::disk('license')->delete([$del_img_1, $del_img_2]); // 파일 삭제 //자격증 이미지 중복확인 및 등록 $doctor_img_name = $request['doctor_license_name']; $is_file_exist = file_exists("storage/img/license/".$doctor_img_name); while($is_file_exist){ $doctor_img_name = $request['doctor_license_name']; $randomNum = mt_rand(1, 99); $doctor_img_name = "(".$randomNum.")".$doctor_img_name; $is_file_exist = file_exists("storage/img/license/".$doctor_img_name); } $insert_doctor = base64_decode($request['doctor_license']); // 파일 디코딩 $file_doctor = Storage::disk('license')->put($doctor_img_name, $insert_doctor); // 파일 저장 //신분증 이미지 중복확인 및 등록 $user_img_name = $request['user_license_name']; $is_file_exist = file_exists("storage/img/license/".$user_img_name); while($is_file_exist){ $user_img_name = $request['doctor_license_name']; $randomNum = mt_rand(1, 99); $user_img_name = "(".$randomNum.")".$user_img_name; $is_file_exist = file_exists("storage/img/license/".$user_img_name); } $insert_user = base64_decode($request['user_license']); // 파일 디코딩 $file_user = Storage::disk('license')->put($user_img_name, $insert_user); // 파일 저장 //db 처리 if($file_doctor && $file_user) { $update_doctor = \App\doctor_info::where('id',$request->doctor_id)->update(['approval'=>'wait', 'created_at' => now()]); $create_license_user = \App\license::where([['doctor_id',$request->doctor_id],['division','user']])->update([ 'img_name' => $user_img_name, ]); $create_license_doctor = \App\license::where([['doctor_id',$request->doctor_id],['division','doctor']])->update([ 'img_name' => $doctor_img_name, ]); return response()->json([ 'result' => true, ]); } }else{ return response()->json([ 'result' => false, ]); } } /*의사 로그인*/ public function login(Request $request) { function jwt($id,$random){ // Create token header as a JSON string $header = json_encode(['typ' => 'JWT', 'alg' => 'HS256']); // Create token payload as a JSON string $payload = json_encode(['doctor_id' => $id]); // Encode Header to Base64Url String $base64UrlHeader = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($header)); // Encode Payload to Base64Url String $base64UrlPayload = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($payload)); // Create Signature Hash $signature = hash_hmac('sha256', $base64UrlHeader . "." . $base64UrlPayload, $random, true); // Encode Signature to Base64Url String $base64UrlSignature = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($signature)); // Create JWT $jwt = $base64UrlHeader . "." . $base64UrlPayload . "." . $base64UrlSignature; return $jwt; } function Random($length) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; } $doctor_num = ""; $token = ""; if($request->type == "kakao"){ $doctor = \App\doctor_info::where('doctor_kakao',$request['doctor_id'])->first(); if(isset($doctor->id)){ if($doctor->approval == "wait" && $doctor['on/off'] == "on"){ $result = false; /// 아직 인증 안됨 $msg = "관리자의 승인을 기다리는 중 입니다."; }elseif($doctor->approval == "deny" && $doctor['on/off'] == "on"){ $result = false; /// 아직 인증 안됨 $msg = "승인거부"; $doctor_num = $doctor->id; }elseif ($doctor['on/off'] != "on") { $result = false; /// 회원 정지 $msg = "이용이 제한된 계정입니다."; }else{ $token = jwt($doctor->id,Random(3)); $fcm = \App\doctor_info::where('doctor_kakao',$request['doctor_id'])->update(["fcm_token" => $request['fcm_token'],'doctor_token'=> $token]); $log = \App\login_log::create([ 'id_type' => 'doctor', 'login_id' => $doctor->id, 'ip_address'=> $_SERVER["REMOTE_ADDR"] ]); $msg = ""; $result = true; $doctor_num = $doctor->id; } }else{ $result = false; /// 카카오 id 없음 $msg = "계정이 존재하지 않습니다."; } }elseif($request->type == "naver"){ $doctor = \App\doctor_info::where('doctor_naver',$request['doctor_id'])->first(); if(isset($doctor->id)){ if($doctor->approval == "wait" && $doctor['on/off'] == "on"){ $result = false; /// 아직 인증 안됨 $msg = "관리자의 승인을 기다리는 중 입니다."; }elseif($doctor->approval == "deny" && $doctor['on/off'] == "on"){ $result = false; /// 아직 인증 안됨 $msg = "승인거부"; $doctor_num = $doctor->id; }elseif ($doctor['on/off'] != "on") { $result = false; /// 회원 정지 $msg = "이용이 제한된 계정입니다."; }else{ $token = jwt($doctor->id,Random(3)); $fcm = \App\doctor_info::where('doctor_naver',$request['doctor_id'])->update(["fcm_token" => $request['fcm_token'],'doctor_token'=> $token]); $log = \App\login_log::create([ 'id_type' => 'doctor', 'login_id' => $doctor->id, 'ip_address'=> $_SERVER["REMOTE_ADDR"] ]); $msg = ""; $result = true; $doctor_num = $doctor->id; } }else{ $result = false; /// 카카오 id 없음 $msg = "계정이 존재하지 않습니다."; } } elseif($request->type == "google"){ $doctor = \App\doctor_info::where('doctor_google',$request['doctor_id'])->first(); if(isset($doctor->id)){ if($doctor->approval == "wait" && $doctor['on/off'] == "on"){ $result = false; /// 아직 인증 안됨 $msg = "관리자의 승인을 기다리는 중 입니다."; }elseif($doctor->approval == "deny" && $doctor['on/off'] == "on"){ $result = false; /// 아직 인증 안됨 $msg = "승인거부"; $doctor_num = $doctor->id; }elseif ($doctor['on/off'] != "on") { $result = false; /// 회원 정지 $msg = "이용이 제한된 계정입니다."; }else{ $token = jwt($doctor->id,Random(3)); $fcm = \App\doctor_info::where('doctor_google',$request['doctor_id'])->update(["fcm_token" => $request['fcm_token'],'doctor_token'=> $token]); $log = \App\login_log::create([ 'id_type' => 'doctor', 'login_id' => $doctor->id, 'ip_address'=> $_SERVER["REMOTE_ADDR"] ]); $msg = ""; $result = true; $doctor_num = $doctor->id; } }else{ $result = false; /// 카카오 id 없음 $msg = "계정이 존재하지 않습니다."; } } elseif($request->type == "facebook"){ $doctor = \App\doctor_info::where('doctor_facebook',$request['doctor_id'])->first(); if(isset($doctor->id)){ if($doctor->approval == "wait" && $doctor['on/off'] == "on"){ $result = false; /// 아직 인증 안됨 $msg = "관리자의 승인을 기다리는 중 입니다."; }elseif($doctor->approval == "deny" && $doctor['on/off'] == "on"){ $result = false; /// 아직 인증 안됨 $msg = "승인거부"; $doctor_num = $doctor->id; }elseif ($doctor['on/off'] != "on") { $result = false; /// 회원 정지 $msg = "이용이 제한된 계정입니다."; }else{ $token = jwt($doctor->id,Random(3)); $fcm = \App\doctor_info::where('doctor_facebook',$request['doctor_id'])->update(["fcm_token" => $request['fcm_token'],'doctor_token'=> $token]); $log = \App\login_log::create([ 'id_type' => 'doctor', 'login_id' => $doctor->id, 'ip_address'=> $_SERVER["REMOTE_ADDR"] ]); $msg = ""; $result = true; $doctor_num = $doctor->id; } }else{ $result = false; /// 카카오 id 없음 $msg = "계정이 존재하지 않습니다."; } } elseif($request->type == "twitter"){ $doctor = \App\doctor_info::where('doctor_twitter',$request['doctor_id'])->first(); if(isset($doctor->id)){ if($doctor->approval == "wait" && $doctor['on/off'] == "on"){ $result = false; /// 아직 인증 안됨 $msg = "관리자의 승인을 기다리는 중 입니다."; }elseif($doctor->approval == "deny" && $doctor['on/off'] == "on"){ $result = false; /// 아직 인증 안됨 $msg = "승인거부"; $doctor_num = $doctor->id; }elseif ($doctor['on/off'] != "on") { $result = false; /// 회원 정지 $msg = "이용이 제한된 계정입니다."; }else{ $token = jwt($doctor->id,Random(3)); $fcm = \App\doctor_info::where('doctor_twitter',$request['doctor_id'])->update(["fcm_token" => $request['fcm_token'],'doctor_token'=> $token]); $log = \App\login_log::create([ 'id_type' => 'doctor', 'login_id' => $doctor->id, 'ip_address'=> $_SERVER["REMOTE_ADDR"] ]); $msg = ""; $result = true; $doctor_num = $doctor->id; } }else{ $result = false; /// 카카오 id 없음 $msg = "계정이 존재하지 않습니다."; } }else{ $doctor = \App\doctor_info::where('doctor_id',$request['doctor_id'])->first(); if(isset($doctor->id)){ if (Hash::check($request['doctor_pw'], $doctor->doctor_pw)) { if($doctor->approval == "wait" && $doctor['on/off'] == "on"){ $result = false; /// 아직 인증 안됨 $msg = "관리자의 승인을 기다리는 중 입니다."; }elseif($doctor->approval == "deny" && $doctor['on/off'] == "on"){ $result = false; /// 아직 인증 안됨 $msg = "승인거부"; $doctor_num = $doctor->id; }elseif ($doctor['on/off'] != "on") { $result = false; /// 회원 정지 $msg = "이용이 제한된 계정입니다."; }else{ $token = jwt($doctor->id,Random(3)); $fcm = \App\doctor_info::where('doctor_id',$request['doctor_id'])->update(["fcm_token" => $request['fcm_token'],'doctor_token'=> $token]); $log = \App\login_log::create([ 'id_type' => 'doctor', 'login_id' => $doctor->id, 'ip_address'=> $_SERVER["REMOTE_ADDR"] ]); $msg = ""; $result = true; $doctor_num = $doctor->id; } }else{ $result = false; /// 비밀번호 없음 $msg = "비밀번호가 일치하지 않습니다."; } }else{ $result = false; /// id 없음 $msg = "아이디가 존재하지 않습니다."; } } if(isset($doctor->id)) { $doctor_address = \App\hospital_info::where('doctor_id',$doctor->id)->first(); }else { $doctor_address = \App\hospital_info::where('doctor_id',"")->first(); } if(isset($doctor_address->address)) { $address = $doctor_address->address; }else { $address = ""; } return response()->json([ 'result' => $result, 'message' => $msg, 'doctor_num' => $doctor_num, 'doctor_address' => $address, 'token' => $token, ]); } /*의사 토큰 검사*/ public function check_token(Request $request) { if(isset($request['token'])){ $doctor = \App\doctor_info::where('doctor_token',$request['token'])->first(); if(isset($doctor->id)){ $doctor_id = explode('.', $doctor->doctor_token); $doctor_id = base64_decode($doctor_id['1']); $doctor_id = json_decode($doctor_id,true); if($doctor->id == $doctor_id['doctor_id']){ $log = \App\login_log::create([ 'id_type' => 'doctor', 'login_id' => $doctor->id, 'ip_address'=> $_SERVER["REMOTE_ADDR"] ]); return response()->json([ 'result' => true, ]); } } } return response()->json([ 'result' => false, ]); } /*의사 로그아웃*/ public function logout(Request $request) { $state = \App\doctor_info::where('id',$request['doctor_id'])->update([ 'state' => "off", 'latitude' => "0", 'longitude' => "0", 'fcm_token' => NULL, 'address' => NULL, 'doctor_token' => NULL, ]); return response()->json([ 'result' => true, ]); } /*의사 fcm토큰 재설정*/ public function fcm_token(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->doctor_id); if(isset($q)){ return $q; } $fcm = \App\doctor_info::where('id',$request['doctor_id'])->update(["fcm_token" => $request['fcm_token']]); return response()->json([ 'result' => true, ]); } /*의사 상태(채팅 state)등록 */ public function state(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->doctor_id); if(isset($q)){ return $q; } $hospital = \App\hospital_info::where('doctor_id',$request['doctor_id'])->first(); if($request->doctor_state == "on"){ if(isset($hospital)) { $state = \App\doctor_info::where('id',$request['doctor_id'])->update([ 'state' => $request->doctor_state, 'latitude' => $request->latitude, 'longitude' => $request->longitude, 'address' => $request['address'], ]); return response()->json([ 'result' => true, 'address' => $request['address'], ]); }else { return response()->json([ 'result' => false, ]); } }elseif($request->doctor_state == "off"){ $state = \App\doctor_info::where('id',$request['doctor_id'])->update([ 'state' => $request->doctor_state, 'latitude' => "0", 'longitude' => "0", 'address' => NULL, ]); return response()->json([ 'result' => true, 'address' => "", ]); }else{ return response()->json([ 'result' => false, ]); } } /*의사 현재위치 등록*/ public function location(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->doctor_id); if(isset($q)){ return $q; } $doctor = \App\doctor_info::where('id',$request['doctor_id'])->update([ 'latitude' => $request['latitude'], 'longitude' => $request['longitude'], 'address' => $request['address'], ]); return response()->json([ 'result' => true, 'address' => $request['address'], ]); } /*마이페이지*/ public function mypage(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->doctor_id); if(isset($q)){ return $q; } $doctor = \App\doctor_info::where('id',$request['doctor_id'])->first(); if(isset($doctor->id)){ $account = \App\account::where('doctor_id',$request['doctor_id'])->first(); $rating = \App\chat_request::where([['doctor_id',$request->doctor_id],['state','finish'],['rating','<>',NULL]])->avg('rating'); $chat_count = \App\chat_request::where([['doctor_id',$request->doctor_id],['state','finish']])->count(); $get_money = \App\withdraw_list::where([['doctor_id',$request->doctor_id],['state','complete']])->sum("price"); $price = \App\accumulate::where('doctor_id',$request->doctor_id)->sum('point'); $hospital = \App\hospital_info::where('doctor_id',$request['doctor_id'])->first(); if(isset($hospital) && isset($account)){ return response()->json([ 'result' => true, 'doctor_name' => $doctor->doctor_name, 'doctor_phone' => $doctor->doctor_phone, 'point' => $price-$get_money, 'rating' => $rating, 'chat_count' => $chat_count, 'fee' => $doctor->fee, 'hospital' => true, 'hospital_name' => $hospital->name, 'hospital_address' => $hospital->address, 'hospital_intro' => $hospital->intro, 'hospital_url' => $hospital->url, 'account' => true, 'bank_name' => $account->bank_name, 'bank_number' => $account->bank_number, 'bank_depo' => $account->bank_depo, ]); }elseif (isset($hospital) && !isset($account)) { return response()->json([ 'result' => true, 'doctor_name' => $doctor->doctor_name, 'doctor_phone' => $doctor->doctor_phone, 'point' => $price-$get_money, 'rating' => $rating, 'chat_count' => $chat_count, 'fee' => $doctor->fee, 'hospital' => true, 'hospital_name' => $hospital->name, 'hospital_address' => $hospital->address, 'hospital_intro' => $hospital->intro, 'hospital_url' => $hospital->url, 'account' => false, ]); }elseif (!isset($hospital) && isset($account)) { return response()->json([ 'result' => true, 'doctor_name' => $doctor->doctor_name, 'doctor_phone' => $doctor->doctor_phone, 'point' => $price-$get_money, 'rating' => $rating, 'chat_count' => $chat_count, 'fee' => $doctor->fee, 'hospital' => false, 'account' => true, 'bank_name' => $account->bank_name, 'bank_number' => $account->bank_number, 'bank_depo' => $account->bank_depo, ]); }else{ return response()->json([ 'result' => true, 'doctor_name' => $doctor->doctor_name, 'doctor_phone' => $doctor->doctor_phone, 'point' => $price-$get_money, 'rating' => $rating, 'chat_count' => $chat_count, 'fee' => $doctor->fee, 'hospital' => false, 'account' => false, ]); } }else{ return response()->json([ 'result' => false, ]); } } /*내 정보 불러오기 <수정 시>*/ public function mypage_load(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->doctor_id); if(isset($q)){ return $q; } $doctor = \App\doctor_info::where('id',$request['doctor_id'])->first(); if(isset($doctor->id)){ return response()->json([ 'result' => true, 'doctor_id' => $doctor->doctor_id, 'doctor_kakao' => $doctor->doctor_kakao, 'doctor_naver' => $doctor->doctor_naver, 'doctor_google' => $doctor->doctor_google, 'doctor_facebook' => $doctor->doctor_facebook, 'doctor_twitter' => $doctor->doctor_twitter, 'doctor_name' => $doctor->doctor_name, 'doctor_phone' => $doctor->doctor_phone, ]); }else{ return response()->json([ 'result' => false, ]); } } /*마이페이지 수정*/ public function mypage_update(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->doctor_id); if(isset($q)){ return $q; } if(isset($request['doctor_pw'])){ // pw 둘다 수정 $doctor = \App\doctor_info::where('id',$request['doctor_id'])->update([ 'doctor_pw' => bcrypt($request['doctor_pw']), ]); } if(isset($request['doctor_phone'])){ //번호 수정 $doctor = \App\doctor_info::where('id',$request['doctor_id'])->update([ 'doctor_phone' => $request['doctor_phone'], ]); } return response()->json([ 'result' => true, ]); } /*병원 등록*/ public function hospital_register(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->doctor_id); if(isset($q)){ return $q; } $hospital = \App\hospital_info::create([ 'doctor_id' => $request['doctor_id'], 'name' => $request['hospital_name'], 'address' => $request['hospital_address'], 'intro' => $request['hospital_intro'], 'url' => $request['hospital_url'], ]); if(isset($hospital->id)){ return response()->json([ 'result' => true, ]); }else{ return response()->json([ 'result' => false, ]); } } /*병원정보 불러오기*/ public function hospital_load(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->doctor_id); if(isset($q)){ return $q; } $hospital = \App\hospital_info::where('doctor_id',$request['doctor_id'])->first(); if(isset($hospital)){ return response()->json([ 'result' => true, 'hospital_name' => $hospital->name, 'hospital_address' => $hospital->address, 'hospital_intro' => $hospital->intro, 'hospital_url' => $hospital->url, ]); }else{ return response()->json([ 'result' => false, ]); } } /*병원 수정*/ public function hospital_update(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->doctor_id); if(isset($q)){ return $q; } $hospital = \App\hospital_info::where('doctor_id',$request['doctor_id'])->update([ 'name' => $request['hospital_name'], 'address' => $request['hospital_address'], 'intro' => $request['hospital_intro'], 'url' => $request['hospital_url'], ]); return response()->json([ 'result' => true, ]); } /*계좌정보 등록*/ public function account_register(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->doctor_id); if(isset($q)){ return $q; } $account = \App\account::create([ 'doctor_id' => $request['doctor_id'], 'bank_name' => $request['bank_name'], 'bank_number' => $request['bank_number'], 'bank_depo' => $request['bank_depo'], ]); if(isset($account->id)){ return response()->json([ 'result' => true, ]); }else{ return response()->json([ 'result' => false, ]); } } /*계좌정보 목록*/ public function account_load(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->doctor_id); if(isset($q)){ return $q; } $get_money = \App\withdraw_list::where([['doctor_id',$request->doctor_id],['state','complete']])->sum("price"); $price = \App\accumulate::where('doctor_id',$request->doctor_id)->sum('point'); $doctor = \App\doctor_info::where('id',$request->doctor_id)->first(); $account = \App\account::where('doctor_id',$request['doctor_id'])->first(); $rating = \App\chat_request::where([['doctor_id',$request->doctor_id],['state','finish'],['rating','<>',NULL]])->avg('rating'); $chat_count = \App\chat_request::where([['doctor_id',$request->doctor_id],['state','finish']])->count(); if(isset($account->id)){ return response()->json([ 'result' => true, 'bank_name' => $account->bank_name, 'bank_number' => $account->bank_number, 'bank_depo' => $account->bank_depo, 'point' => $price-$get_money, 'rating' => $rating, 'chat_count' => $chat_count, 'doctor_name' => $doctor->doctor_name, ]); }else{ return response()->json([ 'result' => false, ]); } } /*계좌정보 수정*/ public function account_update(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->doctor_id); if(isset($q)){ return $q; } $account = \App\account::where('doctor_id',$request['doctor_id'])->update([ 'bank_name' => $request['bank_name'], 'bank_number' => $request['bank_number'], 'bank_depo' => $request['bank_depo'], ]); return response()->json([ 'result' => true, ]); } /*출금신청 등록*/ public function withdraw_register(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->doctor_id); if(isset($q)){ return $q; } //금액 환산 $fee = \App\doctor_info::where('id',$request->doctor_id)->first(); $fee = $fee->fee; $get_money = floor($request['price']*(100-$fee)/100); $withdraw = \App\withdraw_list::create([ 'doctor_id' => $request['doctor_id'], 'price' => $request['price'], 'fee' => $fee, 'get_money' => $get_money, ]); if(isset($withdraw->id)){ return response()->json([ 'result' => true, ]); }else{ return response()->json([ 'result' => false, ]); } } /*출금신청 내역*/ public function withdraw_list(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->doctor_id); if(isset($q)){ return $q; } $withdraw_id = array(); $price = array(); $fee = array(); $get_money = array(); $state = array(); $coment = array(); $date = array(); $withdraws = \App\withdraw_list::where('doctor_id',$request['doctor_id'])->orderBy('id','desc')->get(); foreach ($withdraws as $i => $withdraw) { $withdraw_id[$i] = $withdraw->id; $price[$i] = $withdraw->price; $fee[$i] = $withdraw->fee; $get_money[$i] = $withdraw->get_money; $state[$i] = $withdraw->state; $coment[$i] = $withdraw->coment; $date[$i] = $withdraw->created_at; } if($withdraws != "[]"){ return response()->json([ 'result' => true, 'withdraw_id' => $withdraw_id, 'price' => $price, 'fee' => $fee, 'get_money' => $get_money, 'state' => $state, 'coment' => $coment, 'date' => $date, ]); }else{ return response()->json([ 'result' => false, ]); } } /*출금신청 수정*/ public function withdraw_update(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->doctor_id); if(isset($q)){ return $q; } $withdraw = \App\withdraw_list::where('id',$request['withdraw_id'])->first(); if($withdraw->state == "wait"){ //금액 환산 $fee = \App\doctor_info::where('id',$request->doctor_id)->first(); $fee = $fee->fee; $get_money = floor($request['price']*(100-$fee)/100); $withdraw = \App\withdraw_list::where([['id',$request['withdraw_id']],["state","wait"]])->update([ 'price' => $request['price'], 'fee' => $fee, 'get_money' => $get_money, ]); return response()->json([ 'result' => true, ]); }else{ return response()->json([ 'result' => false, ]); } } /*출금신청 삭제*/ public function withdraw_destroy(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->doctor_id); if(isset($q)){ return $q; } $withdraw = \App\withdraw_list::where('id',$request['withdraw_id'])->first(); if($withdraw->state == "wait"){ $withdraw = \App\withdraw_list::where([['id',$request['withdraw_id']],["state","wait"]])->delete(); return response()->json([ 'result' => true, ]); }else{ return response()->json([ 'result' => false, ]); } } /*파일 업로드*/ public function Upload(Request $request) { // 1) $doctor = base64_decode($request['doctor_license']); // 파일 디코딩 $file_doctor = Storage::disk('doctor_license')->put($request['doctor_license_name'], $doctor); // 파일 저장 // 2) $uploadedFile = $request->file('file'); // 파일 설정 $filename = $uploadedFile->getClientOriginalName(); //파일 이름불러오기 $file = $uploadedFile ->storeAs('public/img',$filename); //파일 이름($filename)으로 경로(public/img)에 저장 } } <file_sep>/routes/policy.php <?php /* 이용약관 페이지 */ /*서비스 이용약관*/ Route::get('policy/service', function () { return view('policy.service'); }); /*개인정보 이용약관*/ Route::get('policy/privacy', function () { return view('policy.privacy'); }); //로그인 ?> <file_sep>/app/Http/Controllers/RegisterController.php <?php namespace App\Http\Controllers; use Illuminate\Http\Request; class RegisterController extends Controller { //로그인하지 않은 사람만 이용가능한 컨트롤러 public function __construct() { $this->middleware('guest'); } public function create() { return view("login.register"); } public function store(Request $request) { $this->validate($request,[ 'admin_id' => 'required|max:20|min:5|unique:admin_info,admin_id|regex:/^[a-z0-9\-+]{5,20}$/', 'admin_pw' => 'required|max:15|min:5|confirmed|regex:/^(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[~!@#$%^&*])[a-zA-Z0-9~!@#$%^&*]{5,15}$/', 'checkbox' => 'required', ]); $user = \App\admin_info::create([ 'admin_id'=> $request->input('admin_id'), 'admin_pw'=> <PASSWORD>($request->input('admin_pw')), ]); // flash('가입 신청이 완료되었습니다. 관리자의 승인 후 로그인이 가능합니다.')->info(); return redirect()->route('login')->with('alert','가입 신청이 완료되었습니다. \n관리자의 승인 후 로그인이 가능합니다.'); } } <file_sep>/app/account.php <?php namespace App; use Illuminate\Database\Eloquent\Model; class account extends Model { //타임스탬프 자동입력 public $timestamps = false; //DB 이름 연동 protected $table = "account"; //대용량할당 protected $fillable = ['doctor_id','bank_name', 'bank_number', 'bank_depo']; } <file_sep>/app/doctor_info.php <?php namespace App; use Illuminate\Database\Eloquent\Model; class doctor_info extends model { //타임스탬프 자동입력 public $timestamps = false; //DB 이름 연동 protected $table = "doctor_info"; //대용량할당 protected $fillable = ['doctor_id', 'doctor_pw', 'doctor_phone', 'doctor_name', 'doctor_kakao', 'doctor_naver', 'doctor_google', 'doctor_facebook', 'doctor_twitter', 'doctor_token', 'latitude', 'longitude', 'address', 'on/off', 'fcm_token', 'fee', 'created_at' ]; //조회시 제외할 칼럼 protected $hidden = ['doctor_pw']; public function license() { return $this->hasMany(license::class); } /*자동 타입변환*/ // protected $casts = [ // 'email_verified_at' => 'datetime', // ]; } <file_sep>/app/license.php <?php namespace App; use Illuminate\Database\Eloquent\Model; class license extends Model { //타임스탬프 자동입력 public $timestamps = false; //DB 이름 연동 protected $table = "license"; //대용량할당 protected $fillable = ['img_name','doctor_id','division']; public function doctor_info() { return $this->belongsTo(doctor_info::class); } /*자동 타입변환*/ // protected $casts = [ // 'email_verified_at' => 'datetime', // ]; } <file_sep>/app/fcm_log.php <?php namespace App; use Illuminate\Database\Eloquent\Model; class fcm_log extends Model { //타임스탬프 자동입력 public $timestamps = false; //DB 이름 연동 protected $table = "fcm_log"; //대용량할당 protected $fillable = ['id_type', 'fcm_id', 'type', 'ip_address']; } <file_sep>/app/pet_info.php <?php namespace App; use Illuminate\Database\Eloquent\Model; class pet_info extends Model { //타임스탬프 자동입력 public $timestamps = false; //DB 이름 연동 protected $table = "pet_info"; //대용량할당 protected $fillable = ['user_id', 'pet_name', 'pet_main_type', 'pet_sub_type', 'pet_gender', 'pet_age', 'pet_birth', 'pet_img', 'pet_notice']; } <file_sep>/app/Http/Controllers/ConfigController.php <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; class ConfigController extends Controller { //로그인만 이용가능한 컨트롤러 public function __construct() { $this->middleware('auth'); $this->middleware('checkstatus'); } /*FCM 발송페이지*/ public function fcm() { return view('config.fcm'); } /*FCM 발송*/ public function fcm_send(Request $request) { $this->validate($request,[ 'type' => 'required', 'title' => 'required', 'body' => 'required' ]); $token = array(); if($request->type == "all"){ $users = \App\user_info::where('on/off','on')->get(); $doctors= \App\doctor_info::where([['approval','complete'],['on/off','on']])->get(); foreach ($users as $user) { if($user->fcm_token != null){ $log = \App\fcm_log::create([ 'id_type' => 'user', 'fcm_id' => $user->id, 'type' => "관리자 단체 발송", 'ip_address' => $_SERVER["REMOTE_ADDR"], ]); array_push($token, $user->fcm_token); } } foreach ($doctors as $doctor) { if($doctor->fcm_token != null){ $log = \App\fcm_log::create([ 'id_type' => 'doctor', 'fcm_id' => $doctor->id, 'type' => "관리자 단체 발송", 'ip_address' => $_SERVER["REMOTE_ADDR"], ]); array_push($token, $doctor->fcm_token); } } }elseif($request->type == "user"){ if(isset($request->payment)) { $users = \App\payment_list::join('user_info','payment_list.user_id','=','user_info.id')->select('user_info.id', 'user_info.fcm_token', DB::raw("count(payment_list.id) as count"))->where([['on/off','on'],['payment_list.state','complete']])->groupBy('user_info.id')->having('count','>=',$request->payment)->get(); }else { $users = \App\user_info::where('on/off','on')->get(); } foreach ($users as $user) { if($user->fcm_token != null){ $log = \App\fcm_log::create([ 'id_type' => 'user', 'fcm_id' => $user->id, 'type' => "관리자 단체 발송", 'ip_address' => $_SERVER["REMOTE_ADDR"], ]); array_push($token, $user->fcm_token); } } }else{ if(isset($request->rating) and isset($request->count) and $request->sido != '0' and $request->gugun != '0') { $address = $request->sido." ".$request->gugun; $doctors = \App\chat_request::join('doctor_info','chat_request.doctor_id','=','doctor_info.id')->join('hospital_info','doctor_info.id','=','hospital_info.doctor_id') ->select('doctor_info.id', 'doctor_info.fcm_token', DB::raw("avg(rating) as rating"), DB::raw("count(chat_request.id) as count"), DB::raw("hospital_info.address")) ->where([['approval','complete'],['on/off','on'],['chat_request.state','finish']])->groupBy('doctor_info.id') ->having('rating','>=',$request->rating)->having('count','>=',$request->count)->having('hospital_info.address','like',"%".$address."%")->get(); } elseif(isset($request->rating) and isset($request->count) and $request->sido != '0' and $request->gugun == '0') { $address = $request->sido; $doctors = \App\chat_request::join('doctor_info','chat_request.doctor_id','=','doctor_info.id')->join('hospital_info','doctor_info.id','=','hospital_info.doctor_id') ->select('doctor_info.id', 'doctor_info.fcm_token', DB::raw("avg(rating) as rating"), DB::raw("count(chat_request.id) as count"), DB::raw("hospital_info.address")) ->where([['approval','complete'],['on/off','on'],['chat_request.state','finish']])->groupBy('doctor_info.id') ->having('rating','>=',$request->rating)->having('count','>=',$request->count)->having('hospital_info.address','like',"%".$address."%")->get(); } elseif(isset($request->rating) and isset($request->count) and $request->sido == '0' and $request->gugun != '0') { $address = $request->gugun; $doctors = \App\chat_request::join('doctor_info','chat_request.doctor_id','=','doctor_info.id')->join('hospital_info','doctor_info.id','=','hospital_info.doctor_id') ->select('doctor_info.id', 'doctor_info.fcm_token', DB::raw("avg(rating) as rating"), DB::raw("count(chat_request.id) as count"), DB::raw("hospital_info.address")) ->where([['approval','complete'],['on/off','on'],['chat_request.state','finish']])->groupBy('doctor_info.id') ->having('rating','>=',$request->rating)->having('count','>=',$request->count)->having('hospital_info.address','like',"%".$address."%")->get(); } elseif(isset($request->rating) and isset($request->count) and $request->sido == '0' and $request->gugun == '0') { $doctors = \App\chat_request::join('doctor_info','chat_request.doctor_id','=','doctor_info.id') ->select('doctor_info.id', 'doctor_info.fcm_token', DB::raw("avg(rating) as rating"), DB::raw("count(chat_request.id) as count")) ->where([['approval','complete'],['on/off','on'],['chat_request.state','finish']])->groupBy('doctor_info.id') ->having('rating','>=',$request->rating)->having('count','>=',$request->count)->get(); } elseif(isset($request->rating) and $request->sido != '0' and $request->gugun != '0') { $address = $request->sido." ".$request->gugun; $doctors = \App\chat_request::join('doctor_info','chat_request.doctor_id','=','doctor_info.id')->join('hospital_info','doctor_info.id','=','hospital_info.doctor_id') ->select('doctor_info.id', 'doctor_info.fcm_token', DB::raw("avg(rating) as rating"), DB::raw("hospital_info.address")) ->where([['approval','complete'],['on/off','on'],['chat_request.state','finish']])->groupBy('doctor_info.id') ->having('rating','>=',$request->rating)->having('hospital_info.address','like',"%".$address."%")->get(); } elseif(isset($request->rating) and $request->sido != '0' and $request->gugun == '0') { $address = $request->sido; $doctors = \App\chat_request::join('doctor_info','chat_request.doctor_id','=','doctor_info.id')->join('hospital_info','doctor_info.id','=','hospital_info.doctor_id') ->select('doctor_info.id', 'doctor_info.fcm_token', DB::raw("avg(rating) as rating"), DB::raw("hospital_info.address")) ->where([['approval','complete'],['on/off','on'],['chat_request.state','finish']])->groupBy('doctor_info.id') ->having('rating','>=',$request->rating)->having('hospital_info.address','like',"%".$address."%")->get(); } elseif(isset($request->rating) and $request->sido == '0' and $request->gugun != '0') { $address = $request->gugun; $doctors = \App\chat_request::join('doctor_info','chat_request.doctor_id','=','doctor_info.id')->join('hospital_info','doctor_info.id','=','hospital_info.doctor_id') ->select('doctor_info.id', 'doctor_info.fcm_token', DB::raw("avg(rating) as rating"), DB::raw("hospital_info.address")) ->where([['approval','complete'],['on/off','on'],['chat_request.state','finish']])->groupBy('doctor_info.id') ->having('rating','>=',$request->rating)->having('hospital_info.address','like',"%".$address."%")->get(); } elseif(isset($request->rating) and $request->sido == '0' and $request->gugun == '0') { $doctors = \App\chat_request::join('doctor_info','chat_request.doctor_id','=','doctor_info.id') ->select('doctor_info.id', 'doctor_info.fcm_token', DB::raw("avg(rating) as rating")) ->where([['approval','complete'],['on/off','on'],['chat_request.state','finish']])->groupBy('doctor_info.id') ->having('rating','>=',$request->rating)->get(); } elseif(isset($request->count) and $request->sido != '0' and $request->gugun != '0') { $address = $request->sido." ".$request->gugun; $doctors = \App\chat_request::join('doctor_info','chat_request.doctor_id','=','doctor_info.id')->join('hospital_info','doctor_info.id','=','hospital_info.doctor_id') ->select('doctor_info.id', 'doctor_info.fcm_token', DB::raw("count(chat_request.id) as count"), DB::raw("hospital_info.address")) ->where([['approval','complete'],['on/off','on'],['chat_request.state','finish']])->groupBy('doctor_info.id') ->having([['count','>=',$request->count],['hospital_info.address','like',"%".$address."%"]])->get(); } elseif(isset($request->count) and $request->sido != '0' and $request->gugun == '0') { $address = $request->sido; $doctors = \App\chat_request::join('doctor_info','chat_request.doctor_id','=','doctor_info.id')->join('hospital_info','doctor_info.id','=','hospital_info.doctor_id') ->select('doctor_info.id', 'doctor_info.fcm_token', DB::raw("count(chat_request.id) as count"), DB::raw("hospital_info.address")) ->where([['approval','complete'],['on/off','on'],['chat_request.state','finish']])->groupBy('doctor_info.id') ->having('count','>=',$request->count)->having('hospital_info.address','like',"%".$address."%")->get(); } elseif(isset($request->count) and $request->sido == '0' and $request->gugun != '0') { $address = $request->gugun; $doctors = \App\chat_request::join('doctor_info','chat_request.doctor_id','=','doctor_info.id')->join('hospital_info','doctor_info.id','=','hospital_info.doctor_id') ->select('doctor_info.id', 'doctor_info.fcm_token', DB::raw("count(chat_request.id) as count"), DB::raw("hospital_info.address")) ->where([['approval','complete'],['on/off','on'],['chat_request.state','finish']])->groupBy('doctor_info.id') ->having('count','>=',$request->count)->having('hospital_info.address','like',"%".$address."%")->get(); } elseif(isset($request->count) and $request->sido == '0' and $request->gugun == '0') { $doctors = \App\chat_request::join('doctor_info','chat_request.doctor_id','=','doctor_info.id') ->select('doctor_info.id', 'doctor_info.fcm_token', DB::raw("count(chat_request.id) as count")) ->where([['approval','complete'],['on/off','on'],['chat_request.state','finish']])->groupBy('doctor_info.id') ->having('count','>=',$request->count)->get(); } elseif($request->sido != "0" && $request->gugun != "0") { $address = $request->sido." ".$request->gugun; $doctors = \App\doctor_info::join('hospital_info','doctor_info.id','=','hospital_info.doctor_id') ->select('doctor_info.id', 'doctor_info.fcm_token', DB::raw("hospital_info.address")) ->where([['approval','complete'],['on/off','on']])->groupBy('doctor_info.id') ->having('hospital_info.address','like',"%".$address."%")->get(); } elseif($request->sido != "0" && $request->gugun == "0") { $address = $request->sido; $doctors = \App\doctor_info::join('hospital_info','doctor_info.id','=','hospital_info.doctor_id') ->select('doctor_info.id', 'doctor_info.fcm_token', DB::raw("hospital_info.address")) ->where([['approval','complete'],['on/off','on']])->groupBy('doctor_info.id') ->having('hospital_info.address','like',"%".$address."%")->get(); }elseif($request->sido == "0" && $request->gugun != "0") { $address = $request->gugun; $doctors = \App\doctor_info::join('hospital_info','doctor_info.id','=','hospital_info.doctor_id') ->select('doctor_info.id', 'doctor_info.fcm_token', DB::raw("hospital_info.address")) ->where([['approval','complete'],['on/off','on']])->groupBy('doctor_info.id') ->having('hospital_info.address','like',"%".$address."%")->get(); }else { $doctors = \App\doctor_info::where([['approval','complete'],['on/off','on']])->get(); } foreach ($doctors as $doctor) { if($doctor->fcm_token != null){ $log = \App\fcm_log::create([ 'id_type' => 'doctor', 'fcm_id' => $doctor->id, 'type' => "관리자 단체 발송", 'ip_address' => $_SERVER["REMOTE_ADDR"], ]); array_push($token, $doctor->fcm_token); } } } $SERVER_KEY = "<KEY>"; $url = "https://fcm.googleapis.com/fcm/send"; $notification = array('title' => $request->title , 'body' => $request->body, 'sound' => 'default', 'badge' => '1', 'click_action' => '.MainActivity', 'android_channel_id' => '0'); $data = array('android_channel_id' => "0"); $arrayToSend = array('registration_ids' => $token, 'notification' => $notification, 'data' => $data, 'priority' => 'high'); $json = json_encode($arrayToSend); $headers = array(); $headers[] = 'Content-Type: application/json'; $headers[] = 'Authorization: key=' . $SERVER_KEY; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_HTTPHEADER,$headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); //Send the request $response = curl_exec($ch); return redirect()->back()->with('alert','FCM이 성공적으로 발송되었습니다.'); } // /*무통장 입금 계좌 목록*/ // public function passbook() // { // $passbooks = \App\passbook_account::where('on/off','off')->get(); // return view('config.passbook_config',compact('passbooks')); // } // // /*무통장 입금 계좌 등록 */ // public function passbook_register_success(Request $request) // { // $this->validate($request,[ // 'bank_name' => 'required', // 'bank_number' => 'required|min:11|max:14', // 'bank_depo' => 'required' // ]); // // $product = \App\passbook_account::where('id',$request->passbook_id)->insert([ // 'bank_name' => $request->bank_name, // 'bank_number' => $request->bank_number, // 'bank_depo' => $request->bank_depo // ]); // return redirect("config/passbook")->with('alert',"등록 되었습니다."); // } // // /*무통장 입금 계좌 등록 변경*/ // public function passbook_update(Request $request) // { // $passbook = \App\passbook_account::where('on/off',"on")->update(['on/off' => "off"]); // // $passbook = \App\passbook_account::where('id',$request->passbook_id)->update(['on/off' => 'on']); // return redirect("config/passbook")->with('alert',"변경 되었습니다."); // } // // /*무통장 입금 계좌 삭제*/ // public function passbook_delete(Request $request) // { // $passbook = \App\passbook_account::where('id',$request->passbook_delete_id)->delete(); // return redirect("config/passbook")->with('alert',"삭제 되었습니다."); // } } <file_sep>/app/level_list.php <?php namespace App; use Illuminate\Database\Eloquent\Model; class level_list extends Model { //타임스탬프 자동입력 public $timestamps = false; //DB 이름 연동 protected $table = "level_list"; //대용량할당 protected $fillable = ['level']; public function admin_info() { return $this->hasMany(admin_info::class); } } <file_sep>/README.md # Qpet_Server 반려동물 상담앱 서버 및 관리자 페이지 2019.09 ~ 2019.12 / 2020.04 ~ 2020.06 / 4인(50%) <br> 반려동물 상담서비스 고객앱 수의사앱의 관리 및 사용자의 활동분석, 통계, FCM 발송, 로그 관리 등을 위한 <br> 관리자 사이트 <h2>What I did?</h2> 1. Laravel을 통한 rest api구현 <br> 2. 고객앱(Qpet), 의사앱 로그 수집 후 통계 및 관리사이트 구현 <br> 3. Laravel blade를 통한 프론트엔드 구성<br> 4. google firebase통한 fcm 발송기능 구현 <br> <br><br><h2>대시보드</h2><br><br> <img width="100%" src="https://user-images.githubusercontent.com/48462737/131375096-fa757dcc-3daf-4c77-bcd7-b1a69544d5c4.PNG"/> <br><br><h2>회원관리</h2><br><br> <img width="100%" src="https://user-images.githubusercontent.com/48462737/131375110-c5f54ad2-ee25-467d-a17e-49b2193eb2fe.PNG"/> <br><br><h2>상담관리</h2><br><br> <img width="100%" src="https://user-images.githubusercontent.com/48462737/131375109-fe1add42-a917-4c04-adb9-3140e037317a.PNG"/> <br><br><h2>로그관리</h2><br><br> <img width="100%" src="https://user-images.githubusercontent.com/48462737/131375108-85df7bd7-2067-4707-bf77-2a51d1f4fe70.PNG"/> <br><br><h2>결제관리</h2><br><br> <img width="100%" src="https://user-images.githubusercontent.com/48462737/131375101-b7b2de66-3470-4b81-8998-4bfd9cb8c753.PNG"/> <br><br><h2>FCM발송</h2><br><br> <img width="100%" src="https://user-images.githubusercontent.com/48462737/131375096-fa757dcc-3daf-4c77-bcd7-b1a69544d5c4.PNG"/> <file_sep>/app/refund_list.php <?php namespace App; use Illuminate\Database\Eloquent\Model; class refund_list extends Model { //타임스탬프 자동입력 public $timestamps = false; //DB 이름 연동 protected $table = "refund_list"; //대용량할당 protected $fillable = ['user_id','payment_list_id', 'order_id', 'coment','state']; } <file_sep>/app/product.php <?php namespace App; use Illuminate\Database\Eloquent\Model; class product extends Model { //타임스탬프 자동입력 public $timestamps = false; //DB 이름 연동 protected $table = "product"; //대용량할당 protected $fillable = ['name','ticket','img','product_code','price','on/off']; } <file_sep>/app/Http/Controllers/ChatController.php <?php // file_put_contents("storage/log_check.txt", $request); namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\DB; class ChatController extends Controller { public function __construct() { // <고객> 이용 정지 회원인지 확인 function user_check($id){ $stop = \App\user_info::where('id',$id)->first(); if($stop['on/off'] == 'off'){ return response()->json([ 'result' => false ]); } } // <의사> 이용 정지 회원인지 확인 function doctor_check($id){ $stop = \App\doctor_info::where('id',$id)->first(); if($stop['on/off'] == 'off'){ return response()->json([ 'result' => false ]); } } function fcm($title,$body,$data,$token,$type,$channel){ // function fcm($data,$token,$type){ $SERVER_KEY = "<KEY>"; $url = "https://fcm.googleapis.com/fcm/send"; $notification = array('title' => $title , 'body' => $body, 'sound' => 'default', 'badge' => '1', 'click_action' => '.MainActivity', 'android_channel_id' => $channel); if($type == "doctor"){ $arrayToSend = array('registration_ids' => $token, 'notification' => $notification, 'data' => $data, 'priority' => 'high'); // $arrayToSend = array('registration_ids' => $token, 'data' => $data, 'priority' => 'high'); }else{ $arrayToSend = array('to' => $token, 'notification' => $notification, 'data' => $data, 'priority' => 'high'); // $arrayToSend = array('to' => $token, 'data' => $data, 'priority' => 'high'); } $json = json_encode($arrayToSend); $headers = array(); $headers[] = 'Content-Type: application/json'; $headers[] = 'Authorization: key=' . $SERVER_KEY; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_HTTPHEADER,$headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); //Send the request $response = curl_exec($ch); return $response; } function check_time($type, $id){ if($type == "doctor"){ $time = \App\chat_request::where([['state','ing'],['doctor_id',$id]])->get(); }else{ $time = \App\chat_request::where([['state','ing'],['user_id',$id]])->get(); } if($time != "[]"){ foreach ($time as $chat) { if($chat->extra_time != null){ $start = $chat->created_at; $start = date("Y-m-d H:i:s", strtotime($start."+".$chat->extra_time." minutes")); $end = date("Y-m-d H:i:s", strtotime($start."+20 minutes")); }else{ $start = $chat->created_at; $end = date("Y-m-d H:i:s", strtotime($start."+20 minutes")); } $now = date("Y-m-d H:i:s"); if($now > $end){ $channel_id = "GJCIaUNfqtlHkHrF"; $url = "https://api2.scaledrone.com/".$channel_id."/".$chat->pet_id."/publish"; // $json = json_encode($body); $headers = array(); $headers[] = 'Content-Type: application/json'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"POST"); // curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_HTTPHEADER,$headers); $body = array('state' => "off"); $json = json_encode($body); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); //Send the request $response = curl_exec($ch); if ($response === false) { return response()->json([ "result" => false, ]); } //Close request curl_close($ch); $chat_end = \App\chat_request::where('id',$chat->id)->update(['state'=>'finish']); $chat_request = \App\chat_request::where('id',$chat->id)->first(); // 포인트 적립 $price = config('app.price'); $accumulate = \App\accumulate::create([ "doctor_id" => $chat_request->doctor_id, "chat_request_id" => $chat->id, "point" => $price, ]); } } } } } // 일반 사용자가 의사에게 채팅 요청 및 상태확인 public function request(Request $request) { $time = "20"; // 재응답 시간 (초) $how = "10"; // 몇명에게 전송할지 if($request['count']=="1"){ // 정지회원 이용 제한 $user = \App\user_info::where('id',$request['user_id'])->first(); if($user['on/off'] != "on"){ return response()->json([ 'result' => false, 'warning' => "stop_member", ]); } //이용권 없을시 사용불가 if($user['ticket'] < "1"){ return response()->json([ 'result' => false, 'warning' => "no_ticket", ]); } //채팅중일때 다른 채팅 불가 $chat_check = \App\chat_request::where([['pet_id',$request['pet_id']],['state','ing']])->first(); if(isset($chat_check)){ return response()->json([ 'result' => false, 'warning' => "chat_ing", ]); } $match_query = "6371 * acos( cos( radians(".$request['latitude'].") ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(".$request['longitude'].") ) + sin( radians(".$request['latitude'].") ) * sin( radians( latitude ) ) ) as distance"; $count = \App\doctor_info::select('id', 'state', 'on/off', 'fcm_token','approval', DB::raw($match_query)) -> where([["state","on"],["on/off","on"],['approval',"complete"]],['doctor_phone','<>',$user->user_phone]) -> havingRaw('distance <'.$request['distance']) ->get()->count(); if($count == "0"){ //매칭 실패 경우 $chat_request = \App\chat_request::create([ 'user_id' => $request['user_id'], 'pet_id' => $request['pet_id'], 'latitude' => $request['latitude'], 'longitude' => $request['longitude'], 'distance' => $request['distance'], 'chat_title' => $request['chat_title'], 'chat_content' => $request['chat_content'], 'address' => $request['address'], 'state' => "off", ]); return response()->json([ 'result' => false, 'warning' => "no_matching", ]); } $chat_request = \App\chat_request::create([ 'user_id' => $request['user_id'], 'pet_id' => $request['pet_id'], 'latitude' => $request['latitude'], 'longitude' => $request['longitude'], 'distance' => $request['distance'], 'chat_title' => $request['chat_title'], 'chat_content' => $request['chat_content'], 'address' => $request['address'], ]); //매칭 쿼리 $doctor = \App\doctor_info::select('id', 'state', 'on/off', 'fcm_token', 'approval', DB::raw($match_query)) ->where([["state","on"],["on/off","on"],['approval','complete']]) ->havingRaw('distance <'.$request['distance']) ->limit($how) ->get(); //다음 채팅시 제외할 의사들 $except = array(); //-------------------fcm 발송 $token = array(); foreach ($doctor as $i => $idx) { $token[$i] = $idx->fcm_token; $except[$i] = $idx->id; } $except_list = \App\except_list::create([ 'chat_request_id' => $chat_request->id, 'except' => serialize($except), ]); //notification 부분 $title = "상담신청이 왔습니다."; $body = "클릭해서 확인해주세요."; //data 부분 $channel = "1"; $data = array('chat_request_id' => $chat_request->id, "android_channel_id" => $channel); // $data = array('chat_request_id' => $chat_request->id, 'type' => "0", "title" => $title, "body" => $body); $type = "doctor"; //발송 $response = fcm($title,$body,$data,$token,$type,$channel); // $response = fcm($data,$token,$type); foreach ($except as $i=> $doctor) { if(isset($token[$i])){ $log = \App\fcm_log::create([ 'id_type' => 'doctor', 'fcm_id' => $doctor, 'type' => "채팅 요청", 'ip_address' => $_SERVER["REMOTE_ADDR"], ]); } } return response()->json([ 'result' => true, 'chat_request_id' => $chat_request->id, 'time' => $time, ]); }else{ $chat_request_id = \App\chat_request::where('id', $request['chat_request_id'])->first(); if(isset($chat_request_id)){ if($chat_request_id['state'] == "wait"){ //아직 대기중 // 정지회원 이용 제한 $check = \App\user_info::where('id',$request['user_id'])->first(); if($check['on/off'] != "on"){ $chat_request = \App\chat_request::where("id",$request['chat_request_id'])->update([ 'state' => "off", ]); return response()->json([ 'state' => false, 'result' => false, ]); } //제외할 의사 $except = array(); $except_list = \App\except_list::where("chat_request_id",$request['chat_request_id'])->first(); $except = unserialize($except_list->except); //매칭 쿼리 $match_query = "6371 * acos( cos( radians(".$chat_request_id->latitude.") ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(".$chat_request_id->longitude.") ) + sin( radians(".$chat_request_id->latitude.") ) * sin( radians( latitude ) ) ) as distance"; $doctor = \App\doctor_info::select('id', 'state', 'on/off', 'fcm_token', 'approval', DB::raw($match_query)) ->whereNotIn('id',$except) ->where([["state","on"],["on/off","on"],['approval','complete']]) ->havingRaw('distance <'.$chat_request_id['distance']) ->limit($how) ->get(); if($doctor == "[]"){ $chat_request = \App\chat_request::where("id",$request['chat_request_id'])->update([ 'state' => "off", ]); return response()->json([ 'state' => false, 'result' => false, ]); }else{ //다음 제외할 의사 $count = count($except); //-------------------fcm 발송 $token = array(); foreach ($doctor as $i => $idx) { $token[$i] = $idx->fcm_token; $except[$count] = $idx->id; $count++; } $except_list = \App\except_list::where("chat_request_id",$request['chat_request_id'])->update([ 'except' => serialize($except), ]); //notification 부분 $title = "상담신청이 왔습니다."; $body = "클릭해서 확인해주세요."; //data 부분 $channel = "1"; $data = array('chat_request_id' => $request['chat_request_id'], "android_channel_id" => $channel); // $data = array('chat_request_id' => $chat_request->id, 'type' => "0", "title" => $title, "body" => $body); $type = "doctor"; //발송 $response = fcm($title,$body,$data,$token,$type,$channel); // $response = fcm($data,$token,$type); foreach ($except as $i=> $doctor) { if(isset($token[$i])){ $log = \App\fcm_log::create([ 'id_type' => 'doctor', 'fcm_id' => $doctor, 'type' => "채팅 요청", 'ip_address' => $_SERVER["REMOTE_ADDR"], ]); } } return response()->json([ 'state' => false, 'result' => true, ]); } }elseif ($chat_request_id['state'] == "ing") { //채팅 연결 $pet = \App\pet_info::where("id",$chat_request_id['pet_id'])->first(); return response()->json([ 'state' => true, 'chat_room' => $chat_request_id['pet_id'], 'pet_name' => $pet->pet_name, ]); }else{ trigger_error("Server Error", E_USER_ERROR); } } trigger_error("Server Error", E_USER_ERROR); } } // 일반 사용자가 의사에게 채팅 요청 취소 public function cancel(Request $request) { $chat_request_id = \App\chat_request::where('id', $request['chat_request_id'])->first(); // 이용 정지 회원인지 확인 $q = user_check($chat_request_id->user_id); if(isset($q)){ return $q; } if($chat_request_id->state == "ing"){ $pet = \App\pet_info::where("id",$chat_request_id['pet_id'])->first(); return response()->json([ 'result' => false, 'chat_room' => $chat_request_id->pet_id, 'pet_name' => $pet->pet_name, ]); } $cancel = \App\chat_request::where('id',$request['chat_request_id'])->update(['state' => 'off']); return response()->json([ 'result' => true, ]); } // 의사가 채팅 푸시알림으로 인해 채팅 요청 확인 public function response(Request $request) { $info = \App\chat_request::where('id',$request['chat_request_id'])->first(); $pet = \App\pet_info::where('id',$info->pet_id)->first(); if(isset($info)){ return response()->json([ 'result' => true, 'chat_title' => $info->chat_title, 'chat_content' => $info->chat_content, 'address' => $info->address, 'pet_name' => $pet->pet_name, 'pet_age' => $pet->pet_age, 'pet_birth' => $pet->pet_birth, 'pet_gender' => $pet->pet_gender, 'pet_main_type' => $pet->pet_main_type, 'pet_sub_type' => $pet->pet_sub_type, 'pet_notice' => $pet->pet_notice, ]); }else{ return response()->json([ 'result' => false, ]); } } // 의사가 채팅 수락 public function accept(Request $request) { $info = \App\chat_request::where('id',$request['chat_request_id'])->first(); // <의사> 이용 정지 회원인지 확인 $q = doctor_check($request->doctor_id); if(isset($q)){ return $q; } if($info->state == "wait"){ $user = \App\user_info::where("id",$info->user_id)->first(); // <고객> 이용 정지 회원인지 확인 $q = user_check($user->id); if(isset($q)){ return $q; } if($user->ticket == "0"){ return response()->json([ 'result' => false, ]); }else{ // 고객회원 이용권 갯수 차감 $check = \App\user_info::where("id",$info->user_id)->update([ 'ticket' => $user->ticket-1, ]); //-------------------fcm 발송 $token = $user->fcm_token; //notification 부분 $title = "상담이 시작되었습니다."; $body = "클릭해서 확인해주세요."; $pet = \App\pet_info::where("id",$info->pet_id)->first(); //data 부분 $channel = "1"; $data = array('chat_room' => $info->pet_id, 'chat_request_id' => $request['chat_request_id'], 'pet_name' => $pet->pet_name, "android_channel_id" => $channel); // $data = array('chat_request_id' => $chat_request->id, 'type' => "0", "title" => $title, "body" => $body); $type = "user"; //발송 $response = fcm($title,$body,$data,$token,$type,$channel); // $response = fcm($data,$token,$type); if(isset($token)){ $log = \App\fcm_log::create([ 'id_type' => 'user', 'fcm_id' => $user->id, 'type' => "채팅 연결", 'ip_address' => $_SERVER["REMOTE_ADDR"], ]); } $info_change = \App\chat_request::where('id',$request['chat_request_id'])->update([ "doctor_id" => $request['doctor_id'], "state" => 'ing', "created_at" => now(), ]); return response()->json([ 'result' => true, 'chat_room' => $info->pet_id, 'chat_request_id' => $request['chat_request_id'], 'pet_name' => $pet->pet_name, ]); } }else{ return response()->json([ 'result' => false, ]); } } // 채팅방 들어갈때 채팅 불러오기 (유저/의사) public function load(Request $request) { if($request['id_type'] == "doctor"){ // <의사> 이용 정지 회원인지 확인 check_time('doctor',$request->doctor_id); $q = doctor_check($request->doctor_id); if(isset($q)){ return $q; } }else{ // <고객> 이용 정지 회원인지 확인 check_time('user',$request->user_id); $q = user_check($request->user_id); if(isset($q)){ return $q; } } $id_type = array(); $send_id = array(); $message_type = array(); $message = array(); $date = array(); $chat_request_id = array(); if($request['chat_state'] != null){ //채팅상태가 있으면 <목록에서 들어온 경우> if($request['id_type'] == "doctor"){ // 의사앱에서 채팅 불러오는 경우 if($request['chat_state'] == "ing"){ // 채팅중인 경우 $chats = \App\chat::where('room',$request['chat_room'])->get(); if($chats == "[]"){ return response()->json([ "result" => true, ]); } foreach ($chats as $i => $chat) { //모든 채팅 불러오기 $id_type[$i] = $chat->id_type; if($chat->id_type =="doctor"){ if($chat->send_doctor == $request['doctor_id']){ $doctor = \App\doctor_info::where('id',$request['doctor_id'])->first(); $send_id[$i] = $doctor->doctor_name; }else{ $send_id[$i] = "**다른 의사**"; } }else{ $user = \App\user_info::where('id',$chat->send_user)->first(); if($user['on/off'] != "on"){ $send_id[$i] = "**알수없는 고객**"; }else{ $send_id[$i] = $user->user_nick; } $send_id[$i] = $user->user_nick; } $message_type[$i] = $chat->message_type; $message[$i] = $chat->message; $time=date_create($chat->created_at); $date[$i] = date_format($time,"Y-m-d H:i"); $chat_request_id[$i] = $chat->request_id; } }else{ // 채팅중이 아닌경우 <자기것만 볼수있음> $infos = \App\chat_request::where([['doctor_id',$request['doctor_id']],['pet_id',$request['chat_room']]])->get(); $count = "0"; foreach ($infos as $info) { $chats = \App\chat::where('request_id',$info->id)->get(); if($chats != "[]"){ foreach ($chats as $i => $chat) { $i = $count + $i; $id_type[$i] = $chat->id_type; if($chat->id_type =="doctor"){ $doctor = \App\doctor_info::where('id',$request['doctor_id'])->first(); $send_id[$i] = $doctor->doctor_name; }else{ $user = \App\user_info::where('id',$chat->send_user)->first(); if($user['on/off'] != "on"){ $send_id[$i] = "**알수없는 고객**"; }else{ $send_id[$i] = $user->user_nick; } } $message_type[$i] = $chat->message_type; $message[$i] = $chat->message; $time=date_create($chat->created_at); $date[$i] = date_format($time,"Y-m-d H:i"); $chat_request_id[$i] = $chat->request_id; } $count = $i + 1; } } if($count=="0"){ return response()->json([ "result" => true, ]); } } }else{ //유저앱에서 채팅을 불러온 경우 $chats = \App\chat::where('room',$request['chat_room'])->get(); if($chats == "[]"){ return response()->json([ "result" => true, ]); } foreach ($chats as $i => $chat) { //모든 채팅 불러오기 $id_type[$i] = $chat->id_type; if($chat->id_type =="doctor"){ $doctor = \App\doctor_info::where('id',$chat->send_doctor)->first(); if($doctor['on/off'] != "on"){ $send_id[$i] = "**알수없는 의사**"; }else{ $send_id[$i] = $doctor->doctor_name; } }else{ $user = \App\user_info::where('id',$chat->send_user)->first(); $send_id[$i] = $user->user_nick; } $message_type[$i] = $chat->message_type; $message[$i] = $chat->message; $time=date_create($chat->created_at); $date[$i] = date_format($time,"Y-m-d H:i"); $chat_request_id[$i] = $chat->request_id; } } }else{ // <매칭후 바로 들어온 경우> if($request['id_type'] == "doctor"){ //의사앱에서 채팅 불러오는 경우 $chats = \App\chat::where('room',$request['chat_room'])->get(); if($chats == "[]"){ return response()->json([ "result" => true, ]); } foreach ($chats as $i => $chat) { //모든 채팅 불러오기 $id_type[$i] = $chat->id_type; if($chat->id_type =="doctor"){ if($chat->send_doctor == $request['doctor_id']){ $doctor = \App\doctor_info::where('id',$request['doctor_id'])->first(); $send_id[$i] = $doctor->doctor_name; }else{ $send_id[$i] = "**다른 의사**"; } }else{ $user = \App\user_info::where('id',$chat->send_user)->first(); if($user['on/off'] != "on"){ $send_id[$i] = "**알수없는 고객**"; }else{ $send_id[$i] = $user->user_nick; } } $message_type[$i] = $chat->message_type; $message[$i] = $chat->message; $time=date_create($chat->created_at); $date[$i] = date_format($time,"Y-m-d H:i"); $chat_request_id[$i] = $chat->request_id; } }else{ //유저앱에서 채팅을 불러온 경우 $chats = \App\chat::where('room',$request['chat_room'])->get(); if($chats == "[]"){ return response()->json([ "result" => true, ]); } foreach ($chats as $i => $chat) { //모든 채팅 불러오기 $id_type[$i] = $chat->id_type; if($chat->id_type =="doctor"){ $doctor = \App\doctor_info::where('id',$chat->send_doctor)->first(); if($doctor['on/off'] != "on"){ $send_id[$i] = "**알수없는 의사**"; }else{ $send_id[$i] = $doctor->doctor_name; } }else{ $user = \App\user_info::where('id',$chat->send_user)->first(); $send_id[$i] = $user->user_nick; } $message_type[$i] = $chat->message_type; $message[$i] = $chat->message; $time=date_create($chat->created_at); $date[$i] = date_format($time,"Y-m-d H:i"); $chat_request_id[$i] = $chat->request_id; } } } return response()->json([ "result" => true, "id_type" => $id_type, "send_id" => $send_id, "message_type" => $message_type, "message" => $message, "date" => $date, "chat_request_id" => $chat_request_id, ]); } // 채팅방 목록 불러오기 (유저/의사) public function list(Request $request) { if($request['id_type'] == "doctor"){ // <의사> 이용 정지 회원인지 확인 check_time('doctor',$request->doctor_id); $q = doctor_check($request->doctor_id); if(isset($q)){ return $q; } }else{ // <고객> 이용 정지 회원인지 확인 check_time('user',$request->user_id); $q = user_check($request->user_id); if(isset($q)){ return $q; } } $chat_room = array(); $pet_name = array(); $chat_state = array(); $chat_request_id = array(); $date = array(); $message = array(); $pet_img = array(); if($request['id_type'] == "doctor"){ $type ="doctor_id"; $id =$request->doctor_id; }else{ $type ="user_id"; $id =$request->user_id; } $chats = \App\chat_request::select('pet_id','state','message','chat_request.id',DB::raw("if (isnull(chat.created_at), chat_request.created_at, chat.created_at) as time")) ->fromsub(function($query) use ($type,$id){ $query->from('chat_request')->whereIn('state',['ing','finish'])->where($type,$id)->orderBy('id','desc')->limit("18446744073709551615"); },'chat_request') ->leftjoinsub(function($query) { $query->from('chat')->orderBy('id','desc')->limit("18446744073709551615"); },'chat','chat_request.id','=','chat.request_id')->groupBy('pet_id')->orderBy('time','desc')->get(); foreach ($chats as $i => $chat) { $pet = \App\pet_info::where('id',$chat->pet_id)->first(); $chat_room[$i] = $chat->pet_id; if($pet['on/off'] == "off"){ $pet_name[$i] = "삭제된 반려동물 입니다."; }else{ $pet_name[$i] = $pet->pet_name; } $chat_state[$i] = $chat->state; $chat_request_id[$i] = $chat->id; if($chat->message == null){ $message[$i] = "상담이 시작되었습니다."; }else{ $message[$i] = $chat->message; } $date[$i] = $chat->time; $pet_img[$i] = $pet->pet_img; } return response()->json([ "result" => true, "chat_room" => $chat_room, "pet_name" => $pet_name, "chat_state" => $chat_state, "chat_request_id" => $chat_request_id, "message" => $message, "date" => $date, "pet_img" => $pet_img, ]); } // 채팅 보내기 (유저/의사) public function send(Request $request) { if($request['id_type'] == "doctor"){ // <의사> 이용 정지 회원인지 확인 check_time('doctor',$request->send_id); $q = doctor_check($request->send_id); if(isset($q)){ return $q; } }else{ // <고객> 이용 정지 회원인지 확인 check_time('user',$request->send_id); $q = user_check($request->send_id); if(isset($q)){ return $q; } } $channel_id = "GJCIaUNfqtlHkHrF"; $url = "https://api2.scaledrone.com/".$channel_id."/".$request['chat_room']."/publish"; // $url = "https://api2.scaledrone.com/".$channel_id."/1/publish"; // $json = json_encode($body); $headers = array(); $headers[] = 'Content-Type: application/json'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"POST"); // curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_HTTPHEADER,$headers); if($request['state'] != "on"){ //채팅 종료시 $body = array('state' => "off"); $json = json_encode($body); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); //Send the request $response = curl_exec($ch); if ($response === false) { return response()->json([ "result" => false, ]); } //Close request curl_close($ch); $chat_request = \App\chat_request::where('id',$request['chat_request_id'])->update(['state' => "finish"]); $chat_request = \App\chat_request::where('id',$request['chat_request_id'])->first(); // 포인트 적립 $price = config('app.price'); $accumulate = \App\accumulate::create([ "doctor_id" => $chat_request->doctor_id, "chat_request_id" => $request['chat_request_id'], "point" => $price, ]); //-------------------fcm 발송 $user_a = \App\user_info::where('id',$chat_request->user_id)->first(); $doctor_a = \App\doctor_info::where('id',$chat_request->doctor_id)->first(); $token = $user_a->fcm_token; //notification 부분 $title = "아직 평점을 못 준 상담이 있습니다."; $body_a = "클릭해서 확인해주세요."; //data 부분 $channel = "1"; $data = array('chat_request_id' => $request['chat_request_id'], 'doctor_id' => $doctor_a->id, 'doctor_name' => $doctor_a->doctor_name, "android_channel_id" => $channel); // $data = array('chat_request_id' => $chat_request->id, 'type' => "0", "title" => $title, "body" => $body); $type = "user"; //발송 $response = fcm($title,$body_a,$data,$token,$type,$channel); // 평점 4.0 이상 , 채팅횟수 100회 이상시 수수료 등급 조정 // $chat_count = \App\chat_request::where([['doctor_id',$chat_request->doctor_id],['state','finish']])->count(); // $rating = \App\chat_request::where([['doctor_id',$chat_request->doctor_id],['state','finish'],['rating','<>',"0.0"]])->avg('rating'); // // if($chat_count >= "100" && $rating >= "4.0"){ // $fee = \App\doctor_info::where('id',$chat_request->doctor_id)->update([ // "fee" => "20" // ]); // } return response()->json([ "result" => true, ]); }else{ //이미지 처리 if($request['message_type'] == "img"){ //채팅방 이미지용 폴더 있는지 확인 $file_check = Storage::disk('chat')->exists($request['chat_room']); //없을 경우 생성 if(!$file_check){ Storage::makeDirectory("public/img/chat/".$request['chat_room']); File::chmod("storage/img/chat/".$request['chat_room'],0777); } //이미지 저장 $file_name = $request['message']; //이미지 중복확인 $is_file_exist = file_exists("storage/img/chat/".$request['chat_room']."/".$file_name); while($is_file_exist){ $file_name = $request['message']; $randomNum = mt_rand(1, 99); $file_name = "(".$randomNum.")".$file_name; $is_file_exist = file_exists("storage/img/chat/".$request['chat_room']."/".$file_name); } file_put_contents("storage/img/chat/".$request['chat_room']."/".$file_name, base64_decode($request['file_encode'])); $msg = "http://ccit2019.cafe24.com/storage/img/chat/".$request['chat_room']."/".$file_name; //비디오처리 }elseif ($request['message_type'] == "video") { //채팅방 비디오용 폴더 있는지 확인 $file_check = Storage::disk('chat_video')->exists($request['chat_room']); //없을 경우 생성 if(!$file_check){ Storage::makeDirectory("public/video/chat/".$request['chat_room']); File::chmod("storage/video/chat/".$request['chat_room'],0777); } //이미지 저장 $file_name = $request['message']; //이미지 중복확인 $is_file_exist = file_exists("storage/video/chat/".$request['chat_room']."/".$file_name); while($is_file_exist){ $file_name = $request['message']; $randomNum = mt_rand(1, 99); $file_name = "(".$randomNum.")".$file_name; $is_file_exist = file_exists("storage/video/chat/".$request['chat_room']."/".$file_name); } file_put_contents("storage/video/chat/".$request['chat_room']."/".$file_name, base64_decode($request['file_encode'])); $msg = "http://ccit2019.cafe24.com/storage/video/chat/".$request['chat_room']."/".$file_name; // 텍스트 처리 }else{ $msg = $request['message']; } } if($request['id_type'] == "doctor"){ $doctor = \App\doctor_info::where('id',$request['send_id'])->first(); $send_id = $doctor->doctor_name; }else{ $user = \App\user_info::where('id',$request['send_id'])->first(); $send_id = $user->user_nick; } //메시지 보내기 $body = array( 'id_type' => $request['id_type'], 'send_id' => $send_id, 'message_type' => $request['message_type'], 'message' => $msg, 'time' => date("Y-m-d H:i"), 'state' => $request['state'], ); $json = json_encode($body); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); //Send the request $response = curl_exec($ch); if ($response === false) { return response()->json([ "result" => false, ]); } //Close request curl_close($ch); // fcm 알림 전송 // 사용자가 방에 있는지 확인 $url = "https://api2.scaledrone.com/GJCIaUNfqtlHkHrF/".$request['chat_room']."/members"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"GET"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); //Send the request if(curl_exec($ch) != "[]"){ $response = curl_exec($ch); $count = substr_count($response, ',') + 1; }else{ $count = "0"; } //Close request curl_close($ch); //알림 전송 부분 if($count == "1"){ $chat = \App\chat_request::where('id',$request['chat_request_id'])->first(); if($request->id_type == "doctor"){ $user = \App\user_info::where('id',$chat->user_id)->first(); $token = $user->fcm_token; }else{ $doctor = \App\doctor_info::where('id',$chat->doctor_id)->first(); $token = $doctor->fcm_token; } $pet = \App\pet_info::where("id",$request['chat_room'])->first(); //notification 부분 $title = $send_id; $body = $msg; //data 부분 $channel = "2"; $data = array('chat_request_id' => $request['chat_request_id'], 'chat_room' => $request['chat_room'], 'pet_name' => $pet->pet_name, "android_channel_id" => $channel); // $data = array('chat_request_id' => $chat_request->id, 'type' => "0", "title" => $title, "body" => $body); $type = "user"; //발송 $response = fcm($title,$body,$data,$token,$type,$channel); // $response = fcm($data,$token,$type); if(isset($token)){ if($request->id_type == "doctor"){ $log = \App\fcm_log::create([ 'id_type' => 'user', 'fcm_id' => $user->id, 'type' => "채팅 메시지", 'ip_address' => $_SERVER["REMOTE_ADDR"], ]); }else{ $log = \App\fcm_log::create([ 'id_type' => 'doctor', 'fcm_id' => $doctor->id, 'type' => "채팅 메시지", 'ip_address' => $_SERVER["REMOTE_ADDR"], ]); } } } if($request['id_type'] == "user"){ $chat = \App\chat::create([ 'request_id' => $request['chat_request_id'], 'id_type' => $request['id_type'], 'send_user' => $request['send_id'], 'room' => $request['chat_room'], 'message_type' => $request['message_type'], 'message' => $msg, ]); }else{ $chat = \App\chat::create([ 'request_id' => $request['chat_request_id'], 'id_type' => $request['id_type'], 'send_doctor' => $request['send_id'], 'room' => $request['chat_room'], 'message_type' => $request['message_type'], 'message' => $msg, ]); } if (isset($chat->id)) { return response()->json([ "result" => true, ]); }else{ return response()->json([ "result" => false, ]); } } //채팅 추가시간 설정 public function add_time(Request $request) { $time_check = \App\chat_request::where([['state','ing'],['doctor_id',$request->doctor_id],['id',$request->chat_request_id]])->first(); if (!isset($time_check)) { return response()->json([ "result" => false, "message" => '이미 종료된 채팅입니다.', ]); }else{ $time_10 = date("Y-m-d H:i:s", strtotime($time_check->created_at."+10 minutes")); $now = date("Y-m-d H:i:s"); if($time_check->extra_time != null) { return response()->json([ "result" => false, "message" => '이미 연장하셨습니다.', ]); }elseif ($now < $time_10) { return response()->json([ "result" => false, "message" => '아직 10분이 지나지 않았습니다.', ]); }else { $time_add = \App\chat_request::where([['state','ing'],['doctor_id',$request->doctor_id],['id',$request->chat_request_id]])->update(['extra_time' => $request->extra_time]); return response()->json([ "result" => true, ]); } } } } <file_sep>/Merdog.sql -- -------------------------------------------------------- -- 호스트: ccit2019.cafe24.com -- 서버 버전: 5.5.64-MariaDB - MariaDB Server -- 서버 OS: Linux -- HeidiSQL 버전: 10.1.0.5464 -- -------------------------------------------------------- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET NAMES utf8 */; /*!50503 SET NAMES utf8mb4 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -- MerDog 데이터베이스 구조 내보내기 CREATE DATABASE IF NOT EXISTS `MerDog` /*!40100 DEFAULT CHARACTER SET utf8 */; USE `MerDog`; -- 테이블 MerDog.account 구조 내보내기 CREATE TABLE IF NOT EXISTS `account` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '계좌 인덱스 번호', `doctor_id` int(11) NOT NULL COMMENT '의사회원번호', `bank_name` varchar(50) NOT NULL COMMENT '은행명', `bank_number` varchar(50) NOT NULL COMMENT '계좌번호', `bank_depo` varchar(50) NOT NULL COMMENT '예금주', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `doctor_id` (`doctor_id`), CONSTRAINT `FK_account_doctor_info` FOREIGN KEY (`doctor_id`) REFERENCES `doctor_info` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='의사 계좌 정보'; -- 테이블 데이터 MerDog.account:~6 rows (대략적) 내보내기 /*!40000 ALTER TABLE `account` DISABLE KEYS */; INSERT INTO `account` (`id`, `doctor_id`, `bank_name`, `bank_number`, `bank_depo`, `created_at`) VALUES (6, 115, '신한은행', '11033392223', '심성윤', '2019-11-13 13:33:16'); INSERT INTO `account` (`id`, `doctor_id`, `bank_name`, `bank_number`, `bank_depo`, `created_at`) VALUES (12, 103, '신한은행', '11046646', '심성윤', '2019-11-24 14:53:30'); INSERT INTO `account` (`id`, `doctor_id`, `bank_name`, `bank_number`, `bank_depo`, `created_at`) VALUES (14, 143, '신한은행', '1000010011', '심성윤', '2019-12-13 02:28:28'); INSERT INTO `account` (`id`, `doctor_id`, `bank_name`, `bank_number`, `bank_depo`, `created_at`) VALUES (15, 117, '신한은행', '110417188220', '공지환', '2019-12-13 10:54:31'); INSERT INTO `account` (`id`, `doctor_id`, `bank_name`, `bank_number`, `bank_depo`, `created_at`) VALUES (16, 111, 'KB국민은행', '8888', 'ㅎㄹ', '2019-12-13 11:03:08'); INSERT INTO `account` (`id`, `doctor_id`, `bank_name`, `bank_number`, `bank_depo`, `created_at`) VALUES (19, 170, '신한은행', '193949', '929393', '2020-01-07 19:49:24'); /*!40000 ALTER TABLE `account` ENABLE KEYS */; -- 테이블 MerDog.accumulate 구조 내보내기 CREATE TABLE IF NOT EXISTS `accumulate` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '적립 인덱스 번호', `doctor_id` int(11) NOT NULL COMMENT '의사 번호', `point` int(11) NOT NULL COMMENT '적립 포인트', `chat_request_id` int(11) NOT NULL COMMENT '채팅 요청 번호', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `chat_request_id` (`chat_request_id`), KEY `FK_accumulate_doctor_info` (`doctor_id`), CONSTRAINT `FK_accumulate_chat_request` FOREIGN KEY (`chat_request_id`) REFERENCES `chat_request` (`id`) ON UPDATE CASCADE, CONSTRAINT `FK_accumulate_doctor_info` FOREIGN KEY (`doctor_id`) REFERENCES `doctor_info` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='의사 마일리지 적립 기록'; -- 테이블 데이터 MerDog.accumulate:~147 rows (대략적) 내보내기 /*!40000 ALTER TABLE `accumulate` DISABLE KEYS */; INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (57, 111, 5000, 577, '2019-11-26 18:15:06'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (58, 111, 5000, 578, '2019-11-26 19:38:31'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (59, 103, 5000, 580, '2019-11-26 20:30:19'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (60, 111, 5000, 581, '2019-11-26 20:51:09'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (61, 111, 5000, 582, '2019-11-26 21:16:13'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (62, 111, 5000, 587, '2019-11-26 22:42:07'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (66, 111, 5000, 589, '2019-11-26 23:14:54'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (67, 111, 5000, 593, '2019-11-26 23:21:23'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (68, 111, 5000, 598, '2019-11-26 23:38:13'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (69, 111, 5000, 601, '2019-11-26 23:52:14'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (70, 111, 5000, 602, '2019-11-26 23:58:35'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (72, 111, 5000, 603, '2019-11-27 00:05:23'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (73, 111, 5000, 600, '2019-11-27 20:17:38'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (74, 111, 5000, 611, '2019-11-27 20:39:02'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (75, 111, 5000, 613, '2019-11-28 16:25:14'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (76, 111, 5000, 625, '2019-11-28 17:09:06'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (77, 111, 5000, 633, '2019-11-30 17:35:33'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (78, 111, 5000, 632, '2019-12-01 23:41:45'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (79, 103, 5000, 637, '2019-12-02 16:42:50'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (80, 111, 5000, 634, '2019-12-02 16:42:59'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (81, 111, 5000, 642, '2019-12-02 17:00:22'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (82, 111, 5000, 627, '2019-12-03 15:38:15'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (83, 111, 5000, 638, '2019-12-03 15:38:20'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (84, 111, 5000, 641, '2019-12-03 15:38:21'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (85, 111, 5000, 646, '2019-12-03 15:38:22'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (87, 111, 5000, 648, '2019-12-03 15:38:23'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (88, 111, 5000, 650, '2019-12-03 15:38:24'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (89, 111, 5000, 652, '2019-12-03 15:38:24'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (90, 111, 5000, 654, '2019-12-03 16:06:35'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (91, 111, 5000, 655, '2019-12-03 19:40:04'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (92, 111, 5000, 656, '2019-12-03 19:56:40'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (94, 111, 5000, 658, '2019-12-06 11:11:52'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (95, 117, 5000, 673, '2019-12-06 11:12:38'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (96, 117, 5000, 676, '2019-12-06 11:15:21'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (97, 117, 5000, 687, '2019-12-06 11:26:45'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (98, 117, 5000, 697, '2019-12-06 12:15:43'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (99, 117, 5000, 696, '2019-12-06 12:19:54'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (101, 117, 5000, 703, '2019-12-06 12:27:39'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (102, 111, 5000, 707, '2019-12-06 12:28:19'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (103, 117, 5000, 706, '2019-12-06 14:05:16'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (104, 111, 5000, 714, '2019-12-06 14:07:45'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (105, 111, 5000, 715, '2019-12-06 14:08:19'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (106, 111, 5000, 719, '2019-12-06 14:11:04'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (107, 111, 5000, 720, '2019-12-06 14:11:37'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (108, 111, 5000, 723, '2019-12-06 14:15:47'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (109, 111, 5000, 724, '2019-12-06 14:16:16'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (110, 111, 5000, 726, '2019-12-06 14:21:36'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (111, 111, 5000, 727, '2019-12-06 14:22:32'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (112, 111, 5000, 729, '2019-12-06 14:25:18'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (114, 111, 5000, 732, '2019-12-06 14:30:33'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (115, 111, 5000, 734, '2019-12-06 14:31:51'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (116, 111, 5000, 736, '2019-12-06 14:33:35'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (117, 111, 5000, 739, '2019-12-06 14:35:46'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (118, 111, 5000, 740, '2019-12-06 14:36:48'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (119, 111, 5000, 741, '2019-12-06 14:37:20'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (120, 111, 5000, 752, '2019-12-06 14:43:32'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (121, 111, 5000, 754, '2019-12-06 14:45:25'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (122, 111, 5000, 756, '2019-12-06 14:46:22'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (123, 111, 5000, 761, '2019-12-06 14:48:00'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (124, 111, 5000, 764, '2019-12-06 14:50:13'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (125, 111, 5000, 768, '2019-12-06 14:51:53'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (126, 111, 5000, 769, '2019-12-06 14:52:25'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (127, 111, 5000, 778, '2019-12-06 14:54:04'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (129, 111, 5000, 792, '2019-12-06 14:58:48'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (130, 111, 5000, 793, '2019-12-06 14:59:05'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (131, 111, 5000, 794, '2019-12-06 14:59:26'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (132, 111, 5000, 797, '2019-12-07 15:58:51'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (134, 111, 5000, 835, '2019-12-10 15:23:25'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (135, 111, 5000, 836, '2019-12-11 01:24:48'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (136, 111, 5000, 838, '2019-12-12 14:28:45'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (137, 147, 5000, 840, '2019-12-13 10:53:52'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (138, 111, 5000, 843, '2019-12-13 11:48:57'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (139, 111, 5000, 845, '2019-12-16 19:03:14'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (141, 111, 5000, 846, '2019-12-17 17:52:00'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (142, 111, 5000, 848, '2019-12-17 18:16:19'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (143, 111, 5000, 854, '2019-12-17 18:37:05'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (144, 117, 5000, 841, '2019-12-17 20:38:31'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (145, 111, 5000, 861, '2019-12-18 13:49:46'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (146, 111, 5000, 862, '2019-12-18 14:37:40'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (147, 111, 5000, 863, '2019-12-18 18:31:49'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (148, 111, 5000, 867, '2019-12-19 21:16:44'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (150, 111, 5000, 868, '2019-12-21 19:04:41'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (153, 111, 5000, 869, '2019-12-21 19:04:43'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (154, 111, 5000, 871, '2019-12-25 02:11:34'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (155, 111, 5000, 872, '2019-12-25 03:45:20'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (156, 143, 5000, 874, '2019-12-29 16:52:55'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (157, 143, 5000, 876, '2019-12-29 19:23:50'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (158, 111, 5000, 877, '2020-01-02 19:11:51'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (160, 171, 5000, 880, '2020-01-02 20:08:59'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (161, 171, 5000, 881, '2020-01-02 20:34:53'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (162, 171, 5000, 882, '2020-01-02 21:15:46'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (163, 171, 5000, 883, '2020-01-03 11:30:23'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (164, 143, 5000, 887, '2020-01-07 20:32:48'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (165, 171, 5000, 890, '2020-01-07 21:01:59'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (167, 171, 5000, 893, '2020-01-07 21:06:44'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (168, 171, 5000, 894, '2020-01-07 21:08:46'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (169, 171, 5000, 889, '2020-01-07 21:23:53'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (171, 171, 5000, 892, '2020-01-07 21:23:55'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (173, 171, 5000, 896, '2020-01-08 14:11:22'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (174, 103, 5000, 897, '2020-01-08 14:46:37'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (175, 103, 5000, 899, '2020-01-08 15:29:41'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (177, 171, 5000, 903, '2020-01-08 16:33:09'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (178, 171, 5000, 901, '2020-01-08 16:35:06'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (179, 171, 5000, 902, '2020-01-08 16:35:07'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (182, 171, 5000, 908, '2020-01-09 12:12:31'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (184, 171, 5000, 909, '2020-01-09 13:27:54'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (185, 171, 5000, 907, '2020-01-09 14:34:27'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (186, 171, 5000, 910, '2020-01-09 15:12:52'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (187, 171, 5000, 912, '2020-01-09 15:41:12'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (188, 171, 5000, 913, '2020-01-09 16:05:35'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (189, 171, 5000, 914, '2020-01-09 16:23:42'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (190, 171, 5000, 916, '2020-01-09 16:51:42'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (191, 171, 5000, 917, '2020-01-09 17:00:53'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (192, 171, 5000, 918, '2020-01-09 17:00:54'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (193, 103, 5000, 915, '2020-01-09 17:01:42'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (194, 103, 5000, 920, '2020-01-09 17:15:35'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (195, 171, 5000, 919, '2020-01-09 17:20:44'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (196, 171, 5000, 921, '2020-01-09 17:41:11'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (197, 171, 5000, 924, '2020-01-09 18:13:50'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (198, 171, 5000, 922, '2020-01-09 18:58:37'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (199, 171, 5000, 925, '2020-01-09 19:18:37'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (200, 171, 5000, 934, '2020-01-09 19:47:55'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (201, 171, 5000, 935, '2020-01-09 19:50:39'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (203, 171, 5000, 936, '2020-01-09 19:55:51'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (204, 171, 5000, 937, '2020-01-09 20:00:52'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (205, 171, 5000, 938, '2020-01-09 20:08:43'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (207, 171, 5000, 939, '2020-01-09 20:25:19'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (208, 171, 5000, 940, '2020-01-09 20:25:29'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (210, 171, 5000, 941, '2020-01-09 20:45:36'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (212, 171, 5000, 944, '2020-01-09 20:45:50'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (213, 171, 5000, 945, '2020-01-09 21:05:09'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (215, 171, 5000, 946, '2020-01-09 21:06:41'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (216, 171, 5000, 947, '2020-01-09 21:39:54'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (217, 171, 5000, 948, '2020-01-09 21:51:00'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (221, 171, 5000, 949, '2020-01-09 21:52:20'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (222, 171, 5000, 958, '2020-01-09 22:08:11'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (224, 171, 5000, 959, '2020-01-09 22:13:36'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (225, 171, 5000, 962, '2020-01-09 22:16:27'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (226, 171, 5000, 951, '2020-01-09 22:16:39'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (228, 171, 5000, 950, '2020-01-09 22:43:56'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (230, 171, 5000, 952, '2020-01-09 22:43:57'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (231, 171, 5000, 953, '2020-01-09 22:43:58'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (232, 171, 5000, 960, '2020-01-09 22:44:00'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (234, 171, 5000, 961, '2020-01-09 22:44:01'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (235, 171, 5000, 963, '2020-01-09 22:44:03'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (237, 171, 5000, 964, '2020-01-09 22:44:04'); INSERT INTO `accumulate` (`id`, `doctor_id`, `point`, `chat_request_id`, `created_at`) VALUES (238, 171, 5000, 965, '2020-01-09 22:44:05'); /*!40000 ALTER TABLE `accumulate` ENABLE KEYS */; -- 테이블 MerDog.admin_info 구조 내보내기 CREATE TABLE IF NOT EXISTS `admin_info` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '관리자 고유번호', `admin_id` varchar(50) NOT NULL COMMENT '관리자 아이디', `admin_pw` text NOT NULL COMMENT '관리자 비밀번호', `level` int(11) NOT NULL DEFAULT '1' COMMENT '관리자 등급번호 ', `remember_token` varchar(100) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `admin_id` (`admin_id`), KEY `FK_admin_info_level_list` (`level`), CONSTRAINT `FK_admin_info_level_list` FOREIGN KEY (`level`) REFERENCES `level_list` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='관리자 정보'; -- 테이블 데이터 MerDog.admin_info:~13 rows (대략적) 내보내기 /*!40000 ALTER TABLE `admin_info` DISABLE KEYS */; INSERT INTO `admin_info` (`id`, `admin_id`, `admin_pw`, `level`, `remember_token`, `created_at`) VALUES (5, 'ccit2019', '$2y$10$aw8Acjkki/.gNker7sjWMuv5RrXebstyAE3ilSZ5Z3kFV7RL1dRb.', 4, 'sn92yWNwsNpE5egcbr2Dhp2Rgu9MISnEtR7zerC96OUlADR9dyEGzrEsd2lR', '2019-10-22 21:13:55'); INSERT INTO `admin_info` (`id`, `admin_id`, `admin_pw`, `level`, `remember_token`, `created_at`) VALUES (13, 'as<PASSWORD>', '$2y$10$Z8SbBkFkujq7/nOIZHRpBe1TH/SdCuojwygejONbLS/q/QiDcIVm.', 3, NULL, '2019-10-30 20:07:09'); INSERT INTO `admin_info` (`id`, `admin_id`, `admin_pw`, `level`, `remember_token`, `created_at`) VALUES (15, 'asd123', '$2y$10$QPCM64fqnEH3sgJXPvNwXu7gsN55zp18aNuCC.QZcJ5i8r4k9cGHC', 1, NULL, '2019-10-31 12:15:35'); INSERT INTO `admin_info` (`id`, `admin_id`, `admin_pw`, `level`, `remember_token`, `created_at`) VALUES (16, '<PASSWORD>', '$2y$10$.zm7.v32jXZDOx817flcTOxKzS4XloYH.rBU5nM4L50Br.0ElCW6W', 1, NULL, '2019-10-31 12:20:19'); INSERT INTO `admin_info` (`id`, `admin_id`, `admin_pw`, `level`, `remember_token`, `created_at`) VALUES (17, 'abc123', '$2y$10$c6/.lOPnoli4D0KTYWk4KOxlY0R6VnUJEVxd23PEnpU1IRmzBkh72', 1, NULL, '2019-10-31 19:20:05'); INSERT INTO `admin_info` (`id`, `admin_id`, `admin_pw`, `level`, `remember_token`, `created_at`) VALUES (19, 'asfrtqwt14', '$2y$10$Hp2Wtbid0tr3vv2eZB3cM.u/thDRmX/JaPeqo/0BshTKLRIuvzdyi', 1, NULL, '2019-10-31 19:21:01'); INSERT INTO `admin_info` (`id`, `admin_id`, `admin_pw`, `level`, `remember_token`, `created_at`) VALUES (20, 'asfasf134', '$2y$10$1fJm30hDQEZmEdwtHB8my.9nEB2wMbjtlmfEl3s0nFnTyryo14d/C', 1, NULL, '2019-10-31 19:21:12'); INSERT INTO `admin_info` (`id`, `admin_id`, `admin_pw`, `level`, `remember_token`, `created_at`) VALUES (21, 'asf12352365', '$2y$10$.OULb8dcSgX.9HelqCYO9.lnkaiXPARjScqt2L9FPqwuX4KuAjZNq', 1, NULL, '2019-10-31 19:21:25'); INSERT INTO `admin_info` (`id`, `admin_id`, `admin_pw`, `level`, `remember_token`, `created_at`) VALUES (22, 'sdgsdg214', '$2y$10$d.Nmhm/FSs5D0YlJz4RhAezw6jEgIQoGXAUlsELDf9wMG7EF4ykzy', 1, NULL, '2019-10-31 19:21:37'); INSERT INTO `admin_info` (`id`, `admin_id`, `admin_pw`, `level`, `remember_token`, `created_at`) VALUES (23, 'gw35235', '$2y$10$68LvE/6fP1ZW8QS4MM7YpuH5wqkNcTB1AoVG6flkzwRlhdE5ja8CK', 2, NULL, '2019-10-31 19:21:51'); INSERT INTO `admin_info` (`id`, `admin_id`, `admin_pw`, `level`, `remember_token`, `created_at`) VALUES (24, 'asfas214214', '$2y$10$/Gdonmb9dL8FQYDFGSWNOu/s1DViRqqUmwXJgzuS9SCGurAOGwhXy', 3, NULL, '2019-10-31 19:22:02'); INSERT INTO `admin_info` (`id`, `admin_id`, `admin_pw`, `level`, `remember_token`, `created_at`) VALUES (25, 'asgasgasg', '$2y$10$86mMVv1FASaZF6mxZi0x1unO0GC6PgnYP0mgrYY6.eaoAYjwkFyhm', 2, NULL, '2019-10-31 19:22:14'); INSERT INTO `admin_info` (`id`, `admin_id`, `admin_pw`, `level`, `remember_token`, `created_at`) VALUES (29, 'ccit2020', '$2y$10$pThKxa/YmsdyeabTvldb1Om03yscDaQOrpZVdgoR6ks32jETy5Umu', 2, NULL, '2020-01-02 17:11:44'); /*!40000 ALTER TABLE `admin_info` ENABLE KEYS */; -- 테이블 MerDog.chat 구조 내보내기 CREATE TABLE IF NOT EXISTS `chat` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '채팅 메시지 번호', `request_id` int(11) NOT NULL COMMENT '요청정보 번호', `id_type` varchar(50) NOT NULL COMMENT 'user / doctor', `send_user` int(11) DEFAULT NULL COMMENT '사용자 번호 <보냄>', `send_doctor` int(11) DEFAULT NULL COMMENT '의사 번호 <보냄>', `room` int(11) NOT NULL COMMENT '애완동물 번호 = 방이름', `message_type` varchar(50) NOT NULL COMMENT 'text / img / video', `message` text NOT NULL COMMENT '메시지 내용', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `read` varchar(50) NOT NULL DEFAULT 'no' COMMENT '읽음 여부 yes=읽음/ no=안읽음', `on/off` varchar(10) NOT NULL DEFAULT 'on' COMMENT '채팅 삭제 여부', PRIMARY KEY (`id`), KEY `FK_chat_pet` (`room`), KEY `FK_chat_doctor_info` (`send_doctor`), KEY `FK_chat_user_info` (`send_user`), KEY `FK_chat_chat_request` (`request_id`), CONSTRAINT `FK_chat_chat_request` FOREIGN KEY (`request_id`) REFERENCES `chat_request` (`id`) ON UPDATE CASCADE, CONSTRAINT `FK_chat_doctor_info` FOREIGN KEY (`send_doctor`) REFERENCES `doctor_info` (`id`) ON UPDATE CASCADE, CONSTRAINT `FK_chat_pet` FOREIGN KEY (`room`) REFERENCES `pet_info` (`id`) ON UPDATE CASCADE, CONSTRAINT `FK_chat_user_info` FOREIGN KEY (`send_user`) REFERENCES `user_info` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='채팅 목록'; -- 테이블 데이터 MerDog.chat:~505 rows (대략적) 내보내기 /*!40000 ALTER TABLE `chat` DISABLE KEYS */; INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (416, 577, 'user', 77, NULL, 35, 'text', '.', '2019-11-26 18:15:04', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (417, 578, 'user', 77, NULL, 35, 'text', 'dd', '2019-11-26 19:38:22', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (418, 580, 'doctor', NULL, 103, 35, 'text', 'ddd', '2019-11-26 19:39:57', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (419, 580, 'user', 77, NULL, 35, 'text', 'nn', '2019-11-26 20:28:33', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (420, 581, 'doctor', NULL, 111, 35, 'text', '시딛ㅂㄴㄱ시디', '2019-11-26 20:31:13', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (421, 581, 'doctor', NULL, 111, 35, 'text', 'ㅎㄷㅂㅈㄱ디ㅣ', '2019-11-26 20:50:46', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (422, 582, 'doctor', NULL, 111, 35, 'text', '보내', '2019-11-26 20:52:04', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (423, 582, 'doctor', NULL, 111, 35, 'text', 'ㅣ호잇', '2019-11-26 20:53:24', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (424, 582, 'user', 77, NULL, 35, 'text', '채팅좀묘', '2019-11-26 21:00:10', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (425, 582, 'doctor', NULL, 111, 35, 'text', '아나', '2019-11-26 21:00:26', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (426, 582, 'doctor', NULL, 111, 35, 'text', '시ㅢㄷ브', '2019-11-26 21:04:06', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (427, 582, 'doctor', NULL, 111, 35, 'text', 'ㅅㄷ긔닏ㄱㄷ긔', '2019-11-26 21:11:20', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (428, 582, 'doctor', NULL, 111, 35, 'text', 'ㄷ븨니ㅡㄱ븝', '2019-11-26 21:11:58', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (429, 582, 'doctor', NULL, 111, 35, 'text', 'ㄱ디ㅢㅣ짖', '2019-11-26 21:16:06', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (430, 587, 'doctor', NULL, 111, 35, 'text', 'c8', '2019-11-26 21:18:48', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (431, 587, 'doctor', NULL, 111, 35, 'text', '8800', '2019-11-26 21:18:58', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (432, 587, 'doctor', NULL, 111, 35, 'text', 'bveu2ue', '2019-11-26 21:23:13', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (433, 587, 'doctor', NULL, 111, 35, 'text', 'cwuwh2', '2019-11-26 21:23:52', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (434, 587, 'doctor', NULL, 111, 35, 'text', 'fru3u372', '2019-11-26 21:24:31', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (435, 587, 'doctor', NULL, 111, 35, 'text', 'rggshwu2', '2019-11-26 21:26:27', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (436, 587, 'doctor', NULL, 111, 35, 'text', 'fyutui', '2019-11-26 21:29:39', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (437, 587, 'user', 77, NULL, 35, 'text', '종료?', '2019-11-26 23:09:50', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (438, 589, 'doctor', NULL, 111, 35, 'text', 'ㅎㅇ', '2019-11-26 23:11:23', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (439, 587, 'user', 77, NULL, 35, 'text', '?', '2019-11-26 23:11:28', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (440, 589, 'user', 77, NULL, 35, 'text', '?', '2019-11-26 23:11:43', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (441, 589, 'user', 77, NULL, 35, 'text', '네', '2019-11-26 23:11:47', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (442, 589, 'doctor', NULL, 111, 35, 'text', '종료눌러?', '2019-11-26 23:11:52', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (443, 589, 'user', 77, NULL, 35, 'text', '눌러요', '2019-11-26 23:11:53', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (444, 589, 'doctor', NULL, 111, 35, 'text', '잠시만', '2019-11-26 23:12:03', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (445, 589, 'doctor', NULL, 111, 35, 'text', '이거 이러면 15분 기다려야하는데', '2019-11-26 23:12:19', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (446, 589, 'doctor', NULL, 111, 35, 'text', 'ㄱㄷ', '2019-11-26 23:12:57', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (447, 593, 'doctor', NULL, 111, 35, 'text', '굳', '2019-11-26 23:18:31', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (448, 589, 'user', 77, NULL, 35, 'text', '채팅', '2019-11-26 23:18:34', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (449, 593, 'doctor', NULL, 111, 35, 'text', '종료 눌러?', '2019-11-26 23:18:44', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (450, 589, 'user', 77, NULL, 35, 'text', '종료해봐요', '2019-11-26 23:18:45', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (451, 593, 'doctor', NULL, 111, 35, 'text', '1분 기다려', '2019-11-26 23:18:53', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (452, 589, 'user', 77, NULL, 35, 'text', '고고요', '2019-11-26 23:19:36', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (453, 593, 'doctor', NULL, 111, 35, 'text', '너가 보낸거', '2019-11-26 23:19:55', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (454, 593, 'doctor', NULL, 111, 35, 'text', '마지막 기준 1분이라', '2019-11-26 23:20:00', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (455, 593, 'doctor', NULL, 111, 35, 'text', '여기로 보내지마', '2019-11-26 23:20:18', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (456, 593, 'doctor', NULL, 111, 35, 'text', 'ㅠㅠ', '2019-11-26 23:20:21', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (457, 598, 'user', 80, NULL, 39, 'text', '슷', '2019-11-26 23:36:56', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (458, 598, 'user', 80, NULL, 39, 'text', '슷', '2019-11-26 23:36:58', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (459, 601, 'user', 77, NULL, 35, 'text', '.', '2019-11-26 23:50:22', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (460, 601, 'doctor', NULL, 111, 35, 'text', '스', '2019-11-26 23:50:26', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (461, 602, 'doctor', NULL, 111, 35, 'text', '보내지마', '2019-11-26 23:58:07', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (462, 602, 'user', 77, NULL, 35, 'text', '종료합니다', '2019-11-27 00:03:50', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (463, 600, 'doctor', NULL, 111, 39, 'text', 'ㄷ', '2019-11-27 20:17:35', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (464, 611, 'doctor', NULL, 111, 39, 'text', 'h', '2019-11-27 20:38:56', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (465, 613, 'user', 80, NULL, 39, 'text', 'hw', '2019-11-27 20:40:53', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (466, 613, 'user', 80, NULL, 39, 'text', 'uiiijji', '2019-11-27 20:41:14', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (467, 613, 'user', 80, NULL, 39, 'text', 'd33', '2019-11-27 20:42:31', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (468, 613, 'doctor', NULL, 111, 39, 'text', '야임마', '2019-11-28 15:33:59', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (469, 625, 'user', 80, NULL, 39, 'text', '어이', '2019-11-28 17:05:30', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (470, 625, 'user', 80, NULL, 39, 'text', '이자식아', '2019-11-28 17:05:33', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (471, 625, 'user', 80, NULL, 39, 'text', '어이', '2019-11-28 17:05:52', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (472, 625, 'user', 80, NULL, 39, 'text', '야', '2019-11-28 17:06:02', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (473, 625, 'user', 80, NULL, 39, 'text', 'ㅇ디ㅡ', '2019-11-28 17:06:58', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (474, 625, 'user', 80, NULL, 39, 'text', '이', '2019-11-28 17:07:15', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (475, 625, 'user', 80, NULL, 39, 'text', '이', '2019-11-28 17:07:46', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (476, 625, 'user', 80, NULL, 39, 'text', '이', '2019-11-28 17:08:01', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (477, 625, 'user', 80, NULL, 39, 'text', '듭지', '2019-11-28 17:08:07', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (478, 625, 'user', 80, NULL, 39, 'text', '디', '2019-11-28 17:08:41', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (479, 627, 'user', 78, NULL, 34, 'text', 'ㅎㅇ', '2019-11-28 17:11:20', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (480, 627, 'user', 78, NULL, 34, 'text', 'ㅊㅊ2', '2019-11-28 17:12:57', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (481, 632, 'user', 77, NULL, 35, 'text', '메세징', '2019-11-28 17:29:28', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (482, 632, 'user', 77, NULL, 35, 'text', 'ㄷㅅ', '2019-11-28 17:29:46', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (483, 632, 'user', 77, NULL, 35, 'text', 'ㅇ', '2019-11-28 17:32:58', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (484, 632, 'user', 77, NULL, 35, 'text', 'ㄱㅇㆍㄱ윽ㅇ', '2019-11-28 17:34:57', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (485, 632, 'user', 77, NULL, 35, 'text', 'ㅂㄷ프', '2019-11-28 17:35:09', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (486, 632, 'doctor', NULL, 111, 35, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/35/11120191128_180819786.jpeg', '2019-11-28 18:08:23', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (487, 632, 'user', 77, NULL, 35, 'text', 'ㅅㄱㄷㄱㄷㄱ', '2019-11-28 18:13:53', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (488, 632, 'user', 77, NULL, 35, 'text', 'ㅂㅈㄷㅂㄴㅅ', '2019-11-28 18:14:06', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (489, 632, 'user', 77, NULL, 35, 'text', 'ㄷㄱㆍㄷㄱㆍㄷㄱㆍㄷ', '2019-11-28 18:14:38', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (490, 633, 'doctor', NULL, 111, 39, 'video', 'http://ccit2019.cafe24.com/storage/video/chat/39/11120191129_101837242.mp4', '2019-11-29 10:18:59', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (491, 633, 'doctor', NULL, 111, 39, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/39/11120191129_111346268.jpeg', '2019-11-29 11:13:57', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (492, 633, 'doctor', NULL, 111, 39, 'text', '시발', '2019-11-30 17:34:54', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (493, 633, 'user', 80, NULL, 39, 'text', '싣거ㅓ', '2019-11-30 17:35:13', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (494, 634, 'doctor', NULL, 111, 41, 'text', 'ㅎㅇ', '2019-12-01 20:42:22', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (495, 634, 'doctor', NULL, 111, 41, 'text', 'ㅎㅇ', '2019-12-01 20:42:38', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (496, 634, 'user', 77, NULL, 41, 'text', '뿅', '2019-12-01 21:00:26', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (497, 634, 'user', 77, NULL, 41, 'text', '뭐지다시가네', '2019-12-01 21:00:44', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (498, 634, 'user', 77, NULL, 41, 'text', '.', '2019-12-01 22:10:37', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (499, 634, 'user', 77, NULL, 41, 'text', '좋군', '2019-12-01 22:10:52', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (500, 634, 'user', 77, NULL, 41, 'text', '뭐야 왤케느러', '2019-12-01 22:10:59', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (501, 634, 'user', 77, NULL, 41, 'text', 'ㅅ', '2019-12-01 22:52:05', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (502, 634, 'user', 77, NULL, 41, 'text', 'ㄴㅈㄱㅈ', '2019-12-01 22:52:39', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (503, 634, 'user', 77, NULL, 41, 'text', '.', '2019-12-01 23:19:09', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (504, 634, 'user', 77, NULL, 41, 'text', '.', '2019-12-01 23:35:37', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (505, 634, 'user', 77, NULL, 41, 'text', '.', '2019-12-01 23:37:52', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (506, 634, 'user', 77, NULL, 41, 'text', 'ㄷ', '2019-12-01 23:38:07', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (507, 634, 'user', 77, NULL, 41, 'text', 'ㄷ', '2019-12-01 23:38:37', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (508, 634, 'user', 77, NULL, 41, 'text', 'ㄱ', '2019-12-01 23:38:40', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (509, 634, 'user', 77, NULL, 41, 'text', 'ㄴ', '2019-12-01 23:38:44', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (510, 634, 'user', 77, NULL, 41, 'text', 'ㄱ', '2019-12-01 23:38:47', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (511, 637, 'doctor', NULL, 103, 35, 'text', 'ffff', '2019-12-01 23:47:40', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (512, 637, 'doctor', NULL, 103, 35, 'text', 'fg', '2019-12-01 23:47:45', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (513, 637, 'doctor', NULL, 103, 35, 'text', 'cx?', '2019-12-01 23:47:52', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (514, 637, 'user', 77, NULL, 35, 'text', '형', '2019-12-01 23:48:01', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (515, 637, 'user', 77, NULL, 35, 'text', '연속으로 채팅 보내봐요', '2019-12-01 23:48:10', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (516, 637, 'doctor', NULL, 103, 35, 'text', 'dd', '2019-12-01 23:48:13', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (517, 637, 'doctor', NULL, 103, 35, 'text', 'hu', '2019-12-01 23:48:16', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (518, 637, 'doctor', NULL, 103, 35, 'text', 'hyuu', '2019-12-01 23:48:21', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (519, 637, 'doctor', NULL, 103, 35, 'text', 'ui', '2019-12-01 23:48:26', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (520, 637, 'doctor', NULL, 103, 35, 'text', 'uu', '2019-12-01 23:48:29', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (521, 637, 'user', 77, NULL, 35, 'text', '계속가긴가나', '2019-12-01 23:48:31', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (522, 637, 'doctor', NULL, 103, 35, 'text', '77', '2019-12-01 23:48:33', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (523, 637, 'doctor', NULL, 103, 35, 'text', 'uu', '2019-12-01 23:48:37', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (524, 637, 'doctor', NULL, 103, 35, 'text', 'iuuu', '2019-12-01 23:48:40', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (525, 637, 'doctor', NULL, 103, 35, 'text', 'uu', '2019-12-01 23:48:44', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (526, 637, 'user', 77, NULL, 35, 'text', '그게 최대속도인가요?', '2019-12-01 23:48:45', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (527, 637, 'doctor', NULL, 103, 35, 'text', 'ii', '2019-12-01 23:48:47', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (528, 637, 'doctor', NULL, 103, 35, 'text', 'uuuuhh', '2019-12-01 23:48:51', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (529, 637, 'doctor', NULL, 103, 35, 'text', 'uu', '2019-12-01 23:48:54', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (530, 637, 'doctor', NULL, 103, 35, 'text', 'uu', '2019-12-01 23:48:57', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (531, 637, 'doctor', NULL, 103, 35, 'text', 'uu', '2019-12-01 23:49:01', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (532, 637, 'user', 77, NULL, 35, 'text', '보낼때 바로바로 가요?', '2019-12-01 23:49:02', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (533, 637, 'doctor', NULL, 103, 35, 'text', 'uu', '2019-12-01 23:49:04', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (534, 637, 'doctor', NULL, 103, 35, 'text', 'yy', '2019-12-01 23:49:08', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (535, 637, 'doctor', NULL, 103, 35, 'text', 'tre', '2019-12-01 23:49:11', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (536, 637, 'doctor', NULL, 103, 35, 'text', 'ttt', '2019-12-01 23:49:14', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (537, 637, 'doctor', NULL, 103, 35, 'text', 'yy', '2019-12-01 23:49:18', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (538, 637, 'doctor', NULL, 103, 35, 'text', 'yy', '2019-12-01 23:49:21', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (539, 637, 'doctor', NULL, 103, 35, 'text', 'yy', '2019-12-01 23:49:24', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (540, 637, 'doctor', NULL, 103, 35, 'text', 'yyuu', '2019-12-01 23:49:29', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (541, 637, 'doctor', NULL, 103, 35, 'text', 'yy', '2019-12-01 23:49:32', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (542, 637, 'doctor', NULL, 103, 35, 'text', 'uuu', '2019-12-01 23:49:36', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (543, 637, 'doctor', NULL, 103, 35, 'text', 'uu', '2019-12-01 23:49:39', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (544, 637, 'doctor', NULL, 103, 35, 'text', 'uu', '2019-12-01 23:49:42', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (545, 637, 'doctor', NULL, 103, 35, 'text', 'ㅇㅇㅇㅇ지금 10개정도 더나옿긋', '2019-12-01 23:49:45', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (546, 634, 'user', 77, NULL, 41, 'text', '.', '2019-12-02 00:39:07', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (547, 634, 'user', 77, NULL, 41, 'text', '굿?', '2019-12-02 00:45:55', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (548, 634, 'user', 77, NULL, 41, 'text', '고', '2019-12-02 00:47:55', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (549, 634, 'user', 77, NULL, 41, 'text', '되긴되네', '2019-12-02 00:48:04', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (550, 634, 'user', 77, NULL, 41, 'text', '지금', '2019-12-02 00:48:12', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (551, 634, 'user', 77, NULL, 41, 'text', '다시', '2019-12-02 00:48:14', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (552, 634, 'user', 77, NULL, 41, 'text', '디', '2019-12-02 00:48:17', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (553, 637, 'user', 77, NULL, 35, 'text', '.', '2019-12-02 00:49:21', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (554, 637, 'doctor', NULL, 103, 35, 'text', '아', '2019-12-02 00:54:24', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (555, 637, 'doctor', NULL, 103, 35, 'text', '에', '2019-12-02 00:54:27', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (556, 637, 'user', 77, NULL, 35, 'text', 'ㄴ', '2019-12-02 00:54:28', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (557, 637, 'doctor', NULL, 103, 35, 'text', '에', '2019-12-02 00:54:30', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (558, 637, 'user', 77, NULL, 35, 'text', 'ㄱ', '2019-12-02 00:54:31', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (559, 637, 'doctor', NULL, 103, 35, 'text', '오', '2019-12-02 00:54:32', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (560, 637, 'user', 77, NULL, 35, 'text', 'ㄴ', '2019-12-02 00:54:34', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (561, 637, 'doctor', NULL, 103, 35, 'text', '우', '2019-12-02 00:54:36', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (562, 637, 'user', 77, NULL, 35, 'text', 'ㄷ', '2019-12-02 00:54:37', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (563, 637, 'doctor', NULL, 103, 35, 'text', '가', '2019-12-02 00:54:39', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (564, 637, 'doctor', NULL, 103, 35, 'text', '케', '2019-12-02 00:54:42', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (565, 637, 'user', 77, NULL, 35, 'text', 'ㄱ', '2019-12-02 00:54:43', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (566, 637, 'doctor', NULL, 103, 35, 'text', '키', '2019-12-02 00:54:45', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (567, 637, 'user', 77, NULL, 35, 'text', 'ㄴ', '2019-12-02 00:54:46', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (568, 637, 'doctor', NULL, 103, 35, 'text', '코', '2019-12-02 00:54:47', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (569, 637, 'doctor', NULL, 103, 35, 'text', '쿠', '2019-12-02 00:54:50', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (570, 637, 'doctor', NULL, 103, 35, 'text', '느금?', '2019-12-02 00:54:53', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (571, 637, 'user', 77, NULL, 35, 'text', '됐음다', '2019-12-02 00:54:55', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (572, 637, 'doctor', NULL, 103, 35, 'text', 'ㄴㄱ???!?????', '2019-12-02 00:54:56', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (573, 637, 'doctor', NULL, 103, 35, 'text', '패드립?', '2019-12-02 00:54:59', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (574, 637, 'user', 77, NULL, 35, 'text', '갑자기?', '2019-12-02 00:55:00', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (575, 637, 'doctor', NULL, 103, 35, 'text', '아까보다 빨라짐', '2019-12-02 00:55:04', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (576, 637, 'doctor', NULL, 103, 35, 'text', '아까보다', '2019-12-02 00:55:13', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (577, 637, 'doctor', NULL, 103, 35, 'text', '빨라졋네', '2019-12-02 00:55:17', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (578, 637, 'doctor', NULL, 103, 35, 'text', '기분탓?', '2019-12-02 00:55:24', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (579, 637, 'doctor', NULL, 103, 35, 'text', 'ㅇ', '2019-12-02 00:55:27', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (580, 637, 'user', 77, NULL, 35, 'text', '전송예외처리 야매로 박아놓가했는데', '2019-12-02 00:55:29', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (581, 637, 'doctor', NULL, 103, 35, 'text', 'ㅇ', '2019-12-02 00:55:30', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (582, 637, 'doctor', NULL, 103, 35, 'text', 'ㅇ', '2019-12-02 00:55:33', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (583, 637, 'user', 77, NULL, 35, 'text', '기분탓', '2019-12-02 00:55:33', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (584, 637, 'doctor', NULL, 103, 35, 'text', 'ㅇ', '2019-12-02 00:55:35', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (585, 637, 'doctor', NULL, 103, 35, 'text', 'ㅇ', '2019-12-02 00:55:38', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (586, 637, 'user', 77, NULL, 35, 'text', '서버상태 이상해서', '2019-12-02 00:55:49', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (587, 637, 'user', 77, NULL, 35, 'text', '.', '2019-12-02 12:45:27', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (588, 637, 'user', 77, NULL, 35, 'text', '.', '2019-12-02 13:19:56', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (589, 637, 'user', 77, NULL, 35, 'text', 'ㄷ', '2019-12-02 13:21:59', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (590, 634, 'user', 77, NULL, 41, 'text', '.', '2019-12-02 13:22:42', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (591, 634, 'user', 77, NULL, 41, 'text', '.', '2019-12-02 13:23:56', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (592, 634, 'user', 77, NULL, 41, 'text', 'ㄷㄱㄷㄱㄷ', '2019-12-02 13:24:00', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (593, 634, 'user', 77, NULL, 41, 'text', '?', '2019-12-02 13:24:06', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (594, 634, 'user', 77, NULL, 41, 'text', 'ㄴ', '2019-12-02 15:51:49', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (595, 637, 'user', 77, NULL, 35, 'text', 'ㄱㄷㄱㄷ', '2019-12-02 15:51:58', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (596, 638, 'user', 77, NULL, 45, 'text', '넵', '2019-12-02 16:48:24', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (597, 638, 'user', 77, NULL, 45, 'text', '다른거도 받아줘요', '2019-12-02 16:48:36', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (598, 638, 'doctor', NULL, 111, 45, 'text', 'ok', '2019-12-02 16:48:56', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (599, 638, 'doctor', NULL, 111, 45, 'text', '이미 수락', '2019-12-02 16:49:35', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (600, 641, 'user', 77, NULL, 46, 'text', '다믐것도', '2019-12-02 16:50:26', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (601, 650, 'user', 77, NULL, 44, 'text', '.', '2019-12-02 17:00:04', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (602, 648, 'user', 77, NULL, 42, 'text', '.', '2019-12-02 17:00:09', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (603, 642, 'user', 77, NULL, 47, 'text', '.', '2019-12-02 17:00:17', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (604, 652, 'user', 77, NULL, 35, 'text', '?', '2019-12-02 17:02:53', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (605, 652, 'doctor', NULL, 111, 35, 'text', 'ㅎ', '2019-12-02 17:03:07', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (606, 652, 'user', 77, NULL, 35, 'text', '그 fmpeg찾아봤어요?', '2019-12-02 17:06:10', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (607, 652, 'doctor', NULL, 111, 35, 'text', '안드로이드에 설치하는거 까지는', '2019-12-02 17:11:15', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (608, 652, 'doctor', NULL, 111, 35, 'text', '찾아봤는데', '2019-12-02 17:11:18', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (609, 652, 'doctor', NULL, 111, 35, 'text', '이거 힘드네', '2019-12-02 17:12:50', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (610, 646, 'user', 77, NULL, 43, 'text', 'ㄱㄷ', '2019-12-02 17:28:07', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (611, 646, 'user', 77, NULL, 43, 'text', 'ㄷㄱㄷ', '2019-12-02 17:29:25', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (612, 627, 'user', 78, NULL, 34, 'text', '.', '2019-12-03 14:17:52', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (613, 652, 'user', 77, NULL, 35, 'text', '.', '2019-12-03 14:34:06', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (614, 627, 'user', 78, NULL, 34, 'text', 'ㅇ', '2019-12-03 14:39:05', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (615, 627, 'doctor', NULL, 111, 34, 'text', 'ㅇ', '2019-12-03 14:39:15', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (616, 654, 'user', 77, NULL, 35, 'text', 'fdgyfv', '2019-12-03 15:39:18', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (617, 654, 'user', 77, NULL, 35, 'text', 'hgvugh', '2019-12-03 15:39:22', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (618, 654, 'doctor', NULL, 111, 35, 'text', 'ㄷ극ㄴㄱ디', '2019-12-03 15:39:26', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (619, 654, 'user', 77, NULL, 35, 'text', 'gvhhvg', '2019-12-03 15:39:27', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (620, 654, 'doctor', NULL, 111, 35, 'text', '십아', '2019-12-03 15:39:34', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (621, 654, 'doctor', NULL, 111, 35, 'text', '딧기', '2019-12-03 15:39:59', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (622, 654, 'user', 77, NULL, 35, 'text', 'nejejfje', '2019-12-03 15:40:04', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (623, 654, 'user', 77, NULL, 35, 'text', 'eufidiwifc', '2019-12-03 15:40:12', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (624, 654, 'user', 77, NULL, 35, 'text', 'wodofocoehsodo', '2019-12-03 15:40:25', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (625, 655, 'user', 77, NULL, 35, 'text', '네', '2019-12-03 18:56:22', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (626, 656, 'user', 77, NULL, 41, 'text', '네', '2019-12-03 19:26:05', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (627, 656, 'doctor', NULL, 111, 41, 'video', 'http://ccit2019.cafe24.com/storage/video/chat/41/11120191203_193038594.mp4', '2019-12-03 19:30:47', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (628, 656, 'doctor', NULL, 111, 41, 'video', 'http://ccit2019.cafe24.com/storage/video/chat/41/11120191203_194018094.mp4', '2019-12-03 19:40:30', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (629, 656, 'doctor', NULL, 111, 41, 'text', 'ㅇ', '2019-12-03 19:50:55', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (630, 658, 'doctor', NULL, 111, 39, 'text', 'ㅎ', '2019-12-06 10:31:41', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (631, 658, 'doctor', NULL, 111, 39, 'text', 'ㅎ느ㆍㄴ', '2019-12-06 10:31:43', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (632, 658, 'doctor', NULL, 111, 39, 'text', 'ㄱㅅ느', '2019-12-06 10:31:45', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (633, 658, 'user', 80, NULL, 39, 'text', '시바', '2019-12-06 10:32:03', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (634, 673, 'user', 83, NULL, 55, 'text', 'tg', '2019-12-06 11:05:50', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (635, 673, 'doctor', NULL, 117, 55, 'text', 'ㅗ옹', '2019-12-06 11:05:56', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (636, 673, 'user', 83, NULL, 55, 'text', 'ㅎㅇ?', '2019-12-06 11:08:03', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (637, 673, 'user', 83, NULL, 55, 'text', '?', '2019-12-06 11:08:17', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (638, 673, 'user', 83, NULL, 55, 'text', '?', '2019-12-06 11:08:30', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (639, 673, 'user', 83, NULL, 55, 'text', '?', '2019-12-06 11:08:35', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (640, 673, 'doctor', NULL, 117, 55, 'text', '기모링', '2019-12-06 11:08:42', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (641, 673, 'user', 83, NULL, 55, 'text', 'ㅇㅅㅇ', '2019-12-06 11:11:00', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (642, 673, 'user', 83, NULL, 55, 'text', '?', '2019-12-06 11:11:08', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (643, 673, 'user', 83, NULL, 55, 'text', 'ㅇ', '2019-12-06 11:12:07', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (644, 676, 'user', 83, NULL, 55, 'text', 'ㅎㅇ', '2019-12-06 11:24:11', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (645, 687, 'user', 83, NULL, 55, 'text', 'ㅎㅇ', '2019-12-06 11:25:03', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (646, 687, 'user', 83, NULL, 55, 'text', '통신보안', '2019-12-06 11:25:16', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (647, 687, 'user', 83, NULL, 55, 'text', '뭐하누', '2019-12-06 11:25:38', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (648, 687, 'user', 83, NULL, 55, 'text', '진료하라이거야', '2019-12-06 11:25:49', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (649, 734, 'doctor', NULL, 111, 57, 'text', 'ko8', '2019-12-06 14:32:19', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (650, 835, 'doctor', NULL, 111, 64, 'text', '하이', '2019-12-10 00:46:29', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (651, 836, 'doctor', NULL, 111, 57, 'text', 'hwk1', '2019-12-11 00:32:34', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (652, 836, 'doctor', NULL, 111, 57, 'text', 'hei3', '2019-12-11 00:32:40', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (653, 836, 'doctor', NULL, 111, 57, 'text', 'hekd', '2019-12-11 00:32:46', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (654, 836, 'doctor', NULL, 111, 57, 'text', 'jsje', '2019-12-11 00:32:51', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (655, 836, 'doctor', NULL, 111, 57, 'text', '아이고', '2019-12-11 00:32:56', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (656, 836, 'doctor', NULL, 111, 57, 'text', '시바', '2019-12-11 00:33:04', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (657, 838, 'doctor', NULL, 111, 57, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/57/11120191212_140355597.jpeg', '2019-12-12 14:04:12', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (658, 840, 'doctor', NULL, 147, 72, 'text', '넵', '2019-12-13 00:18:28', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (659, 841, 'doctor', NULL, 117, 71, 'text', 'ㅎㅇ', '2019-12-13 11:05:08', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (660, 841, 'user', 78, NULL, 71, 'text', 'ㅎㅇ', '2019-12-13 11:05:25', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (661, 841, 'doctor', NULL, 117, 71, 'text', '萬', '2019-12-13 11:06:28', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (662, 841, 'doctor', NULL, 117, 71, 'text', '日', '2019-12-13 11:06:40', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (663, 841, 'doctor', NULL, 117, 71, 'text', '梁', '2019-12-13 11:06:59', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (664, 841, 'doctor', NULL, 117, 71, 'text', '緊', '2019-12-13 11:07:20', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (665, 841, 'doctor', NULL, 117, 71, 'text', '%', '2019-12-13 11:07:36', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (666, 843, 'doctor', NULL, 111, 74, 'text', '곤니찌와', '2019-12-13 11:08:14', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (667, 843, 'user', 78, NULL, 74, 'text', 'hㅅ', '2019-12-13 11:08:20', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (668, 841, 'doctor', NULL, 117, 71, 'text', '!', '2019-12-13 11:12:16', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (669, 841, 'doctor', NULL, 117, 71, 'text', '÷/÷^×₩×%!%#&', '2019-12-13 11:12:20', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (670, 841, 'doctor', NULL, 117, 71, 'text', 'ㅎㅇ!', '2019-12-13 11:12:25', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (671, 841, 'doctor', NULL, 117, 71, 'text', 'ㅎㅇ', '2019-12-13 11:12:30', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (672, 843, 'user', 78, NULL, 74, 'text', '얍', '2019-12-13 11:12:34', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (673, 841, 'doctor', NULL, 117, 71, 'text', 'ㄷ', '2019-12-13 11:12:55', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (674, 841, 'user', 78, NULL, 71, 'text', '여기', '2019-12-13 11:13:02', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (675, 841, 'doctor', NULL, 117, 71, 'text', '金', '2019-12-13 11:13:12', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (676, 841, 'doctor', NULL, 117, 71, 'text', '!@%#^~', '2019-12-13 11:13:32', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (677, 841, 'doctor', NULL, 117, 71, 'text', 'whs', '2019-12-13 11:13:38', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (678, 841, 'doctor', NULL, 117, 71, 'text', '九', '2019-12-13 11:13:50', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (679, 841, 'user', 78, NULL, 71, 'text', '可', '2019-12-13 11:13:59', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (680, 841, 'user', 78, NULL, 71, 'text', 'ㄱㅈㄱㅈ', '2019-12-13 11:14:02', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (681, 843, 'doctor', NULL, 111, 74, 'text', '♡', '2019-12-13 11:26:35', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (682, 845, 'doctor', NULL, 111, 57, 'text', '시기', '2019-12-16 18:34:36', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (683, 861, 'doctor', NULL, 111, 64, 'text', '오이', '2019-12-18 13:28:23', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (684, 861, 'user', 84, NULL, 64, 'text', '이이', '2019-12-18 13:28:34', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (685, 861, 'doctor', NULL, 111, 64, 'text', '하이', '2019-12-18 13:48:16', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (686, 861, 'doctor', NULL, 111, 64, 'text', 'ㅇ', '2019-12-18 13:49:52', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (687, 862, 'doctor', NULL, 111, 57, 'text', 'cwj2', '2019-12-18 14:13:35', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (688, 862, 'doctor', NULL, 111, 57, 'text', 'hw', '2019-12-18 14:13:43', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (689, 863, 'doctor', NULL, 111, 57, 'text', 'ㅅㄷ', '2019-12-18 14:38:09', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (690, 871, 'doctor', NULL, 111, 57, 'text', '아', '2019-12-21 19:04:52', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (691, 874, 'user', 84, NULL, 57, 'text', '안녕하세요', '2019-12-29 15:13:05', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (692, 874, 'user', 84, NULL, 57, 'text', '하이', '2019-12-29 15:13:23', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (693, 874, 'doctor', NULL, 143, 57, 'text', 'ㅎㅇ', '2019-12-29 15:13:30', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (694, 874, 'user', 84, NULL, 57, 'text', 'ㅎㅈ', '2019-12-29 15:14:00', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (695, 874, 'user', 84, NULL, 57, 'text', '드', '2019-12-29 15:14:03', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (696, 874, 'user', 84, NULL, 57, 'text', '나', '2019-12-29 15:14:07', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (697, 874, 'doctor', NULL, 143, 57, 'text', '답장안해줘도됌 ㄱㅅ', '2019-12-29 15:14:16', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (698, 874, 'doctor', NULL, 143, 57, 'text', '아니다 그 이미지 하나보내줄수잇나 고양이사진', '2019-12-29 15:14:26', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (699, 874, 'doctor', NULL, 143, 57, 'text', 'ㅇ', '2019-12-29 15:14:32', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (700, 874, 'doctor', NULL, 143, 57, 'text', 'ㅇ', '2019-12-29 15:14:35', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (701, 874, 'doctor', NULL, 143, 57, 'text', 'ㅇ', '2019-12-29 15:14:39', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (702, 874, 'doctor', NULL, 143, 57, 'text', 'ㅇ', '2019-12-29 15:14:43', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (703, 874, 'doctor', NULL, 143, 57, 'text', 'ㅇ', '2019-12-29 15:14:47', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (704, 874, 'doctor', NULL, 143, 57, 'text', 'ㅇㅇ', '2019-12-29 15:14:50', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (705, 874, 'doctor', NULL, 143, 57, 'text', 'ㅇ', '2019-12-29 15:14:54', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (706, 874, 'doctor', NULL, 143, 57, 'text', 'ㅇ', '2019-12-29 15:14:58', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (707, 874, 'doctor', NULL, 143, 57, 'text', 'ㅇ', '2019-12-29 15:15:01', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (708, 874, 'user', 84, NULL, 57, 'text', '고객앱', '2019-12-29 15:15:41', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (709, 874, 'user', 84, NULL, 57, 'text', '아니지', '2019-12-29 15:15:45', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (710, 874, 'user', 84, NULL, 57, 'text', '보냄', '2019-12-29 15:15:49', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (711, 874, 'doctor', NULL, 143, 57, 'video', 'http://ccit2019.cafe24.com/storage/video/chat/57/14320191229_151832839.mp4', '2019-12-29 15:19:13', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (712, 876, 'doctor', NULL, 143, 57, 'video', 'http://ccit2019.cafe24.com/storage/video/chat/57/14320191229_185826737.mp4', '2019-12-29 18:59:01', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (713, 876, 'doctor', NULL, 143, 57, 'video', 'http://ccit2019.cafe24.com/storage/video/chat/57/14320191229_185922810.mp4', '2019-12-29 18:59:56', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (714, 876, 'doctor', NULL, 143, 57, 'text', '.', '2019-12-29 19:00:01', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (715, 877, 'doctor', NULL, 111, 100, 'text', '안녕하세요', '2020-01-02 18:39:08', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (716, 877, 'user', 78, NULL, 100, 'text', '안녕하세요', '2020-01-02 18:39:09', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (717, 877, 'doctor', NULL, 111, 100, 'text', '반가워요', '2020-01-02 18:39:18', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (718, 877, 'user', 78, NULL, 100, 'text', '저희 콩이가 많이 아파요...', '2020-01-02 18:39:19', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (719, 877, 'doctor', NULL, 111, 100, 'text', '네 더 자세한 내용 말씀해주세요', '2020-01-02 18:39:40', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (720, 880, 'doctor', NULL, 171, 101, 'text', '안녕하세요', '2020-01-02 20:04:55', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (721, 877, 'user', 78, NULL, 100, 'text', '안녕하세요!', '2020-01-02 20:04:55', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (722, 880, 'user', 78, NULL, 101, 'text', '안녕하세요', '2020-01-02 20:07:04', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (723, 881, 'doctor', NULL, 171, 100, 'text', '안녕하세요', '2020-01-02 20:07:08', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (724, 880, 'user', 78, NULL, 101, 'text', '강아지가 발을 자꾸절어요', '2020-01-02 20:07:17', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (725, 880, 'user', 78, NULL, 101, 'text', '어찌해야하나요???', '2020-01-02 20:07:27', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (726, 882, 'doctor', NULL, 171, 102, 'text', '안녕하세요', '2020-01-02 20:46:12', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (727, 882, 'user', 85, NULL, 102, 'text', '안녕하세요~', '2020-01-02 20:46:13', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (728, 882, 'user', 85, NULL, 102, 'text', '강아지가 아파요...', '2020-01-02 20:46:18', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (729, 882, 'doctor', NULL, 171, 102, 'text', '수의사 유상범입니다', '2020-01-02 20:46:20', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (730, 882, 'doctor', NULL, 171, 102, 'text', '네 어디가 아픈지 더 말씀해주세요', '2020-01-02 20:46:43', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (731, 883, 'doctor', NULL, 171, 57, 'text', '안녕하세요', '2020-01-02 22:33:20', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (732, 887, 'doctor', NULL, 143, 104, 'text', '안녕하세요', '2020-01-07 19:41:46', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (733, 887, 'user', 85, NULL, 104, 'text', '아이거 테스트임 잠만', '2020-01-07 19:41:50', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (734, 887, 'doctor', NULL, 143, 104, 'text', 'ㅇㅋ', '2020-01-07 19:43:08', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (735, 887, 'user', 85, NULL, 104, 'text', 'ㅇㅋ', '2020-01-07 19:43:16', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (736, 889, 'doctor', NULL, 171, 57, 'text', '넵', '2020-01-07 20:56:07', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (737, 889, 'doctor', NULL, 171, 57, 'text', 'ㄴㄱㆍ', '2020-01-07 20:57:24', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (738, 890, 'doctor', NULL, 171, 64, 'text', '안녕하세요', '2020-01-07 20:57:54', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (739, 890, 'doctor', NULL, 171, 64, 'text', '안녕', '2020-01-07 20:58:12', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (740, 889, 'doctor', NULL, 171, 57, 'text', 'ㅇ', '2020-01-07 20:59:33', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (741, 892, 'doctor', NULL, 171, 65, 'text', '아니', '2020-01-07 21:01:44', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (742, 896, 'doctor', NULL, 171, 64, 'text', 'ㅅㄷ', '2020-01-07 21:24:09', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (743, 897, 'user', 85, NULL, 103, 'text', '안녕하세요', '2020-01-08 14:10:43', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (744, 897, 'doctor', NULL, 103, 103, 'text', '연속으로 세번말해줘', '2020-01-08 14:10:55', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (745, 897, 'user', 85, NULL, 103, 'text', '저희 콩이가', '2020-01-08 14:11:09', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (746, 897, 'user', 85, NULL, 103, 'text', '어제밤부터', '2020-01-08 14:11:12', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (747, 897, 'user', 85, NULL, 103, 'text', '발을 저는데', '2020-01-08 14:11:17', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (748, 897, 'user', 85, NULL, 103, 'text', '어떻게 해야하나요?', '2020-01-08 14:11:22', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (749, 897, 'doctor', NULL, 103, 103, 'text', 'ㅇㅋㄷㅋ끜', '2020-01-08 14:11:33', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (750, 897, 'user', 85, NULL, 103, 'text', 'ㅇㅋㄷㅋ', '2020-01-08 14:11:41', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (751, 897, 'doctor', NULL, 103, 103, 'text', '안녕하세요', '2020-01-08 14:13:24', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (752, 897, 'doctor', NULL, 103, 103, 'text', '답장안해도됌', '2020-01-08 14:13:29', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (753, 897, 'doctor', NULL, 103, 103, 'text', '네', '2020-01-08 14:14:20', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (754, 899, 'doctor', NULL, 103, 102, 'text', '네', '2020-01-08 14:47:12', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (755, 899, 'user', 85, NULL, 102, 'text', '이미지보내짐?', '2020-01-08 14:50:34', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (756, 899, 'doctor', NULL, 103, 102, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/102/10320200108_145018224.jpeg', '2020-01-08 14:51:02', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (757, 899, 'doctor', NULL, 103, 102, 'text', 'ㅇㅇㅇ', '2020-01-08 14:51:07', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (758, 910, 'user', 85, NULL, 103, 'text', '안녕하세요!', '2020-01-09 15:06:44', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (759, 910, 'doctor', NULL, 171, 103, 'text', '안녕하세요', '2020-01-09 15:06:46', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (760, 910, 'user', 85, NULL, 103, 'text', '취소', '2020-01-09 15:06:53', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (761, 910, 'user', 85, NULL, 103, 'text', 'ㅈㅅ 상담했었네', '2020-01-09 15:07:01', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (762, 910, 'user', 85, NULL, 103, 'text', 'ㄱㄷㅇ', '2020-01-09 15:07:34', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (763, 912, 'doctor', NULL, 171, 106, 'text', '안녕하세요', '2020-01-09 15:10:57', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (764, 912, 'user', 85, NULL, 106, 'text', '안녕하세요', '2020-01-09 15:11:06', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (765, 912, 'user', 85, NULL, 106, 'text', '몽이가 다리를 절어요', '2020-01-09 15:11:14', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (766, 912, 'doctor', NULL, 171, 106, 'text', '네 더 말씀해 주세요', '2020-01-09 15:11:30', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (767, 912, 'user', 85, NULL, 106, 'text', 'ㅇㅋㅇㅋ', '2020-01-09 15:11:49', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (768, 912, 'user', 85, NULL, 106, 'text', '넴', '2020-01-09 15:14:16', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (769, 912, 'user', 85, NULL, 106, 'text', '잠만', '2020-01-09 15:23:14', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (770, 912, 'user', 85, NULL, 106, 'text', '연장해주세요', '2020-01-09 15:23:38', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (771, 912, 'doctor', NULL, 171, 106, 'text', '잠시만요', '2020-01-09 15:24:11', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (772, 912, 'doctor', NULL, 171, 106, 'text', '연장 되었습니다', '2020-01-09 15:24:19', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (773, 912, 'doctor', NULL, 171, 106, 'text', '10분이요', '2020-01-09 15:24:32', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (774, 912, 'user', 85, NULL, 106, 'text', '감사합니다', '2020-01-09 15:24:42', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (775, 913, 'user', 85, NULL, 104, 'text', '안녕하세요', '2020-01-09 15:41:45', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (776, 913, 'user', 85, NULL, 104, 'text', 'ㄱㅅ 테스트', '2020-01-09 15:41:58', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (777, 913, 'doctor', NULL, 171, 104, 'text', '네 안녕하세요', '2020-01-09 15:42:03', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (778, 914, 'doctor', NULL, 171, 106, 'text', '테스트?', '2020-01-09 15:56:46', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (779, 914, 'doctor', NULL, 171, 106, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/106/17120200109_155911996.jpeg', '2020-01-09 15:59:55', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (780, 912, 'user', 85, NULL, 106, 'text', 'ㅇㅇ', '2020-01-09 16:00:15', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (781, 915, 'user', 85, NULL, 107, 'text', '안녕하세요', '2020-01-09 16:26:33', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (782, 887, 'doctor', NULL, 103, 104, 'text', '안녕하세요', '2020-01-09 16:26:43', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (783, 915, 'user', 85, NULL, 107, 'text', '쿠키가 다리를 절어요', '2020-01-09 16:26:44', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (784, 915, 'user', 85, NULL, 107, 'text', '어떻게 해야하나요???', '2020-01-09 16:27:00', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (785, 918, 'doctor', NULL, 171, 109, 'text', '안녕하세요', '2020-01-09 16:33:57', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (786, 918, 'user', 85, NULL, 109, 'text', '안녕하세요', '2020-01-09 16:33:58', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (787, 918, 'user', 85, NULL, 109, 'text', '강아지 귀에 염증이 났는데', '2020-01-09 16:34:13', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (788, 918, 'user', 85, NULL, 109, 'text', '어떻게 해야하나요??', '2020-01-09 16:34:15', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (789, 919, 'doctor', NULL, 171, 110, 'text', '안녕하세요', '2020-01-09 16:43:50', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (790, 919, 'user', 85, NULL, 110, 'text', '안녕하세요', '2020-01-09 16:43:59', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (791, 920, 'user', 77, NULL, 105, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/105/downloadfile.jpg', '2020-01-09 16:58:58', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (792, 919, 'user', 85, NULL, 110, 'text', '강아지가 자꾸 기침을 하는데', '2020-01-09 17:02:17', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (793, 920, 'user', 77, NULL, 105, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/105/(87)downloadfile.jpg', '2020-01-09 17:03:25', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (794, 920, 'user', 77, NULL, 105, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/105/(92)downloadfile.jpg', '2020-01-09 17:04:12', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (795, 920, 'user', 77, NULL, 105, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/105/(89)downloadfile.jpg', '2020-01-09 17:09:57', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (796, 921, 'user', 77, NULL, 105, 'text', 'ㅎㅇ요', '2020-01-09 17:21:01', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (797, 921, 'user', 77, NULL, 105, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/105/(79)downloadfile.jpg', '2020-01-09 17:21:04', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (798, 921, 'user', 77, NULL, 105, 'text', '사진잘 가나요', '2020-01-09 17:21:16', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (799, 921, 'doctor', NULL, 171, 105, 'text', '사진 잘 옵니다', '2020-01-09 17:21:20', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (800, 921, 'doctor', NULL, 171, 105, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/105/17120200109_172050025.jpeg', '2020-01-09 17:21:33', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (801, 921, 'doctor', NULL, 171, 105, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/105/17120200109_172115083.jpeg', '2020-01-09 17:21:59', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (802, 921, 'doctor', NULL, 171, 105, 'text', '잘 가?', '2020-01-09 17:22:12', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (803, 921, 'doctor', NULL, 171, 105, 'text', '난 가나?', '2020-01-09 17:26:32', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (804, 922, 'user', 85, NULL, 102, 'text', '아아', '2020-01-09 17:38:47', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (805, 922, 'user', 85, NULL, 102, 'text', '보내지는데?', '2020-01-09 17:38:54', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (806, 922, 'user', 85, NULL, 102, 'text', '안보내짐?', '2020-01-09 17:40:20', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (807, 924, 'user', 77, NULL, 105, 'text', '다시', '2020-01-09 17:51:26', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (808, 924, 'user', 77, NULL, 105, 'text', 'ip밴인거같은데', '2020-01-09 17:51:41', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (809, 924, 'user', 77, NULL, 105, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/105/(57)downloadfile.jpg', '2020-01-09 17:51:48', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (810, 924, 'user', 77, NULL, 105, 'text', '.', '2020-01-09 17:52:19', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (811, 924, 'doctor', NULL, 171, 105, 'text', '왜', '2020-01-09 17:54:12', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (812, 924, 'doctor', NULL, 171, 105, 'text', 'ㅋㅋㅋㅋ', '2020-01-09 17:54:34', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (813, 924, 'user', 77, NULL, 105, 'text', '사진보내서 밴당했나', '2020-01-09 17:54:42', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (814, 924, 'user', 77, NULL, 105, 'text', '용량커서', '2020-01-09 17:54:48', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (815, 924, 'doctor', NULL, 171, 105, 'text', '그런가', '2020-01-09 17:55:00', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (816, 924, 'doctor', NULL, 171, 105, 'text', '사진도', '2020-01-09 17:55:03', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (817, 924, 'user', 77, NULL, 105, 'text', '서버가 이상한건지', '2020-01-09 17:55:05', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (818, 924, 'doctor', NULL, 171, 105, 'text', '영상 찍어야함?', '2020-01-09 17:55:09', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (819, 924, 'user', 77, NULL, 105, 'text', '찍으면 좋죠', '2020-01-09 18:02:40', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (820, 921, 'user', 77, NULL, 105, 'text', '네', '2020-01-09 18:58:44', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (821, 925, 'doctor', NULL, 171, 105, 'text', '받았슴다', '2020-01-09 18:58:45', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (822, 925, 'doctor', NULL, 171, 105, 'text', 'ㅎㅇ', '2020-01-09 19:03:11', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (823, 925, 'user', 77, NULL, 105, 'text', '채팅', '2020-01-09 19:03:40', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (824, 925, 'doctor', NULL, 171, 105, 'text', 'ㅎㅇ', '2020-01-09 19:03:43', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (825, 925, 'doctor', NULL, 171, 105, 'text', 'ㅇㅇ', '2020-01-09 19:03:47', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (826, 925, 'user', 77, NULL, 105, 'text', '옙', '2020-01-09 19:04:25', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (827, 925, 'user', 77, NULL, 105, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/105/JPEG_20200109190358_1216571108374690406.jpg', '2020-01-09 19:04:52', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (828, 925, 'user', 77, NULL, 105, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/105/20191217_191509.jpg', '2020-01-09 19:06:11', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (829, 925, 'doctor', NULL, 171, 105, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/105/17120200109_190528265.jpeg', '2020-01-09 19:06:14', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (830, 925, 'user', 77, NULL, 105, 'text', 'ㅅ', '2020-01-09 19:07:41', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (831, 925, 'user', 77, NULL, 105, 'text', '보내봐요', '2020-01-09 19:07:49', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (832, 925, 'doctor', NULL, 171, 105, 'text', 'ㅎㅇ', '2020-01-09 19:07:55', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (833, 925, 'user', 77, NULL, 105, 'text', '다시요', '2020-01-09 19:08:23', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (834, 925, 'doctor', NULL, 171, 105, 'text', '다시', '2020-01-09 19:08:33', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (835, 925, 'user', 77, NULL, 105, 'text', '리리', '2020-01-09 19:09:19', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (836, 925, 'doctor', NULL, 171, 105, 'text', 'ㅇㅋㅇㅋ', '2020-01-09 19:09:26', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (837, 925, 'user', 77, NULL, 105, 'text', 'ㅇ', '2020-01-09 19:10:18', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (838, 925, 'doctor', NULL, 171, 105, 'text', '다시?', '2020-01-09 19:10:29', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (839, 925, 'user', 77, NULL, 105, 'text', '다시다시', '2020-01-09 19:10:40', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (840, 925, 'doctor', NULL, 171, 105, 'text', '테스트1', '2020-01-09 19:10:50', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (841, 925, 'user', 77, NULL, 105, 'text', '간닷', '2020-01-09 19:11:56', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (842, 925, 'doctor', NULL, 171, 105, 'text', '테스트2', '2020-01-09 19:12:03', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (843, 925, 'user', 77, NULL, 105, 'text', '뭐지', '2020-01-09 19:12:52', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (844, 925, 'doctor', NULL, 171, 105, 'text', '테스트3', '2020-01-09 19:13:01', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (845, 925, 'doctor', NULL, 171, 105, 'text', '왜?', '2020-01-09 19:13:04', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (846, 925, 'user', 77, NULL, 105, 'text', '다시', '2020-01-09 19:14:57', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (847, 925, 'user', 77, NULL, 105, 'text', '지금', '2020-01-09 19:16:23', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (848, 925, 'user', 77, NULL, 105, 'text', '다시 보내봐유', '2020-01-09 19:16:29', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (849, 925, 'user', 77, NULL, 105, 'text', '막타', '2020-01-09 19:16:39', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (850, 925, 'user', 77, NULL, 105, 'text', '.', '2020-01-09 19:17:06', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (851, 925, 'doctor', NULL, 171, 105, 'text', 'ㅌ스트4', '2020-01-09 19:17:27', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (852, 925, 'user', 77, NULL, 105, 'text', '지금', '2020-01-09 19:17:47', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (853, 925, 'user', 77, NULL, 105, 'text', '다시욥', '2020-01-09 19:17:50', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (854, 925, 'doctor', NULL, 171, 105, 'text', 'ㄴㄴ', '2020-01-09 19:17:53', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (855, 925, 'doctor', NULL, 171, 105, 'text', '안옴', '2020-01-09 19:17:56', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (856, 925, 'user', 77, NULL, 105, 'text', '굿', '2020-01-09 19:18:17', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (857, 925, 'doctor', NULL, 171, 105, 'text', '굿굿', '2020-01-09 19:18:33', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (858, 934, 'doctor', NULL, 171, 104, 'text', '확인', '2020-01-09 19:45:51', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (859, 934, 'user', 85, NULL, 104, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/104/Screenshot_20200109-193316_Gallery.jpg', '2020-01-09 19:46:16', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (860, 934, 'user', 85, NULL, 104, 'text', '사진', '2020-01-09 19:46:19', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (861, 934, 'user', 85, NULL, 104, 'text', '감?', '2020-01-09 19:46:36', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (862, 934, 'doctor', NULL, 171, 104, 'text', '잘옵니다', '2020-01-09 19:46:38', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (863, 936, 'doctor', NULL, 171, 123, 'text', '아픈곳 말씀해주세요', '2020-01-09 19:56:00', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (864, 936, 'doctor', NULL, 171, 123, 'text', '아니', '2020-01-09 19:56:04', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (865, 936, 'doctor', NULL, 171, 123, 'text', '잉?', '2020-01-09 19:56:08', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (866, 936, 'doctor', NULL, 171, 123, 'text', '잉', '2020-01-09 19:56:13', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (867, 936, 'doctor', NULL, 171, 123, 'text', '잉', '2020-01-09 19:56:35', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (868, 937, 'doctor', NULL, 171, 124, 'text', '안녕하세요', '2020-01-09 19:58:11', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (869, 937, 'user', 85, NULL, 124, 'text', '스트레스 조지네', '2020-01-09 19:58:24', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (870, 937, 'doctor', NULL, 171, 124, 'text', 'ㅋㅋㅋㅋㅋㅋ', '2020-01-09 19:58:37', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (871, 937, 'user', 85, NULL, 124, 'text', '서버오류 나만떠?', '2020-01-09 19:58:44', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (872, 937, 'doctor', NULL, 171, 124, 'text', '값 들어오는거 확인 했엉?', '2020-01-09 19:58:48', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (873, 937, 'user', 85, NULL, 124, 'text', '이거 정보 뭐라고뜸?', '2020-01-09 19:58:51', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (874, 937, 'doctor', NULL, 171, 124, 'text', '난 안떠', '2020-01-09 19:58:52', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (875, 937, 'doctor', NULL, 171, 124, 'text', '종환부계정', '2020-01-09 19:58:58', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (876, 937, 'user', 85, NULL, 124, 'text', '몽이라고 떠? 강아지이름', '2020-01-09 19:59:06', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (877, 937, 'user', 85, NULL, 124, 'text', 'null뜸??', '2020-01-09 19:59:12', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (878, 937, 'doctor', NULL, 171, 124, 'text', '펫이름', '2020-01-09 19:59:27', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (879, 937, 'doctor', NULL, 171, 124, 'text', '몽이라고', '2020-01-09 19:59:31', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (880, 937, 'user', 85, NULL, 124, 'text', '돌겠네진짜 잠만', '2020-01-09 19:59:52', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (881, 937, 'user', 85, NULL, 124, 'text', '진짜 미안...', '2020-01-09 20:00:01', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (882, 938, 'doctor', NULL, 171, 106, 'text', 'ㅎㅇ', '2020-01-09 20:08:18', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (883, 938, 'user', 85, NULL, 106, 'text', '이건잘뜨네', '2020-01-09 20:08:37', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (884, 938, 'doctor', NULL, 171, 106, 'text', '사진하나만', '2020-01-09 20:11:37', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (885, 938, 'doctor', NULL, 171, 106, 'text', '보내줘', '2020-01-09 20:11:41', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (886, 939, 'doctor', NULL, 171, 136, 'text', '안녕하세요', '2020-01-09 20:20:01', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (887, 939, 'user', 85, NULL, 136, 'text', '또널떳다', '2020-01-09 20:20:10', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (888, 939, 'doctor', NULL, 171, 136, 'text', 'ㅋㅋㄲ', '2020-01-09 20:20:15', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (889, 939, 'user', 85, NULL, 136, 'text', '왜이러지 시발', '2020-01-09 20:20:16', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (890, 939, 'user', 85, NULL, 136, 'text', '아', '2020-01-09 20:20:19', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (891, 939, 'doctor', NULL, 171, 136, 'text', '형 일딴', '2020-01-09 20:20:20', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (892, 939, 'doctor', NULL, 171, 136, 'text', '사진점', '2020-01-09 20:20:24', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (893, 939, 'user', 85, NULL, 136, 'text', '먼사진?', '2020-01-09 20:20:34', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (894, 939, 'user', 85, NULL, 136, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/136/Screenshot_20200109-193316_Gallery.jpg', '2020-01-09 20:21:15', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (895, 939, 'user', 85, NULL, 136, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/136/Screenshot_20200109-154025.jpg', '2020-01-09 20:23:09', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (896, 941, 'user', 85, NULL, 139, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/139/Screenshot_20200109-193316_Gallery.jpg', '2020-01-09 20:33:08', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (897, 941, 'user', 85, NULL, 139, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/139/(66)Screenshot_20200109-193316_Gallery.jpg', '2020-01-09 20:37:54', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (898, 941, 'user', 85, NULL, 139, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/139/Screenshot_20200109-154035.jpg', '2020-01-09 20:39:42', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (899, 944, 'user', 85, NULL, 141, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/141/Screenshot_20200109-193316_Gallery.jpg', '2020-01-09 20:42:45', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (900, 944, 'user', 85, NULL, 141, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/141/Screenshot_20200109-155609.jpg', '2020-01-09 20:43:59', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (901, 944, 'user', 85, NULL, 141, 'img', 'http://ccit2019.cafe24.com/storage/img/chat/141/JPEG_20200109204346_6401967059089829840.jpg', '2020-01-09 20:44:41', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (902, 945, 'doctor', NULL, 171, 142, 'text', '안녕하세요', '2020-01-09 21:04:49', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (903, 946, 'doctor', NULL, 171, 140, 'text', '안녕하세요', '2020-01-09 21:06:13', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (904, 945, 'user', 85, NULL, 142, 'text', '안녕하세요', '2020-01-09 21:06:13', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (905, 946, 'user', 85, NULL, 140, 'text', '안녕하세여', '2020-01-09 21:06:20', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (906, 946, 'user', 85, NULL, 140, 'text', '다시..', '2020-01-09 21:06:36', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (907, 947, 'doctor', NULL, 171, 143, 'text', '안녕하세요', '2020-01-09 21:18:03', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (908, 946, 'user', 85, NULL, 140, 'text', '올라프의 상담방에', '2020-01-09 21:18:07', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (909, 946, 'user', 85, NULL, 140, 'text', '왜 들어가져', '2020-01-09 21:18:12', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (910, 947, 'user', 85, NULL, 143, 'text', '또 올라프의 상담방에', '2020-01-09 21:18:24', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (911, 947, 'user', 85, NULL, 143, 'text', '드가지네', '2020-01-09 21:18:28', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (912, 947, 'user', 85, NULL, 143, 'text', '하 ㅋㅋㅋㅋㅋㅋ', '2020-01-09 21:18:33', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (913, 947, 'doctor', NULL, 171, 143, 'text', '먼가', '2020-01-09 21:18:51', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (914, 947, 'doctor', NULL, 171, 143, 'text', '이상하네', '2020-01-09 21:18:55', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (915, 947, 'doctor', NULL, 171, 143, 'text', 'fcm도', '2020-01-09 21:19:04', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (916, 948, 'doctor', NULL, 171, 139, 'text', '사진이', '2020-01-09 21:49:59', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (917, 948, 'doctor', NULL, 171, 139, 'text', '이미', '2020-01-09 21:50:06', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (918, 948, 'user', 85, NULL, 139, 'text', 'ㅇㅇ?', '2020-01-09 21:50:10', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (919, 948, 'user', 85, NULL, 139, 'text', '종료합니다', '2020-01-09 21:50:49', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (920, 948, 'doctor', NULL, 171, 139, 'text', 'ㅇㅋㅇㅋ', '2020-01-09 21:50:56', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (921, 948, 'user', 85, NULL, 139, 'text', '다시요청오면 받아주', '2020-01-09 21:50:58', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (922, 948, 'user', 85, NULL, 139, 'text', '안나제발', '2020-01-09 21:51:34', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (923, 949, 'doctor', NULL, 171, 141, 'text', '안녕하세요', '2020-01-09 21:52:02', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (924, 950, 'doctor', NULL, 171, 138, 'text', '토토로', '2020-01-09 22:01:23', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (925, 953, 'user', 85, NULL, 144, 'text', '맞음', '2020-01-09 22:04:38', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (926, 953, 'user', 85, NULL, 144, 'text', '아니일단', '2020-01-09 22:04:45', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (927, 953, 'user', 85, NULL, 144, 'text', '널도안뜨고', '2020-01-09 22:04:55', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (928, 953, 'user', 85, NULL, 144, 'text', '방도 존나 잘들어가져 왜 되냐고ㅋㅋㅋ', '2020-01-09 22:05:04', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (929, 959, 'doctor', NULL, 171, 146, 'text', '안녕하세요', '2020-01-09 22:09:38', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (930, 960, 'doctor', NULL, 171, 145, 'text', '안녕하세요', '2020-01-09 22:11:47', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (931, 962, 'user', 85, NULL, 143, 'text', '한스 됨', '2020-01-09 22:14:37', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (932, 962, 'doctor', NULL, 171, 143, 'text', 'ㅇㅋㅇㅋ', '2020-01-09 22:14:51', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (933, 964, 'user', 85, NULL, 143, 'text', 'ㅇㅋ 한스', '2020-01-09 22:17:24', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (934, 964, 'user', 85, NULL, 143, 'text', '이제 갑니다 10초뒤에', '2020-01-09 22:17:33', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (935, 964, 'user', 85, NULL, 143, 'text', '영상키셈ㄱ', '2020-01-09 22:17:37', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (936, 965, 'user', 85, NULL, 147, 'text', '안녕하세요', '2020-01-09 22:18:14', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (937, 965, 'doctor', NULL, 171, 147, 'text', '안녕하세요', '2020-01-09 22:18:16', 'no', 'on'); INSERT INTO `chat` (`id`, `request_id`, `id_type`, `send_user`, `send_doctor`, `room`, `message_type`, `message`, `created_at`, `read`, `on/off`) VALUES (938, 634, 'user', 77, NULL, 41, 'text', '넵', '2020-01-12 03:39:01', 'no', 'on'); /*!40000 ALTER TABLE `chat` ENABLE KEYS */; -- 테이블 MerDog.chat_request 구조 내보내기 CREATE TABLE IF NOT EXISTS `chat_request` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '채팅요청정보 인덱스', `user_id` int(11) NOT NULL COMMENT '사용자 회원번호', `pet_id` int(11) NOT NULL COMMENT '펫 회원번호 = 방 이름', `chat_title` text NOT NULL COMMENT '상담신청서 제목', `chat_content` text NOT NULL COMMENT '상담신청서 내용', `address` text NOT NULL COMMENT '사용자 주소', `latitude` float(11,6) NOT NULL DEFAULT '0.000000' COMMENT '위도 <가로 0~90 북/남> 정보', `longitude` float(11,6) NOT NULL DEFAULT '0.000000' COMMENT '경도 <세로 0~180> 정보', `distance` int(11) NOT NULL COMMENT '채팅요청 최대 거리 정보', `state` varchar(10) NOT NULL DEFAULT 'wait' COMMENT '채팅요청 상태 ing: 채팅중/off: 연결 실패 / wait : 대기중/ finish : 완료', `doctor_id` int(11) DEFAULT NULL COMMENT '매칭된 의사 번호', `rating` float(2,1) DEFAULT NULL COMMENT '채팅 평점 <의사를 평가하는 기준>', `extra_time` int(11) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `FK_chat_request_user_info` (`user_id`), KEY `FK_chat_request_pet_info` (`pet_id`), KEY `FK_chat_request_doctor_info` (`doctor_id`), CONSTRAINT `FK_chat_request_doctor_info` FOREIGN KEY (`doctor_id`) REFERENCES `doctor_info` (`id`) ON UPDATE CASCADE, CONSTRAINT `FK_chat_request_pet_info` FOREIGN KEY (`pet_id`) REFERENCES `pet_info` (`id`) ON UPDATE CASCADE, CONSTRAINT `FK_chat_request_user_info` FOREIGN KEY (`user_id`) REFERENCES `user_info` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='채팅 요청 정보'; -- 테이블 데이터 MerDog.chat_request:~362 rows (대략적) 내보내기 /*!40000 ALTER TABLE `chat_request` DISABLE KEYS */; INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (577, 77, 35, '행동', '상벙스', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 111, NULL, NULL, '2019-11-26 18:13:46'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (578, 77, 35, '행동', 'ㄷㄴ슨ㅅ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 111, NULL, NULL, '2019-11-26 18:15:12'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (579, 77, 35, '행동', 'ehshehene', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713379, 126.889061, 15, 'off', NULL, NULL, NULL, '2019-11-26 19:38:38'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (580, 77, 35, '행동', 'ehshehene', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713379, 126.889061, 15, 'finish', 103, NULL, NULL, '2019-11-26 19:38:57'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (581, 77, 35, '행동', 'ydc7rcurcurc', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713387, 126.889061, 15, 'finish', 111, NULL, NULL, '2019-11-26 20:30:45'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (582, 77, 35, '행동', 'ftvtvbun', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 111, NULL, NULL, '2019-11-26 20:51:18'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (583, 77, 35, '행동', 'ㄱㄷㅂㄷㅇㄷㅅㄷㄱㄷㄱ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-11-26 21:16:21'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (584, 77, 35, '행동', 'ㄱㄷㅅㄷㅅㄷㄴㅈ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-11-26 21:16:29'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (585, 77, 35, '행동', 'ㄱㄷㅅㄷㅅㄷㄴㅈ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-11-26 21:16:49'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (586, 77, 35, '행동', 'ㄱㄷㄱㄷㅅㅈㄱ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-11-26 21:17:11'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (587, 77, 35, '행동', 'ㄱㄷㄱㄷㅅㅈㄱ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 111, NULL, NULL, '2019-11-26 21:18:37'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (588, 77, 35, '행동', '다시', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-11-26 23:10:49'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (589, 77, 35, '행동', '다시', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 111, NULL, NULL, '2019-11-26 23:11:10'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (590, 77, 35, '행동', '다시좀요', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-11-26 23:17:10'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (591, 77, 35, '행동', '다시좀요', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-11-26 23:17:41'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (592, 77, 35, '행동', '다시좀요', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-11-26 23:17:55'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (593, 77, 35, '행동', 'ㅡㄴㅇㄷㄴㅇ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 111, NULL, NULL, '2019-11-26 23:18:15'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (594, 80, 40, '행동', 'ㅅㄷㄹㄷ', '경기도 고양시 덕양구', 37.713287, 126.889915, 15, 'off', NULL, NULL, NULL, '2019-11-26 23:32:37'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (595, 80, 40, '행동', 'ㅅㄷㄹㄷ', '경기도 고양시 덕양구', 37.713287, 126.889915, 15, 'off', NULL, NULL, NULL, '2019-11-26 23:32:55'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (596, 80, 39, '행동', 'ㅅㄷㄹㄷ', '경기도 고양시 덕양구', 37.713287, 126.889915, 15, 'wait', NULL, NULL, NULL, '2019-11-26 23:33:40'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (597, 80, 39, '행동', 'ㅅㄷㄹㄷ', '경기도 고양시 덕양구', 37.713287, 126.889915, 15, 'off', NULL, NULL, NULL, '2019-11-26 23:34:08'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (598, 80, 39, '행동', 'ㅅㄷㄹㄷ', '경기도 고양시 덕양구', 37.713287, 126.889915, 15, 'finish', 111, NULL, NULL, '2019-11-26 23:35:12'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (599, 80, 39, '행동', 'ㅅㄱ디디', '경기도 고양시 덕양구', 37.713287, 126.889915, 15, 'off', NULL, NULL, NULL, '2019-11-26 23:38:23'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (600, 80, 39, '행동', 'ㅅㄱ디디', '경기도 고양시 덕양구', 37.713287, 126.889915, 15, 'finish', 111, NULL, NULL, '2019-11-26 23:40:27'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (601, 77, 35, '행동', '간다아', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 111, 1.0, NULL, '2019-11-26 23:50:02'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (602, 77, 35, '행동', '간다아', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 111, 5.0, NULL, '2019-11-26 23:57:51'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (603, 77, 35, '행동', 'ㄱㄷㄱㄷㄱㄷㄱㄷㄱㄷㄱ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 111, 0.5, NULL, '2019-11-27 00:03:35'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (604, 80, 39, '행동', '디디', '경기도 고양시 덕양구', 37.713287, 126.889915, 15, 'wait', NULL, NULL, NULL, '2019-11-27 20:17:48'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (605, 80, 39, '행동', '디디', '경기도 고양시 덕양구', 37.713287, 126.889915, 15, 'off', NULL, NULL, NULL, '2019-11-27 20:17:59'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (606, 80, 39, '행동', '디디ㄷㄱㅈ디', '경기도 고양시 덕양구', 37.713287, 126.889915, 15, 'wait', NULL, NULL, NULL, '2019-11-27 20:18:36'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (607, 80, 39, '행동', '디디ㄷㄱㅈ디', '경기도 고양시 덕양구', 37.713287, 126.889915, 100, 'wait', NULL, NULL, NULL, '2019-11-27 20:18:46'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (608, 80, 39, '행동', '디디ㄷㄱㅈ디', '경기도 고양시 덕양구', 37.713287, 126.889915, 100, 'wait', NULL, NULL, NULL, '2019-11-27 20:20:59'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (609, 80, 39, '행동', '디디ㄷㄱㅈ디', '경기도 고양시 덕양구', 37.713287, 126.889915, 100, 'off', NULL, NULL, NULL, '2019-11-27 20:21:48'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (610, 80, 39, '행동', 'ㅈㄷㄹ', '경기도 고양시 덕양구', 37.713287, 126.889915, 100, 'wait', NULL, NULL, NULL, '2019-11-27 20:37:53'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (611, 80, 39, '행동', 'ㅈㄷㄹ', '경기도 고양시 덕양구', 37.713287, 126.889915, 100, 'finish', 111, NULL, NULL, '2019-11-27 20:38:28'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (612, 80, 39, '행동', 'ㅈㄷㄹ', '경기도 고양시 덕양구', 37.713287, 126.889915, 100, 'off', NULL, NULL, NULL, '2019-11-27 20:39:30'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (613, 80, 39, '행동', 'ㅈㄷㄹ', '경기도 고양시 덕양구', 37.713287, 126.889915, 100, 'finish', 111, NULL, NULL, '2019-11-27 20:40:29'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (614, 80, 39, '행동', '하이', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-11-28 16:52:51'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (615, 80, 39, '행동', '하이', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'wait', NULL, NULL, NULL, '2019-11-28 16:53:40'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (616, 80, 39, '행동', '하이', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-11-28 16:54:19'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (617, 80, 39, '행동', '하이', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-11-28 16:54:29'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (618, 80, 39, '행동', '하이', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-11-28 16:56:56'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (619, 80, 39, '행동', '하이', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-11-28 16:57:11'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (620, 80, 39, '행동', '하이', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'wait', NULL, NULL, NULL, '2019-11-28 16:58:33'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (621, 78, 34, '행동', 'ㅗㅛㅑㅑㅇ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713379, 126.889061, 15, 'off', NULL, NULL, NULL, '2019-11-28 16:59:31'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (622, 78, 34, '행동', 'ㅗㅛㅑㅑㅇ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713379, 126.889061, 15, 'off', NULL, NULL, NULL, '2019-11-28 17:00:08'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (623, 78, 34, '행동', 'ㅗㅛㅑㅑㅇ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713379, 126.889061, 15, 'off', NULL, NULL, NULL, '2019-11-28 17:00:13'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (624, 78, 34, '행동', 'ㅎㅎ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713387, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-11-28 17:03:08'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (625, 80, 39, '행동', '하이', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 111, NULL, NULL, '2019-11-28 17:05:16'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (626, 80, 39, '행동', 'ㄷㄱㅈ디', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-11-28 17:09:14'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (627, 78, 34, '행동', 'ㅎㅎ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713379, 126.889076, 15, 'finish', 111, NULL, NULL, '2019-11-28 17:10:51'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (628, 80, 39, '행동', '지디', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-11-28 17:18:04'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (629, 80, 39, '행동', '지디', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-11-28 17:18:26'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (630, 80, 39, '행동', '지디', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-11-28 17:18:58'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (631, 80, 39, '행동', '늗', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'wait', NULL, NULL, NULL, '2019-11-28 17:19:28'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (632, 77, 35, '행동', 'whshcjee', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 111, 4.0, NULL, '2019-11-28 17:29:11'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (633, 80, 39, '행동', '늗ㅡ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 111, NULL, NULL, '2019-11-28 18:15:41'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (634, 77, 41, '행동', '받아줭', '경기도 고양시 일산서구 일산1동 현중로 10', 37.692005, 126.769379, 15, 'finish', 111, 5.0, NULL, '2019-12-01 20:42:10'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (635, 77, 35, '행동', '성윤형 받아주세요', '경기도 고양시 일산서구 일산1동 현중로 10', 37.692013, 126.769363, 15, 'off', NULL, NULL, NULL, '2019-12-01 23:42:25'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (636, 77, 35, '행동', '성윤형 받아주세요', '경기도 고양시 일산서구 일산1동 현중로 10', 37.692013, 126.769363, 100, 'off', NULL, NULL, NULL, '2019-12-01 23:47:00'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (637, 77, 35, '행동', '성윤형 받아주세요', '경기도 고양시 일산서구 일산1동 현중로 10', 37.692013, 126.769363, 100, 'finish', 103, 5.0, NULL, '2019-12-01 23:47:28'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (638, 77, 45, '행동', 'ㄱㄷㄱㄷ', '경기도 고양시 일산서구 일산1동 현중로 10', 37.692009, 126.769363, 15, 'finish', 111, NULL, NULL, '2019-12-02 16:48:10'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (639, 77, 46, '행동', 'ㄱㄷㄱㄷ', '경기도 고양시 일산서구 일산1동 현중로 10', 37.692009, 126.769363, 15, 'off', NULL, NULL, NULL, '2019-12-02 16:48:39'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (640, 77, 46, '행동', 'ㄱㄷㄱㄷ', '경기도 고양시 일산서구 일산1동 현중로 10', 37.692009, 126.769363, 15, 'off', NULL, NULL, NULL, '2019-12-02 16:49:17'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (641, 77, 46, '행동', 'ㄱㄷㄱㄷ', '경기도 고양시 일산서구 일산1동 현중로 10', 37.692009, 126.769363, 15, 'finish', 111, NULL, NULL, '2019-12-02 16:50:12'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (642, 77, 47, '행동', 'ㄱㄷㄱㄷ', '경기도 고양시 일산서구 일산1동 현중로 10', 37.692009, 126.769363, 15, 'finish', 111, 5.0, NULL, '2019-12-02 16:50:28'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (643, 77, 43, '행동', 'ㄱㄷㄱㄷ', '경기도 고양시 일산서구 일산1동 현중로 10', 37.692009, 126.769363, 15, 'off', NULL, NULL, NULL, '2019-12-02 16:50:37'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (644, 77, 43, '행동', 'ㄱㄷㄱㅈㄱㄷ', '경기도 고양시 일산서구 일산1동 현중로 10', 37.691990, 126.769394, 15, 'off', NULL, NULL, NULL, '2019-12-02 16:51:11'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (645, 77, 43, '행동', 'ㄱㄷㄱㅈㄱㄷ', '경기도 고양시 일산서구 일산1동 현중로 10', 37.691990, 126.769394, 15, 'off', NULL, NULL, NULL, '2019-12-02 16:51:48'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (646, 77, 43, '기타', '받아요', '경기도 고양시 일산서구 일산1동 현중로 10', 37.692013, 126.769379, 15, 'finish', 111, NULL, NULL, '2019-12-02 16:52:29'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (647, 77, 42, '기타', '받아요', '경기도 고양시 일산서구 일산1동 현중로 10', 37.692013, 126.769379, 15, 'off', NULL, NULL, NULL, '2019-12-02 16:52:39'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (648, 77, 42, '기타', '받아요', '경기도 고양시 일산서구 일산1동 현중로 10', 37.692013, 126.769379, 15, 'finish', 111, NULL, NULL, '2019-12-02 16:53:39'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (649, 77, 44, '기타', '받아요', '경기도 고양시 일산서구 일산1동 현중로 10', 37.692013, 126.769379, 15, 'off', NULL, NULL, NULL, '2019-12-02 16:53:56'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (650, 77, 44, '기타', '받아요', '경기도 고양시 일산서구 일산1동 현중로 10', 37.692013, 126.769379, 15, 'finish', 111, NULL, NULL, '2019-12-02 16:55:57'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (651, 77, 41, '기타', '받아요', '경기도 고양시 일산서구 일산1동 현중로 10', 37.692013, 126.769379, 15, 'off', NULL, NULL, NULL, '2019-12-02 16:56:09'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (652, 77, 35, '행동', 'ㄱㄷㄱㄷㄱㄷ', '경기도 고양시 일산서구 일산1동 현중로 10', 37.692001, 126.769371, 15, 'finish', 111, NULL, NULL, '2019-12-02 17:00:49'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (653, 77, 41, '행동', 'ㄱㄷㄱㄷㄱㄷ', '경기도 고양시 일산서구 일산1동 현중로 10', 37.692001, 126.769371, 15, 'off', NULL, NULL, NULL, '2019-12-02 17:01:03'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (654, 77, 35, '행동', 'djdkdkel', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 111, NULL, NULL, '2019-12-03 15:38:49'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (655, 77, 35, '행동', 'ㅋㄷㄱㄷㄱㄷㄱㄷㄱ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 111, NULL, 20, '2019-12-03 18:56:14'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (656, 77, 41, '예방접종', '네', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 111, NULL, 10, '2019-12-03 19:25:53'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (657, 78, 48, '행동', 'ㅊ허ㅓ', '고양시 대화동 성저마을7단지', 37.684383, 126.752716, 20, 'off', NULL, NULL, NULL, '2019-12-05 18:28:06'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (658, 80, 39, '수술', 'ㅂ시마이', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713474, 126.889420, 20, 'finish', 111, NULL, NULL, '2019-12-06 10:31:19'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (659, 83, 55, '영양', '아이폰이 아파용', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713470, 126.889427, 100, 'off', NULL, NULL, NULL, '2019-12-06 10:54:11'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (660, 83, 56, '질병', 'ㅎ', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713474, 126.889427, 15, 'off', NULL, NULL, NULL, '2019-12-06 10:55:55'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (661, 83, 56, '행동', '김ㅎ링', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713467, 126.889435, 15, 'off', NULL, NULL, NULL, '2019-12-06 10:56:49'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (662, 83, 56, '행동', '김ㅎ링', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713467, 126.889435, 15, 'off', NULL, NULL, NULL, '2019-12-06 10:57:16'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (663, 83, 55, '행동', 'ㅎ', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713455, 126.889397, 15, 'off', NULL, NULL, NULL, '2019-12-06 10:58:18'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (664, 83, 55, '행동', 'ㅎ', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713455, 126.889397, 15, 'wait', NULL, NULL, NULL, '2019-12-06 10:58:52'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (665, 83, 56, '행동', 'ㅎ', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713455, 126.889397, 15, 'wait', NULL, NULL, NULL, '2019-12-06 10:59:43'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (666, 83, 55, '행동', 'ㅎ', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713467, 126.889435, 15, 'off', NULL, NULL, NULL, '2019-12-06 10:59:50'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (667, 83, 55, '한방/재활', '안녕하세융', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713467, 126.889435, 10, 'off', NULL, NULL, NULL, '2019-12-06 11:00:25'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (668, 84, 57, '행동', 'ㄹ', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713490, 126.889442, 15, 'off', NULL, NULL, NULL, '2019-12-06 11:01:04'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (669, 84, 57, '행동', 'ㄹ', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713490, 126.889442, 15, 'off', NULL, NULL, NULL, '2019-12-06 11:01:14'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (670, 84, 57, '행동', 'ㆍㅅㆍㅅㆍㅅ', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713478, 126.889435, 15, 'off', NULL, NULL, NULL, '2019-12-06 11:02:31'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (671, 84, 57, '행동', 'ㆍㅅㆍㅅㆍㅅ', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713478, 126.889435, 15, 'off', NULL, NULL, NULL, '2019-12-06 11:03:28'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (672, 84, 57, '행동', 'ㆍㅅㆍㅅㆍㅅ', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713478, 126.889435, 15, 'off', NULL, NULL, NULL, '2019-12-06 11:03:36'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (673, 83, 55, '수술', 'twts', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713478, 126.889435, 15, 'finish', 117, 5.0, 10, '2019-12-06 11:05:40'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (674, 83, 56, '수술', '꼬꼬', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713478, 126.889435, 15, 'off', NULL, NULL, NULL, '2019-12-06 11:06:20'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (675, 83, 56, '행동', 'ㅎㅇㄹ', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713470, 126.889427, 15, 'off', NULL, NULL, NULL, '2019-12-06 11:11:24'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (676, 83, 55, '행동', '고', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713470, 126.889427, 15, 'finish', 117, 5.0, NULL, '2019-12-06 11:13:04'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (677, 83, 56, '행동', 'ㅅㅅㅅ', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713478, 126.889435, 15, 'off', NULL, NULL, NULL, '2019-12-06 11:13:56'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (678, 83, 55, '행동', '고', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713470, 126.889427, 15, 'off', NULL, NULL, NULL, '2019-12-06 11:15:58'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (679, 83, 55, '행동', '고', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713470, 126.889427, 15, 'off', NULL, NULL, NULL, '2019-12-06 11:17:13'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (680, 83, 55, '행동', '고', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713470, 126.889427, 15, 'off', NULL, NULL, NULL, '2019-12-06 11:17:26'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (681, 83, 55, '행동', '고', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713470, 126.889427, 15, 'off', NULL, NULL, NULL, '2019-12-06 11:17:36'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (682, 83, 55, '행동', '고', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713470, 126.889427, 15, 'off', NULL, NULL, NULL, '2019-12-06 11:18:08'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (683, 83, 55, '행동', '고', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713470, 126.889435, 15, 'off', NULL, NULL, NULL, '2019-12-06 11:18:42'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (684, 83, 55, '행동', '고허', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713470, 126.889435, 15, 'off', NULL, NULL, NULL, '2019-12-06 11:18:54'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (685, 83, 55, '행동', '고허ㅓ랴랄', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713470, 126.889435, 15, 'off', NULL, NULL, NULL, '2019-12-06 11:19:06'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (686, 83, 55, '행동', '고허ㅓ랴랄', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713470, 126.889435, 15, 'off', NULL, NULL, NULL, '2019-12-06 11:19:37'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (687, 83, 55, '행동', 'ㅎㅇㄹ', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713463, 126.889420, 15, 'finish', 117, 0.0, 10, '2019-12-06 11:26:47'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (688, 83, 55, '한방/재활', 'ctctxt\n7gigihi\njjibbi\nononon9j\nihhiihboob\noj9jojp\nyugug7g77g\ng7g7g7g7g7g7988\nhuvuvuvuhuguguib\nijjbhollikmloiuy\njihihihojoj', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713467, 126.889420, 100, 'off', NULL, NULL, NULL, '2019-12-06 11:40:18'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (689, 83, 55, '한방/재활', 'ctctxt\n7gigihi\njjibbi\nononon9j\nihhiihboob\noj9jojp\nyugug7g77g\ng7g7g7g7g7g7988\nhuvuvuvuhuguguib\nijjbhollikmloiuy\njihihihojoj', '경기도 고양시 덕양구 대자동 동헌로 305', 37.713467, 126.889420, 100, 'off', NULL, NULL, NULL, '2019-12-06 11:40:25'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (690, 77, 62, '기타', 'ㅆㅈㄷ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-12-06 12:04:06'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (691, 77, 62, '기타', 'ㅆㅈㄷ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-12-06 12:05:02'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (692, 77, 63, '행동', 'ㄱㅈㅅㅈㅅㄷㄱㅈㅂ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-12-06 12:06:46'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (693, 77, 63, '행동', 'ㄱㅈㅅㅈㅅㄷㄱㅈㅂ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-12-06 12:07:20'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (694, 77, 63, '행동', 'ㄱㅈㅅㅈㅅㄷㄱㅈㅂ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'wait', NULL, NULL, NULL, '2019-12-06 12:07:33'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (695, 84, 57, '행동', '하잇', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-12-06 12:11:46'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (696, 84, 57, '행동', '하잇', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 117, 5.0, NULL, '2019-12-06 12:13:29'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (697, 84, 64, '행동', '시발새끼', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 117, 5.0, NULL, '2019-12-06 12:15:16'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (698, 84, 64, '행동', '디디ㅡㄱㄷㅂㄷㄱ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-12-06 12:16:12'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (699, 84, 64, '행동', '디디ㅡㄱㄷㅂㄷㄱ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-12-06 12:16:47'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (700, 84, 64, '행동', '듯드ㅡ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-12-06 12:17:30'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (701, 84, 64, '행동', '듯드ㅡ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-12-06 12:17:56'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (702, 84, 64, '행동', '듯드ㅡ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-12-06 12:18:47'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (703, 84, 57, '행동', '디ㅢㅡㄱ디ㄷ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 117, 5.0, NULL, '2019-12-06 12:20:19'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (704, 84, 64, '행동', '머냐', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-12-06 12:20:47'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (705, 84, 64, '행동', '머냐', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-12-06 12:21:34'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (706, 84, 64, '행동', '머냐', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 117, NULL, NULL, '2019-12-06 12:26:05'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (707, 84, 57, '행동', '지디ㄷ', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'finish', 111, 5.0, NULL, '2019-12-06 12:27:52'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (708, 84, 57, '행동', 'ㅅ드', '경기도 고양시 덕양구 대자동 동헌로307번길 40-3', 37.713383, 126.889069, 15, 'off', NULL, NULL, NULL, '2019-12-06 12:28:29'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (709, 84, 57, '행동', '듯ㄷ', '경기도 고양시 덕양구 화정동 880', 37.638832, 126.835602, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:06:01'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (710, 84, 57, '행동', '즏', '경기도 고양시 덕양구 화정동 880', 37.638809, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:06:28'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (711, 84, 57, '행동', '즏', '경기도 고양시 덕양구 화정동 880', 37.638809, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:06:29'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (712, 84, 64, '행동', 'ㄸㅈ', '경기도 고양시 덕양구 화정동 880', 37.638809, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:06:37'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (713, 84, 64, '행동', 'ㄸㅈ', '경기도 고양시 덕양구 화정동 880', 37.638809, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:07:05'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (714, 84, 57, '행동', 'ㄸㅈ', '경기도 고양시 덕양구 화정동 879-9', 37.638817, 126.835571, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:07:23'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (715, 84, 57, '행동', 'ㄸㅈ', '경기도 고양시 덕양구 화정동 879-9', 37.638817, 126.835571, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:07:54'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (716, 84, 57, '행동', 'ㄸㅈjko88', '경기도 고양시 덕양구 화정동 879-9', 37.638817, 126.835571, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:08:30'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (717, 84, 57, '행동', 'ㄸㅈjko88', '경기도 고양시 덕양구 화정동 879-9', 37.638817, 126.835571, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:08:59'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (718, 84, 57, '행동', 'ㄸㅈjko88', '경기도 고양시 덕양구 화정동 879-9', 37.638817, 126.835571, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:09:14'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (719, 84, 57, '행동', 'ㄸㅈjko88', '경기도 고양시 덕양구 화정동 879-9', 37.638817, 126.835571, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:10:42'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (720, 84, 57, '행동', 'ㄸㅈjko8890', '경기도 고양시 덕양구 화정동 879-9', 37.638817, 126.835571, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:11:16'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (721, 84, 57, '행동', 'ㄸㅈjko8890', '경기도 고양시 덕양구 화정동 879-9', 37.638817, 126.835571, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:11:41'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (722, 84, 57, '행동', 'ㄸㅈjko8890111', '경기도 고양시 덕양구 화정동 879-9', 37.638817, 126.835571, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:11:57'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (723, 84, 57, '행동', 'ㄸㅈjko8890111', '경기도 고양시 덕양구 화정동 879-9', 37.638817, 126.835571, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:15:21'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (724, 84, 57, '행동', 'ㄸㅈjko88901112', '경기도 고양시 덕양구 화정동 879-9', 37.638817, 126.835571, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:16:01'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (725, 84, 57, '행동', 'ㄸㅈjko889011123', '경기도 고양시 덕양구 화정동 879-9', 37.638817, 126.835571, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:16:26'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (726, 84, 57, '행동', 'ㄸㅈjko889011123', '경기도 고양시 덕양구 화정동 879-9', 37.638817, 126.835571, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:21:00'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (727, 84, 57, '행동', '4', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:21:55'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (728, 84, 57, '행동', '6', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:22:39'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (729, 84, 57, '행동', '6', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:25:02'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (730, 84, 57, '행동', '6', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:25:27'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (731, 84, 57, '행동', '77', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:26:33'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (732, 84, 57, '행동', '7888', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:30:07'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (733, 84, 57, '행동', '7888', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:30:36'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (734, 84, 57, '행동', '78889', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:31:27'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (735, 84, 57, '행동', '7888900', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'wait', NULL, NULL, NULL, '2019-12-06 14:31:56'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (736, 84, 57, '행동', '7888900', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:33:11'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (737, 84, 57, '행동', '7888900', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:33:40'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (738, 84, 57, '행동', '7888900', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:34:08'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (739, 84, 57, '행동', '7888900', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:34:58'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (740, 84, 57, '행동', '1', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:36:19'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (741, 84, 57, '행동', '2', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:36:56'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (742, 84, 57, '행동', '3', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:38:37'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (743, 84, 57, '행동', '3', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:38:45'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (744, 84, 57, '행동', '3', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:38:49'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (745, 84, 57, '행동', '3', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:38:53'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (746, 84, 57, '행동', '3', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:38:59'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (747, 84, 57, '행동', '3', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'wait', NULL, NULL, NULL, '2019-12-06 14:39:03'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (748, 84, 57, '행동', '3', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:39:20'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (749, 84, 57, '행동', '3', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:39:25'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (750, 84, 57, '행동', '3', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:39:30'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (751, 84, 57, '행동', '3', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:41:46'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (752, 84, 57, '행동', '1', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:43:10'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (753, 84, 57, '행동', '2', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:43:38'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (754, 84, 57, '행동', '1', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:45:03'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (755, 84, 57, '행동', '2', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:45:37'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (756, 84, 57, '행동', '2', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:46:00'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (757, 84, 57, '행동', '3', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:46:27'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (758, 84, 57, '행동', '3', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:46:42'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (759, 84, 57, '행동', '3', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:46:48'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (760, 84, 57, '행동', '3', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:46:53'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (761, 84, 57, '행동', '3', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:47:36'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (762, 84, 57, '행동', '4', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:48:05'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (763, 84, 57, '행동', '4', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:48:29'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (764, 84, 57, '행동', '4', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:49:31'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (765, 84, 57, '행동', '4', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:50:18'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (766, 84, 57, '행동', '5', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:50:26'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (767, 84, 57, '행동', '5', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:50:56'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (768, 84, 57, '행동', '6', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:51:32'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (769, 84, 57, '행동', '7', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:52:02'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (770, 84, 57, '행동', '8', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:52:30'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (771, 84, 57, '행동', '9', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:52:49'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (772, 84, 57, '행동', '10', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:53:02'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (773, 84, 57, '행동', '11', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:53:09'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (774, 84, 57, '행동', '12', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:53:16'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (775, 84, 57, '행동', '13', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:53:22'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (776, 84, 57, '행동', '13', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:53:27'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (777, 84, 57, '행동', '14', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:53:33'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (778, 84, 57, '행동', '15', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:53:52'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (779, 84, 57, '행동', '16', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:54:09'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (780, 84, 57, '행동', '17', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:54:17'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (781, 84, 57, '행동', '18', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:54:27'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (782, 84, 57, '행동', '19', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:54:34'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (783, 84, 57, '행동', '20', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:54:40'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (784, 84, 57, '행동', '21', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:54:48'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (785, 84, 57, '행동', '22', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:54:55'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (786, 84, 57, '행동', '23', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:55:00'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (787, 84, 57, '행동', '24', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:55:09'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (788, 84, 57, '행동', '25', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:55:16'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (789, 84, 57, '행동', '26', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:55:21'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (790, 84, 57, '행동', '27', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:55:30'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (791, 84, 57, '행동', '27', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'off', NULL, NULL, NULL, '2019-12-06 14:55:44'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (792, 84, 57, '행동', '1', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:58:21'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (793, 84, 57, '행동', '2', '경기도 고양시 덕양구 화정동 879-9', 37.638817, 126.835579, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:58:58'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (794, 84, 57, '행동', '3', '경기도 고양시 덕양구 화정동 879-9', 37.638817, 126.835579, 15, 'finish', 111, 5.0, NULL, '2019-12-06 14:59:14'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (795, 84, 57, '행동', '4', '경기도 고양시 덕양구 화정동 880', 37.638828, 126.835587, 15, 'wait', NULL, NULL, NULL, '2019-12-06 14:59:32'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (796, 84, 57, '행동', '4', '경기도 고양시 덕양구 화정동 880', 37.638828, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-06 15:03:52'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (797, 84, 57, '행동', '4', '경기도 고양시 덕양구 화정동 880', 37.638828, 126.835587, 15, 'finish', 111, NULL, NULL, '2019-12-06 15:04:00'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (798, 84, 64, '행동', '안녕하세요', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-08 10:15:52'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (799, 84, 57, '행동', '왜지?', '경기도 고양시 덕양구 화정동 879-9', 37.638832, 126.835579, 15, 'wait', NULL, NULL, NULL, '2019-12-08 10:16:09'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (800, 84, 57, '행동', '왜지?', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'wait', NULL, NULL, NULL, '2019-12-08 10:16:43'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (801, 84, 57, '행동', '안녕하세요', '경기도 고양시 덕양구 화정동 880', 37.638821, 126.835594, 15, 'off', NULL, NULL, NULL, '2019-12-08 10:25:45'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (802, 84, 57, '행동', '안녕하세요', '경기도 고양시 덕양구 화정동 880', 37.638836, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-08 10:26:14'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (803, 84, 64, '행동', '안녕하세요', '경기도 고양시 덕양구 화정동 880', 37.638836, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-08 10:26:17'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (804, 84, 57, '행동', '안녕하세요', '경기도 고양시 덕양구 화정동 880', 37.638836, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-08 10:26:18'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (805, 84, 57, '행동', '안녕하세요', '경기도 고양시 덕양구 화정동 880', 37.638836, 126.835587, 15, 'off', NULL, NULL, NULL, '2019-12-08 10:26:18'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (806, 84, 57, '행동', '안녕하세요\nㅡ', '경기도 고양시 덕양구 화정동 880', 37.638836, 126.835587, 15, 'wait', NULL, NULL, NULL, '2019-12-08 10:26:25'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (807, 84, 57, '행동', '안녕하세요\nㅡ', '경기도 고양시 덕양구 화정동 880', 37.638809, 126.835602, 15, 'off', NULL, NULL, NULL, '2019-12-08 10:26:51'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (808, 84, 57, '행동', '안녕하세요\nㅡ', '경기도 고양시 덕양구 화정동 880', 37.638809, 126.835602, 15, 'off', NULL, NULL, NULL, '2019-12-08 10:28:59'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (809, 84, 57, '행동', '안녕하세요\nㅡ', '경기도 고양시 덕양구 화정동 880', 37.638809, 126.835594, 15, 'off', NULL, NULL, NULL, '2019-12-08 10:29:47'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (810, 84, 57, '행동', 'ㅅㄴㄷ', '경기도 고양시 덕양구 화정동 880', 37.638824, 126.835609, 15, 'off', NULL, NULL, NULL, '2019-12-08 10:57:10'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (811, 84, 57, '행동', 'ㅅㄴㄷ', '경기도 고양시 덕양구 화정동 880', 37.638824, 126.835609, 15, 'wait', NULL, NULL, NULL, '2019-12-08 11:01:17'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (812, 84, 57, '행동', 'ㅅㄴㄷ', '경기도 고양시 덕양구 화정동 880', 37.638824, 126.835609, 15, 'wait', NULL, NULL, NULL, '2019-12-08 11:21:56'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (813, 84, 57, '행동', 'ㅅㄴㄷ', '경기도 고양시 덕양구 화정동 880', 37.638824, 126.835609, 15, 'off', NULL, NULL, NULL, '2019-12-08 12:40:31'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (814, 84, 57, '행동', '아기모딱', '경기도 고양시 덕양구 화정동 880', 37.638824, 126.835609, 15, 'wait', NULL, NULL, NULL, '2019-12-08 15:01:16'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (815, 84, 57, '행동', '아ㄷ', '경기도 고양시 덕양구 화정동 880', 37.638824, 126.835609, 15, 'wait', NULL, NULL, NULL, '2019-12-08 15:09:43'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (816, 84, 64, '행동', '아ㄷ', '경기도 고양시 덕양구 화정동 880', 37.638824, 126.835609, 15, 'wait', NULL, NULL, NULL, '2019-12-08 15:09:59'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (817, 84, 64, '행동', '아ㄷ', '경기도 고양시 덕양구 화정동 880', 37.638824, 126.835609, 15, 'wait', NULL, NULL, NULL, '2019-12-08 15:10:30'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (818, 84, 64, '행동', '아ㄷ', '경기도 고양시 덕양구 화정동 880', 37.638824, 126.835609, 15, 'wait', NULL, NULL, NULL, '2019-12-08 15:17:09'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (819, 84, 64, '행동', '아ㄷ', '경기도 고양시 덕양구 화정동 880', 37.638824, 126.835609, 15, 'wait', NULL, NULL, NULL, '2019-12-08 15:19:18'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (820, 84, 64, '행동', '아ㄷk', '경기도 고양시 덕양구 화정동 880', 37.638824, 126.835609, 15, 'wait', NULL, NULL, NULL, '2019-12-08 15:42:26'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (821, 84, 64, '행동', '아ㄷk 호우', '경기도 고양시 덕양구 화정동 880', 37.638824, 126.835609, 15, 'wait', NULL, NULL, NULL, '2019-12-08 15:42:48'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (822, 84, 57, '행동', '아니', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'wait', NULL, NULL, NULL, '2019-12-08 16:04:31'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (823, 84, 57, '행동', '시바', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'wait', NULL, NULL, NULL, '2019-12-08 16:47:59'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (824, 84, 57, '행동', '시바ㄷ', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'wait', NULL, NULL, NULL, '2019-12-08 16:55:14'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (825, 84, 57, '행동', '시바ㄷ', '경기도 고양시 덕양구 화정동 879-9', 37.638821, 126.835579, 15, 'wait', NULL, NULL, NULL, '2019-12-08 16:56:15'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (826, 84, 64, '행동', 'ㅅㄷ', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'wait', NULL, NULL, NULL, '2019-12-08 16:56:58'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (827, 84, 64, '행동', 'ㅅㄷ', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'wait', NULL, NULL, NULL, '2019-12-08 16:58:40'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (828, 84, 65, '행동', '하이', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'wait', NULL, NULL, NULL, '2019-12-08 17:00:35'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (829, 84, 65, '행동', '하이', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'wait', NULL, NULL, NULL, '2019-12-08 17:02:18'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (830, 84, 65, '행동', '하이', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'wait', NULL, NULL, NULL, '2019-12-08 17:06:00'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (831, 84, 65, '행동', '하이', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'wait', NULL, NULL, NULL, '2019-12-08 17:06:46'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (832, 84, 65, '행동', '하이', '경기도 고양시 덕양구 화정동 880', 37.638813, 126.835587, 15, 'wait', NULL, NULL, NULL, '2019-12-08 17:11:47'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (833, 84, 57, '행동', '하이', '경기도 고양시 덕양구 화정동 880', 37.638809, 126.835602, 15, 'wait', NULL, NULL, NULL, '2019-12-08 19:45:50'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (834, 84, 57, '행동', '하이', '경기도 고양시 덕양구 화정동 880', 37.638809, 126.835602, 15, 'wait', NULL, NULL, NULL, '2019-12-08 19:55:17'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (835, 84, 64, '행동', 'ㄴㄷ', '경기도 고양시 덕양구 화정1동 879-8', 37.638786, 126.835571, 15, 'finish', 111, NULL, NULL, '2019-12-10 00:46:20'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (836, 84, 57, '행동', 'ck', '경기도 고양시 덕양구 화정동 879-9', 37.638824, 126.835579, 15, 'finish', 111, NULL, NULL, '2019-12-11 00:32:26'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (837, 85, 72, '영양', 'ㄱㄱㄱ', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690952, 126.762428, 15, 'off', NULL, NULL, NULL, '2019-12-12 01:48:47'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (838, 84, 57, '행동', 'ㅅㄷ', '경기도 고양시 덕양구 화정동 880', 37.638821, 126.835587, 15, 'finish', 111, NULL, NULL, '2019-12-12 14:03:48'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (839, 78, 71, '행동', '이용권테스트', '고양시 대화동 성저마을7단지', 37.684334, 126.752670, 15, 'off', NULL, NULL, NULL, '2019-12-13 00:16:28'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (840, 85, 72, '행동', 'ㅇㅇ', '고양시 대화동 성저마을7단지', 37.684357, 126.752686, 15, 'finish', 147, NULL, NULL, '2019-12-13 00:18:20'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (841, 78, 71, '행동', 'ㄷ극', '서울특별시 강남구 신사동 569-22', 37.523876, 127.026962, 15, 'finish', 117, NULL, NULL, '2019-12-13 11:05:02'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (842, 78, 74, '행동', 'ㄷ극hej2', '서울특별시 강남구 신사동 569-22', 37.523876, 127.026962, 15, 'off', NULL, NULL, NULL, '2019-12-13 11:07:36'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (843, 78, 74, '행동', 'ㄷ극hej2', '서울특별시 강남구 신사동 569-22', 37.523876, 127.026962, 15, 'finish', 111, NULL, 10, '2019-12-13 11:07:47'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (844, 84, 57, '행동', '이현 개새', '경기도 용인시 기흥구 마북동 502-2', 37.297752, 127.105209, 15, 'wait', NULL, NULL, NULL, '2019-12-16 18:31:46'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (845, 84, 57, '행동', '이현 개새6', '경기도 용인시 기흥구 마북동 502-2', 37.297752, 127.105209, 15, 'finish', 111, NULL, NULL, '2019-12-16 18:34:27'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (846, 84, 57, '행동', '상담', '경기도 용인시 기흥구 보정동 죽전로15번길 15-15', 37.321873, 127.109161, 15, 'finish', 111, 5.0, NULL, '2019-12-17 17:47:51'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (847, 84, 57, '행동', '상담', '경기도 용인시 기흥구 보정동 213-7', 37.321911, 127.109169, 15, 'wait', NULL, NULL, NULL, '2019-12-17 17:52:10'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (848, 84, 57, '행동', '상담', '경기도 용인시 기흥구 보정동 213-7', 37.321911, 127.109169, 15, 'finish', 111, NULL, NULL, '2019-12-17 17:52:31'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (849, 84, 64, '행동', '상담', '경기도 용인시 기흥구 보정동 213-7', 37.321911, 127.109169, 15, 'wait', NULL, NULL, NULL, '2019-12-17 17:54:50'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (850, 84, 64, '행동', '상담', '경기도 용인시 기흥구 보정동 213-7', 37.321911, 127.109169, 15, 'wait', NULL, NULL, NULL, '2019-12-17 18:09:06'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (851, 84, 64, '행동', '상담', '경기도 용인시 기흥구 보정동 213-7', 37.321911, 127.109169, 15, 'wait', NULL, NULL, NULL, '2019-12-17 18:12:06'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (852, 84, 64, '행동', '상담', '경기도 용인시 기흥구 보정동 213-7', 37.321911, 127.109169, 15, 'wait', NULL, NULL, NULL, '2019-12-17 18:14:18'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (853, 84, 64, '행동', '상담', '경기도 용인시 기흥구 보정동 213-7', 37.321911, 127.109169, 15, 'wait', NULL, NULL, NULL, '2019-12-17 18:16:01'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (854, 84, 64, '행동', '상담', '경기도 용인시 기흥구 보정동 213-7', 37.321911, 127.109169, 15, 'finish', 111, NULL, NULL, '2019-12-17 18:16:18'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (855, 84, 57, '행동', '상담', '경기도 용인시 기흥구 보정동 213-7', 37.321911, 127.109169, 15, 'wait', NULL, NULL, NULL, '2019-12-17 18:16:44'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (856, 84, 65, '행동', '상담', '경기도 용인시 기흥구 보정동 213-7', 37.321911, 127.109169, 15, 'wait', NULL, NULL, NULL, '2019-12-17 18:26:03'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (857, 84, 65, '행동', '상담', '경기도 용인시 기흥구 보정동 213-7', 37.321911, 127.109169, 15, 'wait', NULL, NULL, NULL, '2019-12-17 18:34:55'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (858, 84, 65, '행동', '상담', '경기도 용인시 기흥구 보정동 213-7', 37.321911, 127.109169, 15, 'wait', NULL, NULL, NULL, '2019-12-17 18:35:48'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (859, 84, 57, '행동', '싣', '경기도 용인시 기흥구 마북동 548-5', 37.301338, 127.111298, 15, 'off', NULL, NULL, NULL, '2019-12-18 13:27:35'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (860, 84, 64, '행동', '싣', '경기도 용인시 기흥구 마북동 548-5', 37.301338, 127.111298, 15, 'off', NULL, NULL, NULL, '2019-12-18 13:27:39'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (861, 84, 64, '행동', '싣', '경기도 용인시 기흥구 마북동 548-5', 37.301338, 127.111298, 15, 'finish', 111, NULL, NULL, '2019-12-18 13:28:16'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (862, 84, 57, '행동', 'c', '경기도 용인시 기흥구 마북동 548-8', 37.301304, 127.111313, 15, 'finish', 111, NULL, NULL, '2019-12-18 14:13:29'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (863, 84, 57, '행동', 'c', '경기도 용인시 기흥구 마북동 548-8', 37.301304, 127.111313, 15, 'finish', 111, NULL, NULL, '2019-12-18 14:37:56'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (864, 78, 75, '행동', '종료?', '고양시 대화동 성저마을7단지', 37.684364, 126.752670, 15, 'wait', NULL, NULL, NULL, '2019-12-18 19:12:29'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (865, 84, 57, '행동', 'ㄷ슫ㅊ', '경기도 수원시 영통구 이의동 340-4', 37.292904, 127.048691, 20, 'off', NULL, NULL, NULL, '2019-12-19 20:20:15'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (866, 84, 57, '행동', 'ㄷ슫ㅊ', '경기도 수원시 영통구 이의동 340-4', 37.292904, 127.048691, 100, 'wait', NULL, NULL, NULL, '2019-12-19 20:20:18'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (867, 84, 57, '행동', 'ㄷ슫ㅊ', '경기도 수원시 영통구 이의동 340-4', 37.292904, 127.048691, 100, 'finish', 111, NULL, NULL, '2019-12-19 20:21:00'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (868, 84, 64, '행동', 'ㄷ슫ㅊ.', '경기도 수원시 영통구 이의동 340-4', 37.292900, 127.048698, 100, 'finish', 111, NULL, NULL, '2019-12-19 21:16:40'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (869, 84, 65, '행동', 'ㄷ슫ㅊ.', '경기도 수원시 영통구 이의동 340-4', 37.292900, 127.048698, 100, 'finish', 111, NULL, NULL, '2019-12-19 21:23:19'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (870, 84, 57, '행동', 'ㄷ슫ㅊ.', '경기도 수원시 영통구 이의동 340-4', 37.292900, 127.048698, 100, 'wait', NULL, NULL, NULL, '2019-12-19 21:41:44'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (871, 84, 57, '행동', 'rh4j3j', '경기도 용인시 기흥구 죽전로', 37.320190, 127.110130, 15, 'finish', 111, NULL, NULL, '2019-12-21 19:04:36'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (872, 84, 57, '행동', 'be', '경기도 용인시 기흥구 마북동 548-8', 37.301350, 127.111282, 15, 'finish', 111, NULL, 10, '2019-12-25 03:00:33'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (873, 84, 57, '행동', '아', '경기도 수원시 팔달구 인계동 1041-6', 37.265423, 127.030701, 100, 'wait', NULL, NULL, NULL, '2019-12-29 15:11:48'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (874, 84, 57, '행동', '아', '경기도 수원시 팔달구 인계동 1041-6', 37.265423, 127.030701, 100, 'finish', 143, NULL, NULL, '2019-12-29 15:12:50'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (875, 84, 57, '행동', '시디', '경기도 용인시 기흥구 마북동 510-9', 37.298195, 127.107971, 100, 'wait', NULL, NULL, NULL, '2019-12-29 18:57:39'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (876, 84, 57, '행동', '시디', '경기도 용인시 기흥구 마북동 510-9', 37.298195, 127.107971, 100, 'finish', 143, NULL, NULL, '2019-12-29 18:58:12'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (877, 78, 100, '질병', '강아지가 아파요!!', '경기도 고양시 일산서구 탄현동 1563-6', 37.691139, 126.762436, 100, 'finish', 111, 3.0, NULL, '2020-01-02 18:38:57'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (878, 78, 100, '질병', '아파요..', '경기도 고양시 일산서구 일산1동 일현로 41', 37.691078, 126.762398, 100, 'off', NULL, NULL, NULL, '2020-01-02 19:55:31'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (879, 78, 100, '질병', '아파요..', '경기도 고양시 일산서구 탄현동 1563-6', 37.691277, 126.762459, 100, 'off', NULL, NULL, NULL, '2020-01-02 19:56:31'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (880, 78, 101, '질병', '아파요...', '경기도 고양시 일산서구 일산1동 일현로 41', 37.691044, 126.762466, 100, 'finish', 171, 2.5, NULL, '2020-01-02 20:04:43'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (881, 78, 100, '수술', '아파요...', '경기도 고양시 일산서구 탄현동 1563-6', 37.691227, 126.762390, 100, 'finish', 171, NULL, NULL, '2020-01-02 20:06:51'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (882, 85, 102, '행동', '아파요..', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690987, 126.762444, 15, 'finish', 171, NULL, NULL, '2020-01-02 20:46:00'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (883, 84, 57, '행동', '안녕하세요', '경기도 용인시 기흥구 언남동 419-2', 37.292740, 127.121544, 100, 'finish', 171, NULL, NULL, '2020-01-02 22:33:07'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (884, 85, 102, '질병', '가능하신분', '고양시 대화동 성저마을7단지', 37.684364, 126.752625, 100, 'wait', NULL, NULL, NULL, '2020-01-07 18:36:49'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (885, 85, 102, '질병', '테스트 ㄱ', '고양시 대화동 성저마을7단지', 37.684364, 126.752625, 100, 'off', NULL, NULL, NULL, '2020-01-07 19:29:19'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (886, 85, 104, '행동', '테스트임', '고양시 대화동 성저마을7단지', 37.684345, 126.752670, 100, 'off', NULL, NULL, NULL, '2020-01-07 19:40:59'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (887, 85, 104, '행동', '테스트임', '고양시 대화동 성저마을7단지', 37.684345, 126.752670, 100, 'finish', 143, NULL, NULL, '2020-01-07 19:41:34'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (888, 84, 57, '행동', '시', '경기도 용인시 기흥구 마북동 548-5', 37.301331, 127.111343, 15, 'off', NULL, NULL, NULL, '2020-01-07 20:55:46'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (889, 84, 57, '행동', '시', '경기도 용인시 기흥구 마북동 548-5', 37.301331, 127.111343, 100, 'finish', 171, NULL, NULL, '2020-01-07 20:55:57'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (890, 84, 64, '행동', '시', '경기도 용인시 기흥구 마북동 548-5', 37.301331, 127.111343, 100, 'finish', 171, 5.0, NULL, '2020-01-07 20:57:39'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (891, 84, 65, '행동', 'ㅅㄷ', '경기도 용인시 기흥구 마북동 548-5', 37.301315, 127.111336, 15, 'off', NULL, NULL, NULL, '2020-01-07 21:00:35'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (892, 84, 65, '행동', 'ㅅㄷ', '경기도 용인시 기흥구 마북동 548-5', 37.301315, 127.111336, 100, 'finish', 171, NULL, NULL, '2020-01-07 21:00:44'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (893, 84, 64, '행동', 'ㅅㄴ', '경기도 용인시 기흥구 마북동 548-5', 37.301327, 127.111343, 100, 'finish', 171, 5.0, NULL, '2020-01-07 21:02:24'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (894, 84, 64, '행동', '지', '경기도 용인시 기흥구 마북동 548-5', 37.301331, 127.111343, 100, 'finish', 171, 5.0, NULL, '2020-01-07 21:06:57'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (895, 84, 64, '행동', '딪ㄱㄴ', '경기도 용인시 기흥구 마북동 548-5', 37.301334, 127.111336, 15, 'off', NULL, NULL, NULL, '2020-01-07 21:08:57'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (896, 84, 64, '행동', '딪ㄱㄴ', '경기도 용인시 기흥구 마북동 548-5', 37.301334, 127.111336, 100, 'finish', 171, NULL, NULL, '2020-01-07 21:09:07'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (897, 85, 103, '행동', '강아지가 발을 절어요', '경기도 고양시 일산서구 대화동 2388', 37.683064, 126.754723, 100, 'finish', 103, NULL, NULL, '2020-01-08 14:10:31'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (898, 85, 102, '행동', '받아죠', '경기도 고양시 일산서구 대화동 2388', 37.683079, 126.754707, 100, 'off', NULL, NULL, NULL, '2020-01-08 14:45:59'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (899, 85, 102, '행동', '받아죠', '경기도 고양시 일산서구 대화동 2388', 37.683079, 126.754707, 100, 'finish', 103, NULL, NULL, '2020-01-08 14:47:03'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (900, 84, 64, '행동', '지ㅣ', '경기도 용인시 기흥구 마북동 548-5', 37.301327, 127.111320, 15, 'off', NULL, NULL, NULL, '2020-01-08 15:51:18'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (901, 84, 64, '행동', '지ㅣ', '경기도 용인시 기흥구 마북동 548-5', 37.301327, 127.111320, 100, 'finish', 171, NULL, NULL, '2020-01-08 15:51:28'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (902, 84, 57, '행동', '지ㅣ', '경기도 용인시 기흥구 마북동 548-5', 37.301327, 127.111320, 100, 'finish', 171, NULL, NULL, '2020-01-08 15:51:56'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (903, 85, 102, '행동', '받아줘열', '경기도 고양시 일산서구 대화동 2388', 37.683067, 126.754715, 100, 'finish', 171, NULL, NULL, '2020-01-08 16:03:22'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (904, 85, 102, '행동', '받아줘열', '경기도 고양시 일산서구 대화동 2388', 37.683064, 126.754723, 100, 'off', NULL, NULL, NULL, '2020-01-08 16:33:32'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (905, 85, 102, '행동', '받아줘열', '경기도 고양시 일산서구 대화동 2388', 37.683064, 126.754723, 100, 'off', NULL, NULL, NULL, '2020-01-08 16:34:00'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (906, 85, 102, '행동', '받아줘열', '경기도 고양시 일산서구 대화동 2388', 37.683064, 126.754723, 100, 'off', NULL, NULL, NULL, '2020-01-08 16:34:25'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (907, 85, 102, '행동', '받아줘열', '경기도 고양시 일산서구 대화동 2388', 37.683064, 126.754723, 100, 'finish', 171, NULL, NULL, '2020-01-08 16:35:03'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (908, 77, 105, '행동', 'djfhfuf', '서울특별시 강남구 신사동 569-9', 37.523922, 127.026924, 15, 'finish', 171, NULL, NULL, '2020-01-09 11:34:32'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (909, 77, 105, '행동', 'rkrkrke', '서울특별시 강남구 신사동 569-9', 37.523918, 127.026939, 15, 'finish', 171, NULL, NULL, '2020-01-09 12:13:36'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (910, 85, 103, '행동', '콩이가 다리를 절어요', '고양시 대화동 성저마을7단지', 37.684364, 126.752701, 100, 'finish', 171, 3.5, NULL, '2020-01-09 15:06:31'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (911, 85, 106, '행동', '강아지가 다리를 절어요', '고양시 대화동 성저마을7단지', 37.684361, 126.752678, 100, 'off', NULL, NULL, NULL, '2020-01-09 15:09:48'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (912, 85, 106, '행동', '강아지가 다리를 절어요', '고양시 대화동 성저마을7단지', 37.684345, 126.752670, 100, 'finish', 171, NULL, 10, '2020-01-09 15:10:47'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (913, 85, 104, '질병', '뽀삐의 귀에 염증이 생겼어요', '고양시 대화동 성저마을7단지', 37.684349, 126.752647, 100, 'finish', 171, NULL, NULL, '2020-01-09 15:41:11'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (914, 85, 106, '행동', '받아줠', '고양시 대화동 성저마을7단지', 37.684338, 126.752663, 100, 'finish', 171, NULL, NULL, '2020-01-09 15:56:37'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (915, 85, 107, '질병', '쿠키가 다리를 절어요', '고양시 대화동 성저마을7단지', 37.684319, 126.752678, 100, 'finish', 103, NULL, NULL, '2020-01-09 16:26:22'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (916, 77, 105, '행동', '받아주셈요', '서울특별시 강남구 신사동 569-9', 37.523914, 127.026939, 15, 'finish', 171, 5.0, NULL, '2020-01-09 16:27:45'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (917, 85, 108, '질병', '귀에 염증이 있어요', '고양시 대화동 성저마을7단지', 37.684338, 126.752663, 100, 'finish', 171, NULL, NULL, '2020-01-09 16:31:45'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (918, 85, 109, '질병', '귀에 염증', '고양시 대화동 성저마을7단지', 37.684341, 126.752663, 100, 'finish', 171, NULL, NULL, '2020-01-09 16:33:49'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (919, 85, 110, '질병', '<NAME>증', '고양시 대화동 성저마을7단지', 37.684353, 126.752708, 100, 'finish', 171, NULL, NULL, '2020-01-09 16:43:42'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (920, 77, 105, '행동', 'ㅅㆍㄴㆍㄴㆍㄴㆍ', '서울특별시 강남구 신사동 569-9', 37.523911, 127.026939, 15, 'finish', 103, NULL, NULL, '2020-01-09 16:53:06'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (921, 77, 105, '행동', '꾸엑', '서울특별시 강남구 신사동 569-9', 37.523914, 127.026924, 100, 'finish', 171, NULL, NULL, '2020-01-09 17:20:42'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (922, 85, 102, '행동', '아파여', '고양시 대화동 성저마을7단지', 37.684418, 126.752762, 15, 'finish', 171, NULL, 10, '2020-01-09 17:37:51'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (923, 77, 105, '행동', '다시', '서울특별시 강남구 신사동 569-9', 37.523922, 127.026939, 15, 'off', NULL, NULL, NULL, '2020-01-09 17:49:11'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (924, 77, 105, '행동', '다시', '서울특별시 강남구 신사동 569-9', 37.523922, 127.026939, 100, 'finish', 171, NULL, NULL, '2020-01-09 17:50:02'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (925, 77, 105, '행동', '받아봐요', '서울특별시 강남구 신사동 569-9', 37.523918, 127.026909, 100, 'finish', 171, NULL, NULL, '2020-01-09 18:58:35'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (926, 85, 104, '행동', '테스트', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690903, 126.762466, 100, 'off', NULL, NULL, NULL, '2020-01-09 19:36:53'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (927, 85, 104, '행동', '테스트', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690903, 126.762466, 100, 'off', NULL, NULL, NULL, '2020-01-09 19:37:29'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (928, 85, 104, '행동', '테스트', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690903, 126.762466, 100, 'off', NULL, NULL, NULL, '2020-01-09 19:38:10'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (929, 85, 104, '행동', '테스트', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690926, 126.762489, 100, 'off', NULL, NULL, NULL, '2020-01-09 19:39:45'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (930, 85, 104, '행동', '테스트', '고양시 일산1동 탄현역', 37.690937, 126.762611, 100, 'off', NULL, NULL, NULL, '2020-01-09 19:43:50'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (931, 85, 104, '행동', '테스트', '고양시 일산1동 탄현역', 37.690937, 126.762611, 100, 'off', NULL, NULL, NULL, '2020-01-09 19:44:14'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (932, 85, 104, '기타', '테스트', '고양시 일산1동 탄현역', 37.690937, 126.762611, 100, 'off', NULL, NULL, NULL, '2020-01-09 19:44:41'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (933, 85, 104, '기타', '테스트', '고양시 일산1동 탄현역', 37.690937, 126.762611, 100, 'off', NULL, NULL, NULL, '2020-01-09 19:45:11'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (934, 85, 104, '기타', '테스트', '고양시 일산1동 탄현역', 37.690937, 126.762611, 100, 'finish', 171, 5.0, NULL, '2020-01-09 19:45:43'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (935, 85, 109, '질병', '귀에 염증', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690937, 126.762466, 100, 'finish', 171, 3.5, NULL, '2020-01-09 19:49:18'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (936, 85, 123, '질병', '귀에 염증', '고양시 일산1동 탄현역', 37.690838, 126.762512, 100, 'finish', 171, 3.5, NULL, '2020-01-09 19:54:40'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (937, 85, 124, '질병', '귀에 염증', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690948, 126.762474, 100, 'finish', 171, 5.0, NULL, '2020-01-09 19:58:02'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (938, 85, 106, '질병', 'ㅇ', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690903, 126.762489, 15, 'finish', 171, 3.5, NULL, '2020-01-09 20:08:08'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (939, 85, 136, '질병', '<NAME>', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690948, 126.762436, 100, 'finish', 171, 5.0, NULL, '2020-01-09 20:19:51'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (940, 85, 137, '질병', '아오', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690948, 126.762451, 100, 'finish', 171, 5.0, NULL, '2020-01-09 20:24:54'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (941, 85, 139, '질병', '테스트', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690929, 126.762451, 15, 'finish', 171, 3.5, NULL, '2020-01-09 20:30:14'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (942, 85, 141, '기타', 'ㅇㅇ', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690948, 126.762444, 100, 'off', NULL, NULL, NULL, '2020-01-09 20:41:32'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (943, 85, 141, '기타', 'ㅇㅇ', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690948, 126.762444, 100, 'off', NULL, NULL, NULL, '2020-01-09 20:41:56'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (944, 85, 141, '기타', 'ㅇㅇ', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690948, 126.762444, 100, 'finish', 171, 5.0, NULL, '2020-01-09 20:42:29'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (945, 85, 142, '질병', '귀에 염증', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690945, 126.762444, 100, 'finish', 171, 5.0, NULL, '2020-01-09 21:04:38'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (946, 85, 140, '질병', '귀에 염증', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690945, 126.762466, 100, 'finish', 171, 5.0, NULL, '2020-01-09 21:06:03'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (947, 85, 143, '질병', '귀에 염증', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690945, 126.762466, 100, 'finish', 171, NULL, NULL, '2020-01-09 21:17:53'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (948, 85, 139, '행동', '받아주세요', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690945, 126.762466, 100, 'finish', 171, 2.5, NULL, '2020-01-09 21:49:45'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (949, 85, 141, '잘 모르겠어요', '가자', '고양시 일산1동 육각수오피스텔', 37.690601, 126.762405, 100, 'finish', 171, 2.5, NULL, '2020-01-09 21:51:20'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (950, 85, 138, '한방/재활', 'ㅇㅇ', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690945, 126.762474, 100, 'finish', 171, NULL, NULL, '2020-01-09 22:01:08'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (951, 85, 139, '기타', 'ㅇㅇ', '고양시 일산1동 탄현역', 37.690865, 126.762566, 100, 'finish', 171, 2.5, NULL, '2020-01-09 22:02:39'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (952, 85, 141, '행동', 'ㅇㅇ', '고양시 일산1동 탄현역', 37.690865, 126.762566, 100, 'finish', 171, NULL, NULL, '2020-01-09 22:03:33'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (953, 85, 144, '수술', 'ㅇㅇ', '고양시 일산1동 탄현역', 37.690865, 126.762566, 100, 'finish', 171, NULL, NULL, '2020-01-09 22:04:22'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (954, 85, 145, '행동', '네', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690937, 126.762459, 100, 'off', NULL, NULL, NULL, '2020-01-09 22:06:04'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (955, 85, 145, '행동', '네', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690937, 126.762459, 100, 'off', NULL, NULL, NULL, '2020-01-09 22:06:27'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (956, 85, 145, '행동', '네', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690937, 126.762459, 100, 'off', NULL, NULL, NULL, '2020-01-09 22:06:52'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (957, 85, 145, '행동', '네', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690937, 126.762459, 100, 'off', NULL, NULL, NULL, '2020-01-09 22:07:13'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (958, 85, 145, '행동', '네', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690937, 126.762459, 100, 'finish', 171, 3.0, NULL, '2020-01-09 22:07:41'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (959, 85, 146, '질병', '귀에 염증', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690941, 126.762466, 100, 'finish', 171, 5.0, NULL, '2020-01-09 22:09:25'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (960, 85, 145, '질병', '귀에염증', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690971, 126.762428, 100, 'finish', 171, NULL, NULL, '2020-01-09 22:11:37'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (961, 85, 146, '수술', 'ㅇㅇ', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690937, 126.762459, 100, 'finish', 171, NULL, NULL, '2020-01-09 22:13:54'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (962, 85, 143, '수술', 'ㅇㅇ', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690910, 126.762451, 100, 'finish', 171, 3.0, NULL, '2020-01-09 22:14:24'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (963, 85, 139, '행동', 'ㅇㅇ', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690910, 126.762482, 15, 'finish', 171, NULL, NULL, '2020-01-09 22:16:53'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (964, 85, 143, '행동', 'ㅇㅇ', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690910, 126.762482, 15, 'finish', 171, NULL, NULL, '2020-01-09 22:17:12'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (965, 85, 147, '질병', '귀에 염증', '경기도 고양시 일산서구 일산1동 일현로 41', 37.690945, 126.762474, 100, 'finish', 171, NULL, NULL, '2020-01-09 22:18:04'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (966, 77, 148, '행동', '받아주세욥', '경기도 고양시 일산서구 일산1동 현중로 10', 37.691994, 126.769379, 100, 'off', NULL, NULL, NULL, '2020-01-09 22:39:59'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (967, 77, 148, '잘 모르겠어요', '테스트', '서울특별시 서초구 서초동 1445-29', 37.483608, 127.017792, 15, 'off', NULL, NULL, NULL, '2020-01-10 13:54:08'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (968, 78, 100, '질병', 'ㅋ', '서울특별시 서대문구 창천동 52-59', 37.557690, 126.935913, 100, 'wait', NULL, NULL, NULL, '2020-01-22 22:13:14'); INSERT INTO `chat_request` (`id`, `user_id`, `pet_id`, `chat_title`, `chat_content`, `address`, `latitude`, `longitude`, `distance`, `state`, `doctor_id`, `rating`, `extra_time`, `created_at`) VALUES (969, 78, 149, '질병', '아파', '서울특별시 마포구 동교동 207-1', 37.559483, 126.921829, 100, 'off', NULL, NULL, NULL, '2020-01-26 13:50:34'); /*!40000 ALTER TABLE `chat_request` ENABLE KEYS */; -- 테이블 MerDog.doctor_info 구조 내보내기 CREATE TABLE IF NOT EXISTS `doctor_info` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '의사 번호', `doctor_id` varchar(50) DEFAULT NULL COMMENT '의사 아이디', `doctor_pw` text COMMENT '의사 비밀번호', `doctor_name` varchar(50) NOT NULL COMMENT '의사 이름', `doctor_phone` varchar(50) NOT NULL COMMENT '의사 전화번호', `doctor_kakao` varchar(50) DEFAULT NULL COMMENT '의사 카카오계정 아이디', `doctor_naver` varchar(50) DEFAULT NULL COMMENT '의사 네이버계정 아이디', `doctor_google` varchar(50) DEFAULT NULL COMMENT '의사 구글계정 아이디', `doctor_facebook` varchar(50) DEFAULT NULL COMMENT '의사 페이스북계정 아이디', `doctor_twitter` varchar(50) DEFAULT NULL COMMENT '의사 트위터계정 아이디', `state` varchar(10) NOT NULL DEFAULT 'off' COMMENT '채팅 요청 상태 on/off', `latitude` float(11,6) DEFAULT '0.000000' COMMENT '위도 <가로 0~90 북/남> 정보', `longitude` float(11,6) DEFAULT '0.000000' COMMENT '경도 <세로 0~180> 정보', `address` text COMMENT '현재 주소', `approval` varchar(50) NOT NULL DEFAULT 'wait' COMMENT '승인여부 wait : 승인대기 / complete: 승인 / deny: 승인거부', `fcm_token` text, `doctor_token` text, `fee` int(11) NOT NULL DEFAULT '30' COMMENT '수수료', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `on/off` varchar(10) NOT NULL DEFAULT 'on' COMMENT '의사 회원 활성화여부 on/off', PRIMARY KEY (`id`), UNIQUE KEY `doctor_phone` (`doctor_phone`), UNIQUE KEY `doctor_id` (`doctor_id`), UNIQUE KEY `doctor_kakao` (`doctor_kakao`), UNIQUE KEY `doctor_naver` (`doctor_naver`), UNIQUE KEY `doctor_google` (`doctor_google`), UNIQUE KEY `doctor_facebook` (`doctor_facebook`), UNIQUE KEY `doctor_twitter` (`doctor_twitter`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='의사 정보'; -- 테이블 데이터 MerDog.doctor_info:~21 rows (대략적) 내보내기 /*!40000 ALTER TABLE `doctor_info` DISABLE KEYS */; INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (103, 'tesx4', '$2y$10$zKpf7.3Hr9L/YFnBfGrsX.b81oVNdl95DrXi3eV1GycuDiIHiqgCG', '심성윤', '01077322222', NULL, NULL, NULL, NULL, NULL, 'off', 0.000000, 0.000000, NULL, 'complete', NULL, NULL, 30, '2019-10-30 13:52:00', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (106, 'cv778', '$2y$10$BPIQ3aY8y5KJsQLDRRB4Pudmr25ZJSawWVcWwPL4xNAOBo4HIptfa', '드느느', '0109966336', NULL, NULL, NULL, NULL, NULL, 'off', 0.000000, 0.000000, NULL, 'complete', 'eChoYUo53KM:APA91bGG9_Qs7qA_pFKgE0ysKRZ6wZMU2fd8AMmR7HVeeU0CTrQywWA9Ppecoz_azdspixWO6TOutXSoRdCki_mLzPXhtBxoP9cllu7VFjeZyWsOyM3R1-2z-9YIS759uwqezcKiAiNn', '<KEY>', 30, '2019-10-30 15:51:53', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (107, 'hey373', '$2y$10$Rye2VfXUS/ovblI1AXdd8OIzUAxtlnlYHiH/q7zyn0o0fHUp.H5ea', '도도기', '01088663333', NULL, NULL, NULL, NULL, NULL, 'off', 0.000000, 0.000000, NULL, 'wait', 'eChoYUo53KM:APA91bGG9_Qs7qA_pFKgE0ysKRZ6wZMU2fd8AMmR7HVeeU0CTrQywWA9Ppecoz_azdspixWO6TOutXSoRdCki_mLzPXhtBxoP9cllu7VFjeZyWsOyM3R1-2z-9YIS759uwqezcKiAiNn', '<KEY>', 30, '2019-10-30 15:53:27', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (108, 'tesx6', '$2y$10$a6gRnoB0MJo3.l43O6Xov.l6.4PzIg/axTxf2JO7d4HO2XG6KWwwO', '심상범', '01089285877', NULL, NULL, NULL, NULL, NULL, 'off', 0.000000, 0.000000, NULL, 'wait', 'eChoYUo53KM:APA91bGG9_Qs7qA_pFKgE0ysKRZ6wZMU2fd8AMmR7HVeeU0CTrQywWA9Ppecoz_azdspixWO6TOutXSoRdCki_mLzPXhtBxoP9cllu7VFjeZyWsOyM3R1-2z-9YIS759uwqezcKiAiNn', '<KEY>', 30, '2019-10-30 16:02:12', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (109, 'vdhe4', '$2y$10$.7ATT0HGFF3T6AhzV1ECCeVv4IEE7LJ0q3WQI6PdENGA78SQkBHre', '드드드', '0101888666', NULL, NULL, NULL, NULL, NULL, 'off', 0.000000, 0.000000, NULL, 'deny', 'eChoYUo53KM:APA91bGG9_Qs7qA_pFKgE0ysKRZ6wZMU2fd8AMmR7HVeeU0CTrQyw<KEY>', '<KEY>', 30, '2019-10-30 16:06:02', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (111, 'cvcv5648', '$2y$10$BnP0jK2fWutE.MhLw8w.FuS4qM8rkilLkZgJba0WUDF0aP/tVe6tm', '드드드', '01051816265', NULL, NULL, NULL, NULL, NULL, 'off', 0.000000, 0.000000, NULL, 'complete', NULL, NULL, 30, '2019-11-26 20:07:37', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (112, 'test12', <PASSWORD>$q<PASSWORD>Z<PASSWORD>', '심성윤', '01077383530', NULL, NULL, NULL, NULL, NULL, 'off', NULL, NULL, NULL, 'complete', 'eChoYUo53KM:APA91bGG9_Qs7qA_pFKgE0ysKRZ6wZMU2fd8AMmR7HVeeU0CTrQywWA9Ppecoz_azdspixWO6TOutXSoRdCki_mLzPXhtBxoP9cllu7VFjeZyWsOyM3R1-2z-9YIS759uwqezcKiAiNn', '<KEY>', 30, '2019-10-30 19:01:52', 'off'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (115, 'test1', <PASSWORD>', '심성윤', '01063911618', NULL, NULL, NULL, NULL, NULL, 'off', 0.000000, 0.000000, NULL, 'complete', 'eChoYUo53KM:APA91bGG9_Qs7qA_pFKgE0ysKRZ6wZMU2fd8AMmR7HVeeU0CTrQywWA9Ppecoz_azdsp<KEY>', '<KEY>', 30, '2019-11-06 15:44:50', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (116, 'test2', '$2y$10$A1iryhYuusD8BpUXmRt8NOp32c3QWJgqRsFcZMGCwKJBYEccZB7Ae', '백종원', '01053050315', NULL, NULL, NULL, NULL, NULL, 'off', NULL, NULL, NULL, 'complete', 'eChoYUo53KM:APA91bGG9_Qs7qA_pFKgE0ysKRZ6wZ<KEY>', '<KEY>', 30, '2019-11-07 13:52:04', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (117, 'st02219', '$2y$10$sUG2Xk6a0C/sq7cwsCKgs.YnnFJy6fH9te7yHXy84d1R47OxCsM5S', '공지환', '01073756544', NULL, NULL, NULL, NULL, NULL, 'on', 37.523876, 127.026962, '대한민국 서울특별시 강남구 신사동 569-22', 'complete', 'eChoYUo53KM:APA91bGG9_Qs7qA_pFKgE0ysKRZ6wZMU2fd8AMmR7HVeeU0CTrQywWA9Ppecoz_azdspixWO6TOutXSoRdCki_mLzPXhtBxoP9cllu7VFjeZyWsOyM3R1-2z-9YIS759uwqezcKiAiNn', '<KEY>B5KFIq_WT1vq3PDWurErZ7entPTK0', 30, '2019-11-21 19:07:36', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (143, NULL, NULL, '심성윤', '01077383507', '1046848409', NULL, NULL, NULL, NULL, 'off', 0.000000, 0.000000, NULL, 'complete', NULL, NULL, 30, '2019-12-01 15:31:51', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (144, 'cvcv77', '$2y$10$WWsIjDNmm8X4E29wsWfk3ORx8oQZmcItFRR.iLvKEpnmSYtH7ROli', '상범', '01051816220', NULL, NULL, NULL, NULL, NULL, 'off', 0.000000, 0.000000, NULL, 'wait', 'eChoYUo53KM:APA91bGG9_Qs7qA_pFKgE0ysKRZ6wZMU2fd8AMmR7<KEY>', '<KEY>', 30, '2019-12-02 15:15:57', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (146, 'ccit2019', '$2y$10$KREGZ06DFh6sseldY4YkleGk4dMdzv121q2avFvKOG3xZJUfb21jG', '신', '01096488148', NULL, NULL, NULL, NULL, NULL, 'off', 0.000000, 0.000000, NULL, 'wait', 'eChoYUo53KM:APA91bGG9_Qs7qA_pFKgE0ysKRZ6wZMU2fd8AMmR7HVeeU0CTrQywWA9Ppecoz_azdspixWO6TOutXSoRdCki_mLzPXhtBxoP<KEY>OyM3R1-2z-9YIS759uwqezcKiAiNn', '<KEY>', 30, '2019-12-06 10:34:52', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (147, 'ashly9696', '$2y$10$Fi2Qccsqx.dRujJBVliX2eaDcIEn7VvwlSH/Epn3VOtnlwXYjD3Aa', '조재형', '01020751754', NULL, NULL, NULL, NULL, NULL, 'off', 0.000000, 0.000000, NULL, 'complete', 'eChoYUo53KM:APA91bGG9_Qs7qA_pFKgE0ysKRZ6wZMU2fd8AMmR7HVeeU0CTrQywWA9Ppecoz_azdspixWO6TOutXSoRdCki_mLzPXhtBxoP9cllu7VFjeZyWsOyM3R1-2z-9YIS759uwqezcKiAiNn', '<KEY>', 30, '2019-12-06 10:37:53', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (148, 'cvcv8888', '$2y$10$QBqzkKPz<PASSWORD>ex<PASSWORD>z<PASSWORD>.49<PASSWORD>', '듸스', '01051816263', NULL, NULL, NULL, NULL, NULL, 'off', 0.000000, 0.000000, NULL, 'wait', 'eChoYUo53KM:APA91bGG9_Qs7qA_pFKgE0ysKRZ6wZMU2fd8AMmR7HVeeU0CTrQywWA9Ppecoz_azdspixWO6TOutXSoRdCki_mLzPXhtBxoP9cllu7VFjeZyWsOyM3R1-2z-9YIS759uwqezcKiAiNn', '<KEY>', 30, '2019-12-06 15:33:10', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (153, 'h2i3o', <PASSWORD>', '상범', '01051816262', NULL, NULL, NULL, NULL, NULL, 'off', 0.000000, 0.000000, NULL, 'wait', 'eChoYUo53KM:APA91bGG9_Qs7qA_pFKgE0ysKRZ6wZMU2fd8AMmR7HVeeU0CTrQywWA9Ppecoz_azdspixWO6TOutXSoRdCki_mLzPXhtBxoP9cllu7VFjeZyWsOyM3R1-2z-9YIS759uwqezcKiAiNn', '<KEY>', 30, '2019-12-17 23:13:17', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (164, NULL, NULL, '페상범', '01051816244', NULL, NULL, NULL, 'x2B5igo16dduro8Sarg4Ceuoo4X2', NULL, 'off', 0.000000, 0.000000, NULL, 'deny', 'eChoYUo53KM:APA91bGG<KEY>', '<KEY>', 30, '2019-12-23 23:11:59', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (167, NULL, NULL, '트상범', '0105186368', NULL, NULL, NULL, NULL, 'NsUOFThpijPo0RMcNznWUBqpWWo2', 'off', 0.000000, 0.000000, NULL, 'complete', 'eChoYUo53KM:APA91bGG9_Qs7qA_pFKgE0ysKRZ6wZMU2fd8AMmR7HVeeU0CTrQywWA9Ppecoz_<KEY>', '<KEY>', 30, '2019-12-25 16:21:46', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (170, NULL, NULL, '네이보', '01077383511', NULL, '49583790', NULL, NULL, NULL, 'off', 0.000000, 0.000000, NULL, 'complete', NULL, NULL, 30, '2019-12-26 01:22:30', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (171, NULL, NULL, '유상범', '01051816269', NULL, NULL, 'moHgEURcK6Nvf1OMVbBodGSSfji1', NULL, NULL, 'on', 37.713459, 126.890442, '대한민국 경기도 고양시 덕양구 대자동 동헌로307번길 22-5', 'complete', 'dt<KEY>', '<KEY>', 30, '2020-01-02 19:58:21', 'on'); INSERT INTO `doctor_info` (`id`, `doctor_id`, `doctor_pw`, `doctor_name`, `doctor_phone`, `doctor_kakao`, `doctor_naver`, `doctor_google`, `doctor_facebook`, `doctor_twitter`, `state`, `latitude`, `longitude`, `address`, `approval`, `fcm_token`, `doctor_token`, `fee`, `created_at`, `on/off`) VALUES (172, NULL, NULL, '유상범', '01051816260', '1223066710', NULL, NULL, NULL, NULL, 'off', 0.000000, 0.000000, NULL, 'complete', NULL, NULL, 30, '2020-01-02 21:49:23', 'on'); /*!40000 ALTER TABLE `doctor_info` ENABLE KEYS */; -- 테이블 MerDog.except_list 구조 내보내기 CREATE TABLE IF NOT EXISTS `except_list` ( `id` int(11) NOT NULL AUTO_INCREMENT, `chat_request_id` int(11) DEFAULT NULL, `except` text, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `FK_except_list_chat_request` (`chat_request_id`), CONSTRAINT `FK_except_list_chat_request` FOREIGN KEY (`chat_request_id`) REFERENCES `chat_request` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='매칭 제외 목록'; -- 테이블 데이터 MerDog.except_list:~461 rows (대략적) 내보내기 /*!40000 ALTER TABLE `except_list` DISABLE KEYS */; INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (520, 577, 'a:1:{i:0;i:111;}', '2019-11-26 18:13:46'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (521, 578, 'a:1:{i:0;i:111;}', '2019-11-26 18:15:12'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (522, 580, 'a:1:{i:0;i:103;}', '2019-11-26 19:38:57'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (523, 581, 'a:1:{i:0;i:111;}', '2019-11-26 20:30:45'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (524, 582, 'a:1:{i:0;i:111;}', '2019-11-26 20:51:18'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (525, 584, 'a:1:{i:0;i:111;}', '2019-11-26 21:16:29'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (526, 585, 'a:1:{i:0;i:111;}', '2019-11-26 21:16:49'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (527, 586, 'a:1:{i:0;i:111;}', '2019-11-26 21:17:11'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (528, 587, 'a:1:{i:0;i:111;}', '2019-11-26 21:18:37'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (529, 588, 'a:1:{i:0;i:111;}', '2019-11-26 23:10:49'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (530, 589, 'a:1:{i:0;i:111;}', '2019-11-26 23:11:10'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (531, 590, 'a:1:{i:0;i:111;}', '2019-11-26 23:17:10'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (532, 591, 'a:1:{i:0;i:111;}', '2019-11-26 23:17:41'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (533, 592, 'a:1:{i:0;i:111;}', '2019-11-26 23:17:55'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (534, 593, 'a:1:{i:0;i:111;}', '2019-11-26 23:18:15'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (535, 594, 'a:1:{i:0;i:111;}', '2019-11-26 23:32:37'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (536, 595, 'a:1:{i:0;i:111;}', '2019-11-26 23:32:55'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (537, 596, 'a:1:{i:0;i:111;}', '2019-11-26 23:33:40'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (538, 597, 'a:1:{i:0;i:111;}', '2019-11-26 23:34:08'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (539, 598, 'a:1:{i:0;i:111;}', '2019-11-26 23:35:12'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (540, 599, 'a:1:{i:0;i:111;}', '2019-11-26 23:38:23'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (541, 600, 'a:1:{i:0;i:111;}', '2019-11-26 23:40:27'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (542, 601, 'a:1:{i:0;i:111;}', '2019-11-26 23:50:02'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (543, 602, 'a:1:{i:0;i:111;}', '2019-11-26 23:57:51'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (544, 603, 'a:1:{i:0;i:111;}', '2019-11-27 00:03:35'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (545, 604, 'a:1:{i:0;i:111;}', '2019-11-27 20:17:48'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (546, 605, 'a:1:{i:0;i:111;}', '2019-11-27 20:17:59'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (547, 606, 'a:1:{i:0;i:111;}', '2019-11-27 20:18:36'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (548, 607, 'a:1:{i:0;i:111;}', '2019-11-27 20:18:46'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (549, 608, 'a:1:{i:0;i:111;}', '2019-11-27 20:20:59'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (550, 609, 'a:1:{i:0;i:111;}', '2019-11-27 20:21:48'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (551, 610, 'a:1:{i:0;i:111;}', '2019-11-27 20:37:53'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (552, 611, 'a:1:{i:0;i:111;}', '2019-11-27 20:38:28'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (553, 612, 'a:1:{i:0;i:111;}', '2019-11-27 20:39:30'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (554, 613, 'a:1:{i:0;i:111;}', '2019-11-27 20:40:29'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (555, 615, 'a:1:{i:0;i:111;}', '2019-11-28 16:53:40'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (556, 616, 'a:1:{i:0;i:111;}', '2019-11-28 16:54:19'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (557, 617, 'a:1:{i:0;i:111;}', '2019-11-28 16:54:29'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (558, 618, 'a:1:{i:0;i:111;}', '2019-11-28 16:56:56'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (559, 619, 'a:1:{i:0;i:111;}', '2019-11-28 16:57:11'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (560, 620, 'a:1:{i:0;i:111;}', '2019-11-28 16:58:33'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (561, 621, 'a:1:{i:0;i:111;}', '2019-11-28 16:59:31'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (562, 622, 'a:1:{i:0;i:111;}', '2019-11-28 17:00:08'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (563, 623, 'a:1:{i:0;i:111;}', '2019-11-28 17:00:13'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (564, 624, 'a:1:{i:0;i:111;}', '2019-11-28 17:03:08'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (565, 625, 'a:1:{i:0;i:111;}', '2019-11-28 17:05:16'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (566, 626, 'a:1:{i:0;i:111;}', '2019-11-28 17:09:14'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (567, 627, 'a:1:{i:0;i:111;}', '2019-11-28 17:10:51'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (568, 628, 'a:1:{i:0;i:111;}', '2019-11-28 17:18:04'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (569, 629, 'a:1:{i:0;i:111;}', '2019-11-28 17:18:26'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (570, 630, 'a:1:{i:0;i:111;}', '2019-11-28 17:18:58'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (571, 631, 'a:1:{i:0;i:111;}', '2019-11-28 17:19:28'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (572, 632, 'a:1:{i:0;i:111;}', '2019-11-28 17:29:11'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (573, 633, 'a:1:{i:0;i:111;}', '2019-11-28 18:15:41'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (574, 634, 'a:1:{i:0;i:111;}', '2019-12-01 20:42:10'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (575, 635, 'a:1:{i:0;i:111;}', '2019-12-01 23:42:25'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (576, 636, 'a:2:{i:0;i:103;i:1;i:111;}', '2019-12-01 23:47:00'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (577, 637, 'a:2:{i:0;i:103;i:1;i:111;}', '2019-12-01 23:47:28'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (578, 638, 'a:1:{i:0;i:111;}', '2019-12-02 16:48:10'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (579, 639, 'a:1:{i:0;i:111;}', '2019-12-02 16:48:39'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (580, 640, 'a:1:{i:0;i:111;}', '2019-12-02 16:49:17'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (581, 641, 'a:2:{i:0;i:111;i:1;i:143;}', '2019-12-02 16:50:12'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (582, 642, 'a:2:{i:0;i:111;i:1;i:143;}', '2019-12-02 16:50:28'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (583, 643, 'a:2:{i:0;i:111;i:1;i:143;}', '2019-12-02 16:50:37'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (584, 644, 'a:2:{i:0;i:111;i:1;i:143;}', '2019-12-02 16:51:11'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (585, 645, 'a:2:{i:0;i:111;i:1;i:143;}', '2019-12-02 16:51:48'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (586, 646, 'a:2:{i:0;i:111;i:1;i:143;}', '2019-12-02 16:52:29'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (587, 647, 'a:2:{i:0;i:111;i:1;i:143;}', '2019-12-02 16:52:39'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (588, 648, 'a:1:{i:0;i:111;}', '2019-12-02 16:53:39'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (589, 649, 'a:1:{i:0;i:111;}', '2019-12-02 16:53:56'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (590, 650, 'a:1:{i:0;i:111;}', '2019-12-02 16:55:57'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (591, 651, 'a:1:{i:0;i:111;}', '2019-12-02 16:56:09'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (592, 652, 'a:1:{i:0;i:111;}', '2019-12-02 17:00:49'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (593, 653, 'a:1:{i:0;i:111;}', '2019-12-02 17:01:03'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (594, 654, 'a:1:{i:0;i:111;}', '2019-12-03 15:38:49'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (595, 655, 'a:1:{i:0;i:111;}', '2019-12-03 18:56:05'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (596, 656, 'a:1:{i:0;i:111;}', '2019-12-03 19:25:50'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (597, 657, 'a:2:{i:0;i:103;i:1;i:111;}', '2019-12-05 18:28:06'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (598, 658, 'a:1:{i:0;i:111;}', '2019-12-06 10:31:12'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (599, 659, 'a:2:{i:0;i:111;i:1;i:143;}', '2019-12-06 10:54:11'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (600, 660, 'a:2:{i:0;i:111;i:1;i:143;}', '2019-12-06 10:55:55'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (601, 661, 'a:2:{i:0;i:111;i:1;i:143;}', '2019-12-06 10:56:49'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (602, 662, 'a:3:{i:0;i:111;i:1;i:117;i:2;i:143;}', '2019-12-06 10:57:16'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (603, 663, 'a:4:{i:0;i:111;i:1;i:117;i:2;i:143;i:3;i:147;}', '2019-12-06 10:58:18'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (604, 664, 'a:4:{i:0;i:111;i:1;i:117;i:2;i:143;i:3;i:147;}', '2019-12-06 10:58:52'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (605, 665, 'a:4:{i:0;i:111;i:1;i:117;i:2;i:143;i:3;i:147;}', '2019-12-06 10:59:43'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (606, 666, 'a:4:{i:0;i:111;i:1;i:117;i:2;i:143;i:3;i:147;}', '2019-12-06 10:59:50'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (607, 667, 'a:4:{i:0;i:111;i:1;i:117;i:2;i:143;i:3;i:147;}', '2019-12-06 11:00:25'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (608, 668, 'a:4:{i:0;i:111;i:1;i:117;i:2;i:143;i:3;i:147;}', '2019-12-06 11:01:04'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (609, 669, 'a:4:{i:0;i:111;i:1;i:117;i:2;i:143;i:3;i:147;}', '2019-12-06 11:01:14'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (610, 670, 'a:4:{i:0;i:111;i:1;i:117;i:2;i:143;i:3;i:147;}', '2019-12-06 11:02:31'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (611, 671, 'a:4:{i:0;i:111;i:1;i:117;i:2;i:143;i:3;i:147;}', '2019-12-06 11:03:28'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (612, 672, 'a:4:{i:0;i:111;i:1;i:117;i:2;i:143;i:3;i:147;}', '2019-12-06 11:03:36'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (613, 673, 'a:4:{i:0;i:111;i:1;i:117;i:2;i:143;i:3;i:147;}', '2019-12-06 11:05:30'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (614, 674, 'a:4:{i:0;i:111;i:1;i:117;i:2;i:143;i:3;i:147;}', '2019-12-06 11:06:20'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (615, 675, 'a:4:{i:0;i:111;i:1;i:117;i:2;i:143;i:3;i:147;}', '2019-12-06 11:11:24'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (616, 676, 'a:4:{i:0;i:111;i:1;i:117;i:2;i:143;i:3;i:147;}', '2019-12-06 11:12:55'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (617, 677, 'a:4:{i:0;i:111;i:1;i:117;i:2;i:143;i:3;i:147;}', '2019-12-06 11:13:56'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (618, 678, 'a:3:{i:0;i:111;i:1;i:117;i:2;i:147;}', '2019-12-06 11:15:58'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (619, 679, 'a:3:{i:0;i:111;i:1;i:117;i:2;i:147;}', '2019-12-06 11:17:13'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (620, 680, 'a:3:{i:0;i:111;i:1;i:117;i:2;i:147;}', '2019-12-06 11:17:26'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (621, 681, 'a:2:{i:0;i:111;i:1;i:147;}', '2019-12-06 11:17:36'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (622, 682, 'a:2:{i:0;i:111;i:1;i:147;}', '2019-12-06 11:18:08'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (623, 683, 'a:2:{i:0;i:111;i:1;i:147;}', '2019-12-06 11:18:42'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (624, 684, 'a:2:{i:0;i:111;i:1;i:147;}', '2019-12-06 11:18:54'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (625, 685, 'a:2:{i:0;i:111;i:1;i:147;}', '2019-12-06 11:19:06'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (626, 686, 'a:2:{i:0;i:111;i:1;i:147;}', '2019-12-06 11:19:37'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (627, 687, 'a:3:{i:0;i:111;i:1;i:117;i:2;i:147;}', '2019-12-06 11:23:54'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (628, 688, 'a:1:{i:0;i:147;}', '2019-12-06 11:40:18'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (629, 689, 'a:1:{i:0;i:147;}', '2019-12-06 11:40:25'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (630, 690, 'a:2:{i:0;i:111;i:1;i:147;}', '2019-12-06 12:04:06'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (631, 691, 'a:2:{i:0;i:111;i:1;i:147;}', '2019-12-06 12:05:02'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (632, 692, 'a:2:{i:0;i:111;i:1;i:147;}', '2019-12-06 12:06:46'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (633, 693, 'a:2:{i:0;i:111;i:1;i:147;}', '2019-12-06 12:07:20'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (634, 694, 'a:2:{i:0;i:111;i:1;i:147;}', '2019-12-06 12:07:33'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (635, 695, 'a:3:{i:0;i:111;i:1;i:117;i:2;i:147;}', '2019-12-06 12:11:46'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (636, 696, 'a:3:{i:0;i:111;i:1;i:117;i:2;i:147;}', '2019-12-06 12:13:14'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (637, 697, 'a:3:{i:0;i:111;i:1;i:117;i:2;i:147;}', '2019-12-06 12:15:04'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (638, 698, 'a:3:{i:0;i:111;i:1;i:117;i:2;i:147;}', '2019-12-06 12:16:12'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (639, 699, 'a:3:{i:0;i:111;i:1;i:117;i:2;i:147;}', '2019-12-06 12:16:47'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (640, 700, 'a:3:{i:0;i:111;i:1;i:117;i:2;i:147;}', '2019-12-06 12:17:30'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (641, 701, 'a:2:{i:0;i:111;i:1;i:117;}', '2019-12-06 12:17:56'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (642, 702, 'a:2:{i:0;i:111;i:1;i:117;}', '2019-12-06 12:18:47'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (643, 703, 'a:2:{i:0;i:111;i:1;i:117;}', '2019-12-06 12:20:08'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (644, 704, 'a:2:{i:0;i:111;i:1;i:117;}', '2019-12-06 12:20:47'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (645, 705, 'a:2:{i:0;i:111;i:1;i:117;}', '2019-12-06 12:21:34'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (646, 706, 'a:2:{i:0;i:111;i:1;i:117;}', '2019-12-06 12:26:03'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (647, 707, 'a:1:{i:0;i:111;}', '2019-12-06 12:27:48'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (648, 708, 'a:1:{i:0;i:111;}', '2019-12-06 12:28:29'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (649, 713, 'a:1:{i:0;i:111;}', '2019-12-06 14:07:05'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (650, 714, 'a:1:{i:0;i:111;}', '2019-12-06 14:07:20'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (651, 715, 'a:1:{i:0;i:111;}', '2019-12-06 14:07:52'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (652, 716, 'a:1:{i:0;i:111;}', '2019-12-06 14:08:30'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (653, 717, 'a:1:{i:0;i:111;}', '2019-12-06 14:08:59'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (654, 718, 'a:1:{i:0;i:111;}', '2019-12-06 14:09:14'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (655, 719, 'a:1:{i:0;i:111;}', '2019-12-06 14:10:40'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (656, 720, 'a:1:{i:0;i:111;}', '2019-12-06 14:11:13'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (657, 721, 'a:1:{i:0;i:111;}', '2019-12-06 14:11:41'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (658, 722, 'a:1:{i:0;i:111;}', '2019-12-06 14:11:57'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (659, 723, 'a:1:{i:0;i:111;}', '2019-12-06 14:15:12'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (660, 724, 'a:1:{i:0;i:111;}', '2019-12-06 14:15:52'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (661, 725, 'a:1:{i:0;i:111;}', '2019-12-06 14:16:26'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (662, 726, 'a:1:{i:0;i:111;}', '2019-12-06 14:20:57'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (663, 727, 'a:1:{i:0;i:111;}', '2019-12-06 14:21:53'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (664, 728, 'a:1:{i:0;i:111;}', '2019-12-06 14:22:39'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (665, 729, 'a:1:{i:0;i:111;}', '2019-12-06 14:24:53'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (666, 730, 'a:1:{i:0;i:111;}', '2019-12-06 14:25:27'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (667, 731, 'a:1:{i:0;i:111;}', '2019-12-06 14:26:33'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (668, 732, 'a:1:{i:0;i:111;}', '2019-12-06 14:30:04'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (669, 733, 'a:1:{i:0;i:111;}', '2019-12-06 14:30:36'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (670, 734, 'a:1:{i:0;i:111;}', '2019-12-06 14:31:24'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (671, 735, 'a:1:{i:0;i:111;}', '2019-12-06 14:31:56'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (672, 736, 'a:1:{i:0;i:111;}', '2019-12-06 14:33:03'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (673, 737, 'a:1:{i:0;i:111;}', '2019-12-06 14:33:40'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (674, 738, 'a:1:{i:0;i:111;}', '2019-12-06 14:34:08'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (675, 739, 'a:1:{i:0;i:111;}', '2019-12-06 14:34:47'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (676, 740, 'a:1:{i:0;i:111;}', '2019-12-06 14:36:17'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (677, 741, 'a:1:{i:0;i:111;}', '2019-12-06 14:36:54'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (678, 742, 'a:1:{i:0;i:111;}', '2019-12-06 14:38:37'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (679, 743, 'a:1:{i:0;i:111;}', '2019-12-06 14:38:45'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (680, 744, 'a:1:{i:0;i:111;}', '2019-12-06 14:38:49'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (681, 745, 'a:1:{i:0;i:111;}', '2019-12-06 14:38:53'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (682, 746, 'a:1:{i:0;i:111;}', '2019-12-06 14:38:59'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (683, 747, 'a:1:{i:0;i:111;}', '2019-12-06 14:39:03'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (684, 748, 'a:1:{i:0;i:111;}', '2019-12-06 14:39:20'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (685, 749, 'a:1:{i:0;i:111;}', '2019-12-06 14:39:25'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (686, 750, 'a:1:{i:0;i:111;}', '2019-12-06 14:39:30'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (687, 751, 'a:1:{i:0;i:111;}', '2019-12-06 14:41:46'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (688, 752, 'a:1:{i:0;i:111;}', '2019-12-06 14:43:08'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (689, 753, 'a:1:{i:0;i:111;}', '2019-12-06 14:43:38'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (690, 754, 'a:1:{i:0;i:111;}', '2019-12-06 14:45:00'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (691, 755, 'a:1:{i:0;i:111;}', '2019-12-06 14:45:37'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (692, 756, 'a:1:{i:0;i:111;}', '2019-12-06 14:45:58'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (693, 757, 'a:1:{i:0;i:111;}', '2019-12-06 14:46:27'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (694, 758, 'a:1:{i:0;i:111;}', '2019-12-06 14:46:42'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (695, 759, 'a:1:{i:0;i:111;}', '2019-12-06 14:46:48'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (696, 760, 'a:1:{i:0;i:111;}', '2019-12-06 14:46:53'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (697, 761, 'a:1:{i:0;i:111;}', '2019-12-06 14:47:34'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (698, 762, 'a:1:{i:0;i:111;}', '2019-12-06 14:48:05'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (699, 763, 'a:1:{i:0;i:111;}', '2019-12-06 14:48:29'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (700, 764, 'a:1:{i:0;i:111;}', '2019-12-06 14:49:20'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (701, 765, 'a:1:{i:0;i:111;}', '2019-12-06 14:50:18'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (702, 766, 'a:1:{i:0;i:111;}', '2019-12-06 14:50:26'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (703, 767, 'a:1:{i:0;i:111;}', '2019-12-06 14:50:56'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (704, 768, 'a:1:{i:0;i:111;}', '2019-12-06 14:51:29'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (705, 769, 'a:1:{i:0;i:111;}', '2019-12-06 14:52:00'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (706, 770, 'a:1:{i:0;i:111;}', '2019-12-06 14:52:30'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (707, 771, 'a:1:{i:0;i:111;}', '2019-12-06 14:52:49'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (708, 772, 'a:1:{i:0;i:111;}', '2019-12-06 14:53:02'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (709, 773, 'a:1:{i:0;i:111;}', '2019-12-06 14:53:09'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (710, 774, 'a:1:{i:0;i:111;}', '2019-12-06 14:53:16'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (711, 775, 'a:1:{i:0;i:111;}', '2019-12-06 14:53:22'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (712, 776, 'a:1:{i:0;i:111;}', '2019-12-06 14:53:27'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (713, 777, 'a:1:{i:0;i:111;}', '2019-12-06 14:53:33'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (714, 778, 'a:1:{i:0;i:111;}', '2019-12-06 14:53:40'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (715, 779, 'a:1:{i:0;i:111;}', '2019-12-06 14:54:09'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (716, 780, 'a:1:{i:0;i:111;}', '2019-12-06 14:54:17'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (717, 781, 'a:1:{i:0;i:111;}', '2019-12-06 14:54:27'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (718, 782, 'a:1:{i:0;i:111;}', '2019-12-06 14:54:34'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (719, 783, 'a:1:{i:0;i:111;}', '2019-12-06 14:54:40'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (720, 784, 'a:1:{i:0;i:111;}', '2019-12-06 14:54:48'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (721, 785, 'a:1:{i:0;i:111;}', '2019-12-06 14:54:55'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (722, 786, 'a:1:{i:0;i:111;}', '2019-12-06 14:55:00'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (723, 787, 'a:1:{i:0;i:111;}', '2019-12-06 14:55:09'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (724, 788, 'a:1:{i:0;i:111;}', '2019-12-06 14:55:16'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (725, 789, 'a:1:{i:0;i:111;}', '2019-12-06 14:55:21'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (726, 790, 'a:1:{i:0;i:111;}', '2019-12-06 14:55:30'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (727, 791, 'a:1:{i:0;i:111;}', '2019-12-06 14:55:44'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (728, 792, 'a:1:{i:0;i:111;}', '2019-12-06 14:58:19'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (729, 793, 'a:1:{i:0;i:111;}', '2019-12-06 14:58:56'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (730, 794, 'a:1:{i:0;i:111;}', '2019-12-06 14:59:11'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (731, 795, 'a:1:{i:0;i:111;}', '2019-12-06 14:59:32'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (732, 796, 'a:1:{i:0;i:111;}', '2019-12-06 15:03:52'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (733, 797, 'a:1:{i:0;i:111;}', '2019-12-06 15:03:58'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (734, 799, 'a:1:{i:0;i:111;}', '2019-12-08 10:16:09'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (735, 800, 'a:1:{i:0;i:111;}', '2019-12-08 10:16:43'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (736, 806, 'a:1:{i:0;i:111;}', '2019-12-08 10:26:25'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (737, 807, 'a:1:{i:0;i:111;}', '2019-12-08 10:26:51'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (738, 808, 'a:1:{i:0;i:111;}', '2019-12-08 10:28:59'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (739, 809, 'a:1:{i:0;i:111;}', '2019-12-08 10:29:47'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (740, 810, 'a:1:{i:0;i:111;}', '2019-12-08 10:57:10'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (741, 811, 'a:1:{i:0;i:111;}', '2019-12-08 11:01:17'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (742, 812, 'a:1:{i:0;i:111;}', '2019-12-08 11:21:56'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (743, 813, 'a:1:{i:0;i:111;}', '2019-12-08 12:40:31'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (744, 814, 'a:2:{i:0;i:103;i:1;i:111;}', '2019-12-08 15:01:16'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (745, 815, 'a:2:{i:0;i:103;i:1;i:111;}', '2019-12-08 15:09:43'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (746, 816, 'a:2:{i:0;i:103;i:1;i:111;}', '2019-12-08 15:09:59'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (747, 817, 'a:2:{i:0;i:103;i:1;i:111;}', '2019-12-08 15:10:30'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (748, 818, 'a:2:{i:0;i:103;i:1;i:111;}', '2019-12-08 15:17:09'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (749, 819, 'a:2:{i:0;i:103;i:1;i:111;}', '2019-12-08 15:19:18'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (750, 820, 'a:2:{i:0;i:103;i:1;i:111;}', '2019-12-08 15:42:26'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (751, 821, 'a:2:{i:0;i:103;i:1;i:111;}', '2019-12-08 15:42:48'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (752, 822, 'a:1:{i:0;i:111;}', '2019-12-08 16:04:31'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (753, 823, 'a:1:{i:0;i:111;}', '2019-12-08 16:47:59'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (754, 824, 'a:1:{i:0;i:111;}', '2019-12-08 16:55:14'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (755, 825, 'a:1:{i:0;i:111;}', '2019-12-08 16:56:15'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (756, 826, 'a:1:{i:0;i:111;}', '2019-12-08 16:56:58'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (757, 827, 'a:1:{i:0;i:111;}', '2019-12-08 16:58:40'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (758, 828, 'a:1:{i:0;i:111;}', '2019-12-08 17:00:35'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (759, 829, 'a:1:{i:0;i:111;}', '2019-12-08 17:02:18'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (760, 830, 'a:1:{i:0;i:111;}', '2019-12-08 17:06:00'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (761, 831, 'a:1:{i:0;i:111;}', '2019-12-08 17:06:46'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (762, 832, 'a:1:{i:0;i:111;}', '2019-12-08 17:11:47'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (763, 833, 'a:1:{i:0;i:111;}', '2019-12-08 19:45:50'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (764, 834, 'a:1:{i:0;i:111;}', '2019-12-08 19:55:17'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (765, 835, 'a:1:{i:0;i:111;}', '2019-12-10 00:46:04'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (766, 836, 'a:1:{i:0;i:111;}', '2019-12-11 00:32:12'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (767, 837, 'a:1:{i:0;i:111;}', '2019-12-12 01:48:47'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (768, 838, 'a:1:{i:0;i:111;}', '2019-12-12 14:03:44'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (769, 839, 'a:1:{i:0;i:111;}', '2019-12-13 00:16:28'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (770, 840, 'a:2:{i:0;i:111;i:1;i:147;}', '2019-12-13 00:18:18'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (771, 841, 'a:2:{i:0;i:111;i:1;i:117;}', '2019-12-13 11:04:57'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (772, 842, 'a:2:{i:0;i:111;i:1;i:117;}', '2019-12-13 11:07:36'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (773, 843, 'a:2:{i:0;i:111;i:1;i:117;}', '2019-12-13 11:07:44'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (774, 844, 'a:1:{i:0;i:111;}', '2019-12-16 18:31:46'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (775, 845, 'a:1:{i:0;i:111;}', '2019-12-16 18:34:18'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (776, 846, 'a:1:{i:0;i:111;}', '2019-12-17 17:47:45'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (777, 847, 'a:1:{i:0;i:111;}', '2019-12-17 17:52:10'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (778, 848, 'a:1:{i:0;i:111;}', '2019-12-17 17:52:27'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (779, 849, 'a:1:{i:0;i:111;}', '2019-12-17 17:54:50'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (780, 850, 'a:1:{i:0;i:111;}', '2019-12-17 18:09:06'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (781, 851, 'a:1:{i:0;i:111;}', '2019-12-17 18:12:06'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (782, 852, 'a:1:{i:0;i:111;}', '2019-12-17 18:14:18'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (783, 853, 'a:1:{i:0;i:111;}', '2019-12-17 18:16:01'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (784, 854, 'a:1:{i:0;i:111;}', '2019-12-17 18:16:13'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (785, 855, 'a:1:{i:0;i:111;}', '2019-12-17 18:16:44'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (786, 856, 'a:1:{i:0;i:111;}', '2019-12-17 18:26:03'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (787, 857, 'a:1:{i:0;i:111;}', '2019-12-17 18:34:55'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (788, 858, 'a:1:{i:0;i:111;}', '2019-12-17 18:35:48'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (789, 861, 'a:1:{i:0;i:111;}', '2019-12-18 13:28:09'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (790, 862, 'a:1:{i:0;i:111;}', '2019-12-18 14:13:24'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (791, 863, 'a:1:{i:0;i:111;}', '2019-12-18 14:37:51'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (792, 864, 'a:1:{i:0;i:147;}', '2019-12-18 19:12:29'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (793, 866, 'a:2:{i:0;i:117;i:1;i:147;}', '2019-12-19 20:20:18'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (794, 867, 'a:3:{i:0;i:111;i:1;i:117;i:2;i:147;}', '2019-12-19 20:20:54'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (795, 868, 'a:3:{i:0;i:111;i:1;i:117;i:2;i:147;}', '2019-12-19 21:16:36'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (796, 869, 'a:3:{i:0;i:111;i:1;i:117;i:2;i:147;}', '2019-12-19 21:23:15'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (797, 870, 'a:3:{i:0;i:111;i:1;i:117;i:2;i:147;}', '2019-12-19 21:41:44'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (798, 871, 'a:1:{i:0;i:111;}', '2019-12-21 19:04:28'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (799, 872, 'a:1:{i:0;i:111;}', '2019-12-25 03:00:27'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (800, 873, 'a:4:{i:0;i:111;i:1;i:117;i:2;i:143;i:3;i:147;}', '2019-12-29 15:11:48'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (801, 874, 'a:4:{i:0;i:111;i:1;i:117;i:2;i:143;i:3;i:147;}', '2019-12-29 15:12:45'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (802, 875, 'a:3:{i:0;i:111;i:1;i:117;i:2;i:147;}', '2019-12-29 18:57:39'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (803, 876, 'a:4:{i:0;i:111;i:1;i:117;i:2;i:143;i:3;i:147;}', '2019-12-29 18:58:06'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (804, 877, 'a:4:{i:0;i:103;i:1;i:111;i:2;i:117;i:3;i:147;}', '2020-01-02 18:38:53'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (805, 878, 'a:4:{i:0;i:103;i:1;i:111;i:2;i:117;i:3;i:147;}', '2020-01-02 19:55:31'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (806, 879, 'a:4:{i:0;i:103;i:1;i:111;i:2;i:117;i:3;i:147;}', '2020-01-02 19:56:31'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (807, 880, 'a:4:{i:0;i:103;i:1;i:117;i:2;i:147;i:3;i:171;}', '2020-01-02 20:04:39'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (808, 881, 'a:4:{i:0;i:103;i:1;i:117;i:2;i:147;i:3;i:171;}', '2020-01-02 20:06:48'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (809, 882, 'a:2:{i:0;i:147;i:1;i:171;}', '2020-01-02 20:45:57'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (810, 883, 'a:4:{i:0;i:103;i:1;i:117;i:2;i:147;i:3;i:171;}', '2020-01-02 22:33:02'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (811, 884, 'a:2:{i:0;i:117;i:1;i:147;}', '2020-01-07 18:36:49'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (812, 885, 'a:2:{i:0;i:117;i:1;i:147;}', '2020-01-07 19:29:19'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (813, 886, 'a:3:{i:0;i:117;i:1;i:143;i:2;i:147;}', '2020-01-07 19:40:59'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (814, 887, 'a:3:{i:0;i:117;i:1;i:143;i:2;i:147;}', '2020-01-07 19:41:31'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (815, 889, 'a:4:{i:0;i:103;i:1;i:117;i:2;i:147;i:3;i:171;}', '2020-01-07 20:55:51'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (816, 890, 'a:4:{i:0;i:103;i:1;i:117;i:2;i:147;i:3;i:171;}', '2020-01-07 20:57:32'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (817, 892, 'a:4:{i:0;i:103;i:1;i:117;i:2;i:147;i:3;i:171;}', '2020-01-07 21:00:39'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (818, 893, 'a:4:{i:0;i:103;i:1;i:117;i:2;i:147;i:3;i:171;}', '2020-01-07 21:02:18'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (819, 894, 'a:4:{i:0;i:103;i:1;i:117;i:2;i:147;i:3;i:171;}', '2020-01-07 21:06:53'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (820, 896, 'a:4:{i:0;i:103;i:1;i:117;i:2;i:147;i:3;i:171;}', '2020-01-07 21:09:02'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (821, 897, 'a:4:{i:0;i:103;i:1;i:117;i:2;i:147;i:3;i:171;}', '2020-01-08 14:10:28'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (822, 898, 'a:4:{i:0;i:103;i:1;i:117;i:2;i:147;i:3;i:171;}', '2020-01-08 14:45:59'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (823, 899, 'a:4:{i:0;i:103;i:1;i:117;i:2;i:147;i:3;i:171;}', '2020-01-08 14:46:57'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (824, 901, 'a:4:{i:0;i:103;i:1;i:117;i:2;i:147;i:3;i:171;}', '2020-01-08 15:51:21'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (825, 902, 'a:4:{i:0;i:103;i:1;i:117;i:2;i:147;i:3;i:171;}', '2020-01-08 15:51:52'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (826, 903, 'a:4:{i:0;i:103;i:1;i:117;i:2;i:147;i:3;i:171;}', '2020-01-08 16:03:19'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (827, 904, 'a:4:{i:0;i:103;i:1;i:117;i:2;i:147;i:3;i:171;}', '2020-01-08 16:33:32'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (828, 905, 'a:4:{i:0;i:103;i:1;i:117;i:2;i:147;i:3;i:171;}', '2020-01-08 16:34:00'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (829, 906, 'a:3:{i:0;i:117;i:1;i:147;i:2;i:171;}', '2020-01-08 16:34:25'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (830, 907, 'a:3:{i:0;i:117;i:1;i:147;i:2;i:171;}', '2020-01-08 16:34:55'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (831, 908, 'a:2:{i:0;i:117;i:1;i:147;}', '2020-01-09 11:34:32'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (832, 909, 'a:1:{i:0;i:117;}', '2020-01-09 12:13:36'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (833, 910, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 15:06:24'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (834, 911, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 15:09:48'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (835, 912, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 15:10:40'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (836, 913, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 15:41:03'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (837, 914, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 15:56:23'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (838, 915, 'a:3:{i:0;i:103;i:1;i:117;i:2;i:171;}', '2020-01-09 16:26:18'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (839, 916, 'a:1:{i:0;i:117;}', '2020-01-09 16:27:45'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (840, 917, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 16:31:38'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (841, 918, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 16:33:46'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (842, 919, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 16:43:36'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (843, 920, 'a:1:{i:0;i:117;}', '2020-01-09 16:53:06'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (844, 921, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 17:20:33'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (845, 922, 'a:1:{i:0;i:171;}', '2020-01-09 17:37:42'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (846, 923, 'a:1:{i:0;i:117;}', '2020-01-09 17:49:11'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (847, 924, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 17:50:02'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (848, 925, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 18:58:26'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (849, 926, 'a:1:{i:0;i:117;}', '2020-01-09 19:36:53'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (850, 927, 'a:1:{i:0;i:117;}', '2020-01-09 19:37:29'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (851, 928, 'a:1:{i:0;i:117;}', '2020-01-09 19:38:10'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (852, 929, 'a:1:{i:0;i:117;}', '2020-01-09 19:39:45'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (853, 930, 'a:1:{i:0;i:117;}', '2020-01-09 19:43:50'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (854, 931, 'a:1:{i:0;i:117;}', '2020-01-09 19:44:14'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (855, 932, 'a:1:{i:0;i:117;}', '2020-01-09 19:44:41'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (856, 933, 'a:1:{i:0;i:117;}', '2020-01-09 19:45:11'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (857, 934, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 19:45:34'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (858, 935, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 19:49:11'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (859, 936, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 19:54:33'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (860, 937, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 19:57:56'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (861, 938, 'a:1:{i:0;i:171;}', '2020-01-09 20:07:59'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (862, 939, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 20:19:45'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (863, 940, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 20:24:48'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (864, 941, 'a:1:{i:0;i:171;}', '2020-01-09 20:30:06'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (865, 942, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 20:41:32'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (866, 943, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 20:41:56'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (867, 944, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 20:42:24'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (868, 945, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 21:04:32'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (869, 946, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 21:05:56'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (870, 947, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 21:17:46'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (871, 948, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 21:49:23'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (872, 949, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 21:51:18'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (873, 950, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 22:00:38'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (874, 951, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 22:02:34'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (875, 952, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 22:03:30'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (876, 953, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 22:04:19'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (877, 954, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 22:06:04'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (878, 955, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 22:06:27'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (879, 956, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 22:06:52'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (880, 957, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 22:07:13'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (881, 958, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 22:07:38'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (882, 959, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 22:09:21'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (883, 960, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 22:11:31'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (884, 961, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 22:13:49'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (885, 962, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 22:14:22'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (886, 963, 'a:1:{i:0;i:171;}', '2020-01-09 22:16:46'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (887, 964, 'a:1:{i:0;i:171;}', '2020-01-09 22:17:10'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (888, 965, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 22:18:00'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (889, 966, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-09 22:39:59'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (890, 967, 'a:1:{i:0;i:117;}', '2020-01-10 13:54:08'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (891, 968, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-22 22:13:14'); INSERT INTO `except_list` (`id`, `chat_request_id`, `except`, `created_at`) VALUES (892, 969, 'a:2:{i:0;i:117;i:1;i:171;}', '2020-01-26 13:50:34'); /*!40000 ALTER TABLE `except_list` ENABLE KEYS */; -- 테이블 MerDog.fcm_log 구조 내보내기 CREATE TABLE IF NOT EXISTS `fcm_log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `id_type` varchar(50) NOT NULL COMMENT 'user / doctor', `fcm_id` int(11) NOT NULL COMMENT '회원번호', `type` varchar(50) NOT NULL COMMENT '알림 종류', `ip_address` varchar(50) NOT NULL COMMENT 'ip 주소', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='fcm 기록 로그'; -- 테이블 데이터 MerDog.fcm_log:~966 rows (대략적) 내보내기 /*!40000 ALTER TABLE `fcm_log` DISABLE KEYS */; INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (96, 'user', 77, '관리자 단체 발송', '114.204.208.165', '2019-12-01 20:16:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (97, 'user', 80, '관리자 단체 발송', '172.16.17.32', '2019-12-01 20:16:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (98, 'user', 77, '관리자 단체 발송', '172.16.17.32', '2019-12-01 20:20:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (99, 'user', 80, '관리자 단체 발송', '172.16.17.32', '2019-12-01 20:20:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (100, 'user', 77, '관리자 단체 발송', '172.16.17.32', '2019-12-01 20:21:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (101, 'user', 80, '관리자 단체 발송', '172.16.17.32', '2019-12-01 20:21:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (102, 'user', 77, '관리자 단체 발송', '172.16.17.32', '2019-12-01 20:22:43'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (103, 'user', 80, '관리자 단체 발송', '172.16.17.32', '2019-12-01 20:22:43'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (104, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-01 20:42:10'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (105, 'user', 77, '채팅 연결', '172.16.17.32', '2019-12-01 20:42:13'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (106, 'user', 77, '채팅 메시지', '172.16.17.32', '2019-12-01 20:42:22'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (107, 'user', 77, '채팅 메시지', '172.16.17.32', '2019-12-01 20:42:38'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (108, 'user', 77, '관리자 단체 발송', '172.16.17.32', '2019-12-01 20:52:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (109, 'doctor', 111, '관리자 단체 발송', '172.16.17.32', '2019-12-01 20:52:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (110, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-01 21:00:26'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (111, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-01 21:00:44'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (112, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-01 22:10:37'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (113, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-01 22:10:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (114, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-01 22:10:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (115, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-01 22:52:05'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (116, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-01 22:52:39'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (117, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-01 23:19:09'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (118, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-01 23:42:25'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (119, 'doctor', 103, '채팅 요청', '172.16.17.32', '2019-12-01 23:47:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (120, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-01 23:47:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (121, 'doctor', 103, '채팅 요청', '172.16.17.32', '2019-12-01 23:47:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (122, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-01 23:47:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (123, 'user', 77, '채팅 연결', '192.168.127.12', '2019-12-01 23:47:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (124, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:47:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (125, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:47:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (126, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:47:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (127, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-01 23:48:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (128, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-01 23:48:10'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (129, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:48:13'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (130, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:48:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (131, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:48:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (132, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:48:26'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (133, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:48:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (134, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-01 23:48:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (135, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:48:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (136, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:48:37'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (137, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:48:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (138, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:48:44'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (139, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-01 23:48:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (140, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:48:47'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (141, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:48:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (142, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:48:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (143, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:48:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (144, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:49:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (145, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-01 23:49:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (146, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:49:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (147, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:49:08'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (148, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:49:11'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (149, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:49:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (150, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:49:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (151, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:49:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (152, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:49:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (153, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:49:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (154, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:49:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (155, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:49:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (156, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:49:39'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (157, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:49:42'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (158, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-01 23:49:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (159, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-02 00:47:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (160, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-02 00:48:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (161, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-02 00:49:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (162, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:54:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (163, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:54:27'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (164, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-02 00:54:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (165, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:54:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (166, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-02 00:54:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (167, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:54:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (168, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-02 00:54:34'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (169, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:54:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (170, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-02 00:54:37'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (171, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:54:39'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (172, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:54:42'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (173, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-02 00:54:43'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (174, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:54:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (175, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-02 00:54:46'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (176, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:54:47'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (177, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:54:50'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (178, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:54:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (179, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-02 00:54:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (180, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:54:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (181, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:54:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (182, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-02 00:55:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (183, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:55:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (184, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:55:13'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (185, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:55:17'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (186, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:55:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (187, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:55:27'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (188, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-02 00:55:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (189, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:55:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (190, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:55:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (191, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-02 00:55:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (192, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:55:35'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (193, 'user', 77, '채팅 메시지', '192.168.127.12', '2019-12-02 00:55:38'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (194, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-02 00:55:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (195, 'doctor', 103, '채팅 메시지', '192.168.3.113', '2019-12-02 12:45:27'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (196, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-02 13:19:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (197, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2019-12-02 13:21:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (198, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-02 13:22:42'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (199, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-02 13:23:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (200, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-02 13:24:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (201, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-02 13:24:06'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (202, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-02 15:51:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (203, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-02 16:48:10'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (204, 'user', 77, '채팅 연결', '172.16.17.32', '2019-12-02 16:48:15'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (205, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-02 16:48:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (206, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-02 16:48:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (207, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-02 16:48:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (208, 'user', 77, '채팅 메시지', '172.16.17.32', '2019-12-02 16:48:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (209, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-02 16:49:17'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (210, 'user', 77, '채팅 메시지', '172.16.17.32', '2019-12-02 16:49:35'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (211, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-02 16:50:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (212, 'doctor', 143, '채팅 요청', '172.16.17.32', '2019-12-02 16:50:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (213, 'user', 77, '채팅 연결', '172.16.17.32', '2019-12-02 16:50:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (214, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-02 16:50:26'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (215, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-02 16:50:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (216, 'doctor', 143, '채팅 요청', '172.16.17.32', '2019-12-02 16:50:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (217, 'user', 77, '채팅 연결', '172.16.17.32', '2019-12-02 16:50:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (218, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-02 16:50:37'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (219, 'doctor', 143, '채팅 요청', '172.16.17.32', '2019-12-02 16:50:37'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (220, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-02 16:51:11'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (221, 'doctor', 143, '채팅 요청', '172.16.17.32', '2019-12-02 16:51:11'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (222, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-02 16:51:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (223, 'doctor', 143, '채팅 요청', '172.16.17.32', '2019-12-02 16:51:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (224, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-02 16:52:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (225, 'doctor', 143, '채팅 요청', '172.16.17.32', '2019-12-02 16:52:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (226, 'user', 77, '채팅 연결', '172.16.17.32', '2019-12-02 16:52:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (227, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-02 16:52:39'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (228, 'doctor', 143, '채팅 요청', '172.16.17.32', '2019-12-02 16:52:39'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (229, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-02 16:53:39'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (230, 'user', 77, '채팅 연결', '172.16.17.32', '2019-12-02 16:53:41'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (231, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-02 16:53:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (232, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-02 16:55:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (233, 'user', 77, '채팅 연결', '172.16.17.32', '2019-12-02 16:56:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (234, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-02 16:56:09'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (235, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-02 17:00:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (236, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-02 17:00:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (237, 'user', 77, '채팅 연결', '172.16.17.32', '2019-12-02 17:00:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (238, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-02 17:01:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (239, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-02 17:02:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (240, 'user', 77, '채팅 메시지', '172.16.17.32', '2019-12-02 17:03:07'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (241, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-02 17:06:10'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (242, 'user', 77, '채팅 메시지', '172.16.17.32', '2019-12-02 17:11:15'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (243, 'user', 77, '채팅 메시지', '172.16.17.32', '2019-12-02 17:11:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (244, 'user', 77, '채팅 메시지', '172.16.17.32', '2019-12-02 17:12:50'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (245, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-02 17:28:07'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (246, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-02 17:29:25'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (247, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-03 14:17:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (248, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-03 14:34:06'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (249, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-03 14:39:05'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (250, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-03 15:38:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (251, 'user', 77, '채팅 연결', '172.16.17.32', '2019-12-03 15:39:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (252, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-03 15:39:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (253, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-03 15:39:22'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (254, 'user', 77, '채팅 메시지', '172.16.17.32', '2019-12-03 15:39:26'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (255, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-03 15:39:27'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (256, 'user', 77, '채팅 메시지', '172.16.17.32', '2019-12-03 15:39:34'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (257, 'user', 77, '채팅 메시지', '172.16.17.32', '2019-12-03 15:39:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (258, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-03 15:40:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (259, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-03 15:40:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (260, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-03 15:40:25'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (261, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-03 18:56:05'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (262, 'user', 77, '채팅 연결', '172.16.17.32', '2019-12-03 18:56:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (263, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-03 18:56:22'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (264, 'doctor', 111, '채팅 요청', '172.16.17.321', '2019-12-03 19:25:50'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (265, 'user', 77, '채팅 연결', '172.16.17.32', '2019-12-03 19:25:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (266, 'doctor', 111, '채팅 메시지', '172.16.17.32', '2019-12-03 19:26:05'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (267, 'user', 77, '채팅 메시지', '172.16.17.32', '2019-12-03 19:50:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (268, 'doctor', 143, '관리자 단체 발송', '192.168.3.11', '2019-12-05 15:47:43'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (269, 'user', 77, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:07:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (270, 'doctor', 103, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:19:35'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (271, 'doctor', 111, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:19:35'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (272, 'doctor', 143, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:19:35'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (273, 'doctor', 103, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:21:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (274, 'doctor', 111, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:21:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (275, 'doctor', 143, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:21:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (276, 'user', 77, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:22:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (277, 'user', 78, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:22:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (278, 'doctor', 103, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:23:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (279, 'doctor', 111, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:23:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (280, 'doctor', 143, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:23:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (281, 'doctor', 103, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:28:11'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (282, 'doctor', 111, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:28:11'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (283, 'doctor', 103, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:29:46'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (284, 'doctor', 111, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:29:46'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (285, 'doctor', 143, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:29:46'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (286, 'doctor', 103, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:31:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (287, 'doctor', 111, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:31:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (288, 'doctor', 143, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:31:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (289, 'doctor', 103, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:32:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (290, 'doctor', 111, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:32:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (291, 'doctor', 143, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:32:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (292, 'doctor', 103, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:34:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (293, 'doctor', 111, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:34:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (294, 'doctor', 143, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:34:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (295, 'doctor', 111, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:39:11'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (296, 'doctor', 111, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:47:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (297, 'doctor', 103, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:48:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (298, 'doctor', 111, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:48:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (299, 'doctor', 103, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:49:58'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (300, 'doctor', 111, '관리자 단체 발송', '192.168.3.11', '2019-12-05 17:49:58'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (301, 'doctor', 103, '채팅 요청', '192.168.3.11', '2019-12-05 18:28:06'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (302, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-05 18:28:06'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (303, 'user', 77, '관리자 단체 발송', '192.168.3.11', '2019-12-05 19:08:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (304, 'user', 78, '관리자 단체 발송', '192.168.3.11', '2019-12-05 19:08:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (305, 'doctor', 103, '관리자 단체 발송', '192.168.3.11', '2019-12-05 19:10:08'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (306, 'doctor', 143, '관리자 단체 발송', '192.168.3.11', '2019-12-05 19:10:08'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (307, 'doctor', 103, '관리자 단체 발송', '192.168.3.11', '2019-12-05 20:18:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (308, 'doctor', 111, '관리자 단체 발송', '192.168.3.11', '2019-12-05 20:18:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (309, 'doctor', 103, '관리자 단체 발송', '192.168.3.11', '2019-12-05 20:25:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (310, 'doctor', 111, '관리자 단체 발송', '192.168.3.11', '2019-12-05 20:25:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (311, 'doctor', 103, '관리자 단체 발송', '192.168.3.11', '2019-12-05 20:33:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (312, 'doctor', 103, '관리자 단체 발송', '192.168.3.11', '2019-12-05 20:51:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (313, 'doctor', 143, '관리자 단체 발송', '192.168.3.11', '2019-12-05 20:51:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (314, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 10:31:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (315, 'user', 80, '채팅 연결', '192.168.127.12', '2019-12-06 10:31:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (316, 'user', 80, '채팅 메시지', '192.168.127.12', '2019-12-06 10:31:41'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (317, 'user', 80, '채팅 메시지', '192.168.127.12', '2019-12-06 10:31:43'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (318, 'user', 80, '채팅 메시지', '192.168.127.12', '2019-12-06 10:31:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (319, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 10:54:11'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (320, 'doctor', 143, '채팅 요청', '192.168.3.11', '2019-12-06 10:54:11'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (321, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 10:55:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (322, 'doctor', 143, '채팅 요청', '192.168.3.11', '2019-12-06 10:55:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (323, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 10:56:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (324, 'doctor', 143, '채팅 요청', '192.168.3.11', '2019-12-06 10:56:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (325, 'user', 83, '관리자 발송', '172.16.17.32', '2019-12-06 10:57:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (326, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 10:57:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (327, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-06 10:57:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (328, 'doctor', 143, '채팅 요청', '192.168.3.11', '2019-12-06 10:57:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (329, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 10:58:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (330, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-06 10:58:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (331, 'doctor', 143, '채팅 요청', '192.168.3.11', '2019-12-06 10:58:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (332, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 10:58:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (333, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 10:58:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (334, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-06 10:58:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (335, 'doctor', 143, '채팅 요청', '192.168.3.11', '2019-12-06 10:58:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (336, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 10:58:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (337, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 10:59:44'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (338, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-06 10:59:44'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (339, 'doctor', 143, '채팅 요청', '192.168.3.11', '2019-12-06 10:59:44'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (340, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 10:59:44'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (341, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 10:59:50'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (342, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-06 10:59:50'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (343, 'doctor', 143, '채팅 요청', '192.168.3.11', '2019-12-06 10:59:50'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (344, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 10:59:50'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (345, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 11:00:25'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (346, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-06 11:00:25'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (347, 'doctor', 143, '채팅 요청', '192.168.3.11', '2019-12-06 11:00:25'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (348, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 11:00:25'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (349, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 11:01:05'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (350, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-06 11:01:05'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (351, 'doctor', 143, '채팅 요청', '192.168.127.12', '2019-12-06 11:01:05'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (352, 'doctor', 147, '채팅 요청', '192.168.127.12', '2019-12-06 11:01:05'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (353, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 11:01:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (354, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-06 11:01:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (355, 'doctor', 143, '채팅 요청', '192.168.127.12', '2019-12-06 11:01:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (356, 'doctor', 147, '채팅 요청', '192.168.127.12', '2019-12-06 11:01:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (357, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 11:02:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (358, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-06 11:02:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (359, 'doctor', 143, '채팅 요청', '192.168.127.12', '2019-12-06 11:02:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (360, 'doctor', 147, '채팅 요청', '192.168.127.12', '2019-12-06 11:02:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (361, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 11:03:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (362, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-06 11:03:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (363, 'doctor', 143, '채팅 요청', '192.168.127.12', '2019-12-06 11:03:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (364, 'doctor', 147, '채팅 요청', '192.168.127.12', '2019-12-06 11:03:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (365, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 11:03:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (366, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-06 11:03:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (367, 'doctor', 143, '채팅 요청', '192.168.127.12', '2019-12-06 11:03:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (368, 'doctor', 147, '채팅 요청', '192.168.127.12', '2019-12-06 11:03:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (369, 'doctor', 111, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:03:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (370, 'doctor', 117, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:03:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (371, 'doctor', 143, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:03:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (372, 'doctor', 147, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:03:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (373, 'doctor', 117, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:04:22'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (374, 'doctor', 143, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:04:22'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (375, 'doctor', 147, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:04:22'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (376, 'user', 84, '관리자 발송', '172.16.17.32', '2019-12-06 11:04:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (377, 'doctor', 117, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:05:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (378, 'doctor', 143, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:05:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (379, 'doctor', 147, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:05:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (380, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 11:05:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (381, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-06 11:05:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (382, 'doctor', 143, '채팅 요청', '192.168.3.11', '2019-12-06 11:05:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (383, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 11:05:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (384, 'user', 83, '채팅 연결', '172.16.31.10', '2019-12-06 11:05:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (385, 'doctor', 117, '채팅 메시지', '192.168.3.11', '2019-12-06 11:05:50'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (386, 'user', 83, '채팅 메시지', '172.16.31.10', '2019-12-06 11:05:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (387, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 11:06:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (388, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-06 11:06:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (389, 'doctor', 143, '채팅 요청', '192.168.3.11', '2019-12-06 11:06:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (390, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 11:06:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (391, 'doctor', 117, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:07:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (392, 'doctor', 143, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:07:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (393, 'doctor', 147, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:07:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (394, 'doctor', 117, '채팅 메시지', '192.168.3.11', '2019-12-06 11:08:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (395, 'doctor', 117, '채팅 메시지', '192.168.3.11', '2019-12-06 11:08:17'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (396, 'doctor', 117, '채팅 메시지', '192.168.3.11', '2019-12-06 11:08:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (397, 'doctor', 117, '채팅 메시지', '192.168.3.11', '2019-12-06 11:08:35'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (398, 'doctor', 117, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:08:38'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (399, 'doctor', 143, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:08:38'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (400, 'doctor', 147, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:08:38'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (401, 'user', 83, '채팅 메시지', '172.16.31.10', '2019-12-06 11:08:42'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (402, 'user', 83, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:09:38'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (403, 'user', 83, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:10:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (404, 'user', 77, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:10:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (405, 'user', 83, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:10:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (406, 'user', 84, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:10:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (407, 'doctor', 117, '채팅 메시지', '192.168.3.11', '2019-12-06 11:11:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (408, 'doctor', 117, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:11:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (409, 'doctor', 143, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:11:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (410, 'doctor', 147, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:11:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (411, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 11:11:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (412, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-06 11:11:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (413, 'doctor', 143, '채팅 요청', '192.168.3.11', '2019-12-06 11:11:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (414, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 11:11:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (415, 'doctor', 117, '채팅 메시지', '192.168.3.11', '2019-12-06 11:12:07'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (416, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 11:12:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (417, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-06 11:12:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (418, 'doctor', 143, '채팅 요청', '192.168.3.11', '2019-12-06 11:12:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (419, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 11:12:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (420, 'user', 83, '채팅 연결', '172.16.31.10', '2019-12-06 11:13:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (421, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 11:13:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (422, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-06 11:13:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (423, 'doctor', 143, '채팅 요청', '192.168.3.11', '2019-12-06 11:13:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (424, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 11:13:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (425, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 11:15:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (426, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-06 11:15:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (427, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 11:15:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (428, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 11:17:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (429, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-06 11:17:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (430, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 11:17:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (431, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 11:17:26'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (432, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-06 11:17:26'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (433, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 11:17:26'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (434, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 11:17:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (435, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 11:17:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (436, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 11:18:08'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (437, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 11:18:08'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (438, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 11:18:42'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (439, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 11:18:42'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (440, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 11:18:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (441, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 11:18:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (442, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 11:19:06'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (443, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 11:19:06'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (444, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 11:19:38'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (445, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 11:19:38'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (446, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-06 11:23:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (447, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-06 11:23:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (448, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 11:23:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (449, 'user', 83, '채팅 연결', '172.16.31.10', '2019-12-06 11:23:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (450, 'doctor', 117, '채팅 메시지', '192.168.3.11', '2019-12-06 11:24:11'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (451, 'doctor', 117, '채팅 메시지', '192.168.3.11', '2019-12-06 11:25:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (452, 'doctor', 117, '채팅 메시지', '192.168.3.11', '2019-12-06 11:25:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (453, 'doctor', 117, '채팅 메시지', '192.168.3.11', '2019-12-06 11:25:38'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (454, 'doctor', 117, '채팅 메시지', '192.168.3.11', '2019-12-06 11:25:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (455, 'doctor', 111, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:39:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (456, 'doctor', 117, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:39:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (457, 'doctor', 147, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:39:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (458, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 11:40:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (459, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-06 11:40:25'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (460, 'doctor', 111, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:40:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (461, 'doctor', 117, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:40:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (462, 'doctor', 147, '관리자 단체 발송', '172.16.17.32', '2019-12-06 11:40:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (463, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-06 12:04:06'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (464, 'doctor', 147, '채팅 요청', '172.16.17.32', '2019-12-06 12:04:06'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (465, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-06 12:05:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (466, 'doctor', 147, '채팅 요청', '172.16.17.32', '2019-12-06 12:05:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (467, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-06 12:06:46'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (468, 'doctor', 147, '채팅 요청', '172.16.17.32', '2019-12-06 12:06:46'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (469, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-06 12:07:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (470, 'doctor', 147, '채팅 요청', '172.16.17.32', '2019-12-06 12:07:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (471, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-06 12:07:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (472, 'doctor', 147, '채팅 요청', '172.16.17.32', '2019-12-06 12:07:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (473, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 12:11:46'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (474, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-06 12:11:46'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (475, 'doctor', 147, '채팅 요청', '192.168.127.12', '2019-12-06 12:11:46'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (476, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 12:13:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (477, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-06 12:13:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (478, 'doctor', 147, '채팅 요청', '192.168.127.12', '2019-12-06 12:13:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (479, 'user', 84, '채팅 연결', '172.16.31.10', '2019-12-06 12:13:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (480, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 12:15:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (481, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-06 12:15:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (482, 'doctor', 147, '채팅 요청', '192.168.127.12', '2019-12-06 12:15:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (483, 'user', 84, '채팅 연결', '172.16.31.10', '2019-12-06 12:15:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (484, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 12:16:13'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (485, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-06 12:16:13'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (486, 'doctor', 147, '채팅 요청', '192.168.127.12', '2019-12-06 12:16:13'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (487, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 12:16:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (488, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-06 12:16:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (489, 'doctor', 147, '채팅 요청', '192.168.127.12', '2019-12-06 12:16:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (490, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 12:17:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (491, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-06 12:17:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (492, 'doctor', 147, '채팅 요청', '192.168.127.12', '2019-12-06 12:17:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (493, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 12:17:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (494, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-06 12:17:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (495, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 12:18:47'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (496, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-06 12:18:47'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (497, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 12:20:08'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (498, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-06 12:20:08'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (499, 'user', 84, '채팅 연결', '172.16.31.10', '2019-12-06 12:20:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (500, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 12:20:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (501, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-06 12:20:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (502, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 12:21:34'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (503, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-06 12:21:34'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (504, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 12:26:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (505, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-06 12:26:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (506, 'user', 84, '채팅 연결', '172.16.31.10', '2019-12-06 12:26:05'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (507, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 12:27:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (508, 'user', 84, '채팅 연결', '172.16.31.10', '2019-12-06 12:27:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (509, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 12:28:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (510, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:07:05'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (511, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:07:20'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (512, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:07:23'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (513, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:07:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (514, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:07:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (515, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:08:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (516, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:08:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (517, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:09:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (518, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:10:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (519, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:10:42'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (520, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:11:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (521, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:11:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (522, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:11:41'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (523, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:11:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (524, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:15:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (525, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:15:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (526, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:15:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (527, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:16:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (528, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:16:26'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (529, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:20:58'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (530, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:21:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (531, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:21:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (532, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:21:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (533, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:22:39'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (534, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:24:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (535, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:25:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (536, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:25:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (537, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:26:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (538, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:30:05'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (539, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:30:07'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (540, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:30:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (541, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:31:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (542, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:31:27'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (543, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:31:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (544, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:33:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (545, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:33:11'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (546, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:33:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (547, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:34:08'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (548, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:34:47'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (549, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:34:58'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (550, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:36:17'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (551, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:36:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (552, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:36:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (553, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:36:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (554, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:38:37'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (555, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:38:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (556, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:38:50'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (557, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:38:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (558, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:39:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (559, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:39:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (560, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:39:20'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (561, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:39:25'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (562, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:39:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (563, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:41:46'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (564, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:43:08'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (565, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:43:10'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (566, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:43:38'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (567, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:45:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (568, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:45:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (569, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:45:38'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (570, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:45:58'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (571, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:46:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (572, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:46:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (573, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:46:42'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (574, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:46:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (575, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:46:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (576, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:47:34'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (577, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:47:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (578, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:48:05'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (579, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:48:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (580, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:49:20'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (581, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:49:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (582, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:50:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (583, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:50:26'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (584, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:50:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (585, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:51:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (586, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:51:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (587, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:52:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (588, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:52:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (589, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:52:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (590, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:52:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (591, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:53:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (592, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:53:10'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (593, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:53:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (594, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:53:22'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (595, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:53:27'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (596, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:53:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (597, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:53:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (598, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:53:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (599, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:54:09'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (600, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:54:17'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (601, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:54:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (602, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:54:35'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (603, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:54:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (604, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:54:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (605, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:54:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (606, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:55:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (607, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:55:09'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (608, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:55:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (609, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:55:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (610, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:55:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (611, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:55:44'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (612, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:58:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (613, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:58:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (614, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:58:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (615, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:58:58'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (616, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:59:11'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (617, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 14:59:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (618, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 14:59:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (619, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 15:03:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (620, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-06 15:03:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (621, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-06 15:04:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (622, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 10:26:26'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (623, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 10:26:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (624, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 10:28:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (625, 'doctor', 111, '관리자 단체 발송', '172.16.31.10', '2019-12-08 10:29:13'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (626, 'doctor', 143, '관리자 단체 발송', '172.16.31.10', '2019-12-08 10:29:13'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (627, 'doctor', 147, '관리자 단체 발송', '172.16.31.10', '2019-12-08 10:29:13'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (628, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 10:29:47'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (629, 'user', 77, '관리자 단체 발송', '172.16.31.10', '2019-12-08 10:29:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (630, 'user', 83, '관리자 단체 발송', '172.16.31.10', '2019-12-08 10:29:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (631, 'user', 84, '관리자 단체 발송', '172.16.31.10', '2019-12-08 10:29:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (632, 'doctor', 111, '관리자 단체 발송', '172.16.31.10', '2019-12-08 10:29:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (633, 'doctor', 143, '관리자 단체 발송', '172.16.31.10', '2019-12-08 10:29:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (634, 'doctor', 147, '관리자 단체 발송', '172.16.31.10', '2019-12-08 10:29:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (635, 'doctor', 111, '관리자 단체 발송', '192.168.3.11', '2019-12-08 10:48:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (636, 'doctor', 143, '관리자 단체 발송', '192.168.3.11', '2019-12-08 10:48:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (637, 'doctor', 147, '관리자 단체 발송', '192.168.3.11', '2019-12-08 10:48:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (638, 'user', 77, '관리자 단체 발송', '172.16.31.10', '2019-12-08 10:55:58'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (639, 'user', 83, '관리자 단체 발송', '172.16.31.10', '2019-12-08 10:55:58'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (640, 'user', 84, '관리자 단체 발송', '172.16.31.10', '2019-12-08 10:55:58'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (641, 'doctor', 111, '관리자 단체 발송', '172.16.31.10', '2019-12-08 10:55:58'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (642, 'doctor', 143, '관리자 단체 발송', '172.16.31.10', '2019-12-08 10:55:58'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (643, 'doctor', 147, '관리자 단체 발송', '172.16.31.10', '2019-12-08 10:55:58'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (644, 'doctor', 111, '관리자 단체 발송', '172.16.31.10', '2019-12-08 10:56:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (645, 'doctor', 143, '관리자 단체 발송', '172.16.31.10', '2019-12-08 10:56:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (646, 'doctor', 147, '관리자 단체 발송', '172.16.31.10', '2019-12-08 10:56:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (647, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 10:57:11'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (648, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 11:01:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (649, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 11:21:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (650, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 12:40:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (651, 'doctor', 103, '채팅 요청', '192.168.127.12', '2019-12-08 15:01:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (652, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 15:01:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (653, 'doctor', 103, '채팅 요청', '192.168.127.12', '2019-12-08 15:09:44'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (654, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 15:09:44'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (655, 'doctor', 103, '채팅 요청', '192.168.127.12', '2019-12-08 15:09:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (656, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 15:09:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (657, 'doctor', 103, '채팅 요청', '192.168.127.12', '2019-12-08 15:10:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (658, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 15:10:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (659, 'doctor', 103, '채팅 요청', '192.168.127.12', '2019-12-08 15:17:09'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (660, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 15:17:09'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (661, 'doctor', 103, '채팅 요청', '192.168.127.12', '2019-12-08 15:19:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (662, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 15:19:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (663, 'doctor', 103, '채팅 요청', '192.168.127.12', '2019-12-08 15:42:27'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (664, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 15:42:27'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (665, 'doctor', 103, '채팅 요청', '192.168.127.12', '2019-12-08 15:42:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (666, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 15:42:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (667, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 16:04:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (668, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 16:48:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (669, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 16:55:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (670, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 16:56:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (671, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 16:56:58'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (672, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 16:58:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (673, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 17:00:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (674, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 17:02:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (675, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 17:06:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (676, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 17:06:47'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (677, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 17:11:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (678, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 19:45:50'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (679, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-08 19:55:17'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (680, 'doctor', 103, '관리자 단체 발송', '172.16.31.10', '2019-12-10 00:02:20'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (681, 'doctor', 111, '관리자 단체 발송', '172.16.31.10', '2019-12-10 00:02:20'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (682, 'doctor', 147, '관리자 단체 발송', '172.16.31.10', '2019-12-10 00:02:20'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (683, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-10 00:46:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (684, 'user', 84, '채팅 연결', '192.168.3.11', '2019-12-10 00:46:20'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (685, 'user', 84, '채팅 메시지', '192.168.127.1219', '2019-12-10 00:46:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (686, 'doctor', 111, '채팅 요청', '172.16.31.10', '2019-12-11 00:32:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (687, 'user', 84, '채팅 연결', '172.16.31.10', '2019-12-11 00:32:26'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (688, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-11 00:32:34'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (689, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-11 00:32:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (690, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-11 00:32:46'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (691, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-11 00:32:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (692, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-11 00:32:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (693, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-11 00:33:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (694, 'doctor', 111, '채팅 요청', '172.16.58.3', '2019-12-12 01:48:47'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (695, 'doctor', 111, '채팅 요청', '172.16.31.10', '2019-12-12 14:03:44'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (696, 'user', 84, '채팅 연결', '172.16.31.10', '2019-12-12 14:03:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (697, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-12 14:04:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (698, 'doctor', 111, '채팅 요청', '172.16.58.3', '2019-12-13 00:16:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (699, 'doctor', 111, '채팅 요청', '172.16.58.3', '2019-12-13 00:18:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (700, 'doctor', 147, '채팅 요청', '172.16.58.3', '2019-12-13 00:18:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (701, 'user', 85, '채팅 연결', '172.16.17.32', '2019-12-13 00:18:20'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (702, 'user', 85, '채팅 메시지', '172.16.17.32', '2019-12-13 00:18:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (703, 'user', 77, '관리자 발송', '172.16.17.32', '2019-12-13 00:43:41'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (704, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-13 11:04:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (705, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-13 11:04:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (706, 'doctor', 117, '채팅 메시지', '192.168.127.12', '2019-12-13 11:05:25'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (707, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-13 11:07:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (708, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-13 11:07:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (709, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-13 11:07:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (710, 'doctor', 117, '채팅 요청', '192.168.127.12', '2019-12-13 11:07:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (711, 'doctor', 111, '채팅 메시지', '192.168.127.12', '2019-12-13 11:08:20'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (712, 'doctor', 111, '채팅 메시지', '192.168.127.12', '2019-12-13 11:12:34'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (713, 'doctor', 117, '채팅 메시지', '192.168.127.12', '2019-12-13 11:13:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (714, 'doctor', 117, '채팅 메시지', '192.168.127.12', '2019-12-13 11:13:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (715, 'doctor', 117, '채팅 메시지', '192.168.127.12', '2019-12-13 11:14:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (716, 'doctor', 111, '채팅 요청', '172.16.31.10', '2019-12-16 18:31:47'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (717, 'doctor', 111, '채팅 요청', '172.16.31.10', '2019-12-16 18:34:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (718, 'user', 84, '채팅 연결', '172.16.31.10', '2019-12-16 18:34:27'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (719, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-17 17:47:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (720, 'user', 84, '채팅 연결', '172.16.17.32', '2019-12-17 17:47:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (721, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-17 17:52:10'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (722, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-17 17:52:27'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (723, 'user', 84, '채팅 연결', '172.16.17.32', '2019-12-17 17:52:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (724, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-17 17:54:50'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (725, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-17 18:09:06'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (726, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-17 18:12:07'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (727, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-17 18:14:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (728, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-17 18:16:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (729, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-17 18:16:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (730, 'user', 84, '채팅 연결', '172.16.17.32', '2019-12-17 18:16:17'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (731, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-17 18:16:44'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (732, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-17 18:26:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (733, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-17 18:34:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (734, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-17 18:35:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (735, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-18 13:28:09'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (736, 'user', 84, '채팅 연결', '192.168.3.11', '2019-12-18 13:28:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (737, 'user', 84, '채팅 메시지', '192.168.3.11', '2019-12-18 13:28:23'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (738, 'doctor', 111, '채팅 메시지', '192.168.3.11', '2019-12-18 13:28:34'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (739, 'user', 84, '채팅 메시지', '192.168.3.11', '2019-12-18 13:48:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (740, 'user', 84, '채팅 메시지', '192.168.3.11', '2019-12-18 13:49:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (741, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-18 14:13:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (742, 'user', 84, '채팅 연결', '192.168.3.11', '2019-12-18 14:13:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (743, 'user', 84, '채팅 메시지', '192.168.3.11', '2019-12-18 14:13:35'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (744, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-18 14:37:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (745, 'user', 84, '채팅 연결', '192.168.3.11', '2019-12-18 14:37:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (746, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-18 19:12:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (747, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-19 20:20:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (748, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-19 20:20:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (749, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-19 20:20:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (750, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-19 20:20:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (751, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-19 20:20:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (752, 'user', 84, '채팅 연결', '192.168.3.11', '2019-12-19 20:21:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (753, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-19 21:16:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (754, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-19 21:16:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (755, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-19 21:16:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (756, 'user', 84, '채팅 연결', '192.168.3.11', '2019-12-19 21:16:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (757, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-19 21:23:15'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (758, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-19 21:23:15'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (759, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-19 21:23:15'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (760, 'user', 84, '채팅 연결', '192.168.3.11', '2019-12-19 21:23:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (761, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-19 21:41:44'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (762, 'doctor', 117, '채팅 요청', '192.168.3.11', '2019-12-19 21:41:44'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (763, 'doctor', 147, '채팅 요청', '192.168.3.11', '2019-12-19 21:41:44'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (764, 'doctor', 111, '채팅 요청', '192.168.127.12', '2019-12-21 19:04:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (765, 'user', 84, '채팅 연결', '192.168.127.12', '2019-12-21 19:04:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (766, 'user', 84, '채팅 메시지', '192.168.127.12', '2019-12-21 19:04:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (767, 'doctor', 111, '채팅 요청', '192.168.3.11', '2019-12-25 03:00:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (768, 'user', 84, '채팅 연결', '192.168.3.11', '2019-12-25 03:00:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (769, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-29 15:11:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (770, 'doctor', 117, '채팅 요청', '172.16.17.32', '2019-12-29 15:11:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (771, 'doctor', 143, '채팅 요청', '172.16.17.32', '2019-12-29 15:11:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (772, 'doctor', 147, '채팅 요청', '172.16.17.32', '2019-12-29 15:11:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (773, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-29 15:12:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (774, 'doctor', 117, '채팅 요청', '172.16.17.32', '2019-12-29 15:12:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (775, 'doctor', 143, '채팅 요청', '172.16.17.32', '2019-12-29 15:12:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (776, 'doctor', 147, '채팅 요청', '172.16.17.32', '2019-12-29 15:12:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (777, 'user', 84, '채팅 연결', '172.16.31.10', '2019-12-29 15:12:50'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (778, 'doctor', 143, '채팅 메시지', '172.16.17.32', '2019-12-29 15:13:05'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (779, 'doctor', 143, '채팅 메시지', '172.16.17.32', '2019-12-29 15:13:23'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (780, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-29 15:13:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (781, 'doctor', 143, '채팅 메시지', '172.16.17.32', '2019-12-29 15:14:07'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (782, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-29 15:14:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (783, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-29 15:14:26'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (784, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-29 15:14:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (785, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-29 15:14:35'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (786, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-29 15:14:39'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (787, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-29 15:14:43'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (788, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-29 15:14:47'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (789, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-29 15:14:50'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (790, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-29 15:14:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (791, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-29 15:14:58'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (792, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-29 15:15:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (793, 'doctor', 143, '채팅 메시지', '172.16.17.32', '2019-12-29 15:15:41'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (794, 'doctor', 143, '채팅 메시지', '172.16.17.32', '2019-12-29 15:15:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (795, 'doctor', 143, '채팅 메시지', '172.16.17.32', '2019-12-29 15:15:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (796, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-29 15:19:13'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (797, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-29 18:57:39'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (798, 'doctor', 117, '채팅 요청', '172.16.17.32', '2019-12-29 18:57:39'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (799, 'doctor', 147, '채팅 요청', '172.16.17.32', '2019-12-29 18:57:39'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (800, 'doctor', 111, '채팅 요청', '172.16.17.32', '2019-12-29 18:58:07'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (801, 'doctor', 117, '채팅 요청', '172.16.17.32', '2019-12-29 18:58:07'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (802, 'doctor', 143, '채팅 요청', '172.16.17.32', '2019-12-29 18:58:07'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (803, 'doctor', 147, '채팅 요청', '172.16.17.32', '2019-12-29 18:58:07'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (804, 'user', 84, '채팅 연결', '172.16.31.10', '2019-12-29 18:58:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (805, 'user', 84, '채팅 메시지', '172.16.31.10', '2019-12-29 18:59:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (806, 'doctor', 103, '출금 신청 수락', '172.16.31.10', '2020-01-02 13:04:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (807, 'doctor', 111, '출금 신청 거절', '192.168.3.11', '2020-01-02 18:37:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (808, 'doctor', 103, '채팅 요청', '192.168.3.11', '2020-01-02 18:38:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (809, 'doctor', 111, '채팅 요청', '192.168.3.11', '2020-01-02 18:38:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (810, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-02 18:38:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (811, 'doctor', 147, '채팅 요청', '192.168.3.11', '2020-01-02 18:38:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (812, 'user', 78, '채팅 연결', '192.168.3.11', '2020-01-02 18:38:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (813, 'user', 78, '채팅 메시지', '192.168.3.11', '2020-01-02 18:39:08'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (814, 'doctor', 111, '채팅 메시지', '192.168.3.11', '2020-01-02 18:39:09'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (815, 'user', 78, '채팅 메시지', '192.168.3.11', '2020-01-02 18:39:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (816, 'doctor', 111, '채팅 메시지', '192.168.3.11', '2020-01-02 18:39:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (817, 'user', 78, '채팅 메시지', '192.168.3.11', '2020-01-02 18:39:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (818, 'user', 78, '환불 신청 거절', '192.168.3.11', '2020-01-02 18:43:09'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (819, 'user', 86, '환불 신청 거절', '192.168.127.12', '2020-01-02 19:50:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (820, 'doctor', 103, '채팅 요청', '192.168.3.11', '2020-01-02 19:55:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (821, 'doctor', 111, '채팅 요청', '192.168.3.11', '2020-01-02 19:55:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (822, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-02 19:55:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (823, 'doctor', 147, '채팅 요청', '192.168.3.11', '2020-01-02 19:55:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (824, 'doctor', 103, '채팅 요청', '192.168.3.11', '2020-01-02 19:56:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (825, 'doctor', 111, '채팅 요청', '192.168.3.11', '2020-01-02 19:56:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (826, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-02 19:56:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (827, 'doctor', 147, '채팅 요청', '192.168.3.11', '2020-01-02 19:56:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (828, 'doctor', 103, '채팅 요청', '192.168.3.11', '2020-01-02 20:04:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (829, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-02 20:04:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (830, 'doctor', 147, '채팅 요청', '192.168.3.11', '2020-01-02 20:04:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (831, 'doctor', 171, '채팅 요청', '192.168.3.11', '2020-01-02 20:04:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (832, 'user', 78, '채팅 연결', '192.168.3.11', '2020-01-02 20:04:43'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (833, 'user', 78, '채팅 메시지', '192.168.3.11', '2020-01-02 20:04:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (834, 'doctor', 103, '채팅 요청', '192.168.3.11', '2020-01-02 20:06:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (835, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-02 20:06:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (836, 'doctor', 147, '채팅 요청', '192.168.3.11', '2020-01-02 20:06:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (837, 'doctor', 171, '채팅 요청', '192.168.3.11', '2020-01-02 20:06:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (838, 'user', 78, '채팅 연결', '192.168.3.11', '2020-01-02 20:06:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (839, 'user', 78, '채팅 메시지', '192.168.3.11', '2020-01-02 20:07:08'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (840, 'doctor', 147, '채팅 요청', '192.168.3.11', '2020-01-02 20:45:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (841, 'doctor', 171, '채팅 요청', '192.168.3.11', '2020-01-02 20:45:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (842, 'user', 85, '채팅 연결', '192.168.3.11', '2020-01-02 20:46:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (843, 'user', 85, '채팅 메시지', '192.168.3.11', '2020-01-02 20:46:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (844, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-02 20:46:13'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (845, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-02 20:46:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (846, 'user', 85, '채팅 메시지', '192.168.3.11', '2020-01-02 20:46:20'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (847, 'user', 85, '채팅 메시지', '192.168.3.11', '2020-01-02 20:46:43'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (848, 'doctor', 103, '채팅 요청', '172.16.17.32', '2020-01-02 22:33:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (849, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-02 22:33:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (850, 'doctor', 147, '채팅 요청', '172.16.17.32', '2020-01-02 22:33:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (851, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-02 22:33:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (852, 'user', 84, '채팅 연결', '172.16.17.32', '2020-01-02 22:33:07'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (853, 'user', 84, '채팅 메시지', '172.16.17.32', '2020-01-02 22:33:20'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (854, 'user', 84, '관리자 단체 발송', '2172.16.58.3', '2020-01-03 16:40:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (855, 'user', 85, '관리자 단체 발송', '192.168.3.11', '2020-01-03 16:40:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (856, 'user', 86, '관리자 단체 발송', '192.168.3.11', '2020-01-03 16:40:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (857, 'doctor', 103, '관리자 단체 발송', '192.168.3.11', '2020-01-03 16:40:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (858, 'doctor', 106, '관리자 단체 발송', '192.168.3.11', '2020-01-03 16:40:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (859, 'doctor', 115, '관리자 단체 발송', '192.168.3.11', '2020-01-03 16:40:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (860, 'doctor', 116, '관리자 단체 발송', '192.168.3.11', '2020-01-03 16:40:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (861, 'doctor', 117, '관리자 단체 발송', '192.168.3.11', '2020-01-03 16:40:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (862, 'doctor', 147, '관리자 단체 발송', '192.168.3.11', '2020-01-03 16:40:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (863, 'doctor', 167, '관리자 단체 발송', '192.168.3.11', '2020-01-03 16:40:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (864, 'doctor', 171, '관리자 단체 발송', '192.168.3.11', '2020-01-03 16:40:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (865, 'user', 85, '환불 신청 거절', '172.16.31.10', '2020-01-07 18:16:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (866, 'doctor', 117, '채팅 요청', '172.16.58.3', '2020-01-07 18:36:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (867, 'doctor', 147, '채팅 요청', '172.16.58.3', '2020-01-07 18:36:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (868, 'doctor', 117, '채팅 요청', '172.16.58.3', '2020-01-07 19:29:20'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (869, 'doctor', 147, '채팅 요청', '172.16.58.3', '2020-01-07 19:29:20'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (870, 'doctor', 117, '채팅 요청', '172.16.58.3', '2020-01-07 19:40:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (871, 'doctor', 143, '채팅 요청', '172.16.58.3', '2020-01-07 19:40:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (872, 'doctor', 147, '채팅 요청', '172.16.58.3', '2020-01-07 19:40:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (873, 'doctor', 117, '채팅 요청', '172.16.58.3', '2020-01-07 19:41:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (874, 'doctor', 143, '채팅 요청', '172.16.58.3', '2020-01-07 19:41:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (875, 'doctor', 147, '채팅 요청', '172.16.58.3', '2020-01-07 19:41:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (876, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-07 19:41:34'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (877, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-07 19:41:46'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (878, 'doctor', 143, '채팅 메시지', '172.16.58.3', '2020-01-07 19:41:50'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (879, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-07 19:43:08'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (880, 'doctor', 143, '채팅 메시지', '172.16.58.3', '2020-01-07 19:43:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (881, 'doctor', 103, '채팅 요청', '192.168.3.11', '2020-01-07 20:55:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (882, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-07 20:55:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (883, 'doctor', 147, '채팅 요청', '192.168.3.11', '2020-01-07 20:55:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (884, 'doctor', 171, '채팅 요청', '192.168.3.11', '2020-01-07 20:55:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (885, 'user', 84, '채팅 연결', '192.168.3.11', '2020-01-07 20:55:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (886, 'user', 84, '채팅 메시지', '192.168.3.11', '2020-01-07 20:56:07'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (887, 'user', 84, '채팅 메시지', '192.168.3.11', '2020-01-07 20:57:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (888, 'doctor', 103, '채팅 요청', '192.168.3.11', '2020-01-07 20:57:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (889, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-07 20:57:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (890, 'doctor', 147, '채팅 요청', '192.168.3.11', '2020-01-07 20:57:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (891, 'doctor', 171, '채팅 요청', '192.168.3.11', '2020-01-07 20:57:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (892, 'user', 84, '채팅 연결', '192.168.3.11', '2020-01-07 20:57:39'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (893, 'user', 84, '채팅 메시지', '192.168.3.11', '2020-01-07 20:57:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (894, 'user', 84, '채팅 메시지', '192.168.3.11', '2020-01-07 20:58:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (895, 'user', 84, '채팅 메시지', '192.168.3.11', '2020-01-07 20:59:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (896, 'doctor', 103, '채팅 요청', '192.168.3.11', '2020-01-07 21:00:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (897, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-07 21:00:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (898, 'doctor', 147, '채팅 요청', '192.168.3.11', '2020-01-07 21:00:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (899, 'doctor', 171, '채팅 요청', '192.168.3.11', '2020-01-07 21:00:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (900, 'user', 84, '채팅 연결', '192.168.3.11', '2020-01-07 21:00:44'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (901, 'doctor', 103, '채팅 요청', '192.168.3.11', '2020-01-07 21:02:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (902, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-07 21:02:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (903, 'doctor', 147, '채팅 요청', '192.168.3.11', '2020-01-07 21:02:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (904, 'doctor', 171, '채팅 요청', '192.168.3.11', '2020-01-07 21:02:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (905, 'user', 84, '채팅 연결', '192.168.3.11', '2020-01-07 21:02:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (906, 'doctor', 103, '채팅 요청', '192.168.3.11', '2020-01-07 21:06:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (907, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-07 21:06:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (908, 'doctor', 147, '채팅 요청', '192.168.3.11', '2020-01-07 21:06:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (909, 'doctor', 171, '채팅 요청', '192.168.3.11', '2020-01-07 21:06:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (910, 'user', 84, '채팅 연결', '192.168.3.11', '2020-01-07 21:06:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (911, 'doctor', 103, '채팅 요청', '192.168.3.11', '2020-01-07 21:09:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (912, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-07 21:09:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (913, 'doctor', 147, '채팅 요청', '192.168.3.11', '2020-01-07 21:09:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (914, 'doctor', 171, '채팅 요청', '192.168.3.11', '2020-01-07 21:09:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (915, 'user', 84, '채팅 연결', '192.168.3.11', '2020-01-07 21:09:07'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (916, 'user', 84, '채팅 메시지', '192.168.3.11', '2020-01-07 21:24:09'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (917, 'doctor', 103, '채팅 요청', '172.16.58.3', '2020-01-08 14:10:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (918, 'doctor', 117, '채팅 요청', '172.16.58.3', '2020-01-08 14:10:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (919, 'doctor', 147, '채팅 요청', '172.16.58.3', '2020-01-08 14:10:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (920, 'doctor', 171, '채팅 요청', '172.16.58.3', '2020-01-08 14:10:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (921, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-08 14:10:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (922, 'doctor', 103, '채팅 메시지', '172.16.58.3', '2020-01-08 14:10:43'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (923, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-08 14:10:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (924, 'doctor', 103, '채팅 메시지', '172.16.58.3', '2020-01-08 14:11:09'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (925, 'doctor', 103, '채팅 메시지', '172.16.58.3', '2020-01-08 14:11:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (926, 'doctor', 103, '채팅 메시지', '172.16.58.3', '2020-01-08 14:11:17'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (927, 'doctor', 103, '채팅 메시지', '172.16.58.3', '2020-01-08 14:11:22'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (928, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-08 14:11:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (929, 'doctor', 103, '채팅 메시지', '172.16.58.3', '2020-01-08 14:11:41'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (930, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-08 14:13:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (931, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-08 14:14:20'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (932, 'doctor', 103, '채팅 요청', '172.16.58.3', '2020-01-08 14:46:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (933, 'doctor', 117, '채팅 요청', '172.16.58.3', '2020-01-08 14:46:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (934, 'doctor', 147, '채팅 요청', '172.16.58.3', '2020-01-08 14:46:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (935, 'doctor', 171, '채팅 요청', '172.16.58.3', '2020-01-08 14:46:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (936, 'doctor', 103, '채팅 요청', '172.16.58.3', '2020-01-08 14:46:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (937, 'doctor', 117, '채팅 요청', '172.16.58.3', '2020-01-08 14:46:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (938, 'doctor', 147, '채팅 요청', '172.16.58.3', '2020-01-08 14:46:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (939, 'doctor', 171, '채팅 요청', '172.16.58.3', '2020-01-08 14:46:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (940, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-08 14:47:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (941, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-08 14:47:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (942, 'doctor', 103, '채팅 메시지', '172.16.58.3', '2020-01-08 14:50:34'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (943, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-08 14:51:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (944, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-08 14:51:07'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (945, 'doctor', 103, '채팅 요청', '192.168.3.11', '2020-01-08 15:51:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (946, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-08 15:51:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (947, 'doctor', 147, '채팅 요청', '192.168.3.11', '2020-01-08 15:51:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (948, 'doctor', 171, '채팅 요청', '192.168.3.11', '2020-01-08 15:51:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (949, 'user', 84, '채팅 연결', '192.168.3.11', '2020-01-08 15:51:28'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (950, 'doctor', 103, '채팅 요청', '192.168.3.11', '2020-01-08 15:51:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (951, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-08 15:51:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (952, 'doctor', 147, '채팅 요청', '192.168.3.11', '2020-01-08 15:51:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (953, 'doctor', 171, '채팅 요청', '192.168.3.11', '2020-01-08 15:51:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (954, 'user', 84, '채팅 연결', '192.168.3.11', '2020-01-08 15:51:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (955, 'doctor', 103, '채팅 요청', '172.16.58.3', '2020-01-08 16:03:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (956, 'doctor', 117, '채팅 요청', '172.16.58.3', '2020-01-08 16:03:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (957, 'doctor', 147, '채팅 요청', '172.16.58.3', '2020-01-08 16:03:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (958, 'doctor', 171, '채팅 요청', '172.16.58.3', '2020-01-08 16:03:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (959, 'user', 85, '채팅 연결', '192.168.3.11', '2020-01-08 16:03:22'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (960, 'doctor', 103, '채팅 요청', '172.16.58.3', '2020-01-08 16:33:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (961, 'doctor', 117, '채팅 요청', '172.16.58.3', '2020-01-08 16:33:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (962, 'doctor', 147, '채팅 요청', '172.16.58.3', '2020-01-08 16:33:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (963, 'doctor', 171, '채팅 요청', '172.16.58.3', '2020-01-08 16:33:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (964, 'doctor', 103, '채팅 요청', '172.16.58.3', '2020-01-08 16:34:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (965, 'doctor', 117, '채팅 요청', '172.16.58.3', '2020-01-08 16:34:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (966, 'doctor', 147, '채팅 요청', '172.16.58.3', '2020-01-08 16:34:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (967, 'doctor', 171, '채팅 요청', '172.16.58.3', '2020-01-08 16:34:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (968, 'doctor', 117, '채팅 요청', '172.16.58.3', '2020-01-08 16:34:25'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (969, 'doctor', 147, '채팅 요청', '172.16.58.3', '2020-01-08 16:34:25'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (970, 'doctor', 171, '채팅 요청', '172.16.58.3', '2020-01-08 16:34:25'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (971, 'doctor', 117, '채팅 요청', '172.16.58.3', '2020-01-08 16:34:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (972, 'doctor', 147, '채팅 요청', '172.16.58.3', '2020-01-08 16:34:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (973, 'doctor', 171, '채팅 요청', '172.16.58.3', '2020-01-08 16:34:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (974, 'user', 85, '채팅 연결', '192.168.3.11', '2020-01-08 16:35:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (975, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-09 11:34:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (976, 'doctor', 147, '채팅 요청', '192.168.3.11', '2020-01-09 11:34:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (977, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-09 12:13:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (978, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 15:06:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (979, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 15:06:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (980, 'user', 85, '채팅 연결', '192.168.3.11', '2020-01-09 15:06:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (981, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 15:06:44'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (982, 'user', 85, '채팅 메시지', '192.168.3.11', '2020-01-09 15:06:46'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (983, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 15:06:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (984, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 15:07:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (985, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 15:07:34'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (986, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 15:09:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (987, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 15:09:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (988, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 15:10:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (989, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 15:10:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (990, 'user', 85, '채팅 연결', '192.168.3.11', '2020-01-09 15:10:47'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (991, 'user', 85, '채팅 메시지', '192.168.3.11', '2020-01-09 15:10:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (992, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 15:11:06'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (993, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 15:11:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (994, 'user', 85, '채팅 메시지', '192.168.3.11', '2020-01-09 15:11:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (995, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 15:14:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (996, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 15:23:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (997, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 15:23:38'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (998, 'user', 85, '채팅 메시지', '192.168.3.11', '2020-01-09 15:24:11'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (999, 'user', 85, '채팅 메시지', '192.168.3.11', '2020-01-09 15:24:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1000, 'user', 85, '채팅 메시지', '192.168.3.11', '2020-01-09 15:24:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1001, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 15:24:42'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1002, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 15:41:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1003, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 15:41:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1004, 'user', 85, '채팅 연결', '192.168.3.11', '2020-01-09 15:41:11'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1005, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 15:41:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1006, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 15:41:58'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1007, 'user', 85, '채팅 메시지', '192.168.3.11', '2020-01-09 15:42:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1008, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 15:56:23'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1009, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 15:56:23'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1010, 'user', 85, '채팅 연결', '192.168.3.11', '2020-01-09 15:56:37'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1011, 'user', 85, '채팅 메시지', '192.168.3.11', '2020-01-09 15:56:46'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1012, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 16:00:15'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1013, 'doctor', 103, '채팅 요청', '172.16.17.32', '2020-01-09 16:26:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1014, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 16:26:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1015, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 16:26:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1016, 'user', 85, '채팅 연결', '172.16.17.32', '2020-01-09 16:26:22'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1017, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2020-01-09 16:26:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1018, 'user', 85, '채팅 메시지', '172.16.17.32', '2020-01-09 16:26:43'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1019, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2020-01-09 16:26:44'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1020, 'doctor', 103, '채팅 메시지', '172.16.17.32', '2020-01-09 16:27:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1021, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-09 16:27:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1022, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 16:31:38'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1023, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 16:31:38'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1024, 'user', 85, '채팅 연결', '192.168.3.11', '2020-01-09 16:31:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1025, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 16:33:46'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1026, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 16:33:46'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1027, 'user', 85, '채팅 연결', '192.168.3.11', '2020-01-09 16:33:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1028, 'user', 85, '채팅 메시지', '192.168.3.11', '2020-01-09 16:33:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1029, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 16:33:58'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1030, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 16:34:13'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1031, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 16:34:15'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1032, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 16:43:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1033, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 16:43:36'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1034, 'user', 85, '채팅 연결', '192.168.3.11', '2020-01-09 16:43:42'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1035, 'user', 85, '채팅 메시지', '192.168.3.11', '2020-01-09 16:43:50'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1036, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 16:43:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1037, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-09 16:53:06'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1038, 'doctor', 103, '채팅 메시지', '192.168.3.11', '2020-01-09 16:58:58'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1039, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 17:02:17'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1040, 'doctor', 103, '채팅 메시지', '192.168.3.11', '2020-01-09 17:03:25'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1041, 'doctor', 103, '채팅 메시지', '192.168.3.11', '2020-01-09 17:04:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1042, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-09 17:20:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1043, 'doctor', 171, '채팅 요청', '192.168.3.11', '2020-01-09 17:20:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1044, 'user', 77, '채팅 연결', '192.168.3.11', '2020-01-09 17:20:42'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1045, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 17:21:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1046, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 17:21:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1047, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 17:21:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1048, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 17:21:20'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1049, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 17:21:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1050, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 17:21:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1051, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 17:22:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1052, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 17:26:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1053, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 17:37:43'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1054, 'user', 85, '채팅 연결', '192.168.3.11', '2020-01-09 17:37:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1055, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 17:38:47'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1056, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 17:38:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1057, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 17:40:20'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1058, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-09 17:49:11'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1059, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-09 17:50:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1060, 'doctor', 171, '채팅 요청', '192.168.3.11', '2020-01-09 17:50:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1061, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 17:51:26'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1062, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 17:51:41'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1063, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 17:51:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1064, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 17:52:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1065, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 17:54:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1066, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 17:54:34'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1067, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 17:54:42'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1068, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 17:54:48'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1069, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 17:55:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1070, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 17:55:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1071, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 17:55:05'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1072, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 17:55:09'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1073, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-09 18:58:27'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1074, 'doctor', 171, '채팅 요청', '192.168.3.11', '2020-01-09 18:58:27'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1075, 'user', 77, '채팅 연결', '192.168.3.11', '2020-01-09 18:58:35'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1076, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 18:58:44'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1077, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 18:58:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1078, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 19:03:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1079, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 19:03:43'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1080, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 19:03:47'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1081, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 19:04:25'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1082, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 19:04:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1083, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 19:07:41'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1084, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 19:07:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1085, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 19:07:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1086, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 19:08:23'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1087, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 19:08:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1088, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 19:09:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1089, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 19:09:26'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1090, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 19:10:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1091, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 19:10:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1092, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 19:10:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1093, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 19:10:50'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1094, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 19:11:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1095, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 19:12:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1096, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 19:12:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1097, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 19:13:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1098, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 19:13:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1099, 'doctor', 171, '채팅 메시지', '192.168.3.11', '2020-01-09 19:17:06'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1100, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 19:17:27'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1101, 'user', 77, '채팅 메시지', '192.168.3.11', '2020-01-09 19:18:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1102, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 19:36:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1103, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 19:37:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1104, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 19:38:11'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1105, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 19:39:46'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1106, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 19:43:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1107, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 19:44:15'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1108, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 19:44:41'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1109, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 19:45:11'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1110, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 19:45:35'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1111, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 19:45:35'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1112, 'user', 85, '채팅 연결', '192.168.3.11', '2020-01-09 19:45:43'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1113, 'user', 85, '채팅 메시지', '192.168.3.11', '2020-01-09 19:45:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1114, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 19:46:16'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1115, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 19:46:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1116, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 19:49:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1117, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 19:49:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1118, 'user', 85, '채팅 연결', '192.168.3.11', '2020-01-09 19:49:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1119, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 19:54:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1120, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 19:54:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1121, 'user', 85, '채팅 연결', '192.168.3.11', '2020-01-09 19:54:40'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1122, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 19:57:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1123, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 19:57:56'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1124, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 19:58:02'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1125, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-09 19:58:11'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1126, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 19:59:06'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1127, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 19:59:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1128, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-09 19:59:27'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1129, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-09 19:59:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1130, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 19:59:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1131, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 20:00:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1132, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 20:08:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1133, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 20:08:08'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1134, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-09 20:08:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1135, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 20:19:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1136, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 20:19:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1137, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 20:19:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1138, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-09 20:20:01'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1139, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-09 20:20:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1140, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 20:20:34'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1141, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 20:21:15'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1142, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 20:23:09'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1143, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 20:24:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1144, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 20:24:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1145, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 20:24:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1146, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 20:30:06'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1147, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 20:30:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1148, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 20:33:08'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1149, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 20:37:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1150, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 20:39:42'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1151, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 20:41:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1152, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 20:41:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1153, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 20:41:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1154, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 20:41:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1155, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 20:42:25'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1156, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 20:42:25'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1157, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 20:42:29'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1158, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 20:42:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1159, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 20:43:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1160, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 21:04:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1161, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 21:04:32'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1162, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 21:04:38'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1163, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-09 21:04:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1164, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 21:05:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1165, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 21:05:57'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1166, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 21:06:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1167, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-09 21:06:13'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1168, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 21:06:20'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1169, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 21:17:47'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1170, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 21:17:47'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1171, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 21:17:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1172, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-09 21:18:03'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1173, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 21:18:07'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1174, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 21:18:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1175, 'doctor', 171, '채팅 메시지', '192.168.127.125', '2020-01-09 21:18:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1176, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-09 21:18:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1177, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-09 21:18:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1178, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-09 21:19:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1179, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 21:49:23'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1180, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 21:49:23'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1181, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 21:49:45'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1182, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-09 21:49:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1183, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 21:50:58'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1184, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 21:51:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1185, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 21:51:18'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1186, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 21:51:20'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1187, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 21:51:34'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1188, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 22:00:39'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1189, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 22:00:39'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1190, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 22:01:08'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1191, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-09 22:01:23'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1192, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 22:02:34'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1193, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 22:02:34'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1194, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 22:02:39'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1195, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 22:03:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1196, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 22:03:30'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1197, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 22:03:33'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1198, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 22:04:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1199, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 22:04:19'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1200, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 22:04:22'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1201, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 22:04:55'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1202, 'doctor', 171, '채팅 메시지', '172.16.17.32', '2020-01-09 22:05:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1203, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 22:06:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1204, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 22:06:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1205, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 22:06:27'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1206, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 22:06:27'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1207, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 22:06:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1208, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 22:06:52'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1209, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 22:07:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1210, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 22:07:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1211, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 22:07:38'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1212, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 22:07:38'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1213, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 22:07:41'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1214, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 22:09:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1215, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 22:09:21'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1216, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 22:09:25'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1217, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-09 22:09:38'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1218, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 22:11:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1219, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 22:11:31'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1220, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 22:11:37'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1221, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-09 22:11:47'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1222, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 22:13:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1223, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 22:13:49'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1224, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 22:13:54'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1225, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 22:14:22'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1226, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 22:14:22'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1227, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 22:14:24'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1228, 'user', 85, '채팅 메시지', '172.16.31.10', '2020-01-09 22:14:51'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1229, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 22:16:47'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1230, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 22:16:53'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1231, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 22:17:10'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1232, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 22:17:12'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1233, 'doctor', 117, '채팅 요청', '172.16.17.32', '2020-01-09 22:18:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1234, 'doctor', 171, '채팅 요청', '172.16.17.32', '2020-01-09 22:18:00'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1235, 'user', 85, '채팅 연결', '172.16.31.10', '2020-01-09 22:18:04'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1236, 'doctor', 117, '채팅 요청', '172.16.58.3', '2020-01-09 22:39:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1237, 'doctor', 171, '채팅 요청', '172.16.58.3', '2020-01-09 22:39:59'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1238, 'doctor', 117, '채팅 요청', '192.168.127.12', '2020-01-10 13:54:08'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1239, 'doctor', 117, '채팅 요청', '192.168.3.11', '2020-01-22 22:13:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1240, 'doctor', 171, '채팅 요청', '192.168.3.11', '2020-01-22 22:13:14'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1241, 'doctor', 117, '채팅 요청', '172.16.58.3', '2020-01-26 13:50:35'); INSERT INTO `fcm_log` (`id`, `id_type`, `fcm_id`, `type`, `ip_address`, `created_at`) VALUES (1242, 'doctor', 171, '채팅 요청', '172.16.58.3', '2020-01-26 13:50:35'); /*!40000 ALTER TABLE `fcm_log` ENABLE KEYS */; -- 테이블 MerDog.hospital_info 구조 내보내기 CREATE TABLE IF NOT EXISTS `hospital_info` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '병원 번호', `doctor_id` int(11) NOT NULL COMMENT '의사 번호', `name` varchar(50) DEFAULT NULL COMMENT '병원 이름', `address` text COMMENT '주소', `intro` text COMMENT '병원 소개', `url` varchar(50) DEFAULT NULL COMMENT '병원 홈페이지 url', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `FK_hospital_info_doctor_info` (`doctor_id`), CONSTRAINT `FK_hospital_info_doctor_info` FOREIGN KEY (`doctor_id`) REFERENCES `doctor_info` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='병원정보'; -- 테이블 데이터 MerDog.hospital_info:~8 rows (대략적) 내보내기 /*!40000 ALTER TABLE `hospital_info` DISABLE KEYS */; INSERT INTO `hospital_info` (`id`, `doctor_id`, `name`, `address`, `intro`, `url`, `created_at`) VALUES (21, 115, '장산범', '대한민국 서울특별시 강남구 신사동 논현로163길 13-4', '마지막수정', 'http://www.cc2', '2019-11-07 23:26:19'); INSERT INTO `hospital_info` (`id`, `doctor_id`, `name`, `address`, `intro`, `url`, `created_at`) VALUES (24, 103, '중부병원', '대한민국 경기도 고양시 덕양구 화정동 899', '안녕하세요 중부병원입니다 좋은 하루되세요', 'http://www.joongbuhos.com', '2019-11-29 05:12:26'); INSERT INTO `hospital_info` (`id`, `doctor_id`, `name`, `address`, `intro`, `url`, `created_at`) VALUES (25, 143, '동물병원', '대한민국 경기도 고양시 덕양구 화정1동 884-6', '안녕하세요 동물병원입니아', 'http://ccit2019.cafe24.com', '2019-12-05 15:46:05'); INSERT INTO `hospital_info` (`id`, `doctor_id`, `name`, `address`, `intro`, `url`, `created_at`) VALUES (26, 117, '2223', '대한민국 서울특별시 강남구 신사동 569-22', '기모링', 'http://sksjwjehwj.co.kr', '2019-12-06 10:22:47'); INSERT INTO `hospital_info` (`id`, `doctor_id`, `name`, `address`, `intro`, `url`, `created_at`) VALUES (27, 147, '드', '대한민국 경기도 고양시 덕양구 대자동 동헌로 305', '넵 병원입니다.', '없어용', '2019-12-06 10:43:06'); INSERT INTO `hospital_info` (`id`, `doctor_id`, `name`, `address`, `intro`, `url`, `created_at`) VALUES (29, 111, '상범 병원', '대한민국 경기도 고양시 덕양구 대자동 동헌로 305', '안녕하세요ㄷㄷ', 'https:www.naver.com', '2019-12-16 21:06:28'); INSERT INTO `hospital_info` (`id`, `doctor_id`, `name`, `address`, `intro`, `url`, `created_at`) VALUES (31, 170, 'r', '대한민국 경기도 안산시 상록구 건건동 542', 's', 'd', '2019-12-29 15:00:47'); INSERT INTO `hospital_info` (`id`, `doctor_id`, `name`, `address`, `intro`, `url`, `created_at`) VALUES (32, 171, '상범 병원', '대한민국 경기도 고양시 덕양구 대자동 동헌로307번길 22-5', '안녕하세요 상범 병원입니다', 'www.naver.com', '2020-01-02 20:03:27'); /*!40000 ALTER TABLE `hospital_info` ENABLE KEYS */; -- 테이블 MerDog.level_list 구조 내보내기 CREATE TABLE IF NOT EXISTS `level_list` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '등급 번호', `level` varchar(50) NOT NULL COMMENT '등급 이름', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='관리자 등급 목록'; -- 테이블 데이터 MerDog.level_list:~4 rows (대략적) 내보내기 /*!40000 ALTER TABLE `level_list` DISABLE KEYS */; INSERT INTO `level_list` (`id`, `level`) VALUES (1, 'wait'); INSERT INTO `level_list` (`id`, `level`) VALUES (2, 'normal'); INSERT INTO `level_list` (`id`, `level`) VALUES (3, 'manager'); INSERT INTO `level_list` (`id`, `level`) VALUES (4, 'admin'); /*!40000 ALTER TABLE `level_list` ENABLE KEYS */; -- 테이블 MerDog.license 구조 내보내기 CREATE TABLE IF NOT EXISTS `license` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '이미지 번호', `doctor_id` int(11) NOT NULL COMMENT '의사 번호', `img_name` varchar(50) NOT NULL COMMENT '이미지 이름', `division` varchar(50) NOT NULL COMMENT '자격증/ 신분증 구분 (user/doctor)', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `img_name` (`img_name`), KEY `FK_license_doctor_info` (`doctor_id`), CONSTRAINT `FK_license_doctor_info` FOREIGN KEY (`doctor_id`) REFERENCES `doctor_info` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='의사 이미지(자격증 및 신분증) 목록'; -- 테이블 데이터 MerDog.license:~42 rows (대략적) 내보내기 /*!40000 ALTER TABLE `license` DISABLE KEYS */; INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (42, 103, 'CYMERA_20170103_201347.jpg', 'user', '2019-10-30 13:52:00'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (43, 103, 'CYMERA_20170103_201357.jpg', 'doctor', '2019-10-30 13:52:00'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (48, 106, 'JPEG_20191030_155133_2.jpg', 'user', '2019-10-30 15:51:53'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (49, 106, 'JPEG_20191030_155133_1.jpg', 'doctor', '2019-10-30 15:51:53'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (50, 107, '20190829_131357.jpg', 'user', '2019-10-30 15:53:27'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (51, 107, '20190829_135341.jpg', 'doctor', '2019-10-30 15:53:27'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (52, 108, '1522551845341.jpg', 'user', '2019-10-30 15:59:11'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (53, 108, '1522388743824.jpg', 'doctor', '2019-10-30 15:59:11'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (54, 109, 'JPEG_20191030_160542399_2.jpg', 'user', '2019-10-30 16:06:02'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (55, 109, 'JPEG_20191030_160542397_1.jpg', 'doctor', '2019-10-30 16:06:02'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (58, 111, '2019-08-29-10-58-49.jpg', 'user', '2019-11-26 20:07:37'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (59, 111, '20190829_080954.jpg', 'doctor', '2019-11-26 20:07:37'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (60, 112, 'Capture+_2017-09-24-13-07-19.png', 'user', '2019-10-30 19:01:52'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (61, 112, 'Capture+_2017-09-12-20-54-25.png', 'doctor', '2019-10-30 19:01:52'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (66, 115, 'sp.PNG', 'user', '2019-11-06 15:44:50'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (67, 115, '스크린샷(2).png', 'doctor', '2019-11-06 15:44:50'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (68, 116, 'received_1098266496959968.jpeg', 'user', '2019-11-07 13:52:04'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (69, 116, 'JPEG_20191107_135137058_1.jpg', 'doctor', '2019-11-07 13:52:04'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (70, 117, '20191114_165532.jpg', 'user', '2019-11-21 19:07:36'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (71, 117, '20191114_165534.jpg', 'doctor', '2019-11-21 19:07:36'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (104, 143, 'JPEG_20191201_153147609_2.jpg', 'user', '2019-12-01 15:31:51'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (105, 143, 'JPEG_20191201_153147598_1.jpg', 'doctor', '2019-12-01 15:31:51'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (106, 144, 'FB_IMG_1575004676802.jpg', 'user', '2019-12-02 15:15:57'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (107, 144, 'beauty_20191130124355.jpg', 'doctor', '2019-12-02 15:15:57'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (110, 146, 'JPEG_20191206_103444406_2.jpg', 'user', '2019-12-06 10:34:52'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (111, 146, 'JPEG_20191206_103444404_1.jpg', 'doctor', '2019-12-06 10:34:52'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (112, 147, 'JPEG_20191206_103743229_2.jpg', 'user', '2019-12-06 10:37:53'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (113, 147, 'JPEG_20191206_103743228_1.jpg', 'doctor', '2019-12-06 10:37:53'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (114, 148, '1575603821133.jpg', 'user', '2019-12-06 15:33:10'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (115, 148, 'beauty_20191206121409.jpg', 'doctor', '2019-12-06 15:33:10'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (124, 153, 'beauty_20191217163509.jpg', 'user', '2019-12-17 23:13:17'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (125, 153, '2019-12-17-19-25-38-346.jpg', 'doctor', '2019-12-17 23:13:17'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (135, 164, '20191223_23113312020191221_190156.jpguser_license', 'user', '2019-12-23 23:11:59'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (136, 164, '20191223_23113312020191221_221545.jpglicense_name', 'doctor', '2019-12-23 23:11:59'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (137, 167, '20191225_162118762Screenshot_20191218-000321.jpgus', 'user', '2019-12-25 16:21:46'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (138, 167, '20191225_162118762Screenshot_20191218-000325.jpgli', 'doctor', '2019-12-25 16:21:46'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (143, 170, '20191226_01220358620170104_003254_HDR.jpguser_lice', 'user', '2019-12-26 01:22:30'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (144, 170, '20191226_01220358620180203_132324_HDR.jpglicense_n', 'doctor', '2019-12-26 01:22:30'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (145, 171, '20200102_195743273JPEG_20200102195734_718945070726', 'user', '2020-01-02 19:58:21'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (146, 171, '20200102_195743273JPEG_20200102195722_859593612033', 'doctor', '2020-01-02 19:58:21'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (147, 172, '20200102_21484712220200102_213516.jpguser_license', 'user', '2020-01-02 21:49:23'); INSERT INTO `license` (`id`, `doctor_id`, `img_name`, `division`, `created_at`) VALUES (148, 172, '20200102_21484712220200102_214657.jpglicense_name', 'doctor', '2020-01-02 21:49:23'); /*!40000 ALTER TABLE `license` ENABLE KEYS */; -- 테이블 MerDog.login_log 구조 내보내기 CREATE TABLE IF NOT EXISTS `login_log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `id_type` varchar(50) NOT NULL COMMENT 'user/doctor', `login_id` int(11) NOT NULL COMMENT '회원번호', `ip_address` varchar(50) NOT NULL COMMENT 'ip 주소', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='로그인 로그'; -- 테이블 데이터 MerDog.login_log:~1,316 rows (대략적) 내보내기 /*!40000 ALTER TABLE `login_log` DISABLE KEYS */; INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (124, 'doctor', 111, '172.16.17.32', '2019-12-01 20:33:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (125, 'doctor', 111, '172.16.17.32', '2019-12-01 20:33:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (126, 'user', 77, '172.16.17.32', '2019-12-01 20:34:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (127, 'doctor', 111, '172.16.17.32', '2019-12-01 20:35:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (128, 'doctor', 111, '172.16.17.32', '2019-12-01 20:35:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (129, 'doctor', 111, '172.16.17.32', '2019-12-01 20:35:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (130, 'doctor', 111, '172.16.17.32', '2019-12-01 20:35:21'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (131, 'doctor', 111, '172.16.17.32', '2019-12-01 20:35:23'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (132, 'doctor', 111, '172.16.17.32', '2019-12-01 20:35:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (133, 'doctor', 111, '172.16.17.32', '2019-12-01 20:35:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (134, 'doctor', 111, '172.16.17.32', '2019-12-01 20:35:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (135, 'doctor', 111, '172.16.17.32', '2019-12-01 20:35:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (136, 'doctor', 111, '172.16.17.32', '2019-12-01 20:35:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (137, 'user', 77, '172.16.17.32', '2019-12-01 20:35:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (138, 'doctor', 111, '172.16.17.32', '2019-12-01 20:36:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (139, 'doctor', 111, '172.16.17.32', '2019-12-01 20:36:25'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (140, 'doctor', 111, '172.16.17.32', '2019-12-01 20:36:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (141, 'doctor', 111, '172.16.17.32', '2019-12-01 20:37:25'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (142, 'doctor', 111, '172.16.17.32', '2019-12-01 20:37:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (143, 'doctor', 111, '172.16.17.32', '2019-12-01 20:38:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (144, 'doctor', 111, '172.16.17.32', '2019-12-01 20:38:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (145, 'user', 77, '172.16.17.32', '2019-12-01 20:39:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (146, 'doctor', 111, '172.16.17.32', '2019-12-01 20:39:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (147, 'user', 77, '172.16.17.32', '2019-12-01 20:45:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (148, 'user', 77, '172.16.17.32', '2019-12-01 20:46:47'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (149, 'user', 77, '172.16.17.32', '2019-12-01 20:48:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (150, 'user', 77, '172.16.17.32', '2019-12-01 20:50:04'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (151, 'user', 77, '172.16.17.32', '2019-12-01 20:50:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (152, 'user', 77, '172.16.17.32', '2019-12-01 20:51:21'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (153, 'user', 77, '172.16.17.32', '2019-12-01 20:53:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (155, 'user', 77, '172.16.17.32', '2019-12-01 21:56:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (156, 'user', 77, '172.16.17.32', '2019-12-01 22:10:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (157, 'user', 77, '172.16.17.32', '2019-12-01 22:16:47'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (158, 'user', 77, '172.16.17.32', '2019-12-01 22:20:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (159, 'user', 77, '172.16.17.32', '2019-12-01 22:22:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (160, 'user', 77, '172.16.17.32', '2019-12-01 22:31:43'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (161, 'user', 77, '172.16.17.32', '2019-12-01 22:49:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (162, 'user', 77, '172.16.17.32', '2019-12-01 22:51:45'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (163, 'user', 77, '172.16.17.32', '2019-12-01 23:03:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (164, 'user', 77, '172.16.17.32', '2019-12-01 23:18:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (165, 'user', 77, '172.16.17.32', '2019-12-01 23:35:23'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (166, 'user', 77, '172.16.17.32', '2019-12-01 23:37:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (167, 'user', 77, '172.16.17.32', '2019-12-01 23:42:01'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (168, 'doctor', 103, '192.168.127.12', '2019-12-01 23:44:25'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (169, 'user', 77, '172.16.17.32', '2019-12-01 23:52:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (170, 'user', 77, '172.16.17.32', '2019-12-02 00:37:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (171, 'user', 77, '172.16.17.32', '2019-12-02 00:45:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (172, 'user', 77, '172.16.17.32', '2019-12-02 00:47:43'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (173, 'doctor', 103, '192.168.127.12', '2019-12-02 00:48:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (174, 'doctor', 103, '192.168.127.12', '2019-12-02 00:52:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (175, 'doctor', 103, '192.168.127.12', '2019-12-02 00:57:04'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (176, 'doctor', 103, '192.168.127.12', '2019-12-02 01:13:43'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (177, 'doctor', 103, '192.168.127.12', '2019-12-02 01:17:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (178, 'doctor', 103, '192.168.127.12', '2019-12-02 01:18:45'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (179, 'doctor', 103, '192.168.127.12', '2019-12-02 01:19:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (180, 'doctor', 103, '192.168.127.12', '2019-12-02 01:21:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (181, 'doctor', 103, '192.168.127.12', '2019-12-02 01:21:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (182, 'doctor', 103, '192.168.127.12', '2019-12-02 01:22:16'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (183, 'doctor', 103, '192.168.127.12', '2019-12-02 01:23:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (184, 'doctor', 103, '192.168.127.12', '2019-12-02 01:23:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (185, 'doctor', 103, '192.168.127.12', '2019-12-02 01:24:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (186, 'doctor', 111, '172.16.17.32', '2019-12-02 01:58:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (187, 'doctor', 111, '172.16.17.32', '2019-12-02 01:58:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (188, 'doctor', 111, '172.16.17.32', '2019-12-02 02:23:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (189, 'doctor', 111, '172.16.17.32', '2019-12-02 02:24:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (190, 'doctor', 111, '172.16.17.32', '2019-12-02 02:46:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (191, 'doctor', 103, '192.168.127.12', '2019-12-02 04:19:47'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (192, 'user', 77, '172.16.17.32', '2019-12-02 12:45:16'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (193, 'user', 77, '172.16.17.32', '2019-12-02 13:14:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (194, 'user', 77, '172.16.17.32', '2019-12-02 13:16:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (195, 'user', 77, '172.16.17.32', '2019-12-02 13:17:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (196, 'user', 77, '172.16.17.32', '2019-12-02 13:17:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (197, 'user', 77, '172.16.17.32', '2019-12-02 13:19:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (198, 'user', 77, '172.16.17.32', '2019-12-02 13:23:45'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (199, 'doctor', 103, '192.168.3.11', '2019-12-02 14:28:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (200, 'doctor', 143, '192.168.3.11', '2019-12-02 14:42:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (201, 'doctor', 143, '192.168.3.11', '2019-12-02 14:44:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (202, 'doctor', 143, '192.168.3.11', '2019-12-02 14:48:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (203, 'doctor', 143, '192.168.3.11', '2019-12-02 14:49:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (204, 'doctor', 143, '192.168.3.11', '2019-12-02 14:51:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (205, 'doctor', 111, '172.16.17.32', '2019-12-02 14:55:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (206, 'doctor', 111, '172.16.17.32', '2019-12-02 14:56:17'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (207, 'doctor', 143, '192.168.3.11', '2019-12-02 14:56:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (208, 'doctor', 143, '192.168.3.11', '2019-12-02 14:58:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (209, 'doctor', 143, '192.168.3.11', '2019-12-02 14:58:21'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (210, 'doctor', 143, '192.168.3.11', '2019-12-02 14:59:04'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (211, 'doctor', 143, '192.168.3.11', '2019-12-02 15:00:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (212, 'doctor', 143, '192.168.3.11', '2019-12-02 15:00:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (213, 'doctor', 143, '192.168.3.11', '2019-12-02 15:02:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (214, 'doctor', 143, '192.168.3.11', '2019-12-02 15:02:59'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (215, 'doctor', 143, '192.168.3.11', '2019-12-02 15:04:03'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (216, 'doctor', 143, '192.168.3.11', '2019-12-02 15:04:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (217, 'doctor', 111, '172.16.17.32', '2019-12-02 15:11:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (218, 'doctor', 143, '192.168.3.11', '2019-12-02 15:18:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (219, 'doctor', 111, '172.16.17.32', '2019-12-02 15:20:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (220, 'user', 78, '172.16.17.32', '2019-12-02 15:47:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (221, 'user', 77, '172.16.17.32', '2019-12-02 15:51:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (222, 'user', 78, '172.16.17.32', '2019-12-02 15:52:25'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (223, 'user', 78, '172.16.17.32', '2019-12-02 15:55:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (224, 'user', 78, '172.16.17.32', '2019-12-02 15:56:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (225, 'user', 78, '172.16.17.32', '2019-12-02 16:02:16'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (226, 'user', 77, '172.16.17.32', '2019-12-02 16:05:15'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (227, 'user', 78, '172.16.17.32', '2019-12-02 16:05:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (228, 'user', 78, '172.16.17.32', '2019-12-02 16:06:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (229, 'user', 77, '172.16.17.32', '2019-12-02 16:06:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (230, 'doctor', 143, '192.168.3.11', '2019-12-02 16:14:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (231, 'doctor', 111, '172.16.17.32', '2019-12-02 16:21:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (232, 'doctor', 143, '192.168.3.11', '2019-12-02 16:28:51'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (233, 'doctor', 143, '192.168.3.11', '2019-12-02 16:30:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (234, 'doctor', 143, '192.168.3.11', '2019-12-02 16:32:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (235, 'user', 78, '172.16.17.32', '2019-12-02 16:33:45'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (236, 'doctor', 111, '172.16.17.32', '2019-12-02 16:34:04'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (237, 'doctor', 143, '192.168.3.11', '2019-12-02 16:34:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (238, 'doctor', 143, '192.168.3.11', '2019-12-02 16:34:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (239, 'doctor', 111, '172.16.17.32', '2019-12-02 16:36:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (240, 'user', 77, '172.16.17.32', '2019-12-02 16:38:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (241, 'doctor', 143, '192.168.3.11', '2019-12-02 16:40:30'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (242, 'user', 77, '172.16.17.32', '2019-12-02 16:40:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (243, 'user', 78, '172.16.17.32', '2019-12-02 16:42:03'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (244, 'doctor', 143, '192.168.3.11', '2019-12-02 16:42:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (245, 'user', 77, '172.16.17.32', '2019-12-02 16:42:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (246, 'doctor', 143, '192.168.3.11', '2019-12-02 16:49:15'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (247, 'doctor', 143, '192.168.3.11', '2019-12-02 16:49:56'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (248, 'doctor', 143, '192.168.3.11', '2019-12-02 16:51:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (249, 'doctor', 143, '192.168.3.11', '2019-12-02 16:52:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (250, 'doctor', 143, '192.168.3.11', '2019-12-02 16:53:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (251, 'doctor', 143, '192.168.3.11', '2019-12-02 16:54:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (252, 'doctor', 143, '192.168.3.11', '2019-12-02 16:55:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (253, 'doctor', 143, '192.168.3.11', '2019-12-02 16:55:35'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (254, 'doctor', 143, '192.168.3.11', '2019-12-02 16:56:16'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (255, 'doctor', 143, '192.168.3.11', '2019-12-02 16:58:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (256, 'doctor', 143, '192.168.3.11', '2019-12-02 17:00:59'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (257, 'user', 77, '172.16.17.32', '2019-12-02 17:03:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (258, 'doctor', 143, '192.168.3.11', '2019-12-02 17:03:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (259, 'user', 77, '172.16.17.32', '2019-12-02 17:05:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (260, 'user', 77, '172.16.17.32', '2019-12-02 17:09:04'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (261, 'doctor', 143, '192.168.3.11', '2019-12-02 17:10:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (262, 'doctor', 143, '192.168.3.11', '2019-12-02 17:11:17'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (263, 'doctor', 143, '192.168.3.11', '2019-12-02 17:12:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (264, 'doctor', 143, '192.168.3.11', '2019-12-02 17:12:35'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (265, 'doctor', 143, '192.168.3.11', '2019-12-02 17:14:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (266, 'user', 77, '172.16.17.32', '2019-12-02 17:14:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (267, 'doctor', 143, '192.168.3.11', '2019-12-02 17:14:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (268, 'user', 77, '172.16.17.32', '2019-12-02 17:15:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (269, 'doctor', 143, '192.168.3.11', '2019-12-02 17:20:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (270, 'user', 77, '172.16.17.32', '2019-12-02 17:20:30'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (271, 'doctor', 143, '192.168.3.11', '2019-12-02 17:20:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (272, 'user', 77, '172.16.17.32', '2019-12-02 17:22:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (273, 'user', 77, '172.16.17.32', '2019-12-02 17:25:12'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (274, 'user', 77, '172.16.17.32', '2019-12-02 17:26:16'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (275, 'user', 77, '172.16.17.32', '2019-12-02 17:27:51'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (276, 'user', 77, '172.16.17.32', '2019-12-02 17:29:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (277, 'doctor', 143, '192.168.3.11', '2019-12-02 18:29:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (278, 'user', 78, '172.16.17.32', '2019-12-03 13:04:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (279, 'user', 78, '172.16.17.32', '2019-12-03 13:05:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (280, 'user', 78, '172.16.17.32', '2019-12-03 13:07:16'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (281, 'user', 78, '172.16.17.32', '2019-12-03 13:11:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (282, 'user', 78, '172.16.17.32', '2019-12-03 13:14:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (283, 'user', 78, '172.16.17.32', '2019-12-03 13:15:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (284, 'user', 78, '172.16.17.32', '2019-12-03 13:18:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (285, 'user', 78, '172.16.17.32', '2019-12-03 13:23:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (286, 'user', 78, '172.16.17.32', '2019-12-03 13:24:43'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (287, 'doctor', 111, '172.16.17.32', '2019-12-03 13:41:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (288, 'user', 78, '172.16.17.32', '2019-12-03 13:41:51'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (289, 'user', 78, '172.16.17.32', '2019-12-03 13:47:04'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (290, 'user', 78, '172.16.17.32', '2019-12-03 13:51:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (291, 'user', 77, '172.16.17.32', '2019-12-03 14:33:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (292, 'user', 78, '172.16.17.32', '2019-12-03 14:38:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (293, 'user', 77, '172.16.17.32', '2019-12-03 14:43:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (294, 'user', 78, '172.16.17.32', '2019-12-03 14:43:25'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (295, 'user', 78, '172.16.17.32', '2019-12-03 14:45:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (296, 'user', 77, '172.16.17.32', '2019-12-03 14:46:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (297, 'user', 78, '172.16.17.32', '2019-12-03 14:49:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (298, 'user', 78, '172.16.17.32', '2019-12-03 14:49:43'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (299, 'user', 78, '172.16.17.32', '2019-12-03 14:50:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (300, 'user', 78, '172.16.17.32', '2019-12-03 14:59:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (301, 'user', 78, '172.16.17.32', '2019-12-03 15:01:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (302, 'user', 78, '172.16.17.32', '2019-12-03 15:02:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (303, 'user', 78, '172.16.17.32', '2019-12-03 15:05:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (304, 'user', 78, '172.16.17.32', '2019-12-03 15:08:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (305, 'user', 78, '172.16.17.32', '2019-12-03 15:10:08'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (306, 'user', 78, '172.16.17.32', '2019-12-03 15:11:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (307, 'user', 78, '172.16.17.32', '2019-12-03 15:14:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (308, 'user', 78, '172.16.17.32', '2019-12-03 15:17:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (309, 'user', 78, '172.16.17.32', '2019-12-03 15:18:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (310, 'user', 78, '172.16.17.32', '2019-12-03 15:20:25'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (311, 'user', 77, '172.16.17.32', '2019-12-03 15:38:16'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (312, 'user', 78, '172.16.17.32', '2019-12-03 15:46:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (313, 'doctor', 111, '172.16.17.32', '2019-12-03 15:49:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (314, 'doctor', 111, '172.16.17.32', '2019-12-03 15:50:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (315, 'doctor', 111, '172.16.17.32', '2019-12-03 15:54:12'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (316, 'doctor', 111, '172.16.17.32', '2019-12-03 15:57:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (317, 'user', 78, '172.16.17.32', '2019-12-03 15:57:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (318, 'doctor', 111, '172.16.17.32', '2019-12-03 15:59:51'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (319, 'doctor', 111, '172.16.17.32', '2019-12-03 16:06:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (320, 'user', 78, '172.16.17.32', '2019-12-03 16:11:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (321, 'user', 78, '172.16.17.32', '2019-12-03 16:15:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (322, 'user', 78, '172.16.17.32', '2019-12-03 16:44:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (323, 'doctor', 111, '172.16.17.32', '2019-12-03 16:49:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (324, 'doctor', 111, '172.16.17.32', '2019-12-03 16:57:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (325, 'doctor', 111, '172.16.17.32', '2019-12-03 17:00:01'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (326, 'user', 78, '172.16.17.32', '2019-12-03 17:17:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (327, 'user', 78, '172.16.17.32', '2019-12-03 17:21:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (328, 'user', 78, '172.16.17.32', '2019-12-03 17:25:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (329, 'user', 78, '172.16.17.32', '2019-12-03 17:25:16'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (330, 'user', 78, '172.16.17.32', '2019-12-03 17:26:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (331, 'user', 78, '172.16.17.32', '2019-12-03 17:28:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (332, 'user', 78, '172.16.17.32', '2019-12-03 17:34:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (333, 'user', 78, '172.16.17.32', '2019-12-03 17:34:51'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (334, 'user', 78, '172.16.17.32', '2019-12-03 17:39:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (335, 'user', 78, '172.16.17.32', '2019-12-03 17:42:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (336, 'user', 78, '172.16.17.32', '2019-12-03 17:43:04'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (337, 'doctor', 111, '172.16.17.32', '2019-12-03 17:43:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (338, 'doctor', 111, '172.16.17.32', '2019-12-03 17:45:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (339, 'doctor', 111, '172.16.17.32', '2019-12-03 17:46:01'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (340, 'doctor', 111, '172.16.17.32', '2019-12-03 17:47:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (341, 'doctor', 111, '172.16.17.32', '2019-12-03 17:47:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (342, 'user', 78, '172.16.17.32', '2019-12-03 17:48:01'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (343, 'doctor', 111, '172.16.17.32', '2019-12-03 18:25:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (344, 'doctor', 111, '172.16.17.32', '2019-12-03 18:26:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (345, 'doctor', 111, '172.16.17.32', '2019-12-03 18:31:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (346, 'doctor', 111, '172.16.17.32', '2019-12-03 18:33:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (347, 'doctor', 111, '172.16.17.32', '2019-12-03 18:35:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (348, 'doctor', 111, '172.16.17.32', '2019-12-03 18:37:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (349, 'user', 78, '172.16.17.32', '2019-12-03 18:44:33'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (350, 'doctor', 111, '172.16.17.32', '2019-12-03 18:46:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (351, 'user', 78, '172.16.17.32', '2019-12-03 18:47:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (352, 'doctor', 111, '172.16.17.32', '2019-12-03 18:48:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (353, 'doctor', 111, '172.16.17.32', '2019-12-03 18:55:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (354, 'doctor', 111, '172.16.17.32', '2019-12-03 18:58:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (355, 'user', 78, '172.16.17.32', '2019-12-03 19:04:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (356, 'user', 78, '172.16.17.32', '2019-12-03 19:05:03'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (357, 'doctor', 111, '172.16.17.32', '2019-12-03 19:05:47'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (358, 'user', 78, '172.16.17.32', '2019-12-03 19:10:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (359, 'user', 78, '172.16.17.32', '2019-12-03 19:12:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (360, 'doctor', 111, '172.16.17.32', '2019-12-03 19:12:47'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (361, 'doctor', 111, '172.16.17.32', '2019-12-03 19:14:25'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (362, 'doctor', 111, '172.16.17.32', '2019-12-03 19:16:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (363, 'doctor', 111, '172.16.17.32', '2019-12-03 19:18:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (364, 'doctor', 111, '172.16.17.32', '2019-12-03 19:20:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (365, 'doctor', 111, '172.16.17.32', '2019-12-03 19:22:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (366, 'user', 78, '172.16.17.32', '2019-12-03 19:24:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (367, 'doctor', 111, '172.16.17.32', '2019-12-03 19:32:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (368, 'user', 78, '172.16.17.32', '2019-12-03 19:33:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (369, 'doctor', 111, '172.16.17.32', '2019-12-03 19:39:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (370, 'doctor', 111, '172.16.17.32', '2019-12-03 19:46:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (371, 'doctor', 111, '172.16.17.32', '2019-12-03 19:51:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (372, 'doctor', 111, '172.16.17.32', '2019-12-03 19:56:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (373, 'doctor', 111, '172.16.17.32', '2019-12-03 19:58:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (374, 'doctor', 143, '192.168.3.11', '2019-12-03 20:00:56'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (375, 'doctor', 143, '192.168.3.11', '2019-12-03 20:14:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (376, 'doctor', 143, '192.168.3.11', '2019-12-03 20:19:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (377, 'user', 78, '172.16.17.32', '2019-12-03 20:50:08'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (378, 'user', 78, '172.16.17.32', '2019-12-03 20:52:23'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (379, 'doctor', 111, '172.16.17.32', '2019-12-03 20:57:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (380, 'user', 78, '172.16.17.32', '2019-12-03 21:04:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (381, 'user', 78, '172.16.17.32', '2019-12-03 21:04:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (382, 'doctor', 111, '172.16.17.32', '2019-12-03 21:05:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (383, 'doctor', 111, '172.16.17.32', '2019-12-03 21:10:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (384, 'doctor', 111, '172.16.17.32', '2019-12-03 21:12:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (385, 'user', 78, '172.16.17.32', '2019-12-03 21:31:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (386, 'user', 78, '172.16.17.32', '2019-12-03 21:35:45'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (387, 'user', 78, '172.16.17.32', '2019-12-03 21:36:59'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (388, 'doctor', 111, '172.16.17.32', '2019-12-03 23:12:21'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (389, 'user', 78, '192.168.3.11', '2019-12-04 13:05:25'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (390, 'user', 78, '192.168.3.11', '2019-12-04 13:07:43'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (391, 'user', 78, '192.168.3.11', '2019-12-04 13:10:08'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (392, 'user', 78, '192.168.3.11', '2019-12-04 16:47:23'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (393, 'user', 78, '192.168.3.11', '2019-12-05 09:42:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (394, 'user', 78, '192.168.3.11', '2019-12-05 13:41:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (395, 'user', 78, '192.168.3.11', '2019-12-05 13:43:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (396, 'user', 78, '192.168.3.11', '2019-12-05 13:49:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (397, 'user', 78, '192.168.3.11', '2019-12-05 13:51:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (398, 'user', 78, '192.168.3.11', '2019-12-05 13:54:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (399, 'user', 78, '192.168.3.11', '2019-12-05 13:57:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (400, 'user', 78, '192.168.3.11', '2019-12-05 13:58:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (401, 'doctor', 111, '172.16.17.32', '2019-12-05 14:13:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (402, 'doctor', 143, '192.168.3.11', '2019-12-05 14:31:43'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (403, 'doctor', 143, '192.168.3.11', '2019-12-05 14:33:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (404, 'doctor', 143, '192.168.3.11', '2019-12-05 14:34:59'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (405, 'doctor', 143, '192.168.3.11', '2019-12-05 14:35:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (406, 'doctor', 143, '192.168.3.11', '2019-12-05 14:45:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (407, 'doctor', 143, '192.168.3.11', '2019-12-05 14:46:15'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (408, 'doctor', 143, '192.168.3.11', '2019-12-05 14:46:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (409, 'doctor', 143, '192.168.3.11', '2019-12-05 14:48:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (410, 'doctor', 143, '192.168.3.11', '2019-12-05 14:51:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (411, 'user', 78, '192.168.3.11', '2019-12-05 15:04:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (412, 'user', 78, '192.168.3.11', '2019-12-05 15:05:08'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (413, 'user', 78, '192.168.3.11', '2019-12-05 15:05:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (414, 'user', 78, '192.168.3.11', '2019-12-05 15:05:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (415, 'user', 80, '172.16.17.32', '2019-12-05 15:13:01'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (416, 'user', 78, '192.168.3.11', '2019-12-05 15:14:47'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (417, 'user', 78, '192.168.3.11', '2019-12-05 15:15:43'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (418, 'user', 78, '192.168.3.11', '2019-12-05 15:15:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (419, 'user', 78, '192.168.3.11', '2019-12-05 15:17:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (420, 'user', 78, '192.168.3.11', '2019-12-05 15:24:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (421, 'user', 78, '192.168.3.11', '2019-12-05 15:28:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (422, 'user', 78, '192.168.3.11', '2019-12-05 15:29:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (423, 'user', 78, '192.168.3.11', '2019-12-05 15:31:47'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (424, 'user', 78, '192.168.3.11', '2019-12-05 15:32:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (425, 'doctor', 111, '192.168.3.11', '2019-12-05 15:34:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (426, 'user', 78, '192.168.3.11', '2019-12-05 15:34:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (427, 'doctor', 111, '192.168.3.11', '2019-12-05 15:34:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (428, 'user', 78, '192.168.3.11', '2019-12-05 15:35:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (429, 'doctor', 111, '192.168.3.11', '2019-12-05 15:38:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (430, 'user', 78, '192.168.3.11', '2019-12-05 15:40:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (431, 'user', 78, '192.168.3.11', '2019-12-05 15:40:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (432, 'doctor', 143, '192.168.3.11', '2019-12-05 15:45:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (433, 'doctor', 111, '192.168.3.11', '2019-12-05 15:48:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (434, 'doctor', 143, '192.168.3.11', '2019-12-05 15:48:56'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (435, 'doctor', 111, '192.168.3.11', '2019-12-05 15:49:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (436, 'user', 80, '192.168.3.11', '2019-12-05 15:49:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (437, 'user', 80, '192.168.3.11', '2019-12-05 15:49:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (438, 'doctor', 143, '192.168.3.11', '2019-12-05 15:51:30'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (439, 'doctor', 111, '192.168.3.11', '2019-12-05 15:53:15'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (440, 'doctor', 111, '192.168.3.11', '2019-12-05 15:53:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (441, 'doctor', 143, '192.168.3.11', '2019-12-05 15:54:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (442, 'doctor', 143, '192.168.3.11', '2019-12-05 15:55:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (443, 'doctor', 111, '192.168.3.11', '2019-12-05 15:56:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (444, 'user', 78, '192.168.3.11', '2019-12-05 15:57:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (445, 'doctor', 111, '192.168.3.11', '2019-12-05 15:57:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (446, 'doctor', 111, '192.168.3.11', '2019-12-05 15:57:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (447, 'doctor', 111, '192.168.3.11', '2019-12-05 15:58:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (448, 'user', 78, '192.168.3.11', '2019-12-05 16:01:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (449, 'doctor', 111, '192.168.3.11', '2019-12-05 16:02:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (450, 'doctor', 111, '192.168.3.11', '2019-12-05 16:03:23'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (451, 'doctor', 111, '192.168.3.11', '2019-12-05 16:05:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (452, 'user', 78, '192.168.3.11', '2019-12-05 16:06:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (453, 'user', 78, '192.168.3.11', '2019-12-05 16:06:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (454, 'user', 80, '192.168.3.11', '2019-12-05 16:11:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (455, 'doctor', 111, '192.168.3.11', '2019-12-05 16:18:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (456, 'doctor', 143, '192.168.3.11', '2019-12-05 16:21:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (457, 'doctor', 143, '192.168.3.11', '2019-12-05 16:23:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (458, 'doctor', 111, '192.168.3.11', '2019-12-05 16:23:12'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (459, 'doctor', 111, '192.168.3.11', '2019-12-05 16:24:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (460, 'doctor', 111, '192.168.3.11', '2019-12-05 16:25:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (461, 'doctor', 143, '192.168.3.11', '2019-12-05 16:28:47'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (462, 'doctor', 111, '192.168.3.11', '2019-12-05 16:31:17'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (463, 'doctor', 143, '192.168.3.11', '2019-12-05 16:32:08'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (464, 'doctor', 111, '192.168.3.11', '2019-12-05 16:35:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (465, 'doctor', 111, '192.168.3.11', '2019-12-05 16:35:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (466, 'doctor', 143, '192.168.3.11', '2019-12-05 16:35:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (467, 'doctor', 143, '192.168.3.11', '2019-12-05 16:36:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (468, 'doctor', 111, '192.168.3.11', '2019-12-05 16:45:15'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (469, 'user', 78, '192.168.3.11', '2019-12-05 16:46:33'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (470, 'user', 78, '192.168.3.11', '2019-12-05 16:46:35'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (471, 'doctor', 111, '192.168.3.11', '2019-12-05 16:47:12'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (472, 'doctor', 143, '192.168.3.11', '2019-12-05 16:51:43'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (473, 'doctor', 111, '192.168.3.11', '2019-12-05 16:56:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (474, 'doctor', 111, '192.168.3.11', '2019-12-05 16:58:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (475, 'doctor', 111, '192.168.3.11', '2019-12-05 17:03:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (476, 'doctor', 111, '192.168.3.11', '2019-12-05 17:05:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (477, 'doctor', 143, '192.168.3.11', '2019-12-05 17:06:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (478, 'doctor', 143, '192.168.3.11', '2019-12-05 17:08:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (479, 'doctor', 143, '192.168.3.11', '2019-12-05 17:10:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (480, 'doctor', 143, '192.168.3.11', '2019-12-05 17:10:33'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (481, 'user', 78, '192.168.3.11', '2019-12-05 17:11:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (482, 'user', 78, '192.168.3.11', '2019-12-05 17:11:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (483, 'doctor', 143, '192.168.3.11', '2019-12-05 17:12:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (484, 'doctor', 143, '192.168.3.11', '2019-12-05 17:14:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (485, 'doctor', 143, '192.168.3.11', '2019-12-05 17:16:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (486, 'doctor', 143, '192.168.3.11', '2019-12-05 17:16:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (487, 'doctor', 103, '192.168.3.11', '2019-12-05 17:18:23'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (488, 'doctor', 111, '192.168.3.11', '2019-12-05 17:21:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (489, 'doctor', 111, '192.168.3.11', '2019-12-05 17:22:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (490, 'doctor', 111, '192.168.3.11', '2019-12-05 17:28:16'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (491, 'doctor', 103, '192.168.3.11', '2019-12-05 17:29:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (492, 'doctor', 111, '192.168.3.11', '2019-12-05 17:29:45'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (493, 'doctor', 103, '192.168.3.11', '2019-12-05 17:30:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (494, 'doctor', 103, '192.168.3.11', '2019-12-05 17:32:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (495, 'doctor', 111, '192.168.3.11', '2019-12-05 17:33:25'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (496, 'doctor', 103, '192.168.3.11', '2019-12-05 17:34:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (497, 'doctor', 103, '192.168.3.11', '2019-12-05 17:35:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (498, 'doctor', 111, '192.168.3.11', '2019-12-05 17:36:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (499, 'doctor', 103, '192.168.3.11', '2019-12-05 17:38:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (500, 'doctor', 111, '192.168.3.11', '2019-12-05 17:39:03'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (501, 'doctor', 103, '49.172.164.80', '2019-12-05 17:39:17'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (502, 'doctor', 111, '192.168.3.11', '2019-12-05 17:40:30'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (503, 'doctor', 111, '192.168.3.11', '2019-12-05 17:40:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (504, 'doctor', 103, '192.168.3.11', '2019-12-05 17:41:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (505, 'doctor', 111, '192.168.3.11', '2019-12-05 17:42:23'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (506, 'doctor', 103, '192.168.3.11', '2019-12-05 17:43:16'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (507, 'doctor', 111, '192.168.3.11', '2019-12-05 17:43:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (508, 'doctor', 103, '192.168.3.11', '2019-12-05 17:44:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (509, 'doctor', 111, '192.168.3.11', '2019-12-05 17:45:16'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (510, 'doctor', 111, '192.168.3.11', '2019-12-05 17:47:03'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (511, 'doctor', 111, '192.168.3.11', '2019-12-05 17:48:12'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (512, 'doctor', 103, '192.168.3.11', '2019-12-05 17:49:01'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (513, 'doctor', 103, '192.168.3.11', '2019-12-05 17:50:33'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (514, 'doctor', 103, '192.168.3.11', '2019-12-05 17:51:15'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (515, 'doctor', 111, '192.168.3.11', '2019-12-05 17:51:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (516, 'doctor', 103, '192.168.3.11', '2019-12-05 17:53:56'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (517, 'doctor', 111, '192.168.3.11', '2019-12-05 17:54:56'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (518, 'doctor', 111, '192.168.3.11', '2019-12-05 18:02:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (519, 'doctor', 103, '192.168.3.11', '2019-12-05 18:02:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (520, 'doctor', 111, '192.168.3.11', '2019-12-05 18:03:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (521, 'doctor', 103, '192.168.3.11', '2019-12-05 18:04:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (522, 'doctor', 111, '192.168.3.11', '2019-12-05 18:05:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (523, 'user', 78, '192.168.3.11', '2019-12-05 18:27:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (524, 'user', 78, '192.168.3.11', '2019-12-05 18:27:47'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (525, 'user', 78, '192.168.3.11', '2019-12-05 18:28:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (526, 'doctor', 103, '192.168.3.11', '2019-12-05 18:43:51'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (527, 'doctor', 103, '192.168.3.11', '2019-12-05 18:45:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (528, 'doctor', 103, '192.168.3.11', '2019-12-05 18:48:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (529, 'doctor', 103, '192.168.3.11', '2019-12-05 18:49:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (530, 'doctor', 103, '192.168.3.11', '2019-12-05 18:52:35'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (531, 'doctor', 103, '172.16.31.10', '2019-12-05 18:58:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (532, 'doctor', 111, '192.168.3.11', '2019-12-05 19:10:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (533, 'doctor', 103, '192.168.3.11', '2019-12-05 20:14:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (534, 'doctor', 103, '192.168.3.11', '2019-12-05 20:21:15'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (535, 'doctor', 103, '192.168.3.11', '2019-12-05 20:45:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (536, 'doctor', 103, '192.168.3.11', '2019-12-05 22:31:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (537, 'user', 77, '172.16.17.32', '2019-12-06 00:14:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (538, 'user', 77, '172.16.17.32', '2019-12-06 00:15:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (539, 'doctor', 143, '192.168.3.11', '2019-12-06 01:01:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (540, 'doctor', 143, '192.168.3.11', '2019-12-06 01:02:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (541, 'doctor', 143, '192.168.3.11', '2019-12-06 02:45:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (542, 'doctor', 143, '192.168.3.11', '2019-12-06 02:47:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (543, 'doctor', 143, '192.168.3.11', '2019-12-06 02:53:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (544, 'doctor', 143, '192.168.3.11', '2019-12-06 02:57:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (545, 'doctor', 103, '192.168.3.11', '2019-12-06 03:20:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (546, 'doctor', 143, '192.168.3.11', '2019-12-06 03:20:17'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (547, 'user', 78, '192.168.3.11', '2019-12-06 03:45:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (548, 'user', 78, '192.168.3.11', '2019-12-06 03:49:33'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (549, 'user', 78, '192.168.3.11', '2019-12-06 09:40:03'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (550, 'doctor', 111, '192.168.127.12', '2019-12-06 10:14:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (551, 'doctor', 117, '172.16.31.10', '2019-12-06 10:21:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (552, 'doctor', 117, '172.16.31.10', '2019-12-06 10:21:47'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (553, 'doctor', 117, '172.16.31.10', '2019-12-06 10:23:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (554, 'doctor', 117, '172.16.31.10', '2019-12-06 10:23:59'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (555, 'doctor', 103, '172.16.17.32', '2019-12-06 10:24:51'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (556, 'user', 80, '192.168.127.12', '2019-12-06 10:26:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (557, 'doctor', 143, '172.16.17.32', '2019-12-06 10:26:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (558, 'doctor', 117, '172.16.31.10', '2019-12-06 10:26:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (559, 'doctor', 117, '172.16.31.10', '2019-12-06 10:26:59'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (560, 'user', 78, '192.168.3.11', '2019-12-06 10:28:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (561, 'doctor', 117, '172.16.31.10', '2019-12-06 10:31:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (562, 'doctor', 117, '172.16.31.10', '2019-12-06 10:32:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (563, 'doctor', 143, '172.16.17.32', '2019-12-06 10:35:56'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (564, 'doctor', 143, '172.16.17.32', '2019-12-06 10:36:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (565, 'doctor', 143, '172.16.17.32', '2019-12-06 10:36:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (566, 'doctor', 143, '172.16.17.32', '2019-12-06 10:37:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (567, 'doctor', 143, '172.16.17.32', '2019-12-06 10:37:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (568, 'doctor', 147, '172.16.17.32', '2019-12-06 10:38:56'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (569, 'doctor', 147, '172.16.17.32', '2019-12-06 10:39:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (570, 'doctor', 117, '172.16.31.10', '2019-12-06 10:39:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (571, 'doctor', 117, '172.16.31.10', '2019-12-06 10:39:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (572, 'doctor', 143, '172.16.17.32', '2019-12-06 10:39:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (573, 'doctor', 117, '172.16.31.10', '2019-12-06 10:40:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (574, 'doctor', 117, '172.16.31.10', '2019-12-06 10:41:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (575, 'doctor', 143, '172.16.17.32', '2019-12-06 10:44:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (576, 'user', 83, '192.168.3.11', '2019-12-06 10:45:25'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (577, 'doctor', 143, '172.16.17.32', '2019-12-06 10:46:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (578, 'doctor', 117, '172.16.31.10', '2019-12-06 10:46:47'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (579, 'doctor', 117, '172.16.31.10', '2019-12-06 10:48:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (580, 'doctor', 143, '172.16.17.32', '2019-12-06 10:48:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (581, 'doctor', 117, '172.16.31.10', '2019-12-06 10:48:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (582, 'doctor', 147, '172.16.17.32', '2019-12-06 10:49:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (583, 'user', 83, '192.168.3.11', '2019-12-06 10:51:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (584, 'doctor', 147, '172.16.17.32', '2019-12-06 10:51:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (585, 'user', 84, '192.168.127.12', '2019-12-06 10:55:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (586, 'doctor', 117, '172.16.31.10', '2019-12-06 11:00:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (587, 'user', 83, '192.168.3.11', '2019-12-06 11:01:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (588, 'doctor', 117, '172.16.31.10', '2019-12-06 11:02:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (589, 'user', 84, '192.168.127.12', '2019-12-06 11:03:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (590, 'user', 78, '192.168.3.11', '2019-12-06 11:03:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (591, 'doctor', 117, '172.16.31.10', '2019-12-06 11:04:45'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (592, 'user', 83, '192.168.3.11', '2019-12-06 11:05:17'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (593, 'doctor', 117, '172.16.31.10', '2019-12-06 11:07:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (594, 'doctor', 117, '172.16.31.10', '2019-12-06 11:09:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (595, 'doctor', 143, '172.16.17.32', '2019-12-06 11:12:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (596, 'doctor', 117, '172.16.31.10', '2019-12-06 11:13:12'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (597, 'doctor', 111, '192.168.127.12', '2019-12-06 11:15:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (598, 'doctor', 117, '172.16.31.10', '2019-12-06 11:17:25'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (599, 'user', 77, '172.16.17.32', '2019-12-06 11:17:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (600, 'doctor', 143, '172.16.17.32', '2019-12-06 11:20:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (601, 'doctor', 111, '192.168.127.12', '2019-12-06 11:20:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (602, 'user', 84, '192.168.127.12', '2019-12-06 11:21:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (603, 'doctor', 117, '172.16.31.10', '2019-12-06 11:22:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (604, 'doctor', 117, '172.16.31.10', '2019-12-06 11:23:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (605, 'user', 84, '192.168.127.12', '2019-12-06 11:26:25'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (606, 'doctor', 117, '172.16.31.10', '2019-12-06 11:26:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (607, 'user', 84, '192.168.127.12', '2019-12-06 11:27:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (608, 'user', 83, '192.168.3.11', '2019-12-06 11:32:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (609, 'doctor', 111, '192.168.127.12', '2019-12-06 11:39:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (610, 'doctor', 111, '192.168.127.12', '2019-12-06 11:39:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (611, 'doctor', 111, '192.168.127.12', '2019-12-06 11:40:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (612, 'user', 83, '192.168.3.11', '2019-12-06 11:41:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (613, 'doctor', 111, '192.168.127.12', '2019-12-06 11:59:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (614, 'doctor', 111, '192.168.127.12', '2019-12-06 12:02:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (615, 'doctor', 111, '192.168.127.12', '2019-12-06 12:05:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (616, 'doctor', 117, '172.16.31.10', '2019-12-06 12:10:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (617, 'doctor', 117, '172.16.31.10', '2019-12-06 12:12:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (618, 'doctor', 117, '172.16.31.10', '2019-12-06 12:13:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (619, 'doctor', 117, '172.16.31.10', '2019-12-06 12:19:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (620, 'doctor', 117, '172.16.31.10', '2019-12-06 12:25:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (621, 'doctor', 111, '172.16.31.10', '2019-12-06 12:26:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (622, 'doctor', 111, '172.16.31.10', '2019-12-06 12:26:51'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (623, 'doctor', 111, '172.16.31.10', '2019-12-06 12:26:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (624, 'doctor', 111, '172.16.31.10', '2019-12-06 12:26:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (625, 'user', 84, '192.168.127.12', '2019-12-06 12:27:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (626, 'user', 84, '192.168.127.12', '2019-12-06 12:28:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (627, 'doctor', 111, '192.168.127.12', '2019-12-06 14:06:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (628, 'doctor', 111, '192.168.127.12', '2019-12-06 14:10:33'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (629, 'doctor', 111, '192.168.127.12', '2019-12-06 14:14:56'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (630, 'doctor', 111, '192.168.127.12', '2019-12-06 14:20:51'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (631, 'doctor', 111, '192.168.127.12', '2019-12-06 14:36:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (632, 'doctor', 111, '192.168.127.12', '2019-12-06 14:42:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (633, 'doctor', 111, '192.168.127.12', '2019-12-06 14:43:01'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (634, 'doctor', 111, '192.168.127.12', '2019-12-06 14:44:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (635, 'doctor', 111, '192.168.127.12', '2019-12-06 14:58:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (636, 'user', 84, '192.168.127.12', '2019-12-06 14:58:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (637, 'doctor', 111, '192.168.127.12', '2019-12-06 15:01:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (638, 'doctor', 111, '192.168.127.12', '2019-12-06 15:30:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (639, 'doctor', 147, '172.16.17.32', '2019-12-06 16:42:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (640, 'doctor', 103, '192.168.3.11', '2019-12-06 21:35:03'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (641, 'doctor', 143, '192.168.3.11', '2019-12-06 21:35:21'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (642, 'doctor', 143, '192.168.3.11', '2019-12-06 21:35:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (643, 'doctor', 143, '192.168.3.11', '2019-12-06 22:17:43'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (644, 'doctor', 143, '192.168.3.11', '2019-12-07 02:02:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (645, 'doctor', 111, '192.168.127.12', '2019-12-07 15:58:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (646, 'doctor', 111, '192.168.127.12', '2019-12-07 15:58:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (647, 'doctor', 111, '192.168.127.12', '2019-12-07 15:58:43'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (648, 'doctor', 111, '192.168.127.12', '2019-12-07 15:58:45'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (649, 'doctor', 111, '192.168.127.12', '2019-12-07 17:02:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (650, 'doctor', 111, '192.168.127.12', '2019-12-07 17:03:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (651, 'doctor', 111, '192.168.127.12', '2019-12-07 17:03:51'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (652, 'doctor', 111, '192.168.127.12', '2019-12-07 17:06:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (653, 'doctor', 111, '192.168.127.12', '2019-12-07 17:06:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (654, 'doctor', 111, '192.168.127.12', '2019-12-07 17:06:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (655, 'doctor', 111, '192.168.127.12', '2019-12-07 17:06:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (656, 'doctor', 111, '192.168.127.12', '2019-12-07 17:07:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (657, 'doctor', 111, '192.168.127.12', '2019-12-07 17:07:01'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (658, 'doctor', 111, '192.168.127.12', '2019-12-07 17:07:01'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (659, 'doctor', 111, '192.168.127.12', '2019-12-07 17:09:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (660, 'doctor', 111, '192.168.127.12', '2019-12-07 17:10:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (661, 'doctor', 111, '192.168.127.12', '2019-12-07 17:13:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (662, 'doctor', 111, '192.168.127.12', '2019-12-07 17:20:25'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (663, 'doctor', 111, '192.168.127.12', '2019-12-07 19:57:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (664, 'doctor', 111, '192.168.127.12', '2019-12-07 19:57:56'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (665, 'doctor', 111, '192.168.127.12', '2019-12-07 20:00:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (666, 'doctor', 111, '192.168.127.12', '2019-12-07 20:03:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (667, 'doctor', 111, '192.168.127.12', '2019-12-07 20:10:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (668, 'doctor', 111, '192.168.127.12', '2019-12-07 20:10:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (669, 'doctor', 111, '192.168.127.12', '2019-12-07 20:18:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (670, 'doctor', 111, '192.168.127.12', '2019-12-07 20:18:51'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (671, 'doctor', 111, '192.168.127.12', '2019-12-07 20:22:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (672, 'doctor', 111, '192.168.127.12', '2019-12-07 20:22:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (673, 'doctor', 111, '192.168.127.12', '2019-12-07 20:31:45'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (674, 'doctor', 111, '192.168.127.12', '2019-12-07 20:49:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (675, 'doctor', 111, '192.168.127.12', '2019-12-07 20:54:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (676, 'doctor', 111, '192.168.127.12', '2019-12-07 20:58:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (677, 'doctor', 111, '192.168.127.12', '2019-12-07 20:59:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (678, 'doctor', 111, '192.168.127.12', '2019-12-07 20:59:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (679, 'doctor', 111, '192.168.127.12', '2019-12-07 21:04:03'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (680, 'doctor', 111, '192.168.127.12', '2019-12-07 21:08:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (681, 'doctor', 111, '192.168.127.12', '2019-12-07 21:11:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (682, 'doctor', 111, '192.168.127.12', '2019-12-07 21:15:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (683, 'doctor', 111, '192.168.127.12', '2019-12-07 21:15:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (684, 'doctor', 111, '192.168.127.12', '2019-12-07 21:18:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (685, 'doctor', 111, '192.168.127.12', '2019-12-07 21:23:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (686, 'doctor', 111, '192.168.127.12', '2019-12-07 21:27:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (687, 'doctor', 111, '192.168.127.12', '2019-12-07 21:32:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (688, 'doctor', 111, '192.168.127.12', '2019-12-07 23:07:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (689, 'doctor', 111, '192.168.127.12', '2019-12-07 23:09:17'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (690, 'doctor', 111, '192.168.127.12', '2019-12-07 23:10:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (691, 'doctor', 111, '192.168.127.12', '2019-12-07 23:11:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (692, 'doctor', 111, '192.168.127.12', '2019-12-08 09:57:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (693, 'doctor', 111, '192.168.127.12', '2019-12-08 09:57:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (694, 'doctor', 111, '192.168.127.12', '2019-12-08 09:57:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (695, 'doctor', 111, '192.168.127.12', '2019-12-08 09:57:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (696, 'user', 84, '192.168.127.12', '2019-12-08 09:57:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (697, 'doctor', 111, '192.168.127.12', '2019-12-08 10:07:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (698, 'doctor', 111, '192.168.127.12', '2019-12-08 10:09:08'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (699, 'doctor', 111, '192.168.127.12', '2019-12-08 10:09:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (700, 'doctor', 111, '192.168.127.12', '2019-12-08 10:17:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (701, 'doctor', 111, '192.168.127.12', '2019-12-08 10:17:30'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (702, 'user', 84, '192.168.127.12', '2019-12-08 10:17:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (703, 'doctor', 143, '192.168.3.11', '2019-12-08 14:01:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (704, 'doctor', 103, '192.168.3.11', '2019-12-08 14:07:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (705, 'doctor', 103, '192.168.3.11', '2019-12-08 14:12:59'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (706, 'doctor', 103, '192.168.3.11', '2019-12-08 14:15:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (707, 'doctor', 103, '192.168.3.11', '2019-12-08 14:29:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (708, 'doctor', 103, '192.168.3.11', '2019-12-08 14:52:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (709, 'doctor', 103, '192.168.3.11', '2019-12-08 14:54:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (710, 'doctor', 103, '192.168.3.11', '2019-12-08 14:59:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (711, 'doctor', 111, '192.168.127.12', '2019-12-08 15:10:21'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (712, 'doctor', 111, '192.168.127.12', '2019-12-08 15:14:35'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (713, 'doctor', 111, '192.168.127.12', '2019-12-08 15:16:08'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (714, 'doctor', 111, '192.168.127.12', '2019-12-08 15:18:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (715, 'doctor', 111, '192.168.127.12', '2019-12-08 15:20:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (716, 'doctor', 111, '192.168.127.12', '2019-12-08 15:41:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (717, 'doctor', 103, '192.168.3.11', '2019-12-08 15:46:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (718, 'doctor', 103, '192.168.3.11', '2019-12-08 15:49:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (719, 'doctor', 111, '192.168.127.12', '2019-12-08 15:56:23'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (720, 'doctor', 111, '192.168.127.12', '2019-12-08 16:04:17'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (721, 'doctor', 103, '192.168.3.11', '2019-12-08 16:31:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (722, 'doctor', 111, '192.168.127.12', '2019-12-08 16:47:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (723, 'doctor', 111, '192.168.127.12', '2019-12-08 16:55:04'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (724, 'doctor', 111, '192.168.127.12', '2019-12-08 16:56:08'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (725, 'user', 84, '192.168.127.12', '2019-12-08 16:56:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (726, 'doctor', 111, '192.168.127.12', '2019-12-08 16:58:17'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (727, 'doctor', 111, '192.168.127.12', '2019-12-08 17:02:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (728, 'doctor', 111, '192.168.127.12', '2019-12-08 17:05:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (729, 'doctor', 111, '192.168.127.12', '2019-12-08 17:06:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (730, 'doctor', 111, '192.168.127.12', '2019-12-08 17:10:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (731, 'doctor', 111, '192.168.127.12', '2019-12-08 17:11:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (732, 'doctor', 111, '192.168.127.12', '2019-12-08 17:29:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (733, 'doctor', 111, '192.168.127.12', '2019-12-08 19:34:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (734, 'doctor', 111, '192.168.127.12', '2019-12-08 19:38:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (735, 'doctor', 111, '192.168.127.12', '2019-12-08 19:39:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (736, 'doctor', 111, '192.168.127.12', '2019-12-08 19:42:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (737, 'doctor', 111, '192.168.127.12', '2019-12-08 19:54:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (738, 'user', 77, '172.16.17.32', '2019-12-08 23:55:04'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (739, 'doctor', 111, '192.168.3.11', '2019-12-10 00:45:30'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (740, 'user', 84, '192.168.3.11', '2019-12-10 00:45:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (741, 'doctor', 111, '192.168.127.12', '2019-12-10 15:23:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (742, 'doctor', 111, '172.16.31.10', '2019-12-10 22:35:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (743, 'doctor', 111, '172.16.31.10', '2019-12-10 22:36:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (744, 'doctor', 111, '172.16.31.10', '2019-12-10 22:36:23'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (745, 'doctor', 111, '172.16.31.10', '2019-12-10 22:46:59'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (746, 'doctor', 111, '172.16.31.10', '2019-12-10 22:50:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (747, 'doctor', 111, '172.16.31.10', '2019-12-10 22:53:12'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (748, 'doctor', 111, '172.16.31.10', '2019-12-10 22:55:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (749, 'doctor', 111, '172.16.31.10', '2019-12-10 22:59:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (750, 'doctor', 111, '172.16.31.10', '2019-12-10 23:01:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (751, 'doctor', 111, '172.16.31.10', '2019-12-10 23:02:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (752, 'doctor', 111, '172.16.31.10', '2019-12-10 23:03:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (753, 'doctor', 111, '172.16.31.10', '2019-12-10 23:10:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (754, 'doctor', 111, '172.16.31.10', '2019-12-10 23:11:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (755, 'doctor', 111, '172.16.31.10', '2019-12-10 23:12:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (756, 'doctor', 111, '172.16.31.10', '2019-12-10 23:13:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (757, 'doctor', 111, '172.16.31.10', '2019-12-10 23:14:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (758, 'doctor', 111, '172.16.31.10', '2019-12-10 23:15:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (759, 'doctor', 111, '172.16.31.10', '2019-12-10 23:24:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (760, 'doctor', 111, '172.16.31.10', '2019-12-10 23:27:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (761, 'doctor', 111, '172.16.31.10', '2019-12-10 23:28:30'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (762, 'doctor', 111, '172.16.31.10', '2019-12-10 23:48:59'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (763, 'doctor', 111, '172.16.31.10', '2019-12-10 23:56:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (764, 'doctor', 111, '172.16.31.10', '2019-12-10 23:57:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (765, 'doctor', 111, '172.16.31.10', '2019-12-10 23:58:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (766, 'doctor', 111, '172.16.31.10', '2019-12-11 00:01:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (767, 'doctor', 111, '172.16.31.10', '2019-12-11 00:03:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (768, 'doctor', 111, '172.16.31.10', '2019-12-11 00:03:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (769, 'doctor', 111, '172.16.31.10', '2019-12-11 00:04:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (770, 'doctor', 111, '172.16.31.10', '2019-12-11 00:05:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (771, 'doctor', 111, '172.16.31.10', '2019-12-11 00:07:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (772, 'doctor', 111, '172.16.31.10', '2019-12-11 00:08:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (773, 'doctor', 111, '172.16.31.10', '2019-12-11 00:12:47'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (774, 'doctor', 111, '172.16.31.10', '2019-12-11 00:15:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (775, 'doctor', 111, '172.16.31.10', '2019-12-11 00:15:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (776, 'doctor', 111, '172.16.31.10', '2019-12-11 00:15:43'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (777, 'doctor', 111, '172.16.31.10', '2019-12-11 00:31:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (778, 'user', 84, '172.16.31.10', '2019-12-11 00:32:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (779, 'doctor', 111, '172.16.31.10', '2019-12-11 00:39:08'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (780, 'doctor', 111, '172.16.31.10', '2019-12-11 01:24:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (781, 'doctor', 111, '172.16.31.10', '2019-12-11 16:18:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (782, 'user', 83, '172.16.58.3', '2019-12-11 23:45:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (783, 'user', 78, '172.16.58.3', '2019-12-11 23:45:21'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (784, 'user', 78, '172.16.58.3', '2019-12-11 23:48:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (785, 'user', 78, '172.16.58.3', '2019-12-12 00:09:47'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (786, 'user', 78, '172.16.58.3', '2019-12-12 00:11:16'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (787, 'user', 78, '172.16.58.3', '2019-12-12 00:12:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (788, 'user', 78, '172.16.58.3', '2019-12-12 00:16:30'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (789, 'user', 78, '172.16.58.3', '2019-12-12 00:19:47'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (790, 'user', 78, '172.16.58.3', '2019-12-12 00:22:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (791, 'user', 78, '172.16.58.3', '2019-12-12 00:28:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (792, 'user', 78, '172.16.58.3', '2019-12-12 00:34:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (793, 'user', 78, '172.16.58.3', '2019-12-12 00:35:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (794, 'user', 78, '172.16.58.3', '2019-12-12 00:37:12'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (795, 'user', 78, '172.16.58.3', '2019-12-12 00:42:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (796, 'user', 78, '172.16.58.3', '2019-12-12 00:45:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (797, 'user', 78, '172.16.58.3', '2019-12-12 00:46:25'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (798, 'user', 78, '172.16.58.3', '2019-12-12 00:47:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (799, 'user', 78, '172.16.58.3', '2019-12-12 00:47:16'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (800, 'user', 78, '172.16.58.3', '2019-12-12 00:53:30'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (801, 'user', 78, '172.16.58.3', '2019-12-12 00:54:15'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (802, 'user', 78, '172.16.58.3', '2019-12-12 01:00:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (803, 'user', 78, '172.16.58.3', '2019-12-12 01:07:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (804, 'user', 78, '172.16.58.3', '2019-12-12 01:08:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (805, 'user', 78, '172.16.58.3', '2019-12-12 01:12:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (806, 'user', 78, '172.16.58.3', '2019-12-12 01:25:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (807, 'user', 78, '172.16.58.3', '2019-12-12 01:28:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (808, 'user', 78, '172.16.58.3', '2019-12-12 01:32:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (809, 'user', 78, '172.16.58.3', '2019-12-12 01:37:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (810, 'user', 85, '172.16.58.3', '2019-12-12 01:47:03'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (811, 'doctor', 103, '192.168.3.11', '2019-12-12 12:42:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (812, 'doctor', 111, '172.16.31.10', '2019-12-12 13:28:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (813, 'user', 84, '172.16.31.10', '2019-12-12 13:28:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (814, 'user', 85, '172.16.58.3', '2019-12-12 13:33:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (815, 'doctor', 111, '172.16.31.10', '2019-12-12 13:56:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (816, 'doctor', 103, '192.168.3.11', '2019-12-12 14:06:17'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (817, 'doctor', 103, '192.168.3.11', '2019-12-12 14:07:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (818, 'doctor', 103, '192.168.3.11', '2019-12-12 14:09:08'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (819, 'doctor', 103, '192.168.3.11', '2019-12-12 14:25:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (820, 'doctor', 103, '192.168.3.11', '2019-12-12 14:36:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (821, 'doctor', 103, '192.168.3.11', '2019-12-12 18:27:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (822, 'doctor', 103, '192.168.3.11', '2019-12-12 18:29:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (823, 'doctor', 103, '192.168.3.11', '2019-12-12 18:31:17'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (824, 'doctor', 103, '192.168.3.11', '2019-12-12 18:39:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (825, 'doctor', 103, '192.168.3.11', '2019-12-12 18:40:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (826, 'doctor', 103, '192.168.3.11', '2019-12-12 18:42:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (827, 'doctor', 111, '172.16.31.10', '2019-12-12 18:42:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (828, 'doctor', 103, '192.168.3.11', '2019-12-12 18:46:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (829, 'doctor', 103, '192.168.3.11', '2019-12-12 18:48:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (830, 'doctor', 103, '192.168.3.11', '2019-12-12 18:49:21'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (831, 'doctor', 103, '192.168.3.11', '2019-12-12 18:50:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (832, 'doctor', 103, '192.168.3.11', '2019-12-12 18:51:30'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (833, 'doctor', 103, '192.168.3.11', '2019-12-12 18:57:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (834, 'doctor', 103, '192.168.3.11', '2019-12-12 19:07:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (835, 'doctor', 103, '192.168.3.11', '2019-12-12 19:08:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (836, 'doctor', 103, '192.168.3.11', '2019-12-12 19:16:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (837, 'doctor', 103, '192.168.3.11', '2019-12-12 19:21:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (838, 'doctor', 103, '192.168.3.11', '2019-12-12 19:27:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (839, 'doctor', 103, '192.168.3.11', '2019-12-12 19:49:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (840, 'doctor', 103, '192.168.3.11', '2019-12-12 19:54:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (841, 'doctor', 103, '192.168.3.11', '2019-12-12 19:55:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (842, 'doctor', 103, '192.168.3.11', '2019-12-12 20:03:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (843, 'user', 77, '172.16.17.32', '2019-12-12 23:32:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (844, 'user', 77, '172.16.17.32', '2019-12-13 00:00:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (845, 'user', 85, '172.16.58.3', '2019-12-13 00:12:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (846, 'user', 78, '172.16.58.3', '2019-12-13 00:16:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (847, 'user', 78, '172.16.58.3', '2019-12-13 00:17:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (848, 'user', 85, '172.16.58.3', '2019-12-13 00:17:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (849, 'doctor', 147, '172.16.17.32', '2019-12-13 00:18:04'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (850, 'user', 78, '172.16.58.3', '2019-12-13 00:22:25'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (851, 'user', 77, '172.16.17.32', '2019-12-13 00:29:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (852, 'user', 78, '172.16.58.3', '2019-12-13 00:36:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (853, 'user', 77, '172.16.17.32', '2019-12-13 00:42:47'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (854, 'user', 77, '172.16.17.32', '2019-12-13 00:43:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (855, 'user', 78, '172.16.58.3', '2019-12-13 00:45:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (856, 'user', 77, '172.16.17.32', '2019-12-13 00:45:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (857, 'user', 78, '172.16.58.3', '2019-12-13 00:51:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (858, 'user', 78, '172.16.58.3', '2019-12-13 00:53:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (859, 'user', 78, '172.16.58.3', '2019-12-13 00:53:45'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (860, 'user', 78, '172.16.58.3', '2019-12-13 00:55:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (861, 'doctor', 103, '192.168.3.11', '2019-12-13 02:11:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (862, 'doctor', 143, '192.168.3.11', '2019-12-13 02:15:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (863, 'doctor', 143, '192.168.3.11', '2019-12-13 02:16:16'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (864, 'doctor', 143, '192.168.3.11', '2019-12-13 02:16:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (865, 'doctor', 143, '192.168.3.11', '2019-12-13 02:23:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (866, 'doctor', 143, '192.168.3.11', '2019-12-13 02:27:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (867, 'doctor', 143, '192.168.3.11', '2019-12-13 02:37:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (868, 'doctor', 143, '192.168.3.11', '2019-12-13 03:20:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (869, 'doctor', 143, '192.168.3.11', '2019-12-13 03:21:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (870, 'doctor', 143, '192.168.3.11', '2019-12-13 03:21:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (871, 'doctor', 143, '192.168.3.11', '2019-12-13 03:21:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (872, 'doctor', 103, '192.168.3.11', '2019-12-13 03:27:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (873, 'doctor', 103, '192.168.3.11', '2019-12-13 03:29:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (874, 'doctor', 103, '192.168.3.11', '2019-12-13 03:31:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (875, 'doctor', 103, '192.168.3.11', '2019-12-13 03:32:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (876, 'doctor', 103, '192.168.3.11', '2019-12-13 03:34:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (877, 'doctor', 103, '192.168.3.11', '2019-12-13 03:35:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (878, 'doctor', 103, '192.168.3.11', '2019-12-13 03:37:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (879, 'doctor', 111, '172.16.31.10', '2019-12-13 09:01:35'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (880, 'doctor', 103, '192.168.3.11', '2019-12-13 10:44:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (881, 'user', 78, '172.16.58.3', '2019-12-13 10:45:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (882, 'user', 77, '192.168.127.12', '2019-12-13 10:46:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (883, 'user', 78, '172.16.58.3', '2019-12-13 10:46:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (884, 'doctor', 111, '172.16.31.10', '2019-12-13 10:47:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (885, 'doctor', 103, '192.168.3.11', '2019-12-13 10:47:51'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (886, 'doctor', 103, '192.168.3.11', '2019-12-13 10:48:03'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (887, 'user', 78, '192.168.127.12', '2019-12-13 10:48:59'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (888, 'user', 78, '172.16.58.3', '2019-12-13 10:49:45'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (889, 'doctor', 103, '192.168.3.11', '2019-12-13 10:50:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (890, 'doctor', 117, '172.16.31.10', '2019-12-13 10:53:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (891, 'user', 78, '172.16.17.32', '2019-12-13 10:53:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (892, 'user', 85, '172.16.17.32', '2019-12-13 10:53:45'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (893, 'doctor', 117, '172.16.31.10', '2019-12-13 10:58:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (894, 'doctor', 103, '192.168.3.11', '2019-12-13 10:59:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (895, 'doctor', 103, '192.168.3.11', '2019-12-13 11:00:51'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (896, 'doctor', 111, '172.16.31.10', '2019-12-13 11:02:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (897, 'doctor', 103, '192.168.3.11', '2019-12-13 11:09:17'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (898, 'doctor', 103, '172.16.58.3', '2019-12-13 11:10:15'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (899, 'user', 85, '172.16.17.32', '2019-12-13 11:14:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (900, 'doctor', 103, '192.168.3.11', '2019-12-13 11:47:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (901, 'doctor', 111, '192.168.127.12', '2019-12-13 23:11:23'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (902, 'doctor', 103, '172.16.31.10', '2019-12-14 17:43:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (903, 'doctor', 103, '192.168.3.11', '2019-12-15 18:20:12'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (904, 'user', 84, '172.16.31.10', '2019-12-16 18:31:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (905, 'doctor', 111, '172.16.31.10', '2019-12-16 18:34:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (906, 'doctor', 111, '172.16.31.10', '2019-12-16 18:45:15'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (907, 'doctor', 111, '172.16.31.10', '2019-12-16 19:02:51'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (908, 'doctor', 111, '172.16.31.10', '2019-12-16 19:19:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (909, 'doctor', 111, '172.16.31.10', '2019-12-16 19:25:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (910, 'doctor', 111, '172.16.31.10', '2019-12-16 19:26:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (911, 'doctor', 111, '172.16.31.10', '2019-12-16 19:34:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (912, 'doctor', 111, '172.16.31.10', '2019-12-16 19:38:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (913, 'doctor', 111, '172.16.31.10', '2019-12-16 19:41:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (914, 'doctor', 111, '172.16.31.10', '2019-12-16 19:41:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (915, 'doctor', 111, '172.16.31.10', '2019-12-16 19:42:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (916, 'doctor', 111, '172.16.31.10', '2019-12-16 19:46:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (917, 'doctor', 111, '172.16.31.10', '2019-12-16 20:11:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (918, 'doctor', 111, '172.16.31.10', '2019-12-16 20:11:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (919, 'doctor', 111, '172.16.31.10', '2019-12-16 20:11:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (920, 'doctor', 111, '172.16.31.10', '2019-12-16 20:12:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (921, 'doctor', 111, '172.16.31.10', '2019-12-16 20:13:17'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (922, 'doctor', 111, '172.16.31.10', '2019-12-16 20:14:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (923, 'doctor', 111, '172.16.31.10', '2019-12-16 20:14:59'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (924, 'doctor', 111, '172.16.31.10', '2019-12-16 20:15:43'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (925, 'doctor', 111, '172.16.31.10', '2019-12-16 20:16:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (926, 'doctor', 111, '172.16.31.10', '2019-12-16 20:16:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (927, 'doctor', 111, '172.16.31.10', '2019-12-16 20:16:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (928, 'doctor', 111, '172.16.31.10', '2019-12-16 20:16:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (929, 'doctor', 111, '172.16.31.10', '2019-12-16 20:17:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (930, 'doctor', 111, '172.16.31.10', '2019-12-16 20:17:25'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (931, 'doctor', 111, '172.16.31.10', '2019-12-16 20:18:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (932, 'doctor', 111, '172.16.31.10', '2019-12-16 20:18:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (933, 'doctor', 111, '172.16.31.10', '2019-12-16 20:19:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (934, 'doctor', 111, '172.16.31.10', '2019-12-16 20:22:17'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (935, 'doctor', 111, '172.16.31.10', '2019-12-16 20:25:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (936, 'doctor', 111, '172.16.31.10', '2019-12-16 20:25:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (937, 'doctor', 111, '172.16.31.10', '2019-12-16 20:25:43'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (938, 'doctor', 111, '172.16.31.10', '2019-12-16 20:26:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (939, 'doctor', 111, '172.16.31.10', '2019-12-16 20:26:16'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (940, 'doctor', 111, '172.16.31.10', '2019-12-16 20:26:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (941, 'doctor', 111, '172.16.31.10', '2019-12-16 20:27:56'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (942, 'doctor', 111, '172.16.31.10', '2019-12-16 20:28:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (943, 'doctor', 111, '172.16.31.10', '2019-12-16 20:29:21'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (944, 'doctor', 111, '172.16.31.10', '2019-12-16 20:29:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (945, 'doctor', 111, '172.16.31.10', '2019-12-16 20:31:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (946, 'doctor', 111, '172.16.31.10', '2019-12-16 20:32:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (947, 'doctor', 111, '172.16.31.10', '2019-12-16 20:34:04'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (948, 'doctor', 111, '172.16.31.10', '2019-12-16 20:36:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (949, 'doctor', 111, '172.16.31.10', '2019-12-16 20:38:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (950, 'doctor', 111, '172.16.31.10', '2019-12-16 20:53:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (951, 'doctor', 111, '172.16.31.10', '2019-12-16 21:01:23'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (952, 'doctor', 111, '172.16.31.10', '2019-12-16 21:04:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (953, 'doctor', 111, '172.16.31.10', '2019-12-16 21:05:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (954, 'doctor', 111, '172.16.31.10', '2019-12-16 21:10:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (955, 'doctor', 111, '172.16.31.10', '2019-12-16 21:51:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (956, 'doctor', 111, '172.16.17.32', '2019-12-17 16:18:59'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (957, 'doctor', 111, '172.16.17.32', '2019-12-17 16:20:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (958, 'doctor', 111, '172.16.17.32', '2019-12-17 16:20:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (959, 'doctor', 111, '172.16.17.32', '2019-12-17 16:24:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (960, 'doctor', 111, '172.16.17.32', '2019-12-17 16:27:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (961, 'doctor', 111, '172.16.17.32', '2019-12-17 16:27:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (962, 'doctor', 111, '172.16.17.32', '2019-12-17 16:29:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (963, 'doctor', 111, '172.16.17.32', '2019-12-17 16:32:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (964, 'doctor', 111, '172.16.17.32', '2019-12-17 16:33:33'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (965, 'doctor', 111, '172.16.17.32', '2019-12-17 16:34:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (966, 'doctor', 111, '172.16.17.32', '2019-12-17 16:34:56'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (967, 'doctor', 111, '172.16.17.32', '2019-12-17 16:43:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (968, 'doctor', 111, '172.16.17.32', '2019-12-17 16:48:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (969, 'doctor', 111, '172.16.17.32', '2019-12-17 16:48:23'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (970, 'doctor', 111, '172.16.17.32', '2019-12-17 16:50:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (971, 'doctor', 111, '172.16.17.32', '2019-12-17 16:59:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (972, 'doctor', 103, '192.168.3.11', '2019-12-17 17:10:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (973, 'doctor', 103, '192.168.3.11', '2019-12-17 17:13:33'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (974, 'doctor', 111, '172.16.17.32', '2019-12-17 17:18:43'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (975, 'doctor', 111, '172.16.17.32', '2019-12-17 17:20:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (976, 'doctor', 111, '172.16.17.32', '2019-12-17 17:24:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (977, 'doctor', 111, '172.16.17.32', '2019-12-17 17:33:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (978, 'doctor', 103, '192.168.3.11', '2019-12-17 17:43:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (979, 'user', 84, '172.16.17.32', '2019-12-17 17:46:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (980, 'doctor', 111, '172.16.17.32', '2019-12-17 17:47:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (981, 'doctor', 111, '172.16.17.32', '2019-12-17 17:51:33'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (982, 'doctor', 111, '172.16.17.32', '2019-12-17 18:08:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (983, 'doctor', 111, '172.16.17.32', '2019-12-17 18:11:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (984, 'doctor', 111, '172.16.17.32', '2019-12-17 18:14:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (985, 'doctor', 111, '172.16.17.32', '2019-12-17 18:15:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (986, 'doctor', 111, '172.16.17.32', '2019-12-17 18:21:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (987, 'doctor', 111, '172.16.17.32', '2019-12-17 18:25:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (988, 'doctor', 111, '172.16.17.32', '2019-12-17 18:27:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (989, 'doctor', 103, '192.168.3.11', '2019-12-17 18:30:12'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (990, 'doctor', 111, '172.16.17.32', '2019-12-17 18:32:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (991, 'doctor', 111, '172.16.17.32', '2019-12-17 18:34:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (992, 'doctor', 111, '172.16.17.32', '2019-12-17 18:35:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (993, 'doctor', 111, '172.16.17.32', '2019-12-17 18:36:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (994, 'doctor', 111, '192.168.3.11', '2019-12-17 20:29:45'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (995, 'doctor', 111, '192.168.3.11', '2019-12-17 20:30:33'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (996, 'user', 78, '192.168.3.11', '2019-12-17 20:38:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (997, 'user', 78, '192.168.3.11', '2019-12-17 21:08:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (998, 'user', 78, '192.168.3.11', '2019-12-17 21:10:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (999, 'user', 86, '192.168.3.11', '2019-12-17 22:02:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1000, 'user', 86, '192.168.3.11', '2019-12-17 22:16:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1001, 'user', 86, '192.168.3.11', '2019-12-17 22:20:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1002, 'doctor', 111, '192.168.3.11', '2019-12-17 22:32:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1003, 'doctor', 111, '192.168.3.11', '2019-12-17 22:36:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1004, 'doctor', 111, '192.168.3.11', '2019-12-17 22:50:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1005, 'doctor', 111, '192.168.3.11', '2019-12-17 23:04:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1006, 'user', 78, '192.168.3.11', '2019-12-17 23:06:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1007, 'doctor', 111, '192.168.3.11', '2019-12-17 23:07:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1008, 'user', 78, '192.168.3.11', '2019-12-17 23:18:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1009, 'doctor', 111, '192.168.3.11', '2019-12-17 23:18:56'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1010, 'user', 78, '192.168.3.11', '2019-12-17 23:30:21'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1011, 'doctor', 111, '192.168.3.11', '2019-12-17 23:44:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1012, 'doctor', 111, '192.168.3.11', '2019-12-18 00:12:01'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1013, 'doctor', 111, '192.168.3.11', '2019-12-18 00:13:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1014, 'doctor', 111, '192.168.3.11', '2019-12-18 00:15:17'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1015, 'doctor', 111, '192.168.3.11', '2019-12-18 00:17:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1016, 'doctor', 111, '192.168.3.11', '2019-12-18 00:19:04'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1017, 'doctor', 111, '192.168.3.11', '2019-12-18 00:23:23'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1018, 'doctor', 103, '192.168.3.11', '2019-12-18 00:33:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1019, 'doctor', 103, '192.168.3.11', '2019-12-18 00:42:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1020, 'doctor', 103, '192.168.3.11', '2019-12-18 00:44:35'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1021, 'doctor', 103, '192.168.3.11', '2019-12-18 00:48:08'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1022, 'doctor', 103, '192.168.3.11', '2019-12-18 00:49:35'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1023, 'doctor', 103, '192.168.3.11', '2019-12-18 00:51:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1024, 'doctor', 103, '192.168.3.11', '2019-12-18 00:52:30'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1025, 'doctor', 103, '192.168.3.11', '2019-12-18 00:55:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1026, 'doctor', 103, '192.168.3.11', '2019-12-18 00:57:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1027, 'doctor', 103, '192.168.3.11', '2019-12-18 00:59:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1028, 'doctor', 103, '192.168.3.11', '2019-12-18 01:01:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1029, 'doctor', 103, '192.168.3.11', '2019-12-18 01:04:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1030, 'doctor', 103, '192.168.3.11', '2019-12-18 01:08:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1031, 'doctor', 103, '192.168.3.11', '2019-12-18 01:10:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1032, 'doctor', 111, '192.168.3.11', '2019-12-18 01:12:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1033, 'doctor', 111, '192.168.3.11', '2019-12-18 01:18:01'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1034, 'doctor', 111, '192.168.3.11', '2019-12-18 01:22:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1035, 'doctor', 111, '192.168.3.11', '2019-12-18 01:26:30'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1036, 'doctor', 111, '192.168.3.11', '2019-12-18 01:30:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1037, 'doctor', 111, '192.168.3.11', '2019-12-18 01:31:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1038, 'doctor', 111, '192.168.3.11', '2019-12-18 01:31:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1039, 'doctor', 103, '192.168.3.11', '2019-12-18 01:35:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1040, 'doctor', 103, '192.168.3.11', '2019-12-18 01:37:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1041, 'doctor', 111, '192.168.3.11', '2019-12-18 01:37:35'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1042, 'doctor', 103, '192.168.3.11', '2019-12-18 01:38:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1043, 'doctor', 111, '192.168.3.11', '2019-12-18 01:51:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1044, 'doctor', 111, '192.168.3.11', '2019-12-18 01:52:25'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1045, 'doctor', 111, '192.168.3.11', '2019-12-18 01:54:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1046, 'doctor', 111, '192.168.3.11', '2019-12-18 02:06:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1047, 'doctor', 111, '192.168.3.11', '2019-12-18 02:27:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1048, 'doctor', 111, '192.168.3.11', '2019-12-18 02:30:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1049, 'doctor', 111, '192.168.3.11', '2019-12-18 02:36:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1050, 'doctor', 111, '192.168.3.11', '2019-12-18 02:36:16'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1051, 'doctor', 111, '192.168.3.11', '2019-12-18 02:39:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1052, 'doctor', 111, '192.168.3.11', '2019-12-18 03:11:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1053, 'doctor', 111, '192.168.3.11', '2019-12-18 03:25:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1054, 'doctor', 111, '192.168.3.11', '2019-12-18 03:30:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1055, 'doctor', 111, '192.168.3.11', '2019-12-18 03:34:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1056, 'doctor', 111, '192.168.3.11', '2019-12-18 03:35:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1057, 'doctor', 111, '192.168.3.11', '2019-12-18 03:36:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1058, 'doctor', 111, '192.168.3.11', '2019-12-18 03:37:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1059, 'doctor', 111, '192.168.3.11', '2019-12-18 03:38:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1060, 'doctor', 111, '192.168.3.11', '2019-12-18 03:40:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1061, 'user', 84, '192.168.3.11', '2019-12-18 03:56:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1063, 'user', 78, '192.168.3.11', '2019-12-18 13:19:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1064, 'user', 84, '192.168.3.11', '2019-12-18 13:27:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1066, 'doctor', 111, '192.168.3.11', '2019-12-18 13:28:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1067, 'user', 86, '192.168.3.11', '2019-12-18 13:40:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1068, 'doctor', 111, '192.168.3.11', '2019-12-18 13:47:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1069, 'user', 78, '192.168.3.11', '2019-12-18 14:05:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1070, 'doctor', 111, '192.168.3.11', '2019-12-18 14:12:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1071, 'doctor', 111, '192.168.3.11', '2019-12-18 14:22:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1072, 'doctor', 111, '192.168.3.11', '2019-12-18 14:37:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1073, 'doctor', 111, '192.168.3.11', '2019-12-18 14:37:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1074, 'doctor', 111, '192.168.3.11', '2019-12-18 14:40:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1075, 'doctor', 111, '192.168.3.11', '2019-12-18 14:43:04'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1076, 'doctor', 111, '192.168.3.11', '2019-12-18 14:45:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1077, 'doctor', 111, '192.168.3.11', '2019-12-18 15:03:03'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1078, 'doctor', 111, '192.168.3.11', '2019-12-18 18:35:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1079, 'doctor', 111, '192.168.3.11', '2019-12-18 18:36:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1080, 'doctor', 111, '192.168.3.11', '2019-12-18 18:40:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1081, 'doctor', 111, '192.168.3.11', '2019-12-18 18:45:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1082, 'doctor', 111, '192.168.3.11', '2019-12-18 18:46:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1083, 'doctor', 111, '192.168.3.11', '2019-12-18 18:53:33'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1084, 'doctor', 111, '192.168.3.11', '2019-12-18 19:53:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1085, 'doctor', 111, '192.168.3.11', '2019-12-18 19:54:12'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1086, 'doctor', 111, '192.168.3.11', '2019-12-18 19:56:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1087, 'doctor', 111, '192.168.3.11', '2019-12-18 19:56:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1088, 'doctor', 111, '192.168.3.11', '2019-12-18 20:10:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1089, 'doctor', 111, '192.168.3.11', '2019-12-18 20:10:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1090, 'doctor', 111, '192.168.3.11', '2019-12-18 20:13:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1091, 'doctor', 111, '192.168.3.11', '2019-12-18 20:18:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1092, 'doctor', 111, '192.168.3.11', '2019-12-18 20:19:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1093, 'doctor', 111, '192.168.3.11', '2019-12-18 20:24:33'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1094, 'doctor', 111, '192.168.3.11', '2019-12-18 20:25:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1095, 'doctor', 111, '192.168.3.11', '2019-12-18 20:26:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1096, 'doctor', 111, '192.168.3.11', '2019-12-18 20:29:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1097, 'doctor', 111, '192.168.3.11', '2019-12-19 16:57:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1098, 'doctor', 111, '192.168.3.11', '2019-12-19 18:42:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1099, 'doctor', 103, '192.168.3.11', '2019-12-19 19:15:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1100, 'doctor', 103, '192.168.3.11', '2019-12-19 19:15:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1101, 'doctor', 103, '192.168.3.11', '2019-12-19 19:15:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1102, 'doctor', 103, '192.168.3.11', '2019-12-19 19:16:21'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1103, 'user', 84, '192.168.3.11', '2019-12-19 20:20:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1104, 'doctor', 111, '192.168.3.11', '2019-12-19 20:20:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1105, 'doctor', 111, '192.168.3.11', '2019-12-19 20:48:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1106, 'doctor', 111, '192.168.3.11', '2019-12-19 21:11:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1107, 'doctor', 111, '192.168.3.11', '2019-12-19 21:13:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1108, 'doctor', 111, '192.168.3.11', '2019-12-19 21:15:59'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1109, 'doctor', 111, '192.168.3.11', '2019-12-19 21:16:45'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1110, 'doctor', 111, '192.168.3.11', '2019-12-19 21:23:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1111, 'doctor', 111, '192.168.3.11', '2019-12-19 21:23:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1112, 'doctor', 111, '192.168.3.11', '2019-12-19 21:41:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1113, 'doctor', 111, '192.168.3.11', '2019-12-20 17:03:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1114, 'doctor', 111, '192.168.127.12', '2019-12-21 00:58:51'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1115, 'doctor', 111, '192.168.127.12', '2019-12-21 19:04:03'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1116, 'user', 84, '192.168.127.12', '2019-12-21 19:04:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1127, 'doctor', 143, '172.16.31.10', '2019-12-22 01:32:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1128, 'doctor', 143, '172.16.31.10', '2019-12-22 01:32:23'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1141, 'doctor', 111, '192.168.3.11', '2019-12-25 02:11:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1142, 'doctor', 111, '192.168.3.11', '2019-12-25 02:13:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1143, 'doctor', 111, '192.168.3.11', '2019-12-25 02:17:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1144, 'doctor', 111, '192.168.3.11', '2019-12-25 02:19:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1145, 'doctor', 111, '192.168.3.11', '2019-12-25 02:19:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1146, 'doctor', 111, '192.168.3.11', '2019-12-25 02:19:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1147, 'doctor', 111, '192.168.3.11', '2019-12-25 02:26:45'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1148, 'doctor', 111, '192.168.3.11', '2019-12-25 02:28:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1149, 'doctor', 111, '192.168.3.11', '2019-12-25 02:29:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1150, 'doctor', 111, '192.168.3.11', '2019-12-25 02:33:03'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1151, 'doctor', 111, '192.168.3.11', '2019-12-25 02:34:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1152, 'doctor', 111, '192.168.3.11', '2019-12-25 02:35:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1153, 'doctor', 111, '192.168.3.11', '2019-12-25 02:37:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1154, 'doctor', 111, '192.168.3.11', '2019-12-25 02:38:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1155, 'doctor', 111, '192.168.3.11', '2019-12-25 02:40:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1156, 'doctor', 111, '192.168.3.11', '2019-12-25 02:42:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1157, 'doctor', 111, '192.168.3.11', '2019-12-25 02:47:30'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1158, 'doctor', 111, '192.168.3.11', '2019-12-25 02:48:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1159, 'doctor', 111, '192.168.3.11', '2019-12-25 02:52:01'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1160, 'doctor', 111, '192.168.3.11', '2019-12-25 02:53:51'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1161, 'doctor', 111, '192.168.3.11', '2019-12-25 02:59:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1162, 'user', 84, '192.168.3.11', '2019-12-25 03:00:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1163, 'doctor', 111, '192.168.3.11', '2019-12-25 03:16:33'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1164, 'doctor', 111, '192.168.3.11', '2019-12-25 03:18:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1165, 'doctor', 111, '2172.16.58.3', '2019-12-25 03:19:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1166, 'doctor', 111, '192.168.3.11', '2019-12-25 14:57:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1167, 'doctor', 103, '172.16.17.32', '2019-12-25 16:56:30'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1168, 'doctor', 103, '172.16.17.32', '2019-12-25 16:57:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1169, 'doctor', 103, '172.16.17.32', '2019-12-25 17:00:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1170, 'doctor', 103, '172.16.17.32', '2019-12-25 17:03:30'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1171, 'doctor', 170, '172.16.17.32', '2019-12-26 01:42:23'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1172, 'doctor', 170, '172.16.17.32', '2019-12-26 01:44:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1173, 'doctor', 170, '172.16.17.32', '2019-12-26 01:46:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1174, 'doctor', 170, '172.16.17.32', '2019-12-26 01:49:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1175, 'doctor', 111, '192.168.3.11', '2019-12-26 18:51:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1176, 'doctor', 111, '192.168.3.11', '2019-12-26 18:57:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1177, 'doctor', 170, '172.16.17.32', '2019-12-27 15:01:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1178, 'doctor', 170, '172.16.17.32', '2019-12-27 15:54:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1179, 'doctor', 103, '172.16.17.32', '2019-12-27 15:55:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1180, 'doctor', 103, '172.16.31.10', '2019-12-28 17:52:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1181, 'doctor', 103, '172.16.31.10', '2019-12-28 17:52:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1182, 'doctor', 103, '172.16.31.10', '2019-12-28 17:52:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1183, 'doctor', 111, '2172.16.58.3', '2019-12-29 00:09:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1184, 'user', 78, '192.168.127.12', '2019-12-29 07:23:56'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1185, 'doctor', 103, '172.16.31.10', '2019-12-29 12:53:16'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1186, 'doctor', 143, '172.16.31.10', '2019-12-29 13:19:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1187, 'doctor', 103, '172.16.31.10', '2019-12-29 13:19:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1188, 'doctor', 103, '172.16.31.10', '2019-12-29 13:19:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1189, 'doctor', 103, '172.16.31.10', '2019-12-29 14:21:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1190, 'doctor', 170, '172.16.31.10', '2019-12-29 15:00:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1191, 'user', 84, '172.16.17.32', '2019-12-29 15:11:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1192, 'doctor', 143, '172.16.31.10', '2019-12-29 15:11:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1193, 'doctor', 143, '172.16.31.10', '2019-12-29 15:13:56'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1194, 'doctor', 143, '172.16.31.10', '2019-12-29 16:30:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1195, 'doctor', 143, '172.16.31.10', '2019-12-29 16:52:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1196, 'doctor', 103, '172.16.31.10', '2019-12-29 16:56:04'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1197, 'doctor', 143, '172.16.31.10', '2019-12-29 16:56:56'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1198, 'doctor', 111, '172.16.17.32', '2019-12-29 17:11:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1199, 'doctor', 143, '172.16.31.10', '2019-12-29 18:52:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1200, 'doctor', 143, '172.16.31.10', '2019-12-29 18:57:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1201, 'user', 78, '192.168.127.12', '2019-12-29 23:10:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1202, 'user', 78, '192.168.127.12', '2019-12-29 23:24:59'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1203, 'user', 78, '192.168.127.12', '2019-12-29 23:51:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1204, 'user', 78, '192.168.127.12', '2019-12-29 23:52:04'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1205, 'user', 78, '192.168.127.12', '2019-12-29 23:52:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1206, 'doctor', 143, '172.16.31.10', '2020-01-02 12:24:16'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1207, 'doctor', 143, '172.16.31.10', '2020-01-02 12:24:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1208, 'doctor', 143, '172.16.31.10', '2020-01-02 12:25:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1209, 'doctor', 143, '172.16.31.10', '2020-01-02 12:53:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1210, 'doctor', 143, '172.16.31.10', '2020-01-02 13:02:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1211, 'doctor', 143, '172.16.31.10', '2020-01-02 13:02:46'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1212, 'doctor', 103, '172.16.31.10', '2020-01-02 13:02:59'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1213, 'doctor', 111, '192.168.3.11', '2020-01-02 13:54:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1214, 'doctor', 103, '172.16.31.10', '2020-01-02 13:56:56'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1215, 'doctor', 103, '172.16.31.10', '2020-01-02 14:34:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1216, 'user', 78, '192.168.3.11', '2020-01-02 17:20:53'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1217, 'user', 78, '192.168.3.11', '2020-01-02 18:49:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1218, 'user', 78, '192.168.3.11', '2020-01-02 19:10:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1219, 'user', 78, '192.168.3.11', '2020-01-02 19:47:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1220, 'user', 78, '192.168.3.11', '2020-01-02 19:48:21'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1221, 'user', 85, '192.168.3.11', '2020-01-02 19:48:45'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1222, 'user', 85, '192.168.3.11', '2020-01-02 19:48:59'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1223, 'user', 85, '192.168.3.11', '2020-01-02 19:51:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1224, 'user', 78, '192.168.3.11', '2020-01-02 19:51:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1225, 'user', 78, '192.168.3.11', '2020-01-02 19:56:08'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1226, 'user', 78, '192.168.3.11', '2020-01-02 19:56:51'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1227, 'doctor', 171, '192.168.3.11', '2020-01-02 20:02:25'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1228, 'doctor', 171, '192.168.3.11', '2020-01-02 20:03:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1229, 'user', 78, '192.168.3.11', '2020-01-02 20:04:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1230, 'user', 78, '192.168.3.11', '2020-01-02 20:06:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1231, 'user', 78, '192.168.3.11', '2020-01-02 20:10:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1232, 'doctor', 171, '192.168.3.11', '2020-01-02 20:35:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1233, 'user', 78, '192.168.3.11', '2020-01-02 20:37:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1234, 'doctor', 171, '192.168.3.11', '2020-01-02 20:39:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1235, 'user', 78, '192.168.3.11', '2020-01-02 20:39:33'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1236, 'user', 85, '192.168.3.11', '2020-01-02 20:40:14'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1237, 'doctor', 171, '192.168.3.11', '2020-01-02 20:43:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1238, 'user', 85, '192.168.3.11', '2020-01-02 21:15:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1239, 'user', 85, '192.168.3.11', '2020-01-02 21:16:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1240, 'user', 85, '192.168.3.11', '2020-01-02 21:18:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1241, 'user', 85, '192.168.3.11', '2020-01-02 21:19:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1242, 'user', 85, '192.168.3.11', '2020-01-02 21:47:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1243, 'doctor', 172, '172.16.17.32', '2020-01-02 21:50:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1244, 'doctor', 172, '172.16.17.32', '2020-01-02 22:28:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1245, 'doctor', 172, '172.16.17.32', '2020-01-02 22:29:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1246, 'doctor', 172, '172.16.17.32', '2020-01-02 22:30:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1247, 'doctor', 171, '172.16.17.32', '2020-01-02 22:31:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1248, 'doctor', 171, '172.16.17.32', '2020-01-02 22:31:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1249, 'user', 84, '172.16.17.32', '2020-01-02 22:32:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1250, 'doctor', 171, '172.16.17.32', '2020-01-03 10:25:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1251, 'user', 77, '172.16.17.32', '2020-01-05 22:36:33'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1252, 'user', 77, '172.16.17.32', '2020-01-05 23:05:04'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1253, 'user', 77, '172.16.17.32', '2020-01-05 23:10:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1254, 'user', 77, '172.16.17.32', '2020-01-05 23:11:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1255, 'user', 77, '172.16.17.32', '2020-01-05 23:17:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1256, 'user', 77, '172.16.17.32', '2020-01-06 00:16:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1257, 'user', 77, '192.168.3.11', '2020-01-06 16:45:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1258, 'doctor', 103, '172.16.31.10', '2020-01-06 17:11:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1259, 'doctor', 171, '192.168.3.11', '2020-01-06 17:27:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1260, 'user', 77, '192.168.3.11', '2020-01-07 10:13:04'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1261, 'user', 77, '192.168.3.11', '2020-01-07 11:58:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1262, 'user', 85, '172.16.58.3', '2020-01-07 14:34:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1263, 'user', 85, '172.16.58.3', '2020-01-07 15:20:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1264, 'user', 85, '172.16.58.3', '2020-01-07 18:17:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1265, 'user', 85, '172.16.58.3', '2020-01-07 19:30:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1266, 'doctor', 103, '172.16.31.10', '2020-01-07 19:37:43'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1267, 'doctor', 143, '172.16.31.10', '2020-01-07 19:40:12'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1268, 'doctor', 170, '172.16.31.10', '2020-01-07 19:49:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1269, 'doctor', 170, '172.16.31.10', '2020-01-07 19:49:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1270, 'doctor', 170, '172.16.31.10', '2020-01-07 19:49:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1271, 'doctor', 103, '172.16.31.10', '2020-01-07 19:51:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1272, 'doctor', 171, '192.168.3.11', '2020-01-07 20:53:12'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1273, 'user', 84, '192.168.3.11', '2020-01-07 20:54:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1274, 'doctor', 171, '192.168.3.11', '2020-01-07 21:08:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1275, 'doctor', 171, '192.168.3.11', '2020-01-07 21:23:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1276, 'doctor', 103, '172.16.31.10', '2020-01-08 13:55:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1277, 'doctor', 103, '172.16.31.10', '2020-01-08 14:10:02'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1278, 'user', 85, '172.16.58.3', '2020-01-08 14:10:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1279, 'doctor', 103, '172.16.31.10', '2020-01-08 14:14:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1280, 'user', 85, '172.16.58.3', '2020-01-08 14:45:01'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1281, 'user', 85, '172.16.58.3', '2020-01-08 14:49:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1282, 'user', 85, '172.16.58.3', '2020-01-08 14:50:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1283, 'user', 85, '172.16.58.3', '2020-01-08 14:50:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1284, 'user', 85, '172.16.58.3', '2020-01-08 14:51:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1285, 'user', 85, '172.16.58.3', '2020-01-08 14:51:40'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1286, 'user', 85, '172.16.58.3', '2020-01-08 14:52:26'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1287, 'doctor', 171, '192.168.3.11', '2020-01-08 15:50:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1288, 'user', 84, '192.168.3.11', '2020-01-08 15:51:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1289, 'user', 85, '172.16.58.3', '2020-01-08 16:02:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1290, 'user', 85, '172.16.58.3', '2020-01-08 16:04:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1291, 'user', 85, '172.16.58.3', '2020-01-08 16:12:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1292, 'user', 85, '172.16.58.3', '2020-01-08 16:13:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1293, 'user', 85, '172.16.58.3', '2020-01-08 16:33:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1294, 'doctor', 103, '192.168.3.11', '2020-01-08 16:34:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1295, 'user', 85, '172.16.58.3', '2020-01-08 16:37:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1296, 'user', 85, '172.16.58.3', '2020-01-08 16:38:45'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1297, 'user', 77, '192.168.3.11', '2020-01-09 11:31:01'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1298, 'user', 77, '192.168.3.11', '2020-01-09 12:12:06'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1299, 'user', 77, '192.168.3.11', '2020-01-09 12:26:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1300, 'user', 77, '192.168.3.11', '2020-01-09 12:29:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1301, 'user', 77, '172.16.31.10', '2020-01-09 13:27:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1302, 'user', 85, '172.16.17.32', '2020-01-09 14:34:07'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1303, 'user', 85, '172.16.17.32', '2020-01-09 14:40:35'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1304, 'doctor', 171, '192.168.3.11', '2020-01-09 15:03:30'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1305, 'user', 85, '172.16.17.32', '2020-01-09 15:12:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1306, 'user', 85, '172.16.17.32', '2020-01-09 15:46:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1307, 'doctor', 103, '172.16.17.32', '2020-01-09 16:14:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1308, 'doctor', 103, '172.16.17.32', '2020-01-09 16:18:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1309, 'user', 84, '192.168.3.11', '2020-01-09 16:21:23'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1310, 'user', 85, '172.16.17.32', '2020-01-09 16:30:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1311, 'user', 85, '172.16.17.32', '2020-01-09 16:31:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1312, 'user', 77, '192.168.3.11', '2020-01-09 16:33:32'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1313, 'user', 85, '172.16.17.32', '2020-01-09 16:36:54'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1314, 'user', 77, '192.168.3.11', '2020-01-09 16:37:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1315, 'user', 77, '192.168.3.11', '2020-01-09 16:38:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1316, 'user', 77, '192.168.3.11', '2020-01-09 16:39:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1317, 'user', 85, '172.16.17.32', '2020-01-09 16:41:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1318, 'user', 77, '192.168.3.11', '2020-01-09 16:42:09'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1319, 'user', 77, '192.168.3.11', '2020-01-09 16:44:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1320, 'user', 77, '192.168.3.11', '2020-01-09 16:55:57'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1321, 'user', 77, '192.168.3.11', '2020-01-09 16:58:10'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1322, 'user', 85, '172.16.17.32', '2020-01-09 17:01:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1323, 'user', 77, '192.168.3.11', '2020-01-09 17:03:01'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1324, 'doctor', 103, '192.168.127.12', '2020-01-09 17:04:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1325, 'user', 77, '192.168.3.11', '2020-01-09 17:12:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1326, 'doctor', 171, '192.168.3.11', '2020-01-09 17:34:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1327, 'user', 85, '172.16.17.32', '2020-01-09 17:36:45'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1328, 'user', 77, '192.168.3.11', '2020-01-09 18:47:19'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1329, 'user', 77, '192.168.3.11', '2020-01-09 19:17:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1330, 'doctor', 171, '192.168.3.11', '2020-01-09 19:26:52'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1331, 'user', 78, '172.16.17.32', '2020-01-09 19:27:24'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1332, 'user', 78, '172.16.17.32', '2020-01-09 19:27:38'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1333, 'user', 85, '172.16.17.32', '2020-01-09 19:28:00'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1334, 'user', 85, '172.16.17.32', '2020-01-09 19:35:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1335, 'doctor', 171, '192.168.3.11', '2020-01-09 19:45:27'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1336, 'user', 85, '172.16.17.32', '2020-01-09 19:48:42'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1337, 'doctor', 171, '192.168.3.11', '2020-01-09 19:53:13'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1338, 'user', 85, '172.16.17.32', '2020-01-09 19:55:44'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1339, 'user', 85, '172.16.17.32', '2020-01-09 20:07:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1340, 'user', 85, '172.16.17.32', '2020-01-09 20:13:33'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1341, 'user', 85, '172.16.17.32', '2020-01-09 20:16:55'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1342, 'user', 85, '172.16.17.32', '2020-01-09 20:20:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1343, 'doctor', 171, '172.16.31.10', '2020-01-09 20:32:15'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1344, 'doctor', 171, '172.16.31.10', '2020-01-09 20:37:37'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1345, 'doctor', 171, '172.16.31.10', '2020-01-09 20:39:11'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1346, 'doctor', 171, '172.16.31.10', '2020-01-09 20:42:20'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1347, 'doctor', 171, '172.16.31.10', '2020-01-09 20:46:36'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1348, 'user', 85, '172.16.17.32', '2020-01-09 20:49:12'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1349, 'doctor', 171, '172.16.31.10', '2020-01-09 20:51:34'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1350, 'doctor', 171, '172.16.31.10', '2020-01-09 20:56:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1351, 'user', 77, '172.16.58.3', '2020-01-09 21:08:28'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1352, 'user', 85, '172.16.17.32', '2020-01-09 21:15:12'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1353, 'user', 85, '172.16.17.32', '2020-01-09 21:41:39'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1354, 'user', 85, '172.16.17.32', '2020-01-09 22:02:22'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1355, 'user', 85, '172.16.17.32', '2020-01-09 22:12:58'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1356, 'user', 85, '172.16.17.32', '2020-01-09 22:13:21'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1357, 'user', 77, '172.16.58.3', '2020-01-09 22:39:17'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1358, 'user', 77, '192.168.3.11', '2020-01-10 01:05:29'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1359, 'user', 85, '172.16.31.10', '2020-01-10 01:16:05'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1360, 'user', 78, '172.16.31.10', '2020-01-10 01:28:18'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1361, 'user', 78, '172.16.31.10', '2020-01-10 01:28:31'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1362, 'user', 77, '192.168.127.12', '2020-01-10 13:53:50'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1363, 'user', 78, '192.168.3.11', '2020-01-22 22:12:15'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1364, 'user', 78, '192.168.3.11', '2020-01-22 22:12:17'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1365, 'user', 78, '172.16.31.10', '2020-01-23 21:25:48'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1366, 'user', 78, '172.16.58.3', '2020-01-26 13:49:08'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1367, 'user', 78, '172.16.58.3', '2020-01-26 13:52:41'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1368, 'user', 77, '192.168.3.11', '2020-02-26 14:03:49'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1369, 'user', 62, '192.168.3.11', '2020-02-26 14:04:04'); INSERT INTO `login_log` (`id`, `id_type`, `login_id`, `ip_address`, `created_at`) VALUES (1370, 'user', 77, '192.168.3.11', '2020-02-26 14:04:12'); /*!40000 ALTER TABLE `login_log` ENABLE KEYS */; -- 테이블 MerDog.passbook_account 구조 내보내기 CREATE TABLE IF NOT EXISTS `passbook_account` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '무통장 계좌 인덱스 번호', `bank_name` varchar(50) NOT NULL COMMENT '은행명', `bank_number` varchar(50) NOT NULL COMMENT '계좌번호', `bank_depo` varchar(50) NOT NULL COMMENT '예금주', `on/off` varchar(10) NOT NULL DEFAULT 'off' COMMENT '등록/미등록 여부', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '등록날짜시간', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='무통장 계좌'; -- 테이블 데이터 MerDog.passbook_account:~3 rows (대략적) 내보내기 /*!40000 ALTER TABLE `passbook_account` DISABLE KEYS */; INSERT INTO `passbook_account` (`id`, `bank_name`, `bank_number`, `bank_depo`, `on/off`, `created_at`) VALUES (1, '신한', '110417188220', '공지환', 'off', '2019-11-21 18:02:06'); INSERT INTO `passbook_account` (`id`, `bank_name`, `bank_number`, `bank_depo`, `on/off`, `created_at`) VALUES (2, '국민', '123456789', '기모링', 'off', '2019-11-21 18:09:57'); INSERT INTO `passbook_account` (`id`, `bank_name`, `bank_number`, `bank_depo`, `on/off`, `created_at`) VALUES (3, '우리', '987654321', '이잉', 'on', '2019-11-21 18:32:51'); /*!40000 ALTER TABLE `passbook_account` ENABLE KEYS */; -- 테이블 MerDog.payment_list 구조 내보내기 CREATE TABLE IF NOT EXISTS `payment_list` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '결제내역 인덱스 번호', `user_id` int(11) NOT NULL COMMENT '고객회원 번호', `product_id` int(11) NOT NULL COMMENT '상품 번호', `state` varchar(50) NOT NULL DEFAULT 'fail' COMMENT '결제 상태 -> 완료:complete / 환불:refund / 대기 : wait /실패: fail', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `FK_payment_list_product` (`product_id`), KEY `FK_payment_list_user_info` (`user_id`), CONSTRAINT `FK_payment_list_product` FOREIGN KEY (`product_id`) REFERENCES `product` (`id`) ON UPDATE CASCADE, CONSTRAINT `FK_payment_list_user_info` FOREIGN KEY (`user_id`) REFERENCES `user_info` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='결제 내역'; -- 테이블 데이터 MerDog.payment_list:~101 rows (대략적) 내보내기 /*!40000 ALTER TABLE `payment_list` DISABLE KEYS */; INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (1, 62, 1, 'complete', '2019-11-24 18:17:07'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (2, 62, 1, 'refund', '2019-11-26 22:42:15'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (3, 62, 1, 'fail', '2019-11-24 18:21:36'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (4, 62, 1, 'complete', '2019-11-26 13:26:55'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (5, 62, 1, 'complete', '2019-11-26 13:26:56'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (6, 62, 1, 'complete', '2019-11-26 22:26:58'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (7, 62, 1, 'complete', '2019-11-24 18:17:41'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (8, 62, 1, 'complete', '2019-11-24 18:17:40'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (9, 62, 1, 'complete', '2019-11-24 18:17:40'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (10, 62, 1, 'complete', '2019-11-24 18:17:35'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (11, 62, 1, 'complete', '2019-11-24 18:17:34'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (12, 78, 7, 'complete', '2019-11-24 18:17:26'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (13, 78, 7, 'complete', '2019-11-26 13:26:56'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (14, 78, 1, 'complete', '2019-11-26 13:26:57'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (15, 78, 1, 'complete', '2019-11-28 14:37:08'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (16, 78, 1, 'complete', '2019-11-28 14:37:11'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (17, 78, 1, 'complete', '2019-11-28 14:37:13'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (18, 78, 5, 'complete', '2019-11-28 14:37:22'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (19, 78, 6, 'complete', '2019-11-28 14:38:42'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (20, 78, 1, 'complete', '2019-11-28 15:41:27'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (21, 78, 1, 'complete', '2019-11-28 15:41:36'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (22, 78, 5, 'complete', '2019-11-28 15:41:43'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (23, 78, 8, 'complete', '2019-11-28 15:41:51'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (24, 78, 5, 'complete', '2019-11-28 17:11:45'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (25, 78, 5, 'complete', '2019-11-28 17:11:51'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (26, 78, 5, 'complete', '2019-11-28 17:11:53'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (27, 78, 6, 'complete', '2019-11-28 17:11:56'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (33, 78, 1, 'complete', '2019-11-28 17:29:22'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (34, 78, 1, 'complete', '2019-11-28 17:36:26'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (35, 78, 1, 'complete', '2019-11-28 17:36:30'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (36, 78, 1, 'complete', '2019-11-28 17:36:33'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (37, 78, 5, 'complete', '2019-11-28 17:37:04'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (38, 78, 5, 'complete', '2019-11-28 17:37:06'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (39, 78, 1, 'complete', '2019-11-28 17:37:09'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (40, 78, 1, 'complete', '2019-11-28 17:37:10'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (41, 78, 1, 'complete', '2019-11-28 17:37:11'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (42, 78, 1, 'complete', '2019-11-28 17:37:11'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (43, 78, 1, 'complete', '2019-11-28 17:37:11'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (44, 78, 1, 'complete', '2019-11-28 17:37:11'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (45, 78, 1, 'complete', '2019-11-28 17:37:11'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (46, 78, 1, 'complete', '2019-11-28 17:37:12'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (47, 78, 1, 'complete', '2019-11-28 17:37:13'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (48, 78, 6, 'complete', '2019-11-28 18:21:52'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (49, 78, 6, 'complete', '2019-11-28 18:22:18'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (50, 78, 5, 'complete', '2019-11-29 10:18:27'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (51, 78, 7, 'complete', '2019-12-02 16:12:22'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (52, 78, 6, 'complete', '2019-12-02 16:33:53'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (53, 78, 6, 'complete', '2019-12-03 14:22:44'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (54, 77, 7, 'complete', '2019-12-03 14:33:27'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (55, 77, 8, 'complete', '2019-12-03 14:33:31'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (56, 77, 7, 'complete', '2019-12-03 14:33:37'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (57, 77, 1, 'refund', '2020-01-02 19:51:29'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (58, 78, 5, 'complete', '2019-12-04 13:06:41'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (59, 78, 5, 'complete', '2019-12-05 18:29:36'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (60, 78, 1, 'complete', '2019-12-05 18:29:40'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (61, 83, 7, 'complete', '2019-12-06 10:49:40'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (62, 83, 7, 'complete', '2019-12-06 10:49:49'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (63, 83, 7, 'complete', '2019-12-06 10:49:59'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (64, 83, 8, 'complete', '2019-12-06 10:50:20'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (65, 83, 8, 'complete', '2019-12-06 10:50:35'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (66, 83, 8, 'complete', '2019-12-06 10:50:37'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (67, 83, 5, 'complete', '2019-12-06 10:56:28'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (68, 83, 1, 'complete', '2019-12-06 10:56:30'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (69, 84, 1, 'complete', '2019-12-06 11:00:57'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (70, 83, 8, 'complete', '2019-12-06 11:02:27'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (71, 83, 8, 'complete', '2019-12-06 11:02:29'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (72, 83, 8, 'complete', '2019-12-06 11:02:30'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (73, 83, 8, 'complete', '2019-12-06 11:02:32'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (74, 83, 8, 'complete', '2019-12-06 11:02:34'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (75, 83, 1, 'complete', '2019-12-06 11:07:16'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (76, 83, 7, 'complete', '2019-12-06 11:07:22'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (77, 83, 1, 'complete', '2019-12-06 11:21:46'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (78, 77, 7, 'complete', '2019-12-06 11:22:35'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (79, 84, 7, 'complete', '2019-12-06 11:22:45'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (80, 84, 7, 'complete', '2019-12-06 11:22:48'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (81, 84, 6, 'complete', '2019-12-06 11:22:50'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (82, 84, 7, 'complete', '2019-12-06 11:22:50'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (83, 84, 7, 'complete', '2019-12-06 11:22:51'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (84, 84, 7, 'complete', '2019-12-06 11:22:52'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (85, 84, 7, 'complete', '2019-12-06 11:22:53'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (86, 84, 7, 'complete', '2019-12-06 11:22:54'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (87, 77, 9, 'complete', '2019-12-06 11:32:27'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (88, 83, 5, 'complete', '2019-12-08 10:56:55'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (89, 85, 11, 'refund', '2019-12-18 00:09:44'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (90, 84, 1, 'complete', '2019-12-12 13:29:19'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (91, 84, 9, 'complete', '2019-12-18 13:36:10'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (92, 86, 1, 'complete', '2019-12-18 13:40:25'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (93, 86, 1, 'complete', '2019-12-18 13:40:29'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (94, 86, 1, 'complete', '2019-12-18 13:43:48'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (95, 78, 9, 'complete', '2019-12-29 23:40:26'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (96, 78, 9, 'complete', '2019-12-29 23:55:29'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (97, 85, 11, 'complete', '2020-01-02 20:45:49'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (98, 85, 11, 'complete', '2020-01-02 23:53:25'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (99, 85, 12, 'complete', '2020-01-07 18:11:23'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (100, 85, 12, 'complete', '2020-01-08 16:33:22'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (101, 85, 12, 'complete', '2020-01-09 15:40:31'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (102, 85, 12, 'complete', '2020-01-09 16:29:58'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (103, 85, 12, 'complete', '2020-01-09 17:37:36'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (104, 85, 12, 'complete', '2020-01-09 19:53:58'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (105, 85, 1, 'complete', '2020-01-09 20:19:18'); INSERT INTO `payment_list` (`id`, `user_id`, `product_id`, `state`, `created_at`) VALUES (106, 78, 1, 'complete', '2020-01-26 13:49:25'); /*!40000 ALTER TABLE `payment_list` ENABLE KEYS */; -- 테이블 MerDog.pet_info 구조 내보내기 CREATE TABLE IF NOT EXISTS `pet_info` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '애완동물 번호', `user_id` int(11) NOT NULL COMMENT '사용자 번호', `pet_name` varchar(50) NOT NULL COMMENT '애완동물 이름', `pet_main_type` varchar(50) NOT NULL COMMENT '펫 종류 (ex. 강아지 고양이)', `pet_sub_type` varchar(50) NOT NULL COMMENT '펫 종류에 대한 종류 (ex. 포메라니안 말티즈 )', `pet_age` int(11) NOT NULL COMMENT '펫 나이', `pet_gender` varchar(50) NOT NULL COMMENT '펫 성별 (남, 여, 중성화 남, 중성화 여)', `pet_birth` varchar(50) NOT NULL COMMENT '펫 생년월일', `pet_img` varchar(100) DEFAULT NULL COMMENT '펫 이미지 이름', `pet_notice` varchar(50) DEFAULT NULL COMMENT '펫 특이사항', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `on/off` varchar(10) NOT NULL DEFAULT 'on' COMMENT '활성화 여부 on/off', PRIMARY KEY (`id`), KEY `FK_pet_user_info` (`user_id`), CONSTRAINT `FK_pet_user_info` FOREIGN KEY (`user_id`) REFERENCES `user_info` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='애완동물 정보'; -- 테이블 데이터 MerDog.pet_info:~97 rows (대략적) 내보내기 /*!40000 ALTER TABLE `pet_info` DISABLE KEYS */; INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (34, 78, '고양시', '고양이', '짬타이거', 26, '암컷', '19940915', 'http://ccit2019.cafe24.com/storage/img/pet/(44)1574216166695.jpg', '졸려워요', '2019-11-26 18:13:03', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (35, 77, '뜗뜗뜗뜗뜗뜗뜗뜗', '강아지', '마르티즈', 2, '중성화수컷', '20190707', 'http://ccit2019.cafe24.com/storage/img/pet/20191123_150905.jpg', 'null', '2019-11-26 18:13:20', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (36, 78, '펫정규식테스트', '강아지', '마르티즈', 26, '중성화암컷', '19940915', NULL, NULL, '2019-11-26 21:07:39', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (37, 78, '펫', '강아지', '마르티즈', 9, '수컷', '19990931', NULL, '테스트', '2019-11-26 22:58:57', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (38, 78, '백죵환', '고양이', '짬타이거', 26, '암컷', '19990914', 'http://ccit2019.cafe24.com/storage/img/pet/JPEG_20191126_230042064_.jpg', '테스트', '2019-11-26 23:00:42', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (39, 80, '드소', '강아지', '마르티즈', 5, '수컷', '1995', 'http://ccit2019.cafe24.com/storage/img/pet/1570764214994.jpg', NULL, '2019-11-26 23:32:23', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (40, 80, '드소', '강아지', '마르티즈', 5, '수컷', '1995', 'http://ccit2019.cafe24.com/storage/img/pet/(93)1570764214994.jpg', NULL, '2019-11-26 23:32:24', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (41, 77, '뚜비', '강아지', '포메라니안', 18, '암컷', '19990909', 'http://ccit2019.cafe24.com/storage/img/pet/IMG_20190716_134237854.jpg', '네', '2019-12-01 20:40:35', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (42, 77, '나나', '강아지', '마르티즈', 19, '중성화수컷', '20000101', 'http://ccit2019.cafe24.com/storage/img/pet/Screenshot_20191130-114617_KakaoTalk.jpg', NULL, '2019-12-02 16:44:09', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (43, 77, '뽀', '토끼', '헬로키티', 19, '암컷', '20000220', NULL, 'null', '2019-12-02 16:44:32', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (44, 77, '나나', '고슴도치', '알비노 고슴도치', 8, '중성화수컷', '20000909', NULL, NULL, '2019-12-02 16:44:54', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (45, 77, '보라돌이', '고양이', '스코티시 폴드', 9, '암컷', '20000101', NULL, NULL, '2019-12-02 16:46:49', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (46, 77, '뚜치', '강아지', '믹스견', 3, '중성화수컷', '20100909', NULL, NULL, '2019-12-02 16:47:06', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (47, 77, '뿌꾸', '고슴도치', '플라타나 고슴도치', 6, '중성화수컷', '20101130', NULL, NULL, '2019-12-02 16:47:53', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (48, 78, '고양시', '고양이', '짬타이거', 0, '암컷', '20190315', 'http://ccit2019.cafe24.com/storage/img/pet/ㅇ.jpg', '추가정보', '2019-12-03 13:53:32', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (49, 78, '펫', '강아지', '마르티즈', 9, '중성화암컷', '20101203', NULL, '등록', '2019-12-03 14:39:46', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (50, 78, '펫', '고양이', '짬타이거', 0, '수컷', '20190315', 'http://ccit2019.cafe24.com/storage/img/pet/downloadfile-18.jpg', '23', '2019-12-03 19:30:31', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (51, 78, '고양이사진', '고양이', '짬타이거', 4, '암컷', '20151203', 'http://ccit2019.cafe24.com/storage/img/pet/20191113_143156.jpg', '사진', '2019-12-03 20:20:11', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (52, 78, '고화질', '고슴도치', '모름', 4, '중성화수컷', '20150323', 'http://ccit2019.cafe24.com/storage/img/pet/e9f4cb3052d33bc7670ba1bc4447b0cb.jpg', '정보', '2019-12-03 20:29:57', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (53, 78, '데이트피커테스트', '강아지', '마르티즈', 4, '수컷', '20150803', 'http://ccit2019.cafe24.com/storage/img/pet/20191203_210742.jpg', 'null', '2019-12-03 20:53:49', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (54, 78, '펫로딩', '햄스터', '햄토리', 1, '중성화암컷', '20181205', 'http://ccit2019.cafe24.com/storage/img/pet/20191206_091449.jpg', 'null', '2019-12-05 17:12:24', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (55, 83, '아이폰a', '토끼', '헬로키티', 69, '수컷', '19501206', 'http://ccit2019.cafe24.com/storage/img/pet/JPEG_20191206_105319336_.jpg', '귀여움', '2019-12-06 10:53:30', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (56, 83, '아이폰b', '강아지', '마르티즈', 5, '중성화암컷', '20141206', 'http://ccit2019.cafe24.com/storage/img/pet/JPEG_20191206_105524234_.jpg', '기여엄', '2019-12-06 10:55:35', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (57, 84, '시바견시바', '고슴도치', '모름', 0, '중성화암컷', '', 'http://ccit2019.cafe24.com/storage/img/pet/JPEG_20191206_105730253_.jpg', '빠끄', '2019-12-06 10:57:37', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (58, 84, '지', '고슴도치', '모름', 3, '수컷', '20161206', NULL, 'ㅣㄷ', '2019-12-06 11:24:35', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (59, 84, '^^', '강아지', '마르티즈', 40, '암컷', '19791206', NULL, 'ㄴ', '2019-12-06 11:29:06', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (60, 83, 'bb', '강아지', '코몬도르', 0, '중성화암컷', '20191110', NULL, NULL, '2019-12-06 11:42:44', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (61, 83, 't', '강아지', '마르티즈', 0, '수컷', '20191205', NULL, NULL, '2019-12-06 11:42:59', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (62, 77, '넵', '강아지', '마르티즈', 2, '중성화수컷', '20170206', 'http://ccit2019.cafe24.com/storage/img/pet/JPEG_20191206_120345900_.jpg', NULL, '2019-12-06 12:03:56', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (63, 77, '이거', '강아지', '도베르만', 0, '암컷', '20191006', 'http://ccit2019.cafe24.com/storage/img/pet/JPEG_20191206_120629307_.jpg', NULL, '2019-12-06 12:06:39', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (64, 84, '개새끼', '강아지', '마르티즈', 3, '중성화수컷', '20161206', 'http://ccit2019.cafe24.com/storage/img/pet/beauty_20191206121409.jpg', '디ㅣ지싲', '2019-12-06 12:14:50', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (65, 84, '드즈즉', '강아지', '마르티즈', 2, '중성화수컷', '20171008', 'http://ccit2019.cafe24.com/storage/img/pet/20191129_224352.jpg', '하이', '2019-12-08 17:00:12', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (66, 84, '드즈즉', '강아지', '마르티즈', 2, '중성화수컷', '20171008', 'http://ccit2019.cafe24.com/storage/img/pet/(60)20191129_224352.jpg', '하이', '2019-12-08 17:00:30', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (67, 84, '드즈즉', '강아지', '마르티즈', 2, '중성화수컷', '20171008', 'http://ccit2019.cafe24.com/storage/img/pet/(30)20191129_224352.jpg', '하이', '2019-12-08 17:00:48', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (68, 84, '드즈즉', '강아지', '마르티즈', 2, '중성화수컷', '20171008', 'http://ccit2019.cafe24.com/storage/img/pet/(87)20191129_224352.jpg', '하이', '2019-12-08 17:01:02', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (69, 78, '펫이름^^', '강아지', '마르티즈', 1, '암컷', '20181211', NULL, NULL, '2019-12-11 23:54:28', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (70, 78, '정규식', '강아지', '마르티즈', 2, '중성화암컷', '20171212', NULL, NULL, '2019-12-12 00:47:56', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (71, 78, '펫', '강아지', '마르티즈', 1, '암컷', '20181212', 'http://ccit2019.cafe24.com/storage/img/pet/JPEG_20191212_013926638_.jpg', NULL, '2019-12-12 01:39:41', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (72, 85, '혁기', '고슴도치', '실버 챠콜 고슴도치', 1, '중성화암컷', '20181212', 'http://ccit2019.cafe24.com/storage/img/pet/JPEG_20191212_014737365_.jpg', NULL, '2019-12-12 01:47:52', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (73, 85, '이용권', '강아지', '마르티즈', 1, '중성화수컷', '20181213', 'http://ccit2019.cafe24.com/storage/img/pet/2019-12-09-12-43-14-924.jpg', 'ㅇㅇ', '2019-12-13 00:19:05', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (74, 78, 'ㅇ', '강아지', '마르티즈', 2, '암컷', '20171213', 'http://ccit2019.cafe24.com/storage/img/pet/20191206_091448.jpg', NULL, '2019-12-13 01:00:34', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (75, 78, 'ㅇㅇ', '강아지', '마르티즈', 4, '수컷', '20151217', NULL, NULL, '2019-12-17 21:09:26', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (76, 78, 'ㅇㅇㅇ', '강아지', '마르티즈', 1, '암컷', '20181217', NULL, NULL, '2019-12-17 21:11:15', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (77, 86, '이잉기모링', '고슴도치', '모름', 24, '중성화수컷', '19951029', 'http://ccit2019.cafe24.com/storage/img/pet/1576588526539.jpg', NULL, '2019-12-17 22:03:42', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (78, 78, 'ㄹㄹ', '강아지', '마르티즈', 0, '중성화암컷', '20190917', 'http://ccit2019.cafe24.com/storage/img/pet/(82)2019-12-17-21-34-37-841_original.jpg', NULL, '2019-12-17 22:25:34', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (79, 78, 'ㄹㄹ', '강아지', '마르티즈', 0, '중성화암컷', '20190917', 'http://ccit2019.cafe24.com/storage/img/pet/(84)2019-12-17-21-34-37-841_original.jpg', NULL, '2019-12-17 22:25:53', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (80, 78, 'ㄹㄹ', '강아지', '마르티즈', 1, '중성화암컷', '20180917', 'http://ccit2019.cafe24.com/storage/img/pet/2019-12-17-21-34-37-887.jpg', NULL, '2019-12-17 22:26:44', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (81, 78, 'ㄹㄹ', '강아지', '마르티즈', 1, '중성화암컷', '20180917', 'http://ccit2019.cafe24.com/storage/img/pet/(66)2019-12-17-21-34-37-841_original.jpg', NULL, '2019-12-17 22:27:01', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (86, 78, '머야', '고양이', '짬타이거', 4, '중성화수컷', '20151217', 'http://ccit2019.cafe24.com/storage/img/pet/Screenshot_20191217-225125.jpg', NULL, '2019-12-17 22:53:22', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (87, 78, '등록할게유', '강아지', '마르티즈', 4, '암컷', '20151217', 'http://ccit2019.cafe24.com/storage/img/pet/(35)2019-12-17-21-34-37-841_original.jpg', NULL, '2019-12-17 23:07:49', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (88, 78, '등록할게유', '강아지', '마르티즈', 4, '암컷', '20151217', 'http://ccit2019.cafe24.com/storage/img/pet/(25)2019-12-17-21-34-37-841_original.jpg', NULL, '2019-12-17 23:08:22', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (89, 78, '등록할게유', '강아지', '마르티즈', 4, '암컷', '20151217', 'http://ccit2019.cafe24.com/storage/img/pet/(26)2019-12-17-21-34-37-887.jpg', NULL, '2019-12-17 23:09:10', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (90, 78, '등록할게유', '강아지', '마르티즈', 4, '암컷', '20151217', 'http://ccit2019.cafe24.com/storage/img/pet/(80)2019-12-17-21-34-37-887.jpg', NULL, '2019-12-17 23:09:22', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (91, 78, '머임', '강아지', '마르티즈', 4, '암컷', '20151217', 'http://ccit2019.cafe24.com/storage/img/pet/Screenshot_20191205-163838.jpg', NULL, '2019-12-17 23:10:08', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (92, 78, '머야', '강아지', '마르티즈', 5, '암컷', '20141217', 'http://ccit2019.cafe24.com/storage/img/pet/JPEG_20191217_231036126_.jpg', NULL, '2019-12-17 23:10:53', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (93, 78, '되나', '강아지', '마르티즈', 4, '암컷', '20151217', 'http://ccit2019.cafe24.com/storage/img/pet/(84)20191206_091449.jpg', NULL, '2019-12-17 23:11:49', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (94, 78, '되나', '강아지', '마르티즈', 4, '수컷', '20151217', 'http://ccit2019.cafe24.com/storage/img/pet/JPEG_20191217_232045173_.jpg', NULL, '2019-12-17 23:12:10', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (95, 78, '고용량', '강아지', '마르티즈', 3, '중성화암컷', '20161217', 'http://ccit2019.cafe24.com/storage/img/pet/(93)2019-12-09-12-43-14-924.jpg', NULL, '2019-12-17 23:26:29', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (96, 78, '고용량', '강아지', '마르티즈', 3, '중성화암컷', '20161217', 'http://ccit2019.cafe24.com/storage/img/pet/(7)2019-12-09-12-43-14-924.jpg', NULL, '2019-12-17 23:26:42', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (97, 78, '다시', '강아지', '마르티즈', 2, '중성화수컷', '20171217', 'http://ccit2019.cafe24.com/storage/img/pet/20191214_145956.jpg', NULL, '2019-12-17 23:31:09', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (98, 78, '콩이', '강아지', '마르티즈', 8, '암컷', '20111229', 'http://ccit2019.cafe24.com/storage/img/pet/20191219_192506.jpg', '백내장이있어요!', '2019-12-29 23:22:24', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (99, 78, '콩이', '강아지', '마르티즈', 10, '암컷', '20091229', 'http://ccit2019.cafe24.com/storage/img/pet/20191219_191826.jpg', '건강해요!', '2019-12-29 23:31:36', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (100, 78, '콩이', '강아지', '닥스훈트', 6, '중성화암컷', '20131229', 'http://ccit2019.cafe24.com/storage/img/pet/1576755911724.jpg', '건강해요!', '2019-12-29 23:33:06', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (101, 78, '몽이', '강아지', '마르티즈', 5, '암컷', '20141229', 'http://ccit2019.cafe24.com/storage/img/pet/20191219_191945.jpg', '건강해요!', '2019-12-29 23:59:21', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (102, 85, '몽이', '강아지', '마르티즈', 4, '암컷', '20160102', 'http://ccit2019.cafe24.com/storage/img/pet/20191219_191822.jpg', '심장사상충 예방주사 1년전에 주사', '2020-01-02 20:42:02', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (103, 85, '콩이', '강아지', '마르티즈', 3, '암컷', '20170102', 'http://ccit2019.cafe24.com/storage/img/pet/20191219_191918.jpg', '아파요', '2020-01-02 20:44:27', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (104, 85, '뽀삐', '강아지', '마르티즈', 3, '수컷', '20170102', 'http://ccit2019.cafe24.com/storage/img/pet/(13)20191219_192506.jpg', '선천적 탈골', '2020-01-02 23:55:06', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (105, 77, '나비', '고양이', '래그돌', 0, '암컷', '20200101', 'http://ccit2019.cafe24.com/storage/img/pet/(36)downloadfile.jpg', NULL, '2020-01-07 10:15:10', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (106, 85, '삐삐', '강아지', '마르티즈', 9, '중성화암컷', '20110109', 'http://ccit2019.cafe24.com/storage/img/pet/(73)20191206_091449.jpg', '건강해요', '2020-01-09 15:08:52', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (107, 85, '쿠키', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/2019-09-27-14-22-54_original.jpg', '건강해요', '2020-01-09 16:25:33', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (108, 85, '코코', '강아지', '마르티즈', 6, '중성화암컷', '20140109', 'http://ccit2019.cafe24.com/storage/img/pet/20191220_121611.jpg', '건강해요', '2020-01-09 16:28:58', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (109, 85, '콩몽', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/(14)1576755911724.jpg', '건강해요', '2020-01-09 16:33:00', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (110, 85, '누누', '강아지', '마르티즈', 9, '중성화암컷', '20110109', 'http://ccit2019.cafe24.com/storage/img/pet/20191206_091420.jpg', '귀에 염증이 있어요', '2020-01-09 16:41:31', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (111, 85, '몽이', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/1576755992570.jpg', '귀에 염증', '2020-01-09 19:30:26', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (112, 85, '몽이', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/(76)1576755992570.jpg', '귀에 염증', '2020-01-09 19:30:52', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (113, 85, '몽', '강아지', '마르티즈', 3, '중성화암컷', '20170109', 'http://ccit2019.cafe24.com/storage/img/pet/20191219_191707.jpg', '소화불량', '2020-01-09 19:33:11', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (114, 85, '몽', '강아지', '마르티즈', 3, '중성화암컷', '20170109', 'http://ccit2019.cafe24.com/storage/img/pet/(3)20191219_191707.jpg', '소화불량', '2020-01-09 19:33:38', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (115, 85, '몽이', '강아지', '마르티즈', 2, '중성화암컷', '20180109', 'http://ccit2019.cafe24.com/storage/img/pet/Screenshot_20200109-193316_Gallery.jpg', '귀에 염증', '2020-01-09 19:34:36', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (116, 85, '몽이', '강아지', '마르티즈', 2, '중성화암컷', '20180109', 'http://ccit2019.cafe24.com/storage/img/pet/(67)Screenshot_20200109-193316_Gallery.jpg', '귀에 염증', '2020-01-09 19:34:40', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (117, 85, '몽이', '강아지', '마르티즈', 2, '중성화암컷', '20180109', 'http://ccit2019.cafe24.com/storage/img/pet/(94)Screenshot_20200109-193316_Gallery.jpg', '귀에 염증', '2020-01-09 19:35:25', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (118, 85, '몽이', '강아지', '마르티즈', 2, '중성화암컷', '20180109', 'http://ccit2019.cafe24.com/storage/img/pet/(20)Screenshot_20200109-193316_Gallery.jpg', '귀에 염증', '2020-01-09 19:35:26', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (119, 85, '몽', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/(60)Screenshot_20200109-193316_Gallery.jpg', NULL, '2020-01-09 19:51:09', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (120, 85, '몽', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/(23)Screenshot_20200109-193316_Gallery.jpg', NULL, '2020-01-09 19:51:12', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (121, 85, '몽이', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/(47)Screenshot_20200109-193316_Gallery.jpg', NULL, '2020-01-09 19:52:04', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (122, 85, '몽이', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/(40)Screenshot_20200109-193316_Gallery.jpg', NULL, '2020-01-09 19:52:08', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (123, 85, '몽이', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/(27)Screenshot_20200109-193316_Gallery.jpg', NULL, '2020-01-09 19:52:39', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (124, 85, '몽이', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/JPEG_20200109_195615793_.jpg', NULL, '2020-01-09 19:56:56', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (125, 85, '뽕이', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/(99)Screenshot_20200109-193316_Gallery.jpg', '귀에 염증', '2020-01-09 20:01:35', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (126, 85, '뽕이', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/(58)Screenshot_20200109-193316_Gallery.jpg', '귀에 염증', '2020-01-09 20:01:39', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (127, 85, '뽕이', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/20191219_192337.jpg', '귀에 염증', '2020-01-09 20:03:17', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (128, 85, '뽕이', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/(70)20191219_192337.jpg', '귀에 염증', '2020-01-09 20:04:01', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (129, 85, '뿡뽕', '강아지', '마르티즈', 3, '중성화암컷', '20170109', 'http://ccit2019.cafe24.com/storage/img/pet/(85)Screenshot_20200109-193316_Gallery.jpg', '귀에 염증', '2020-01-09 20:09:25', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (130, 85, '뿡뽕', '강아지', '마르티즈', 3, '중성화암컷', '20170109', 'http://ccit2019.cafe24.com/storage/img/pet/(35)Screenshot_20200109-193316_Gallery.jpg', '귀에 염증', '2020-01-09 20:09:28', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (131, 85, '뿡뽕', '강아지', '마르티즈', 3, '중성화암컷', '20170109', 'http://ccit2019.cafe24.com/storage/img/pet/(66)Screenshot_20200109-193316_Gallery.jpg', '귀에 염증', '2020-01-09 20:11:24', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (132, 85, '뿡뽕', '강아지', '마르티즈', 3, '중성화암컷', '20170109', 'http://ccit2019.cafe24.com/storage/img/pet/(79)Screenshot_20200109-193316_Gallery.jpg', '귀에 염증', '2020-01-09 20:11:26', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (133, 85, '빵이', '강아지', '마르티즈', 4, '중성화암컷', '20160109', NULL, '귀에염증', '2020-01-09 20:14:11', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (134, 85, '뻥이', '강아지', '마르티즈', 3, '중성화암컷', '20170109', 'http://ccit2019.cafe24.com/storage/img/pet/1576755913125.jpg', NULL, '2020-01-09 20:15:43', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (135, 85, '뻥이', '강아지', '마르티즈', 3, '중성화암컷', '20170109', 'http://ccit2019.cafe24.com/storage/img/pet/(42)1576755913125.jpg', NULL, '2020-01-09 20:16:09', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (136, 85, '엘사', '강아지', '마르티즈', 3, '중성화암컷', '20170109', 'http://ccit2019.cafe24.com/storage/img/pet/20191219_191625.jpg', NULL, '2020-01-09 20:17:56', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (137, 85, '테스트', '강아지', '마르티즈', 3, '중성화암컷', '20170109', 'http://ccit2019.cafe24.com/storage/img/pet/1577789447049.jpg', '테스트', '2020-01-09 20:24:30', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (138, 85, '토토로', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/(41)20191219_191625.jpg', '건강해요', '2020-01-09 20:26:54', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (139, 85, '안나', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/(65)20191206_091449.jpg', '귀에염증', '2020-01-09 20:27:25', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (140, 85, '올라프', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/(87)20190820_135811_1.gif', '멍청', '2020-01-09 20:27:57', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (141, 85, '크리스토퍼', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/(52)20191220_121611.jpg', '눈에염증', '2020-01-09 20:28:50', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (142, 85, '엘싸', '강아지', '마르티즈', 13, '중성화암컷', '20070109', 'http://ccit2019.cafe24.com/storage/img/pet/(90)20191219_192506.jpg', '잠이많음', '2020-01-09 20:29:54', 'off'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (143, 85, '한스', '강아지', '마르티즈', 5, '중성화암컷', '20150109', 'http://ccit2019.cafe24.com/storage/img/pet/20191206_091430.jpg', NULL, '2020-01-09 21:14:44', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (144, 85, '아구몬', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/2019-09-27-14-21-41.jpg', NULL, '2020-01-09 21:41:25', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (145, 85, '피카츄', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/(98)Screenshot_20200109-193316_Gallery.jpg', NULL, '2020-01-09 22:05:51', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (146, 85, '뽀삐', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/(68)20191219_192337.jpg', NULL, '2020-01-09 22:08:53', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (147, 85, '또이', '강아지', '마르티즈', 4, '중성화암컷', '20160109', 'http://ccit2019.cafe24.com/storage/img/pet/(98)20191219_191625.jpg', 'ㅇㅇ', '2020-01-09 22:15:23', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (148, 77, '뚜비', '강아지', '마르티즈', 0, '중성화수컷', '20200107', NULL, NULL, '2020-01-09 22:39:45', 'on'); INSERT INTO `pet_info` (`id`, `user_id`, `pet_name`, `pet_main_type`, `pet_sub_type`, `pet_age`, `pet_gender`, `pet_birth`, `pet_img`, `pet_notice`, `created_at`, `on/off`) VALUES (149, 78, 'ㅇㅇ', '고양이', '짬타이거', 4, '중성화암컷', '20160124', 'http://ccit2019.cafe24.com/storage/img/pet/Screenshot_20200125-021943_KakaoTalk.jpg', 'ㄹㄹ', '2020-01-26 13:50:11', 'on'); /*!40000 ALTER TABLE `pet_info` ENABLE KEYS */; -- 테이블 MerDog.product 구조 내보내기 CREATE TABLE IF NOT EXISTS `product` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '상품 인덱스 번호', `name` varchar(50) NOT NULL COMMENT '상품 이름', `ticket` int(11) NOT NULL COMMENT '이용권 갯수', `price` int(11) NOT NULL COMMENT '상품 가격', `product_code` varchar(50) NOT NULL COMMENT '구글 스토어 상품 코드', `img` text NOT NULL COMMENT '상품 이미지', `on/off` varchar(50) NOT NULL DEFAULT 'off' COMMENT '활성화여부 on/off', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='상품 테이블'; -- 테이블 데이터 MerDog.product:~10 rows (대략적) 내보내기 /*!40000 ALTER TABLE `product` DISABLE KEYS */; INSERT INTO `product` (`id`, `name`, `ticket`, `price`, `product_code`, `img`, `on/off`, `created_at`) VALUES (1, '기본상품', 200, 5000, 'asfas', 'box-outline-filled.png', 'on', '2019-11-13 11:11:08'); INSERT INTO `product` (`id`, `name`, `ticket`, `price`, `product_code`, `img`, `on/off`, `created_at`) VALUES (5, '기모링', 123, 4321, 'asf', '(73)box-outline-filled.png', 'off', '2019-11-13 17:02:21'); INSERT INTO `product` (`id`, `name`, `ticket`, `price`, `product_code`, `img`, `on/off`, `created_at`) VALUES (6, '4123', 124, 124, 'adg', '(41)box-outline-filled.png', 'off', '2019-11-13 18:51:52'); INSERT INTO `product` (`id`, `name`, `ticket`, `price`, `product_code`, `img`, `on/off`, `created_at`) VALUES (7, '테스트테스트', 23, 1000, 'asdg', '(85)box-outline-filled.png', 'off', '2019-11-16 17:29:48'); INSERT INTO `product` (`id`, `name`, `ticket`, `price`, `product_code`, `img`, `on/off`, `created_at`) VALUES (8, '테스트', 12414, 124124, 'OREADCE', '(53)box-outline-filled.png', 'off', '2019-11-27 00:29:37'); INSERT INTO `product` (`id`, `name`, `ticket`, `price`, `product_code`, `img`, `on/off`, `created_at`) VALUES (9, '12', 12, 12, '121221', 'cat.jpg', 'off', '2019-11-29 11:12:00'); INSERT INTO `product` (`id`, `name`, `ticket`, `price`, `product_code`, `img`, `on/off`, `created_at`) VALUES (10, '1323', 123, 123123, '123123', 'sleepli.PNG', 'off', '2019-12-01 20:45:52'); INSERT INTO `product` (`id`, `name`, `ticket`, `price`, `product_code`, `img`, `on/off`, `created_at`) VALUES (11, '백종환', 1, 1, '111', 'logo (2).png', 'off', '2019-12-06 11:33:51'); INSERT INTO `product` (`id`, `name`, `ticket`, `price`, `product_code`, `img`, `on/off`, `created_at`) VALUES (12, '체험상품', 3, 1000, '123123', '(30)(85)box-outline-filled.png', 'on', '2020-01-07 14:42:22'); INSERT INTO `product` (`id`, `name`, `ticket`, `price`, `product_code`, `img`, `on/off`, `created_at`) VALUES (13, '기본상품2', 100, 3000, '123123', '(93)(85)box-outline-filled.png', 'on', '2020-01-07 14:43:36'); /*!40000 ALTER TABLE `product` ENABLE KEYS */; -- 테이블 MerDog.refund_list 구조 내보내기 CREATE TABLE IF NOT EXISTS `refund_list` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '환불 신청번호 인덱스', `user_id` int(11) NOT NULL COMMENT '회원번호', `payment_list_id` int(11) NOT NULL COMMENT '결제 번호', `state` varchar(50) NOT NULL DEFAULT 'wait' COMMENT '환불 처리 상태 / 대기 : wait / 완료 : complete / 거절 : deny ', `order_id` varchar(50) NOT NULL COMMENT '구글 주문 번호', `coment` text COMMENT '답변', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `FK_refund_list_user_info` (`user_id`), KEY `payment_list_id` (`payment_list_id`), CONSTRAINT `FK_refund_list_payment_list` FOREIGN KEY (`payment_list_id`) REFERENCES `payment_list` (`id`) ON UPDATE CASCADE, CONSTRAINT `FK_refund_list_user_info` FOREIGN KEY (`user_id`) REFERENCES `user_info` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='환불 신청내역'; -- 테이블 데이터 MerDog.refund_list:~18 rows (대략적) 내보내기 /*!40000 ALTER TABLE `refund_list` DISABLE KEYS */; INSERT INTO `refund_list` (`id`, `user_id`, `payment_list_id`, `state`, `order_id`, `coment`, `created_at`) VALUES (4, 62, 2, 'complete', '124124', '', '2019-11-13 16:01:16'); INSERT INTO `refund_list` (`id`, `user_id`, `payment_list_id`, `state`, `order_id`, `coment`, `created_at`) VALUES (5, 62, 4, 'deny', '125', '안돼!', '2019-11-13 16:01:26'); INSERT INTO `refund_list` (`id`, `user_id`, `payment_list_id`, `state`, `order_id`, `coment`, `created_at`) VALUES (6, 62, 6, 'deny', '125', '돈없어서 거절', '2019-11-16 23:20:33'); INSERT INTO `refund_list` (`id`, `user_id`, `payment_list_id`, `state`, `order_id`, `coment`, `created_at`) VALUES (118, 77, 57, 'wait', 'test', NULL, '2019-12-06 00:14:49'); INSERT INTO `refund_list` (`id`, `user_id`, `payment_list_id`, `state`, `order_id`, `coment`, `created_at`) VALUES (119, 83, 61, 'wait', 'test', NULL, '2019-12-06 10:52:05'); INSERT INTO `refund_list` (`id`, `user_id`, `payment_list_id`, `state`, `order_id`, `coment`, `created_at`) VALUES (120, 84, 69, 'wait', 'test', NULL, '2019-12-06 11:04:54'); INSERT INTO `refund_list` (`id`, `user_id`, `payment_list_id`, `state`, `order_id`, `coment`, `created_at`) VALUES (121, 84, 69, 'wait', 'test', NULL, '2019-12-06 11:05:56'); INSERT INTO `refund_list` (`id`, `user_id`, `payment_list_id`, `state`, `order_id`, `coment`, `created_at`) VALUES (122, 84, 69, 'wait', 'test', NULL, '2019-12-06 11:05:58'); INSERT INTO `refund_list` (`id`, `user_id`, `payment_list_id`, `state`, `order_id`, `coment`, `created_at`) VALUES (123, 84, 69, 'wait', 'test', NULL, '2019-12-06 11:06:00'); INSERT INTO `refund_list` (`id`, `user_id`, `payment_list_id`, `state`, `order_id`, `coment`, `created_at`) VALUES (124, 84, 69, 'wait', 'test', NULL, '2019-12-06 11:06:30'); INSERT INTO `refund_list` (`id`, `user_id`, `payment_list_id`, `state`, `order_id`, `coment`, `created_at`) VALUES (125, 84, 69, 'wait', 'test', NULL, '2019-12-06 11:06:34'); INSERT INTO `refund_list` (`id`, `user_id`, `payment_list_id`, `state`, `order_id`, `coment`, `created_at`) VALUES (126, 77, 57, 'complete', 'test', NULL, '2019-12-06 11:22:48'); INSERT INTO `refund_list` (`id`, `user_id`, `payment_list_id`, `state`, `order_id`, `coment`, `created_at`) VALUES (127, 83, 77, 'deny', 'test', '늦었어', '2019-12-06 11:33:58'); INSERT INTO `refund_list` (`id`, `user_id`, `payment_list_id`, `state`, `order_id`, `coment`, `created_at`) VALUES (128, 83, 77, 'deny', 'test', '1', '2019-12-06 11:34:02'); INSERT INTO `refund_list` (`id`, `user_id`, `payment_list_id`, `state`, `order_id`, `coment`, `created_at`) VALUES (133, 85, 89, 'complete', 'test', NULL, '2019-12-13 10:54:05'); INSERT INTO `refund_list` (`id`, `user_id`, `payment_list_id`, `state`, `order_id`, `coment`, `created_at`) VALUES (134, 86, 92, 'deny', 'test', 'ㄹ', '2019-12-18 13:40:53'); INSERT INTO `refund_list` (`id`, `user_id`, `payment_list_id`, `state`, `order_id`, `coment`, `created_at`) VALUES (143, 78, 96, 'deny', 'test', 'g', '2019-12-29 23:55:35'); INSERT INTO `refund_list` (`id`, `user_id`, `payment_list_id`, `state`, `order_id`, `coment`, `created_at`) VALUES (145, 85, 99, 'deny', 'test', '보유 이용권이 지급된 이용권보다 적어 환불이 불가능 합니다.', '2020-01-07 18:15:05'); /*!40000 ALTER TABLE `refund_list` ENABLE KEYS */; -- 테이블 MerDog.sms_log 구조 내보내기 CREATE TABLE IF NOT EXISTS `sms_log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `phone` varchar(50) NOT NULL, `type` varchar(50) NOT NULL COMMENT 'sms 종류', `ip_address` varchar(50) NOT NULL COMMENT 'ip 주소', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='sms 기록 로그'; -- 테이블 데이터 MerDog.sms_log:~54 rows (대략적) 내보내기 /*!40000 ALTER TABLE `sms_log` DISABLE KEYS */; INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (43, '01051816260', '본인 인증', '172.16.17.32', '2019-12-02 15:15:15'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (44, '01051816260', '본인 인증', '172.16.17.32', '2019-12-02 15:18:15'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (45, '01073756544', 'pw 변경', '172.16.31.10', '2019-12-06 10:28:41'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (46, '01096488148', '본인 인증', '172.16.17.32', '2019-12-06 10:31:37'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (47, '01020751754', '본인 인증', '172.16.17.32', '2019-12-06 10:31:48'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (48, '01044444444', '본인 인증', '172.16.31.10', '2019-12-06 10:35:44'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (49, '01020751754', '가입 승인', '172.16.17.32', '2019-12-06 10:38:41'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (50, '01096488148', '본인 인증', '192.168.3.11', '2019-12-06 10:39:07'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (51, '01096488148', '본인 인증', '192.168.3.11', '2019-12-06 10:42:23'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (52, '01096488148', 'pw 변경', '192.168.3.11', '2019-12-06 10:44:27'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (53, '01077383503', '본인 인증', '192.168.127.12', '2019-12-06 10:49:19'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (54, '0109966336', '가입 승인', '172.16.17.32', '2019-12-06 11:27:38'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (55, '01051816260', '가입 거부', '172.16.17.32', '2019-12-06 11:28:49'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (56, '01011111111', '본인 인증', '192.168.3.11', '2019-12-06 11:30:45'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (57, '01051816260', '본인 인증', '192.168.127.12', '2019-12-06 15:31:39'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (58, '01051816260', '본인 인증', '192.168.127.12', '2019-12-06 15:45:55'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (59, '01051816260', '본인 인증', '192.168.127.12', '2019-12-06 15:51:13'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (60, '01051816260', '본인 인증', '192.168.127.12', '2019-12-06 16:06:26'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (61, '01062203271', '본인 인증', '172.16.58.3', '2019-12-12 00:02:16'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (62, '01062203271', '본인 인증', '172.16.58.3', '2019-12-12 01:45:43'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (63, '01077383503', 'pw 변경', '192.168.3.11', '2019-12-13 03:25:41'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (64, '01051816260', 'pw 변경', '172.16.31.10', '2019-12-16 18:33:19'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (65, '01051816260', 'pw 변경', '172.16.31.10', '2019-12-16 20:11:01'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (66, '01073756544', '본인 인증', '192.168.3.11', '2019-12-17 22:00:35'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (67, '01051816260', '본인 인증', '192.168.3.11', '2019-12-17 22:59:42'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (68, '01051816260', '본인 인증', '192.168.3.11', '2019-12-17 23:03:25'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (69, '01051816260', '본인 인증', '192.168.3.11', '2019-12-17 23:07:28'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (70, '01051816260', '본인 인증', '192.168.3.11', '2019-12-17 23:13:01'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (71, '01051816260', '본인 인증', '192.168.3.11', '2019-12-17 23:25:15'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (72, '01051816260', '가입 승인', '192.168.3.11', '2019-12-18 01:09:50'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (73, '01029100780', '본인 인증', '192.168.127.12', '2019-12-21 19:01:17'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (74, '01029100780', '가입 승인', '192.168.3.11', '2019-12-21 19:06:13'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (75, '01051816260', '본인 인증', '192.168.3.11', '2019-12-23 22:33:25'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (76, '01051816260', '가입 승인', '192.168.3.11', '2019-12-23 22:40:21'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (77, '01077383503', '본인 인증', '172.16.17.32', '2019-12-25 18:28:40'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (78, '01077383503', '본인 인증', '172.16.17.32', '2019-12-26 01:15:23'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (79, '01077383503', '본인 인증', '172.16.17.32', '2019-12-26 01:21:22'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (80, '01077383503', '가입 승인', '172.16.17.32', '2019-12-26 01:42:13'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (81, '01077383503', '본인 인증', '172.16.31.10', '2019-12-29 15:07:18'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (82, '01091170750', '본인 인증', '192.168.3.11', '2020-01-02 19:02:46'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (83, '0105186368', '가입 승인', '192.168.127.12', '2020-01-02 19:10:22'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (84, '01051816244', '가입 거부', '192.168.127.12', '2020-01-02 19:10:57'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (85, '01051816666', '가입 거부', '192.168.127.12', '2020-01-02 19:11:20'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (86, '01051816260', '본인 인증', '192.168.3.11', '2020-01-02 19:57:42'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (87, '01051816260', '가입 승인', '192.168.3.11', '2020-01-02 20:02:15'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (88, '01051816260', '본인 인증', '172.16.17.32', '2020-01-02 21:30:46'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (89, '01051816260', '본인 인증', '172.16.17.32', '2020-01-02 21:36:31'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (90, '01051816260', '가입 승인', '172.16.17.32', '2020-01-02 21:40:51'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (91, '01051816260', '가입 거부', '172.16.17.32', '2020-01-02 21:42:59'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (92, '01051816260', '가입 거부', '172.16.17.32', '2020-01-02 21:44:53'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (93, '01051816260', '가입 거부', '172.16.17.32', '2020-01-02 21:45:24'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (94, '01051816260', '가입 거부', '172.16.17.32', '2020-01-02 21:46:31'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (95, '01051816260', '가입 승인', '172.16.17.32', '2020-01-02 21:49:56'); INSERT INTO `sms_log` (`id`, `phone`, `type`, `ip_address`, `created_at`) VALUES (96, '01022260313', '본인 인증', '172.16.17.32', '2020-01-09 14:41:28'); /*!40000 ALTER TABLE `sms_log` ENABLE KEYS */; -- 테이블 MerDog.user_info 구조 내보내기 CREATE TABLE IF NOT EXISTS `user_info` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '사용자 번호', `user_id` varchar(50) DEFAULT NULL COMMENT '사용자 아이디', `user_pw` text COMMENT '사용자 비밀번호', `user_nick` varchar(50) NOT NULL COMMENT '사용자 닉네임', `user_phone` varchar(50) NOT NULL COMMENT '사용자 전화번호', `user_kakao` varchar(50) DEFAULT NULL COMMENT '사용자 카카오계정 아이디', `user_naver` varchar(50) DEFAULT NULL COMMENT '사용자 네이버계정 아이디', `user_google` varchar(50) DEFAULT NULL COMMENT '사용자 구글계정 아이디', `user_facebook` varchar(50) DEFAULT NULL COMMENT '사용자 페이스북계정 아이디', `user_twitter` varchar(50) DEFAULT NULL COMMENT '사용자 트위터계정 아이디', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `fcm_token` text, `user_token` text, `ticket` int(11) NOT NULL DEFAULT '0' COMMENT '보유한 이용권 수', `on/off` varchar(10) NOT NULL DEFAULT 'on' COMMENT '사용자 회원 활성화 여부 on/off', PRIMARY KEY (`id`), UNIQUE KEY `user_nick` (`user_nick`), UNIQUE KEY `user_phone` (`user_phone`), UNIQUE KEY `user_id` (`user_id`), UNIQUE KEY `user_kakao` (`user_kakao`), UNIQUE KEY `user_naver` (`user_naver`), UNIQUE KEY `user_google` (`user_google`), UNIQUE KEY `user_facebook` (`user_facebook`), UNIQUE KEY `user_twitter` (`user_twitter`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='사용자 정보'; -- 테이블 데이터 MerDog.user_info:~11 rows (대략적) 내보내기 /*!40000 ALTER TABLE `user_info` DISABLE KEYS */; INSERT INTO `user_info` (`id`, `user_id`, `user_pw`, `user_nick`, `user_phone`, `user_kakao`, `user_naver`, `user_google`, `user_facebook`, `user_twitter`, `created_at`, `fcm_token`, `user_token`, `ticket`, `on/off`) VALUES (62, 'test123', '$2y$10$HK7aFPCknYQK1tgUbTu1HeoxpaEIXG0RY23KlZ6vq295SSdZCQGVS', '민호쓰', '01034746005', NULL, NULL, NULL, NULL, NULL, '2019-10-24 22:32:51', NULL, NULL, 1560, 'on'); INSERT INTO `user_info` (`id`, `user_id`, `user_pw`, `user_nick`, `user_phone`, `user_kakao`, `user_naver`, `user_google`, `user_facebook`, `user_twitter`, `created_at`, `fcm_token`, `user_token`, `ticket`, `on/off`) VALUES (77, 'jh123', '$2y$10$AHOjPUN9yHqMPjLPx9hRZ.u0X3ls03ZJirMo1trdS2o2KZO9AcdMG', '조재형', '01020751754', NULL, NULL, NULL, NULL, NULL, '2019-11-06 12:07:20', 'f-py0J24JR4:APA91bE89XFXUj40xechIG0b63ayodron7rSiFnAtSXjh16qPoLpq6MFaepAVX-Stl67NJ5MiByX6RYaUW2lpnOXeXPxH5ZSRre5VbMlg07IRpuifDbncdJnFPqbg9vD0vOtRgf1rvSQ', '<KEY>', 14234, 'on'); INSERT INTO `user_info` (`id`, `user_id`, `user_pw`, `user_nick`, `user_phone`, `user_kakao`, `user_naver`, `user_google`, `user_facebook`, `user_twitter`, `created_at`, `fcm_token`, `user_token`, `ticket`, `on/off`) VALUES (78, NULL, NULL, '종환', '01053050315', NULL, '55141433', NULL, NULL, NULL, '2019-11-06 12:08:36', NULL, NULL, 20133, 'on'); INSERT INTO `user_info` (`id`, `user_id`, `user_pw`, `user_nick`, `user_phone`, `user_kakao`, `user_naver`, `user_google`, `user_facebook`, `user_twitter`, `created_at`, `fcm_token`, `user_token`, `ticket`, `on/off`) VALUES (79, 'test100', '$2y$10$jS7bxC/cxDqzC18vcWzcI.FHqBNGuAmk9IAQxNr.7aycsak3aW1PO', '테스트', '01089059133', NULL, NULL, NULL, NULL, NULL, '2019-11-10 12:57:50', NULL, NULL, 1696, 'off'); INSERT INTO `user_info` (`id`, `user_id`, `user_pw`, `user_nick`, `user_phone`, `user_kakao`, `user_naver`, `user_google`, `user_facebook`, `user_twitter`, `created_at`, `fcm_token`, `user_token`, `ticket`, `on/off`) VALUES (80, 'cvcv5648', '$2y$10$Cy/NNWqVxluqxhAH7qYFiOHaC6wFqTEp0hHSHx40VHrR4X.LsVFOG', '상범', '01051816260', NULL, NULL, NULL, NULL, NULL, '2019-11-12 20:11:50', NULL, NULL, 1656, 'on'); INSERT INTO `user_info` (`id`, `user_id`, `user_pw`, `user_nick`, `user_phone`, `user_kakao`, `user_naver`, `user_google`, `user_facebook`, `user_twitter`, `created_at`, `fcm_token`, `user_token`, `ticket`, `on/off`) VALUES (81, 'jgn97', '$2y$10$g2SR5EA/dG7JBSv58.b.pebhOmU6uIcbhmUpJ3C64F6Uf42oUeSBq', '조경남', '01030141437', NULL, NULL, NULL, NULL, NULL, '2019-11-14 05:52:49', NULL, NULL, 747, 'on'); INSERT INTO `user_info` (`id`, `user_id`, `user_pw`, `user_nick`, `user_phone`, `user_kakao`, `user_naver`, `user_google`, `user_facebook`, `user_twitter`, `created_at`, `fcm_token`, `user_token`, `ticket`, `on/off`) VALUES (82, 'ollenu', '$2y$10$jLh8HxDK9BhrA1cVXEfpluf7kOqtpcNL/M2P7wi3U8aMHTvWA3wcq', '좆재', '01024832850', NULL, NULL, NULL, NULL, NULL, '2019-11-23 15:13:34', NULL, NULL, 568, 'off'); INSERT INTO `user_info` (`id`, `user_id`, `user_pw`, `user_nick`, `user_phone`, `user_kakao`, `user_naver`, `user_google`, `user_facebook`, `user_twitter`, `created_at`, `fcm_token`, `user_token`, `ticket`, `on/off`) VALUES (83, 'ccit2019', '$2y$10$HQblD8wocEi13XJZxAIXR.V/kqq070WeVQbg.IQ6wMgdMbLh0FmOG', '신', '01096488148', NULL, NULL, NULL, NULL, NULL, '2019-12-06 10:43:39', NULL, NULL, 101246, 'on'); INSERT INTO `user_info` (`id`, `user_id`, `user_pw`, `user_nick`, `user_phone`, `user_kakao`, `user_naver`, `user_google`, `user_facebook`, `user_twitter`, `created_at`, `fcm_token`, `user_token`, `ticket`, `on/off`) VALUES (84, 'test4', '$2y$10$CLvp2JP2v0iUa3NAhcW1UuNjsDS5e9meZ6R5vi9CLwvSxvgd4zWRm', '시바견사', '01077383503', NULL, NULL, NULL, NULL, NULL, '2019-12-06 10:54:33', 'dzbz54fvRGA:APA91bEI3JhIRJpo4oZoW3MTmyV-0QVBhxG5eyWT51Y3aJmz4pkvxY1sWHqeM_95MuSth2ZlT1f74WIi3vKfprksIx4wrDrv6Z9C3dOIy-C8ZghhrlDSfL_5eVgVuq86YCj-6_qD5_d9', '<KEY>VPvOxvm7-CZeDd0UPmK8LUP0nJHE', 639, 'on'); INSERT INTO `user_info` (`id`, `user_id`, `user_pw`, `user_nick`, `user_phone`, `user_kakao`, `user_naver`, `user_google`, `user_facebook`, `user_twitter`, `created_at`, `fcm_token`, `user_token`, `ticket`, `on/off`) VALUES (85, 'jonghwan94', '$2y$10$EL8hTmooRV9mO.W87rqeieLuSuSGKMY2Rq6c1.nMJTFgjnrw3iTh2', '종환부계정', '01022260313', NULL, NULL, NULL, NULL, NULL, '2019-12-12 01:46:53', NULL, NULL, 179, 'on'); INSERT INTO `user_info` (`id`, `user_id`, `user_pw`, `user_nick`, `user_phone`, `user_kakao`, `user_naver`, `user_google`, `user_facebook`, `user_twitter`, `created_at`, `fcm_token`, `user_token`, `ticket`, `on/off`) VALUES (86, 'st02219', '$2y$10$idCYzBjIW97Q/NVk.WR9guzMD7xi8CDoeywZG5sStqmDqb1RKsSni', '공지환', '01073756544', NULL, NULL, NULL, NULL, NULL, '2019-12-17 22:02:02', 'ee7LQWdZlrU:APA91bGlRbUXKm33LgdDS77c-ECQ4GfVmjEwqOIgSIrHryxuc8506W5sCXjrnGA3fLYPVVyFN-VjiNxYPbc4fXZ1kQjv2evFXXv2mc8OK8YL<KEY>', '<KEY>', 600, 'on'); /*!40000 ALTER TABLE `user_info` ENABLE KEYS */; -- 테이블 MerDog.withdraw_list 구조 내보내기 CREATE TABLE IF NOT EXISTS `withdraw_list` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '출금 내역 인덱스 번호', `doctor_id` int(11) NOT NULL COMMENT '의사회원 번호', `price` int(11) NOT NULL COMMENT '출금할 금액', `fee` int(11) NOT NULL DEFAULT '30' COMMENT '수수료 퍼센트 /30% (변경가능)', `get_money` int(11) NOT NULL COMMENT '받을 돈 <수수료 계산후>', `state` varchar(50) NOT NULL DEFAULT 'wait' COMMENT '출금 내역 상태 <wait:대기 / complete:완료 / deny :거절>', `coment` text COMMENT '답변', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `FK_withdraw_list_doctor_info` (`doctor_id`), CONSTRAINT `FK_withdraw_list_doctor_info` FOREIGN KEY (`doctor_id`) REFERENCES `doctor_info` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='출금 내역'; -- 테이블 데이터 MerDog.withdraw_list:~29 rows (대략적) 내보내기 /*!40000 ALTER TABLE `withdraw_list` DISABLE KEYS */; INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (11, 115, 1000000, 30, 700000, 'wait', NULL, '2019-11-25 14:07:43'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (12, 115, 1000000, 30, 700000, 'wait', NULL, '2019-11-25 14:07:43'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (13, 103, 200000, 30, 140000, 'wait', NULL, '2019-11-20 16:10:46'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (14, 103, 10000, 30, 7000, 'wait', NULL, '2019-11-25 14:07:44'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (15, 115, 20000, 30, 14000, 'wait', NULL, '2019-11-25 14:07:44'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (16, 115, 8920000, 30, 6244000, 'wait', NULL, '2019-11-25 14:07:45'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (17, 103, 10000, 30, 7000, 'wait', NULL, '2019-11-25 14:07:45'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (18, 115, 49494949, 30, 34646464, 'deny', NULL, '2019-11-25 14:07:53'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (19, 115, 18188, 30, 12731, 'wait', NULL, '2019-11-25 14:07:46'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (20, 103, 89200, 30, 62440, 'deny', NULL, '2019-11-25 14:09:59'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (21, 115, 400000, 30, 280000, 'deny', NULL, '2019-11-25 23:57:53'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (22, 115, 20000, 30, 14000, 'wait', NULL, '2019-11-25 19:11:53'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (23, 115, 20000, 30, 14000, 'deny', NULL, '2019-11-26 19:52:29'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (24, 103, 20000, 30, 14000, 'wait', NULL, '2019-11-25 19:14:31'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (25, 103, 20000, 30, 14000, 'deny', 'ㅁㄴㅇ', '2019-11-26 23:10:34'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (26, 103, 99999, 30, 69999, 'deny', NULL, '2019-11-25 23:57:31'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (27, 103, 10000, 30, 7000, 'deny', NULL, '2019-11-26 19:52:58'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (28, 103, 10000, 30, 7000, 'wait', NULL, '2019-12-18 00:51:35'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (29, 103, 50000, 30, 35000, 'wait', NULL, '2019-12-18 00:52:05'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (30, 103, 50000, 30, 35000, 'wait', NULL, '2019-12-18 00:52:05'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (31, 103, 10000, 30, 7000, 'wait', NULL, '2019-12-18 01:04:48'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (32, 103, 100000, 30, 70000, 'wait', NULL, '2019-12-18 01:05:42'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (33, 111, 20000, 30, 14000, 'wait', NULL, '2019-12-18 03:32:00'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (34, 111, 20000, 30, 14000, 'wait', NULL, '2019-12-18 03:34:08'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (35, 111, 20000, 30, 14000, 'wait', NULL, '2019-12-18 03:35:03'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (36, 111, 200000, 30, 140000, 'wait', NULL, '2019-12-18 03:36:19'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (37, 111, 200000, 30, 140000, 'deny', '구냥', '2020-01-02 18:37:48'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (38, 111, 200000, 30, 140000, 'deny', '안돼!', '2020-01-09 11:41:39'); INSERT INTO `withdraw_list` (`id`, `doctor_id`, `price`, `fee`, `get_money`, `state`, `coment`, `created_at`) VALUES (39, 103, 10000, 30, 7000, 'complete', NULL, '2020-01-02 13:04:54'); /*!40000 ALTER TABLE `withdraw_list` ENABLE KEYS */; /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; <file_sep>/app/chat.php <?php namespace App; use Illuminate\Database\Eloquent\Model; class chat extends Model { //타임스탬프 자동입력 public $timestamps = false; //DB 이름 연동 protected $table = "chat"; //대용량할당 protected $fillable = ['request_id', 'id_type', 'send_user', 'send_doctor', 'room', 'message_type', 'message', 'read']; //조회시 제외할 칼럼 // protected $hidden = ['doctor_pw', 'remember_token']; // public function license() // { // return $this->hasMany(license::class); // } /*자동 타입변환*/ // protected $casts = [ // 'email_verified_at' => 'datetime', // ]; } <file_sep>/app/hospital_info.php <?php namespace App; use Illuminate\Database\Eloquent\Model; class hospital_info extends Model { //타임스탬프 자동입력 public $timestamps = false; //DB 이름 연동 protected $table = "hospital_info"; //대용량할당 protected $fillable = ['doctor_id','name', 'url', 'address', 'intro', 'latitude', 'longitutde' ]; } <file_sep>/app/Http/Controllers/AjaxController.php <?php namespace App\Http\Controllers; use Illuminate\Http\Request; class AjaxController extends Controller { //아이디 중복확인 public function check_id(Request $request) { $admin = \App\admin_info::where('admin_id',$request['admin_id'])->first(); if(isset($admin->id)){ $result = false; }else{ $result = true; } return response()->json([ 'result' => $result, ]); } //SMS 인증 public function sendSMS(Request $request) { //전화번호 형식 $recv = preg_replace("/(^02.{0}|^01.{1}|[0-9]{3})([0-9]+)([0-9]{4})/", "$1-$2-$3", $request['phone']); $msg = "[MerDog] 본인확인 인증번호 [".$request['number']."] 를 입력해주세요."; $sms_url = "https://sslsms.cafe24.com/sms_sender.php"; // HTTPS 전송요청 URL $sms['user_id'] = base64_encode("ccitsms"); //SMS 아이디. $sms['secure'] = base64_encode("1cc4bc9ea5d24c9811d2cf30d430276f") ;//인증키 $sms['msg'] = base64_encode(stripslashes($msg)); $sms['rphone'] = base64_encode($recv); // 수신번호 $sms['sphone1'] = base64_encode('010'); // 발신번호 $sms['sphone2'] = base64_encode('7375'); $sms['sphone3'] = base64_encode('6544'); $sms['mode'] = base64_encode("1"); // base64 사용시 반드시 모드값을 1로 주셔야 합니다. $host_info = explode("/", $sms_url); $host = $host_info[2]; $path = $host_info[3]; srand((double)microtime()*1000000); $boundary = "---------------------".substr(md5(rand(0,32000)),0,10); // 헤더 생성 $header = "POST /".$path ." HTTP/1.0\r\n"; $header .= "Host: ".$host."\r\n"; $header .= "Content-type: multipart/form-data, boundary=".$boundary."\r\n"; // 본문 생성 $data = ""; foreach($sms AS $index => $value){ $data .="--$boundary\r\n"; $data .= "Content-Disposition: form-data; name=\"".$index."\"\r\n"; $data .= "\r\n".$value."\r\n"; $data .="--$boundary\r\n"; } $header .= "Content-length: " . strlen($data) . "\r\n\r\n"; $fp = fsockopen($host, 80); if ($fp) { fputs($fp, $header.$data); $rsp = ''; while(!feof($fp)) { $rsp .= fgets($fp,8192); } fclose($fp); $msg = explode("\r\n\r\n",trim($rsp)); $rMsg = explode(",", $msg[1]); $RESULT= $rMsg[0]; //발송결과 $Count= $rMsg[1]; //잔여건수 //발송결과 알림 if($RESULT=="success") { $result = true; $log = \App\sms_log::create([ 'phone' => $request['phone'], 'type' => "본인 인증", 'ip_address' => $_SERVER["REMOTE_ADDR"], ]); }else{ $result = false; } }else { $result = false; } return response()->json([ 'result' => $result, ]); } } <file_sep>/app/user_info.php <?php namespace App; use Illuminate\Database\Eloquent\Model; class user_info extends Model { //타임스탬프 자동입력 public $timestamps = false; //DB 이름 연동 protected $table = "user_info"; //대용량할당 protected $fillable = ['user_id', 'user_pw', 'user_phone', 'user_nick', 'created_at', 'user_kakao', 'user_naver', 'fcm_token', 'doctor_token','ticket']; //조회시 제외할 칼럼 protected $hidden = ['user_pw', 'remember_token']; /*자동 타입변환*/ // protected $casts = [ // 'email_verified_at' => 'datetime', // ]; } <file_sep>/app/admin_info.php <?php namespace App; // 라라벨 인증 사용 use Illuminate\Foundation\Auth\User as Authenticatable; // 비밀번호 변경 메일을 위해 필요한 trait use Illuminate\Notifications\Notifiable; use Illuminate\Database\Eloquent\Model; class admin_info extends Authenticatable { use Notifiable; //타임스탬프 자동입력 public $timestamps = false; //DB 이름 연동 protected $table = "admin_info"; //대용량할당 protected $fillable = ['admin_id', 'admin_pw']; //조회시 제외할 칼럼 protected $hidden = ['admin_pw']; /*자동 타입변환*/ // protected $casts = [ // 'email_verified_at' => 'datetime', // ]; public function level_list() { return $this->belongsTo(level_list::class); } public function getAuthPassword(){ return $this->admin_pw; // case sensitive } } <file_sep>/app/except_list.php <?php namespace App; use Illuminate\Database\Eloquent\Model; class except_list extends Model { //타임스탬프 자동입력 public $timestamps = false; //DB 이름 연동 protected $table = "except_list"; //대용량할당 protected $fillable = ['chat_request_id', 'except']; } <file_sep>/app/Http/Controllers/ManageController.php <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\File; class ManageController extends Controller { //로그인만 이용가능한 컨트롤러 public function __construct() { $this->middleware('auth'); $this->middleware('checkstatus'); $this->middleware('normal')->only([ //회원관리 'admin_create','admin_pw','admin_level','doctor_fee','doctor_detail_fee','doctor_stop','user_stop','user_ticket','user_detail_ticket', //승인대기 'wait_admin_create','wait_admin_update','wait_doctor_create','wait_doctor_update', 'wait_doctor_delete', //결제관리 'refund','refund_update','refund_delete','withdraw_request','withdraw_request_accept','withdraw_request_deny', //상품관리 'product_state','product_register','product_register_success' ]); $this->middleware('manager')->only([ //회원관리 'doctor_fee','doctor_detail_fee','doctor_stop','user_stop', //결제관리 'refund_update','refund_delete','withdraw_request_accept','withdraw_request_deny', ]); function fcm($title,$body,$data,$token,$channel_id){ $SERVER_KEY = "<KEY>"; $url = "https://fcm.googleapis.com/fcm/send"; $notification = array('title' => $title , 'body' => $body, 'sound' => 'default', 'badge' => '1', 'click_action' => '.MainActivity', 'android_channel_id' => $channel_id); $arrayToSend = array('to' => $token, 'notification' => $notification, 'data' => $data, 'priority' => 'high'); $json = json_encode($arrayToSend); $headers = array(); $headers[] = 'Content-Type: application/json'; $headers[] = 'Authorization: key=' . $SERVER_KEY; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_HTTPHEADER,$headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); //Send the request $response = curl_exec($ch); //Close request curl_close($ch); return $response; } function sms($phone,$msg,$log_type){ //전화번호 형식 $recv = preg_replace("/(^02.{0}|^01.{1}|[0-9]{3})([0-9]+)([0-9]{4})/", "$1-$2-$3", $phone); $sms_url = "https://sslsms.cafe24.com/sms_sender.php"; // HTTPS 전송요청 URL $sms['user_id'] = base64_encode("ccitsms"); //SMS 아이디. $sms['secure'] = base64_encode("1cc4bc9ea5d24c9811d2cf30d430276f") ;//인증키 $sms['msg'] = base64_encode(stripslashes($msg)); $sms['rphone'] = base64_encode($recv); // 수신번호 $sms['sphone1'] = base64_encode('010'); // 발신번호 $sms['sphone2'] = base64_encode('7375'); $sms['sphone3'] = base64_encode('6544'); $sms['mode'] = base64_encode("1"); // base64 사용시 반드시 모드값을 1로 주셔야 합니다. $host_info = explode("/", $sms_url); $host = $host_info[2]; $path = $host_info[3]; srand((double)microtime()*1000000); $boundary = "---------------------".substr(md5(rand(0,32000)),0,10); // 헤더 생성 $header = "POST /".$path ." HTTP/1.0\r\n"; $header .= "Host: ".$host."\r\n"; $header .= "Content-type: multipart/form-data, boundary=".$boundary."\r\n"; // 본문 생성 $data = ""; foreach($sms AS $index => $value){ $data .="--$boundary\r\n"; $data .= "Content-Disposition: form-data; name=\"".$index."\"\r\n"; $data .= "\r\n".$value."\r\n"; $data .="--$boundary\r\n"; } $header .= "Content-length: " . strlen($data) . "\r\n\r\n"; $fp = fsockopen($host, 80); if ($fp) { fputs($fp, $header.$data); $rsp = ''; while(!feof($fp)) { $rsp .= fgets($fp,8192); } fclose($fp); $msg = explode("\r\n\r\n",trim($rsp)); $rMsg = explode(",", $msg[1]); $RESULT= $rMsg[0]; //발송결과 $Count= $rMsg[1]; //잔여건수 //발송결과 알림 if($RESULT=="success") { $result = true; $log = \App\sms_log::create([ 'phone' => $phone, 'type' => $log_type, 'ip_address' => $_SERVER["REMOTE_ADDR"], ]); }else{ $result = false; } }else { $result = false; } return $result; } } //회원관리 /*관리자 목록*/ public function admin_create() { $admins = \App\admin_info::where('level','<>','1')->get(); return view('manage.admin',compact('admins')); } /*관리자 비밀번호 재설정*/ public function admin_pw(Request $request) { $this->validate($request,[ 'admin_pw' => 'required|max:15|min:5|confirmed|regex:/^(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[~!@#$%^&*])[a-zA-Z0-9~!@#$%^&*]{5,15}$/', ]); $user = \App\admin_info::where('id',$request->user_num)->update(['admin_pw' => bcrypt($request->input('admin_pw'))]); return redirect()->back()->with('alert','비밀번호가 재설정 되었습니다.'); } /*관리자 직급 변경*/ public function admin_level(Request $request) { if($request->level == "4"){ if(auth()->user()->level != "4"){ return redirect()->back()->with('alert','해당 직급으로 변경 할 권한이 없습니다.'); } } $user = \App\admin_info::where('id',$request->user_num)->update(['level' => $request->input('level')]); return redirect()->back()->with('alert','직급이 변경되었습니다.'); } /*의사 목록*/ public function doctor_create() { $doctors = \App\doctor_info::where([['approval','complete'],['on/off','on']])->get(); return view('manage.doctor',compact('doctors')); } /*의사 정지 회원 목록*/ public function stop_doctor() { $doctors = \App\doctor_info::where('on/off','off')->get(); return view('manage.stop_doctor',compact('doctors')); } /*의사 전체 수수료 조정*/ public function doctor_fee(Request $request) { if($request->type == "all"){ $this->validate($request,[ 'fee' => 'required|max:100|min:1|numeric', ]); $fee = \App\doctor_info::where([['approval','complete'],['on/off','on']])->update(['fee' => $request->fee]); }elseif($request->type == "count"){ $this->validate($request,[ 'count' => 'required|min:1', 'fee' => 'required|max:100|min:1', ]); $lists = \App\chat_request::select('doctor_id', DB::raw("count(id) as count"))->where('state','finish')->groupBy('doctor_id')->get(); foreach ($lists as $list) { if($list->count >= $request->count){ $doctor = \App\doctor_info::where('id',$list->doctor_id)->first(); if($doctor->state != "0" && $doctor['on/off'] != "off"){ $fee = \App\doctor_info::where('id', $list->doctor_id)->update(['fee' => $request->fee]); } } } }elseif($request->type == "rating"){ $this->validate($request,[ 'rating' => 'required|between:0.1,5.0', 'fee' => 'required|max:100|min:1', ]); $lists = \App\chat_request::select('doctor_id', DB::raw("avg(rating) as rating"))->where([['state','finish'],['rating','<>', NULL]])->groupBy('doctor_id')->get(); foreach ($lists as $list) { if($list->rating >= $request->rating){ $doctor = \App\doctor_info::where('id',$list->doctor_id)->first(); if($doctor->state != "0" && $doctor['on/off'] != "off"){ $fee = \App\doctor_info::where('id', $list->doctor_id)->update(['fee' => $request->fee]); } } } }elseif($request->type == "both"){ $this->validate($request,[ 'count' => 'required|min:1', 'rating' => 'required|between:0.1,5.0', 'fee' => 'required|max:100|min:1', ]); $lists = \App\chat_request::select('doctor_id', DB::raw("count(id) as count"))->where('state','finish')->groupBy('doctor_id')->get(); foreach ($lists as $list) { if($list->count >= $request->count){ $doctor = \App\doctor_info::where('id',$list->doctor_id)->first(); if($doctor->state != "0" && $doctor['on/off'] != "off"){ $rating = \App\chat_request::where([['doctor_id',$list->doctor_id],['state','finish'],['rating','<>',NULL]])->avg('rating'); if($rating >= $request->rating){ $fee = \App\doctor_info::where('id', $list->doctor_id)->update(['fee' => $request->fee]); } } } } } return redirect()->back()->with('alert', '적용되었습니다.'); } /*의사 상세*/ public function doctor_detail($id) { $doctor = \App\doctor_info::where('id',$id)->first(); return view('manage.detail_doctor',compact('doctor')); } /*의사 상세 FCM 발송*/ public function doctor_detail_fcm(Request $request) { $this->validate($request,[ 'doctor_id' => 'required', 'title' => 'required', 'body' => 'required', ]); $doctor = \App\doctor_info::where('id',$request->doctor_id)->first(); $data = array("notice"=>"notice"); $token = $doctor->fcm_token; fcm($request->title,$request->body,$data,$token,"0"); if($token != null){ $log = \App\fcm_log::create([ 'id_type' => 'doctor', 'fcm_id' => $doctor->id, 'type' => "관리자 발송", 'ip_address' => $_SERVER["REMOTE_ADDR"], ]); return redirect()->back()->with('alert', 'FCM이 발송 되었습니다.'); }else{ return redirect()->back()->with('alert', '로그아웃 상태입니다.'); } } /*의사 상세 수수료 조정*/ public function doctor_detail_fee(Request $request) { $doctor = \App\doctor_info::where('id',$request['doctor_id'])->update(['fee'=> $request->fee,]); return redirect()->back()->with('alert', '적용되었습니다.'); } /*의사 상세 -> 회원 일시정지*/ public function doctor_stop(Request $request) { $doctor = \App\doctor_info::where('id',$request['doctor_id'])->update([ 'on/off'=> 'off', 'state'=> 'off', 'fcm_token'=> NULL, 'address'=> NULL, 'latitude'=> NULL, 'longitude'=> NULL, 'doctor_token' => NULL, ]); return redirect('manage/doctor'); } /*회원 목록*/ public function user_create() { $users = \App\user_info::where('on/off','on')->get(); return view('manage.user',compact('users')); } /*정지 회원 목록*/ public function stop_user() { $users = \App\user_info::where('on/off','off')->get(); return view('manage.stop_user',compact('users')); } /*회원 이용권 지급*/ public function user_ticket(Request $request) { $this->validate($request,[ 'ticket' => 'required', ]); $users = \App\user_info::whereIn('id',$request->user_id)->get(); foreach ($users as $user) { $ticket = \App\user_info::where('id',$user->id)->first(); $ticket = \App\user_info::where('id',$user->id)->update(['ticket' => $ticket->ticket + $request->ticket]); } return redirect()->back()->with('alert', '이용권 지급이 완료되었습니다.'); } /*회원 상세*/ public function user_detail($id) { $user = \App\user_info::where('id',$id)->first(); return view('manage.detail_user',compact('user')); } /*회원 상세 FCM 발송*/ public function user_detail_fcm(Request $request) { $this->validate($request,[ 'user_id' => 'required', 'title' => 'required', 'body' => 'required', ]); $user = \App\user_info::where('id',$request->user_id)->first(); $data = array("notice"=>"notice",'android_channel_id'=> '0'); $token = $user->fcm_token; fcm($request->title,$request->body,$data,$token,"0"); if($token != null){ $log = \App\fcm_log::create([ 'id_type' => 'user', 'fcm_id' => $user->id, 'type' => "관리자 발송", 'ip_address' => $_SERVER["REMOTE_ADDR"], ]); return redirect()->back()->with('alert', 'FCM이 발송 되었습니다.'); }else{ return redirect()->back()->with('alert', '로그아웃 상태입니다.'); } } /*회원 상세 이용권 지급*/ public function user_detail_ticket(Request $request) { $ticket = \App\user_info::where('id',$request['user_id_ticket'])->first(); $user = \App\user_info::where('id',$request['user_id_ticket'])->update(['ticket' => $ticket->ticket + $request->ticket]); return redirect()->back()->with('alert', '적용되었습니다.'); } /*회원 상세 -> 회원 일시정지*/ public function user_stop(Request $request) { $user = \App\user_info::where('id',$request['user_id'])->update([ 'on/off' => "off", 'fcm_token' => NULL, 'user_token' => NULL, ]); $pet = \App\pet_info::where('user_id',$request['id'])->update(['on/off' => "off"]); return redirect('manage/user'); } //승인대기 /*승인대기 - 관리자 창*/ public function wait_admin_create() { $admins = \App\admin_info::where('level','1')->get(); return view('manage.wait_admin',compact('admins')); } /*승인대기 - 관리자 승인 창*/ public function wait_admin_update(Request $request) { $admins = \App\admin_info::where('id',$request->id)->update(['level' => '2']); return redirect()->back()->with('alert', '승인되었습니다'); } /*승인대기 - 관리자 승인거부 창*/ public function wait_admin_delete(Request $request) { $admins = \App\admin_info::where('id',$request->id)->delete(); return redirect()->back()->with('alert', '거부되었습니다.'); } /*승인대기 - 의사 창*/ public function wait_doctor_create() { $doctors = \App\doctor_info::where('approval','wait')->get(); return view('manage.wait_doctor',compact('doctors')); } /*승인대기 - 의사 승인 창*/ public function wait_doctor_update(Request $request) { $doctors = \App\doctor_info::where('id',$request->id)->update(['approval' => 'complete']); $doctors = \App\doctor_info::where('id',$request->id)->first(); $msg = "[MerDog] 회원님의 회원가입이 승인 되었습니다."; $log_type = "가입 승인"; sms($doctors->doctor_phone,$msg,$log_type); return redirect()->back()->with('alert', '승인되었습니다'); } /*승인대기 - 의사 승인거부 창*/ public function wait_doctor_delete(Request $request) { $doctors = \App\doctor_info::where('id',$request->id)->update(['approval' => 'deny']); $doctors = \App\doctor_info::where('id',$request->id)->first(); $msg = "[MerDog] 회원님의 회원가입이 거부 되었습니다. 로그인 후 자격증 정보를 다시 입력해주세요."; $log_type = "가입 거부"; sms($doctors->doctor_phone,$msg,$log_type); return redirect()->back()->with('alert', '거부되었습니다'); } //상담관리 /*상담 관리 목록 (채팅요청정보 목록)*/ public function chat($id=null) { if(isset($id)){ $id = explode("_",$id); $type = $id['0']; $id = $id['1']; if($type == "user"){ $chat_requests = \App\chat_request::where('user_id',$id)->whereIn('state',['ing','finish'])->get(); }elseif($type == "doctor") { $chat_requests = \App\chat_request::where('doctor_id',$id)->whereIn('state',['ing','finish'])->get(); }else { $chat_requests = \App\chat_request::whereIn('state',['ing','finish'])->get(); } return view('manage.chat',compact('chat_requests'))->with('id',$id)->with('type',$type); }else{ $chat_requests = \App\chat_request::whereIn('state',['ing','finish'])->get(); return view('manage.chat',compact('chat_requests')); } } /* 상담상세내역 */ public function chat_detail($id) { $chat_detail = \App\chat_request::where('id',$id)->first(); return view('manage.detail_chat',compact('chat_detail')); } /* 채팅방 채팅상세 전체내역 */ public function room_chat_detail($id) { $room_chat_details = \App\chat_request::where('pet_id', $id)->whereIn('state',['ing','finish'])->get(); // $payments = \App\payment_list::where([['state','<>','wait'],['user_id',$id]])->get(); return view('manage.chat_manage.room_chat_detail',compact('room_chat_details'))->with('id',$id); } /* 일반회원 채팅목록(회원별 상담) */ public function user_chat() { $user_list = \App\chat_request::select('user_id')->whereIn('state',['ing','finish'])->distinct()->get(); $user_chats = \App\user_info::whereIn('id',$user_list)->get(); return view('manage.chat_manage.user_chat',compact('user_chats')); } /* 일반회원 채팅상세 전체내역(회원별 상담) */ public function user_chat_detail($id) { $user_chat_details = \App\chat_request::where('user_id',$id)->whereIn('state',['ing','finish'])->get(); return view('manage.chat_manage.user_chat_detail',compact('user_chat_details'))->with('id',$id); } /* 의사회원 채팅목록(회원별 상담) */ public function doctor_chat() { $doctor_list = \App\chat_request::select('doctor_id')->whereIn('state',['ing','finish'])->distinct()->get(); $doctor_chats = \App\doctor_info::whereIn('id',$doctor_list)->get(); return view('manage.chat_manage.doctor_chat',compact('doctor_chats')); } /* 의사회원 채팅상세 전체내역(회원별 상담) */ public function doctor_chat_detail($id) { $doctor_chat_details = \App\chat_request::where('doctor_id',$id)->whereIn('state',['ing','finish'])->get(); return view('manage.chat_manage.doctor_chat_detail',compact('doctor_chat_details'))->with('id',$id); } //결제관리 /*결제 내역*/ public function payment($id=null) { if(isset($id)){ $payments = \App\payment_list::where([['state','<>','wait'],['user_id',$id]])->get(); return view('manage.payment_manage.payment',compact('payments'))->with('id',$id); }else{ $payments = \App\payment_list::where('state','<>','wait')->get(); return view('manage.payment_manage.payment',compact('payments')); } } /*환불 신청 내역*/ public function refund() { $user = \App\user_info::select('id')->where('on/off','on')->get(); $refunds = \App\refund_list::where('state','wait')->whereIn('user_id',$user)->get(); return view('manage.payment_manage.refund',compact('refunds')); } /*환불 신청 승인*/ public function refund_update(Request $request) { $refunds = \App\refund_list::where('id',$request->refund_id)->update(['state' => 'complete']); $payment_list = \App\payment_list::where('id', $request->payment_id)->update(['state' => 'refund']); $user = \App\user_info::where('id', $request->user)->first(); $users = \App\user_info::where('id', $request->user)->update(['ticket' => $user->ticket-$request->ticket]); return redirect()->back()->with('alert', '승인되었습니다.'); } /*환불 신청 거절*/ public function refund_delete(Request $request) { $refunds = \App\refund_list::where('id',$request->id)->update(['state' => 'deny','coment' => $request->coment]); $title = "환불 신청이 거부되었습니다."; $body = "환불 신청 내역을 확인해주세요."; $data = array('refund_id' => $request->id,'android_channel_id'=> '3'); $user = \App\refund_list::where('id',$request->id)->first(); $token = \App\user_info::select('fcm_token')->where('id',$user->user_id)->first(); $token = $token->fcm_token; fcm($title,$body,$data,$token,"3"); if(isset($token)){ $log = \App\fcm_log::create([ 'id_type' => 'user', 'fcm_id' => $user->user_id, 'type' => "환불 신청 거절", 'ip_address' => $_SERVER["REMOTE_ADDR"], ]); } return redirect()->back()->with('alert', '거절되었습니다.'); } /*출금 내역*/ public function withdraw($id=null) { if(isset($id)){ $withdraws = \App\withdraw_list::where([['state','complete'],['doctor_id',$id]])->get(); return view('manage.payment_manage.withdraw',compact('withdraws'))->with('id',$id); }else{ $withdraws = \App\withdraw_list::where('state','complete')->get(); return view('manage.payment_manage.withdraw',compact('withdraws')); } } /*출금 신청 내역*/ public function withdraw_request() { $doctor = \App\doctor_info::select('id')->where([['on/off','on'],['approval','complete']])->get(); $withdraw_requests = \App\withdraw_list::where('state','wait')->whereIn('doctor_id',$doctor)->get(); return view('manage.payment_manage.withdraw_request',compact('withdraw_requests')); } /*출금 수락*/ public function withdraw_request_accept(Request $request) { $withdraw = \App\withdraw_list::where('id', $request->id)->update(['state'=>'complete']); $title = "출금 신청이 승인되었습니다."; $body = "출금 신청 내역을 확인해주세요."; $data = array('withdraw_id' => $request->id,'android_channel_id'=> '3'); $doctor = \App\withdraw_list::where('id',$request->id)->first(); $token = \App\doctor_info::select('fcm_token')->where('id',$doctor->doctor_id)->first(); $token = $token->fcm_token; fcm($title,$body,$data,$token,"3"); if(isset($token)){ $log = \App\fcm_log::create([ 'id_type' => 'doctor', 'fcm_id' => $doctor->doctor_id, 'type' => "출금 신청 수락", 'ip_address' => $_SERVER["REMOTE_ADDR"], ]); } return redirect()->back()->with('alert', '완료되었습니다.'); } /*출금 거절*/ public function withdraw_request_deny(Request $request) { $withdraw = \App\withdraw_list::where('id', $request->id)->update(['state'=>'deny','coment' => $request->coment]); $title = "출금 신청이 거부되었습니다."; $body = "출금 신청 내역을 확인해주세요."; $data = array('withdraw_id' => $request->id,'android_channel_id'=> '0'); $doctor = \App\withdraw_list::where('id',$request->id)->first(); $token = \App\doctor_info::select('fcm_token')->where('id',$doctor->doctor_id)->first(); $token = $token->fcm_token; fcm($title,$body,$data,$token,"3"); if(isset($token)){ $log = \App\fcm_log::create([ 'id_type' => 'doctor', 'fcm_id' => $doctor->doctor_id, 'type' => "출금 신청 거절", 'ip_address' => $_SERVER["REMOTE_ADDR"], ]); } return redirect()->back()->with('alert', '거절되었습니다.'); } //상품관리 /*상품 내역*/ public function product() { $products = \App\product::get(); return view('manage.product_manage.product',compact('products')); } /*상품 상세내역*/ public function product_detail($id) { $product = \App\product::where('id', $id)->first(); return view('manage.product_manage.product_detail',compact('product')); } /*상품 수정*/ public function product_update($id) { $product = \App\product::where('id', $id)->first(); return view('manage.product_manage.product_update',compact('product')); } /*상품 수정 완료*/ public function product_update_success(Request $request) { $this->validate($request,[ 'name' => 'required', 'ticket' => 'required|min:0', 'price' => 'required|min:0', 'code' => 'required', ]); if($request->check =="2"){ $this->validate($request,[ 'img' => 'mimes:jpeg,jpg,png,gif|required|max:10000', ]); $del_img = \App\product::where('id',$request->product_id)->first(); $delete = File::delete("storage/img/product/".$del_img->img); // $delete = Storage::disk('license')->delete($del_img->); // 파일 삭제 $uploadedFile = $request->file('img'); // 파일 설정 $filename = $uploadedFile->getClientOriginalName(); //파일 이름불러오기 $is_file_exist = file_exists("storage/img/product/".$filename); while($is_file_exist){ $filename = $uploadedFile->getClientOriginalName(); $randomNum = mt_rand(1, 99); $filename = "(".$randomNum.")".$filename; $is_file_exist = file_exists("storage/img/product/".$filename); } $file = $uploadedFile ->storeAs('public/img/product',$filename); //파일 이름($filename)으로 경로(public/img)에 저장 $product = \App\product::where('id',$request->product_id)->update(['img' => $filename]); } $product = \App\product::where('id',$request->product_id)->update([ 'name' => $request->name, 'ticket' => $request->ticket, 'price' => $request->price, 'product_code' => $request->code, ]); return redirect("manage/product")->with('alert','상품이 수정되었습니다.'); } /*상품 상태 변경*/ public function product_state(Request $request) { $product = \App\product::where('id',$request->product_id)->update([ 'on/off' => $request['on/off'] ]); return redirect("manage/product"); } /*상품 등록*/ public function product_register() { return view('manage.product_manage.product_register'); } /*상품 등록 완료*/ public function product_register_success(Request $request) { $this->validate($request,[ 'name' => 'required', 'ticket' => 'required|min:0', 'price' => 'required|min:0', 'code' => 'required', 'img' => 'mimes:jpeg,jpg,png,gif|required|max:10000', ]); $uploadedFile = $request->file('img'); // 파일 설정 $filename = $uploadedFile->getClientOriginalName(); //파일 이름불러오기 $is_file_exist = file_exists("storage/img/product/".$filename); while($is_file_exist){ $filename = $uploadedFile->getClientOriginalName(); $randomNum = mt_rand(1, 99); $filename = "(".$randomNum.")".$filename; $is_file_exist = file_exists("storage/img/product/".$filename); } $file = $uploadedFile ->storeAs('public/img/product',$filename); //파일 이름($filename)으로 경로(public/img)에 저장 $product = \App\product::create([ 'name' => $request->name, 'ticket' => $request->ticket, 'price' => $request->price, 'product_code' => $request->code, 'img' => $filename, ]); return redirect("manage/product")->with('alert','상품이 등록되었습니다.'); } } <file_sep>/app/login_log.php <?php namespace App; use Illuminate\Database\Eloquent\Model; class login_log extends Model { //타임스탬프 자동입력 public $timestamps = false; //DB 이름 연동 protected $table = "login_log"; //대용량할당 protected $fillable = ['id_type','login_id','ip_address']; } <file_sep>/routes/web.php <?php /* |-------------------------------------------------------------------------- | Web Routes |-------------------------------------------------------------------------- | | Here is where you can register web routes for your application. These | routes are loaded by the RouteServiceProvider within a group which | contains the "web" middleware group. Now create something great! | */ include "test.php"; // /*테스트용 */ // Route::get('/te', function () { // return view('register'); // }); // //로그인 include "ajax.php"; include "userapp.php"; include "doctorapp.php"; include "chat.php"; include "policy.php"; // 메인 /*로그인시 HOME 화면 */ Route::get('/home/{date?}/{move?}', function ($date = null, $move = null) { return view('main.home')->with('date',$date)->with('move',$move); })->middleware('auth')->name('home'); /*로그인 창*/ Route::get('/',[ 'as' => 'login', 'uses' => 'LoginController@create' ]); /*로그인 처리*/ Route::post('/',[ 'as' => 'login.store', 'uses' => 'LoginController@store' ]); /*로그아웃 처리*/ Route::get('/logout',[ 'as' => 'logout', 'uses' => 'LoginController@destroy' ]); //사용자 등록 /*회원가입 창*/ Route::get('/register',[ 'as' => 'register', 'uses' => 'RegisterController@create' ]); /*회원가입 처리*/ Route::post('/register',[ 'as' => 'register.store', 'uses' => 'RegisterController@store' ]); //회원관리 /*관리자*/ Route::get('/manage/admin',[ 'as' => 'manage.admin', 'uses' => 'ManageController@admin_create' ]); /*관리자 비밀번호 재설정*/ Route::post('/manage/admin/pw',[ 'as' => 'manage.admin_pw', 'uses' => 'ManageController@admin_pw' ]); /*관리자 직급 변경*/ Route::post('/manage/admin/level',[ 'as' => 'manage.admin_level', 'uses' => 'ManageController@admin_level' ]); /*의사*/ Route::get('/manage/doctor',[ 'as' => 'manage.doctor', 'uses' => 'ManageController@doctor_create' ]); /*의사 전체 수수료 조정*/ Route::post('/manage/doctor/fee',[ 'as' => 'manage.doctor_fee', 'uses' => 'ManageController@doctor_fee' ]); /*의사 -> 의사 일시정지회원 페이지*/ Route::get('/manage/doctor/stop_doctor',[ 'as' => 'manage.stop_doctor', 'uses' => 'ManageController@stop_doctor' ]); /*의사 상세*/ Route::get('/manage/doctor/detail/{id?}',[ 'as' => 'manage.doctor_detail', 'uses' => 'ManageController@doctor_detail' ]); /*의사 상세 -> FCM 발송 */ Route::post('/manage/doctor/detail_fcm',[ 'as' => 'manage.doctor_detail_fcm', 'uses' => 'ManageController@doctor_detail_fcm' ]); /*의사 상세 수수료 조정*/ Route::post('/manage/doctor/detail_fee',[ 'as' => 'manage.doctor_detail_fee', 'uses' => 'ManageController@doctor_detail_fee' ]); /*의사 상세 -> 회원 일시정지*/ Route::post('/manage/doctor/doctor_stop',[ 'as' => 'manage.doctor_stop', 'uses' => 'ManageController@doctor_stop' ]); /*회원*/ Route::get('/manage/user',[ 'as' => 'manage.user', 'uses' => 'ManageController@user_create' ]); /*회원 이용권 지급*/ Route::post('/manage/user/ticket',[ 'as' => 'manage.user_ticket', 'uses' => 'ManageController@user_ticket' ]); /*회원 -> 일시정지회원 페이지*/ Route::get('/manage/user/stop_user',[ 'as' => 'manage.stop_user', 'uses' => 'ManageController@stop_user' ]); /*회원 상세*/ Route::get('/manage/user/detail/{id?}',[ 'as' => 'manage.user_detail', 'uses' => 'ManageController@user_detail' ]); /*회원 상세 -> FCM 발송 */ Route::post('/manage/user/detail_fcm',[ 'as' => 'manage.user_detail_fcm', 'uses' => 'ManageController@user_detail_fcm' ]); /*회원 상세 -> 회원 이용권 지급*/ Route::post('/manage/user/detail_ticket',[ 'as' => 'manage.user_detail_ticket', 'uses' => 'ManageController@user_detail_ticket' ]); /*회원 상세 -> 회원 일시정지*/ Route::post('/manage/user/user_stop',[ 'as' => 'manage.user_stop', 'uses' => 'ManageController@user_stop' ]); //승인 대기 /*승인대기 - 관리자 목록*/ Route::get('/manage/wait_admin',[ 'as' => 'manage.wait_admin', 'uses' => 'ManageController@wait_admin_create' ]); /*승인대기 - 관리자 승인*/ Route::post('/manage/wait_admin/update',[ 'as' => 'manage.wait_admin.update', 'uses' => 'ManageController@wait_admin_update' ]); /*승인대기 - 관리자 승인거부*/ Route::post('/manage/wait_admin/delete',[ 'as' => 'manage.wait_admin.delete', 'uses' => 'ManageController@wait_admin_delete' ]); /*승인대기 - 의사 회원 목록*/ Route::get('/manage/wait_doctor',[ 'as' => 'manage.wait_doctor', 'uses' => 'ManageController@wait_doctor_create' ]); /*승인대기 - 의사 승인*/ Route::post('/manage/wait_doctor/update',[ 'as' => 'manage.wait_doctor.update', 'uses' => 'ManageController@wait_doctor_update' ]); /*승인대기 - 의사 승인거부*/ Route::post('/manage/wait_doctor/delete',[ 'as' => 'manage.wait_doctor.delete', 'uses' => 'ManageController@wait_doctor_delete' ]); //상담관리 /*상담 관리 목록*/ Route::get('/manage/chat/{id?}',[ 'as' => 'manage.chat', 'uses' => 'ManageController@chat' ]); /*상담 상세 내역*/ Route::get('/manage/chat/detail/{id?}',[ 'as' => 'manage.chat_detail', 'uses' => 'ManageController@chat_detail' ]); /*채팅방 상담 상세 내역*/ Route::get('/manage/chat/detail/room/{id?}',[ 'as' => 'manage.chat_manage.room_chat_detail', 'uses' => 'ManageController@room_chat_detail' ]); /* 일반회원 채팅목록(회원별 상담) */ Route::get('/manage/user_chat',[ 'as' => 'manage.user_chat', 'uses' => 'ManageController@user_chat' ]); /* 일반회원 채팅상세 전체내역(회원별 상담) */ Route::get('/manage/user_chat/detail/{id?}',[ 'as' => 'manage.user_chat_detail', 'uses' => 'ManageController@user_chat_detail' ]); /* 의사회원 채팅목록(회원별 상담) */ Route::get('/manage/doctor_chat',[ 'as' => 'manage.doctor_chat', 'uses' => 'ManageController@doctor_chat' ]); /* 의사회원 채팅상세 전체내역(회원별 상담) */ Route::get('/manage/doctor_chat/detail/{id?}',[ 'as' => 'manage.doctor_chat_detail', 'uses' => 'ManageController@doctor_chat_detail' ]); //결제관리 /*결제 내역*/ Route::get('/manage/payment/{id?}',[ 'as' => 'manage.payment_manage.payment', 'uses' => 'ManageController@payment' ]); /*무통장 신청 내역*/ Route::get('/manage/passbook',[ 'as' => 'manage.payment_manage.passbook', 'uses' => 'ManageController@passbook' ]); /*무통장 신청 승인*/ Route::post('/manage/passbook/update',[ 'as' => 'manage.payment_manage.passbook_update', 'uses' => 'ManageController@passbook_update' ]); /*무통장 신청 거절*/ Route::post('/manage/passbook/delete',[ 'as' => 'manage.payment_manage.passbook_delete', 'uses' => 'ManageController@passbook_delete' ]); /*환불 신청 내역*/ Route::get('/manage/refund',[ 'as' => 'manage.payment_manage.refund', 'uses' => 'ManageController@refund' ]); /*환불 신청 승인*/ Route::post('/manage/refund/update',[ 'as' => 'manage.payment_manage.refund_update', 'uses' => 'ManageController@refund_update' ]); /*환불 신청 거절*/ Route::post('/manage/refund/delete',[ 'as' => 'manage.payment_manage.refund_delete', 'uses' => 'ManageController@refund_delete' ]); /*출금 내역*/ Route::get('/manage/withdraw/{id?}',[ 'as' => 'manage.payment_manage.withdraw', 'uses' => 'ManageController@withdraw' ]); /*출금 신청 내역*/ Route::get('/manage/withdraw_request',[ 'as' => 'manage.payment_manage.withdraw_request', 'uses' => 'ManageController@withdraw_request' ]); /*출금 신청 수락*/ Route::post('/manage/withdraw_request/accept',[ 'as' => 'manage.payment_manage.withdraw_request.accept', 'uses' => 'ManageController@withdraw_request_accept' ]); /*출금 신청 거절*/ Route::post('/manage/withdraw_request/deny',[ 'as' => 'manage.payment_manage.withdraw_request.deny', 'uses' => 'ManageController@withdraw_request_deny' ]); //상품관리 /*상품 내역*/ Route::get('/manage/product',[ 'as' => 'manage.product_manage.product', 'uses' => 'ManageController@product' ]); /*상품 상세*/ Route::get('/manage/product/detail/{id?}',[ 'as' => 'manage.product_manage.product_detail', 'uses' => 'ManageController@product_detail' ]); /*상품 수정 페이지*/ Route::get('/manage/product/update/{id?}',[ 'as' => 'manage.product_manage.product_update', 'uses' => 'ManageController@product_update' ]); /*상품 수정 완료*/ Route::post('/manage/product/update/{id?}',[ 'as' => 'manage.product_manage.product_update_success', 'uses' => 'ManageController@product_update_success' ]); /*상품 상태 변경*/ Route::post('/manage/product/state/{id?}',[ 'as' => 'manage.product_manage.product_state', 'uses' => 'ManageController@product_state' ]); /*상품 등록 페이지*/ Route::get('/manage/product/register',[ 'as' => 'manage.product_manage.product_register', 'uses' => 'ManageController@product_register' ]); /*상품 등록*/ Route::post('/manage/product/register',[ 'as' => 'manage.product_manage.product_register_success', 'uses' => 'ManageController@product_register_success' ]); //로그 관리 /*로그인 로그 내역*/ Route::get('/log/login/{id?}',[ 'as' => 'log.login_log', 'uses' => 'LogController@login_log' ]); /*FCM 로그 내역*/ Route::get('/log/fcm/{id?}',[ 'as' => 'log.fcm_log', 'uses' => 'LogController@fcm_log' ]); /*SMS 로그 내역*/ Route::get('/log/sms',[ 'as' => 'log.sms_log', 'uses' => 'LogController@sms_log' ]); //설정 /*FCM 발송 페이지*/ Route::get('/config/fcm',[ 'as' => 'config.fcm', 'uses' => 'ConfigController@fcm' ]); /*FCM 발송*/ Route::POST('/config/fcm',[ 'as' => 'config.fcm_send', 'uses' => 'ConfigController@fcm_send' ]); // /*무통장 입금 계좌 설정*/ // Route::get('/config/passbook',[ // 'as' => 'config.passbook_config', // 'uses' => 'ConfigController@passbook' // ]); // // /*무통장 입금 계좌 등록 완료*/ // Route::post('/manage/passbook/register',[ // 'as' => 'config.passbook_register_success', // 'uses' => 'ConfigController@passbook_register_success' // ]); // // /*무통장 입금 계좌 등록 변경*/ // Route::post('/config/passbook/update',[ // 'as' => 'config.passbook_config.update', // 'uses' => 'ConfigController@passbook_update' // ]); // // /*통장 입금 계좌 삭제*/ // Route::post('/config/passbook/delete/',[ // 'as' => 'config.passbook_config.delete', // 'uses' => 'ConfigController@passbook_delete' // ]); <file_sep>/app/passbook_account.php <?php namespace App; use Illuminate\Database\Eloquent\Model; class passbook_account extends Model { //타임스탬프 자동입력 public $timestamps = false; //DB 이름 연동 protected $table = "passbook_account"; //대용량할당 protected $fillable = ['bank_name','bank_number','bank_depo','on/off']; } <file_sep>/app/Http/Controllers/UserAppController.php <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Storage; class UserAppController extends Controller { public function __construct() { function check($id){ // 이용 정지 회원인지 확인 $stop = \App\user_info::where('id',$id)->first(); if($stop['on/off'] == 'off'){ return response()->json([ 'result' => false ]); } } } /*사용자 등록*/ public function register(Request $request) { if($request->type == "kakao"){ $user = \App\user_info::create([ 'user_kakao'=> $request->input('user_id'), 'user_nick'=> $request->input('user_name'), 'user_phone'=> $request->input('user_phone'), ]); return response()->json([ 'result' => true, ]); }elseif($request->type == "naver"){ $user = \App\user_info::create([ 'user_naver'=> $request->input('user_id'), 'user_nick'=> $request->input('user_name'), 'user_phone'=> $request->input('user_phone'), ]); return response()->json([ 'result' => true, ]); }else{ $user = \App\user_info::create([ 'user_id'=> $request->input('user_id'), 'user_pw'=> bcrypt($request->input('user_pw')), 'user_nick'=> $request->input('user_name'), 'user_phone'=> $request->input('user_phone'), ]); return response()->json([ 'result' => true, ]); } } /*전화번호 중복확인*/ public function check_phone(Request $request) { $user = \App\user_info::where('user_phone',$request['user_phone'])->first(); if(isset($user->id)){ $result = false; }else{ $result = true; } return response()->json([ 'result' => $result, ]); } /*아이디 중복확인*/ public function check_id(Request $request) { $user = \App\user_info::where('user_id',$request['user_id'])->first(); if(isset($user->id)){ $result = false; }else{ $result = true; } return response()->json([ 'result' => $result, ]); } /*닉네임 중복확인*/ public function check_nick(Request $request) { $user = \App\user_info::where('user_nick',$request['user_name'])->first(); if(isset($user->id)){ $result = false; }else{ $result = true; } return response()->json([ 'result' => $result, ]); } /*아아디 찾기*/ public function find_id(Request $request) { $user = \App\user_info::where([['user_phone',$request['user_phone']],['user_nick',$request['user_name']]])->first(); if(isset($user->id)){ return response()->json([ 'result' => true, 'user_id' => $user->user_id, 'user_kakao' => $user->user_kakao, 'user_naver' => $user->user_naver, ]); }else{ return response()->json([ 'result' => false, /// 아이디 없음 ]); } } /*비밀번호 찾기*/ public function find_pw(Request $request) { function Random($length) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; } $pw = Random(6); /// 새로운 랜덤 pw 설정 $user = \App\user_info::where([['user_id',$request['user_id']],['user_phone',$request['user_phone']]])->update(['user_pw' => <PASSWORD>($pw)]); if($user != "0"){ //전화번호 형식 $recv = preg_replace("/(^02.{0}|^01.{1}|[0-9]{3})([0-9]+)([0-9]{4})/", "$1-$2-$3", $request['user_phone']); $msg = "[MerDog] 회원님의 임시 비밀번호는 [".$pw."] 입니다."; $sms_url = "https://sslsms.cafe24.com/sms_sender.php"; // HTTPS 전송요청 URL $sms['user_id'] = base64_encode("ccitsms"); //SMS 아이디. $sms['secure'] = base64_encode("1cc4bc9ea5d24c9811d2cf30d430276f") ;//인증키 $sms['msg'] = base64_encode(stripslashes($msg)); $sms['rphone'] = base64_encode($recv); // 수신번호 $sms['sphone1'] = base64_encode('010'); // 발신번호 $sms['sphone2'] = base64_encode('7375'); $sms['sphone3'] = base64_encode('6544'); $sms['mode'] = base64_encode("1"); // base64 사용시 반드시 모드값을 1로 주셔야 합니다. $host_info = explode("/", $sms_url); $host = $host_info[2]; $path = $host_info[3]; srand((double)microtime()*1000000); $boundary = "---------------------".substr(md5(rand(0,32000)),0,10); // 헤더 생성 $header = "POST /".$path ." HTTP/1.0\r\n"; $header .= "Host: ".$host."\r\n"; $header .= "Content-type: multipart/form-data, boundary=".$boundary."\r\n"; // 본문 생성 $data = ""; foreach($sms AS $index => $value){ $data .="--$boundary\r\n"; $data .= "Content-Disposition: form-data; name=\"".$index."\"\r\n"; $data .= "\r\n".$value."\r\n"; $data .="--$boundary\r\n"; } $header .= "Content-length: " . strlen($data) . "\r\n\r\n"; $fp = fsockopen($host, 80); if ($fp) { fputs($fp, $header.$data); $rsp = ''; while(!feof($fp)) { $rsp .= fgets($fp,8192); } fclose($fp); $msg = explode("\r\n\r\n",trim($rsp)); $rMsg = explode(",", $msg[1]); $RESULT= $rMsg[0]; //발송결과 $Count= $rMsg[1]; //잔여건수 //발송결과 알림 if($RESULT=="success") { $result = true; $log = \App\sms_log::create([ 'phone' => $request['user_phone'], 'type' => "pw 변경", 'ip_address' => $_SERVER["REMOTE_ADDR"], ]); }else{ $result = false; } }else { $result = false; } }else{ $result = false; } return response()->json([ 'result' => $result ]); } /*사용자 로그인*/ public function login(Request $request) { function jwt($id,$random){ // Create token header as a JSON string $header = json_encode(['typ' => 'JWT', 'alg' => 'HS256']); // Create token payload as a JSON string $payload = json_encode(['user_id' => $id]); // Encode Header to Base64Url String $base64UrlHeader = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($header)); // Encode Payload to Base64Url String $base64UrlPayload = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($payload)); // Create Signature Hash $signature = hash_hmac('sha256', $base64UrlHeader . "." . $base64UrlPayload, $random, true); // Encode Signature to Base64Url String $base64UrlSignature = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($signature)); // Create JWT $jwt = $base64UrlHeader . "." . $base64UrlPayload . "." . $base64UrlSignature; return $jwt; } function Random($length) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; } $user_num = ""; $state = ""; $token = ""; //카카오 계정 if($request->type == "kakao"){ $user = \App\user_info::where('user_kakao',$request['user_id'])->first(); if(isset($user->id)){ if($user['on/off']=="on") { $token = jwt($user->id,Random(3)); $fcm = \App\user_info::where('user_kakao',$request['user_id'])->update(["fcm_token" => $request['fcm_token'],"user_token" => $token]); $log = \App\login_log::create([ 'id_type' => 'user', 'login_id' => $user->id, 'ip_address'=> $_SERVER["REMOTE_ADDR"] ]); $result = true; $user_num = $user->id; }else{ $result = false; $state = "off"; } }else{ $result = false; } return response()->json([ 'result' => $result, 'user_num' => $user_num, 'state' => $state, 'token' => $token, ]); //네이버 계정 }elseif ($request->type == "naver") { $user = \App\user_info::where('user_naver',$request['user_id'])->first(); if(isset($user->id)){ if($user['on/off']=="on") { $token = jwt($user->id,Random(3)); $fcm = \App\user_info::where('user_naver',$request['user_id'])->update(["fcm_token" => $request['fcm_token'],"user_token" => $token]); $log = \App\login_log::create([ 'id_type' => 'user', 'login_id' => $user->id, 'ip_address'=> $_SERVER["REMOTE_ADDR"] ]); $result = true; $user_num = $user->id; }else{ $result = false; $state = "off"; } }else{ $result = false; } return response()->json([ 'result' => $result, 'user_num' => $user_num, 'state' => $state, 'token' => $token, ]); }else{ $user = \App\user_info::where('user_id',$request['user_id'])->first(); if(isset($user->id)){ if (Hash::check($request['user_pw'], $user->user_pw)) { if($user['on/off']=="on") { $token = jwt($user->id,Random(3)); $fcm = \App\user_info::where('user_id',$request['user_id'])->update(["fcm_token" => $request['fcm_token'],"user_token" => $token]); $log = \App\login_log::create([ 'id_type' => 'user', 'login_id' => $user->id, 'ip_address'=> $_SERVER["REMOTE_ADDR"] ]); $result = true; $user_num = $user->id; }else{ $result = false; $state = "off"; } }else{ $result = false; } }else{ $result = false; } return response()->json([ 'result' => $result, 'user_num' => $user_num, 'state' => $state, 'token' => $token, ]); } } /*사용자 토큰 검사*/ public function check_token(Request $request) { if(isset($request['token'])){ $user = \App\user_info::where('user_token',$request['token'])->first(); if(isset($user->id)){ $user_id = explode('.', $user->user_token ); $user_id = base64_decode($user_id[1]); $user_id = json_decode($user_id,true); if($user->id == $user_id['user_id']){ $log = \App\login_log::create([ 'id_type' => 'user', 'login_id' => $user->id, 'ip_address'=> $_SERVER["REMOTE_ADDR"] ]); return response()->json([ 'result' => true, ]); } } } return response()->json([ 'result' => false, ]); } /*사용자 로그아웃*/ public function logout(Request $request) { $fcm = \App\user_info::where('id',$request['user_id'])->update(["fcm_token" => NULL, 'user_token' => NULL]); return response()->json([ 'result' => true, ]); } /*사용자 fcm토큰 재설정*/ public function fcm_token(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->user_id); if(isset($q)){ return $q; } $fcm = \App\user_info::where('id',$request['user_id'])->update(["fcm_token" => $request['fcm_token']]); return response()->json([ 'result' => true, ]); } /*사용자 이용권 갯수*/ public function ticket(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->user_id); if(isset($q)){ return $q; } $user = \App\user_info::where('id',$request['user_id'])->first(); if(isset($user)){ return response()->json([ 'result' => true, 'ticket' => $user->ticket, ]); }else{ return response()->json([ 'result' => false, ]); } } /*사용자 마이페이지*/ public function mypage(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->user_id); if(isset($q)){ return $q; } $user = \App\user_info::where('id',$request['user_id'])->first(); $chats = \App\chat_request::where('user_id',$user->id)->whereNull('rating')->get(); $chat = array(); foreach ($chat as $value) { $chat[] = $value->id; } if(isset($user)){ return response()->json([ 'result' => true, 'user_name' => $user->user_nick, 'user_phone' => $user->user_phone, 'chat_request_id' => $chat, ]); }else{ return response()->json([ 'result' => false, ]); } } /*사용자 마이페이지 수정*/ public function mypage_update(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->user_id); if(isset($q)){ return $q; } if(isset($request['user_pw'])){ //pw 수정 $user_pw = \App\user_info::where('id',$request['user_id'])->update([ 'user_pw' => bcrypt($request['user_pw']), ]); } if(isset($request['user_phone'])){ //번호 수정 $user_phone = \App\user_info::where('id',$request['user_id'])->update([ 'user_phone' => $request['user_phone'], ]); } if(isset($request['user_name'])){ //닉네임 수정 $user_nick = \App\user_info::where('id',$request['user_id'])->update([ 'user_nick' => $request['user_name'], ]); } return response()->json([ 'result' => true, ]); } /*사용자 반려동물 목록*/ public function pet_list(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->user_id); if(isset($q)){ return $q; } $pets = \App\pet_info::where([['user_id',$request['user_id']],['on/off','on']])->get(); if($pets !="[]"){ $pet_id = array(); $pet_main_type = array(); $pet_sub_type = array(); $pet_name = array(); $pet_age = array(); $pet_gender = array(); $pet_img = array(); foreach ($pets as $i => $pet) { $pet_id[$i] = $pet->id; $pet_main_type[$i] = $pet->pet_main_type; $pet_sub_type[$i] = $pet->pet_sub_type; $pet_name[$i] = $pet->pet_name; $pet_age[$i] = $pet->pet_age; $pet_gender[$i] = $pet->pet_gender; $pet_img[$i] = $pet->pet_img; } return response()->json([ 'result' => true, 'pet_id' => $pet_id, 'pet_main_type' => $pet_main_type, 'pet_sub_type' => $pet_sub_type, 'pet_name' => $pet_name, 'pet_age' => $pet_age, 'pet_gender' => $pet_gender, 'pet_img' => $pet_img, ]); }else{ return response()->json([ 'result' => false, ]); } } /*사용자 반려동물 등록*/ public function pet_register(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->user_id); if(isset($q)){ return $q; } $img = NULL; if(isset($request['pet_img']) && isset($request['pet_img_name'])){ $file_name = $request['pet_img_name']; $file_check = Storage::disk('pet')->exists($file_name); while ($file_check) { $file_name = $request['pet_img_name']; $randomNum = mt_rand(1, 99); $file_name = "(".$randomNum.")".$file_name; $file_check = Storage::disk('pet')->exists($file_name); } $insert_img = base64_decode($request['pet_img']); // 파일 디코딩 $file_pet = Storage::disk('pet')->put($file_name, $insert_img); // 파일 저장 if($file_pet){ $img = "http://ccit2019.cafe24.com/storage/img/pet/".$file_name; } } $pet = \App\pet_info::create([ 'user_id'=> $request->input('user_id'), 'pet_main_type'=> $request->input('pet_main_type'), 'pet_sub_type'=> $request->input('pet_sub_type'), 'pet_name'=> $request->input('pet_name'), 'pet_age'=> $request->input('pet_age'), 'pet_gender'=> $request->input('pet_gender'), 'pet_birth'=> $request->input('pet_birth'), 'pet_notice'=> $request->input('pet_notice'), 'pet_img'=> $img, ]); if(isset($pet->id)){ return response()->json([ 'result' => true, ]); }else{ return response()->json([ 'result' => false, ]); } } /*사용자 반려동물 상세*/ public function pet_detail(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->user_id); if(isset($q)){ return $q; } $pet = \App\pet_info::where('id',$request['pet_id'])->first(); return response()->json([ 'result' => true, 'pet_id' => $pet->id, 'pet_main_type' => $pet->pet_main_type, 'pet_sub_type' => $pet->pet_sub_type, 'pet_name' => $pet->pet_name, 'pet_age' => $pet->pet_age, 'pet_gender' => $pet->pet_gender, 'pet_birth' => $pet->pet_birth, 'pet_notice' => $pet->pet_notice, 'pet_img' => $pet->pet_img, ]); } /*사용자 반려동물 수정*/ public function pet_update(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->user_id); if(isset($q)){ return $q; } $pet = \App\pet_info::where('id',$request['pet_id'])->first(); if(isset($request['pet_img']) && isset($request['pet_img_name'])){ $file_name = $request->input('pet_img_name'); $file_check = Storage::disk('pet')->exists($file_name); while ($file_check) { $randomNum = mt_rand(1, 99); $file_name = $randomNum."-".$file_name; } $insert_img = base64_decode($request['pet_img']); // 파일 디코딩 $file_pet = Storage::disk('pet')->put($file_name, $insert_img); // 파일 저장 $pet_name = explode('/',$pet->pet_img); $pet_name = $pet_name['6']; $delete = Storage::disk('pet')->delete($pet_name); // 파일 삭제 if($file_pet){ $img = "http://ccit2019.cafe24.com/storage/img/pet/".$file_name; } }else{ $img = $pet->pet_img; } $pet = \App\pet_info::where('id',$request['pet_id'])->update([ 'pet_main_type'=> $request->pet_main_type, 'pet_sub_type'=> $request->pet_sub_type, 'pet_name'=> $request->pet_name, 'pet_age'=> $request->pet_age, 'pet_gender'=> $request->pet_gender, 'pet_birth'=> $request->pet_birth, 'pet_notice'=> $request->pet_notice, 'pet_img'=> $img, ]); return response()->json([ 'result' => true, ]); } /*사용자 반려동물 삭제*/ public function pet_destroy(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->user_id); if(isset($q)){ return $q; } $pet = \App\pet_info::where('id',$request['pet_id'])->update(['on/off' => 'off']); if($pet != "0"){ return response()->json([ 'result' => true, ]); }else{ return response()->json([ 'result' => false, ]); } } /*상품 목록 불러오기*/ public function product(Request $request) { $products = \App\product::where('on/off','on')->get(); $product_id = array(); $product_name = array(); $product_img = array(); $product_ticket = array(); $product_price = array(); foreach ($products as $i => $product) { $product_id[$i] = $product->id; $product_name[$i] = $product->name; $product_img[$i] = "http://ccit2019.cafe24.com/storage/img/product/".$product->img; $product_ticket[$i] = $product->ticket; $product_price[$i] = $product->price; } return response()->json([ 'result' => true, 'product_id' => $product_id, 'product_name' => $product_name, 'product_img' => $product_img, 'product_ticket' => $product_ticket, 'product_price' => $product_price, ]); } /*결제신청*/ public function payment(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->user_id); if(isset($q)){ return $q; } $payment = \App\payment_list::create([ 'user_id'=> $request->input('user_id'), 'product_id'=> $request->input('product_id'), 'state'=> "complete", ]); $product = \App\product::where("id",$request->product_id)->first(); $user = \App\user_info::where("id",$request->user_id)->first(); $users = \App\user_info::where("id",$request->user_id)->update([ "ticket"=> $user->ticket+$product->ticket, ]); if(isset($payment->id)){ return response()->json([ 'result' => true, ]); }else{ return response()->json([ 'result' => false, ]); } } /*결제 내역 목록*/ public function payment_list(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->user_id); if(isset($q)){ return $q; } $payments = \App\payment_list::where("user_id",$request->user_id)->get(); $payment_id = array(); $product_id = array(); $state = array(); $date = array(); foreach ($payments as $i => $payment) { $payment_id[$i] = $payment->id; $product_id[$i] = $payment->product_id; $state[$i] = $payment->state; $date[$i] = $payment->created_at; } return response()->json([ 'result' => true, 'payment_id' => $payment_id, 'product_id' => $product_id, 'state' => $state, 'date' => $date, ]); } /*결제 내역 상세*/ // public function payment_load(Request $request) // { // // 이용 정지 회원인지 확인 // $q = check($request->user_id); // if(isset($q)){ // return $q; // } // // $payment = \App\payment_list::where([["user_id",$request->user_id],["id",$request->payment_id]])->first(); // // if($payment->method == "passbook"){ // return response()->json([ // 'result' => true, // 'payment_id' => $payment->id, // 'product_id' => $payment->product_id, // 'method' => $payment->method, // 'bank_name' => $payment->bank_name, // 'bank_depo' => $payment->bank_depo, // 'state' => $payment->state, // 'date' => $payment->created_at, // ]); // }else{ // return response()->json([ // 'result' => true, // 'payment_id' => $payment->id, // 'product_id' => $payment->product_id, // 'method' => $payment->method, // 'state' => $payment->state, // 'date' => $payment->created_at, // ]); // } // } /*환불 신청*/ public function refund(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->user_id); if(isset($q)){ return $q; } $payment = \App\payment_list::where('id',$request->payment_id)->first(); if($payment->state == "complete"){ $refund = \App\refund_list::create([ 'user_id'=> $request->input('user_id'), 'payment_list_id'=> $request->input('payment_id'), 'order_id'=> $request->input('order_id'), ]); if(isset($refund->id)){ return response()->json([ 'result' => true, ]); }else{ return response()->json([ 'result' => false, ]); } }else{ return response()->json([ 'result' => false, ]); } } /*환불 신청 내역 목록*/ public function refund_list(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->user_id); if(isset($q)){ return $q; } $refunds = \App\refund_list::where([["user_id",$request->user_id],["state","<>","complete"]])->get(); $refund_id = array(); $payment_list_id = array(); $order_id = array(); $coment = array(); $state = array(); $date = array(); foreach ($refunds as $i => $refund) { $refund_id[$i] = $refund->id; $payment_list_id[$i] = $refund->payment_list_id; $order_id[$i] = $refund->order_id; $coment[$i] = $refund->coment; $state[$i] = $refund->state; $date[$i] = $refund->created_at; } return response()->json([ 'result' => true, 'refund_id' => $refund_id, 'payment_id' => $payment_list_id, 'order_id' => $order_id, 'coment' => $coment, "state" => $state, 'date' => $date, ]); } /*환불 신청 상세*/ // public function refund_load(Request $request) // { // // 이용 정지 회원인지 확인 // $q = check($request->user_id); // if(isset($q)){ // return $q; // } // // $refund = \App\refund_list::where([["user_id",$request->user_id],['id',$request->refund_id]])->first(); // return response()->json([ // 'result' => true, // 'refund_id' => $refund->id, // 'payment_id' => $refund->payment_list_id, // 'bank_name' => $refund->bank_name, // 'bank_number' => $refund->bank_number, // 'bank_depo'=> $refund->bank_depo, // "state" => $refund->state, // 'date' => $refund->created_at, // ]); // } // /*환불 신청 수정*/ // public function refund_update(Request $request) // { // // 이용 정지 회원인지 확인 // $q = check($request->user_id); // if(isset($q)){ // return $q; // } // // $check = \App\refund_list::where('id',$request['refund_id'])->first(); // if($check->state != "wait"){ // return response()->json([ // 'result' => false, // ]); // }else{ // $refund = \App\refund_list::where([['id',$request['refund_id']],["state","wait"]])->update([ // 'payment_list_id'=> $request->payment_id, // 'bank_name'=> $request->bank_name, // 'bank_number'=> $request->bank_number, // 'bank_depo'=> $request->bank_depo, // ]); // // return response()->json([ // 'result' => true, // ]); // } // } /*환불 신청 삭제*/ public function refund_destroy(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->user_id); if(isset($q)){ return $q; } $check = \App\refund_list::where('id',$request['refund_id'])->first(); if($check->state == "wait"){ $refund = \App\refund_list::where([['id',$request['refund_id']],["state","wait"]])->delete(); return response()->json([ 'result' => true, ]); }else{ return response()->json([ 'result' => false, ]); } } /*평점 등록*/ public function rating(Request $request) { // 이용 정지 회원인지 확인 $q = check($request->user_id); if(isset($q)){ return $q; } if(isset($request['chat_request_id']) && isset($request['rating'])){ $chat = \App\chat_request::where('id',$request['chat_request_id'])->first(); if($chat['state'] == "finish"){ $rating = \App\chat_request::where('id',$request['chat_request_id'])->update(['rating' => $request->rating]); return response()->json([ 'result' => true, ]); } } return response()->json([ 'result' => false, ]); } } <file_sep>/app/Http/Controllers/LoginController.php <?php namespace App\Http\Controllers; use Illuminate\Support\Facades\Hash; use Illuminate\Http\Request; class LoginController extends Controller { //로그인하지 않은 사람만 이용가능한 컨트롤러 <로그아웃 제외> public function __construct() { $this->middleware('guest',['except' => 'destroy']); } public function create() { return view("login.login"); } public function store(Request $request) { $this->validate($request,[ 'admin_id' => 'required|max:20|min:5', 'admin_pw' => 'required|max:15|min:5', ]); $admin = \App\admin_info::where('admin_id',$request['admin_id'])->first(); if(!isset($admin)){ flash("아이디가 존재하지 않습니다.")->error(); return back()->withInput(); }else{ if (!Hash::check($request['admin_pw'], $admin->admin_pw)) { flash("비밀번호가 맞지 않습니다.")->error(); return back()->withInput(); } $level = \App\level_list::where('id',$admin->level)->first(); if(isset($level)){ if($level->level == "wait"){ flash("승인되지 않은 계정입니다. 관리자에게 문의하세요.")->error(); return back()->withInput(); // return redirect()->back()->withInput()->with('alert', '승인되지 않은 계정입니다. 관리자에게 문의하세요.'); } } } auth()->login($admin); return redirect()->route('home'); } public function destroy() { auth()->logout(); flash('또 방문해주세요.'); return redirect('/'); } } <file_sep>/routes/ajax.php <?php /* AJAX */ /*아이디 중복확인*/ Route::post('ajax/check_id',[ 'as' => 'ajax.check_id', 'uses' => 'AjaxController@check_id' ]); /*SMS 전송*/ Route::post('ajax/sms',[ 'as' => 'ajax.sms', 'uses' => 'AjaxController@sendSMS' ]); ?> <file_sep>/app/Http/Controllers/LogController.php <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; class LogController extends Controller { //로그인만 이용가능한 컨트롤러 public function __construct() { $this->middleware('auth'); $this->middleware('checkstatus'); } /*로그인 로그 내역*/ public function login_log($id=null) { if(isset($id)){ $id = explode("_",$id); $type = $id['0']; $id = $id['1']; if($type == "user"){ $logs = \App\login_log::where([['login_id',$id],['id_type','user']])->get(); }elseif($type == "doctor") { $logs = \App\login_log::where([['login_id',$id],['id_type','doctor']])->get(); } return view('log.login_log',compact('logs'))->with('id',$id)->with('type',$type);; }else{ $logs = \App\login_log::get(); return view('log.login_log',compact('logs')); } } /*FCM 로그 내역*/ public function fcm_log($id=null) { if(isset($id)){ $id = explode("_",$id); $type = $id['0']; $id = $id['1']; if($type == "user"){ $logs = \App\fcm_log::where([['fcm_id',$id],['id_type','user']])->get(); }elseif($type == "doctor") { $logs = \App\fcm_log::where([['fcm_id',$id],['id_type','doctor']])->get(); } return view('log.fcm_log',compact('logs'))->with('id',$id)->with('type',$type);; }else{ $logs = \App\fcm_log::get(); return view('log.fcm_log',compact('logs')); } } /*SMS 발송 로그 내역*/ public function sms_log($id=null) { $logs = \App\sms_log::get(); return view('log.sms_log',compact('logs')); } } <file_sep>/routes/chat.php <?php /*채팅 관련*/ // 일반 사용자가 의사에게 채팅 요청 및 상태확인 Route::post('chat/request',[ // 'as' => 'doctorapp.register', 'uses' => 'ChatController@request' ]); // 일반 사용자가 의사에게 채팅 요청 취소 Route::post('chat/cancel',[ // 'as' => 'doctorapp.register', 'uses' => 'ChatController@cancel' ]); // 의사가 채팅 푸시알림으로 인해 채팅 요청 확인 Route::post('chat/response',[ // 'as' => 'doctorapp.register', 'uses' => 'ChatController@response' ]); // 의사가 채팅 수락 Route::post('chat/accept',[ // 'as' => 'doctorapp.register', 'uses' => 'ChatController@accept' ]); // 채팅방 들어갈때 채팅 불러오기 (유저/의사) Route::post('chat/load',[ // 'as' => 'doctorapp.register', 'uses' => 'ChatController@load' ]); // 채팅방 목록 불러오기 (유저/의사) Route::post('chat/list',[ // 'as' => 'doctorapp.register', 'uses' => 'ChatController@list' ]); // 채팅 보내기 Route::post('chat/send',[ // 'as' => 'doctorapp.register', 'uses' => 'ChatController@send' ]); // 채팅 추가시간 주기 Route::post('chat/add_time',[ // 'as' => 'doctorapp.register', 'uses' => 'ChatController@add_time' ]); ?> <file_sep>/app/chat_request.php <?php namespace App; use Illuminate\Database\Eloquent\Model; class chat_request extends Model { //타임스탬프 자동입력 public $timestamps = false; //DB 이름 연동 protected $table = "chat_request"; //대용량할당 protected $fillable = ['user_id', 'doctor_id', 'chat_title', 'chat_content', 'pet_id', 'latitude', 'longitude', 'distance', 'state', 'rating','address','created_at','extra_time']; } <file_sep>/routes/doctorapp.php <?php // 의사앱 url 라우팅 /*테스트용 */ Route::post('doctorapp/test',[ // 'as' => 'doctorapp.register', 'uses' => 'DoctorAppController@Upload' ]); /*의사 등록*/ Route::post('doctorapp/register',[ // 'as' => 'doctorapp.register', 'uses' => 'DoctorAppController@register' ]); /*거부 상태 자격증 정보 변경*/ Route::post('doctorapp/re_register',[ // 'as' => 'doctorapp.register', 'uses' => 'DoctorAppController@re_register' ]); /*의사 로그인*/ Route::post('doctorapp/login',[ // 'as' => 'doctorapp.register', 'uses' => 'DoctorAppController@login' ]); /*의사 토큰 검증*/ Route::post('doctorapp/check_token',[ // 'as' => 'doctorapp.register', 'uses' => 'DoctorAppController@check_token' ]); /*의사 로그아웃*/ Route::post('doctorapp/logout',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@logout' ]); /*의사 fcm토큰 재설정*/ Route::post('doctorapp/fcm_token',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@fcm_token' ]); /*의사 채팅상태 등록*/ Route::post('doctorapp/state',[ // 'as' => 'doctorapp.register', 'uses' => 'DoctorAppController@state' ]); /*의사 현재 위치 등록*/ Route::post('doctorapp/location',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@location' ]); /*의사 전화번호 중복확인*/ Route::post('doctorapp/check_phone',[ // 'as' => 'doctorapp.register', 'uses' => 'DoctorAppController@check_phone' ]); /*의사 아이디 중복확인*/ Route::post('doctorapp/check_id',[ // 'as' => 'doctorapp.register', 'uses' => 'DoctorAppController@check_id' ]); /*아이디 찾기*/ Route::post('doctorapp/find_id',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@find_id' ]); /*비밀번호 찾기*/ Route::post('doctorapp/find_pw',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@find_pw' ]); /*마이페이지*/ Route::post('doctorapp/mypage',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@mypage' ]); /*내 정보 불러오기 <수정 시>*/ Route::post('doctorapp/mypage_load',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@mypage_load' ]); /*마이페이지 수정*/ Route::post('doctorapp/mypage_update',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@mypage_update' ]); /*병원 등록*/ Route::post('doctorapp/hospital_register',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@hospital_register' ]); /*병원정보 불러오기*/ Route::post('doctorapp/hospital_load',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@hospital_load' ]); /*병원 수정*/ Route::post('doctorapp/hospital_update',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@hospital_update' ]); /*계좌정보 목록*/ Route::post('doctorapp/account_load',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@account_load' ]); /*계좌정보 등록*/ Route::post('doctorapp/account_register',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@account_register' ]); /*계좌정보 수정*/ Route::post('doctorapp/account_update',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@account_update' ]); /*출금신청 완료 내역*/ Route::post('doctorapp/withdraw_list',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@withdraw_list' ]); /*출금신청 대기 내역*/ Route::post('doctorapp/withdraw_request_list',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@withdraw_request_list' ]); /*출금신청 등록*/ Route::post('doctorapp/withdraw_register',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@withdraw_register' ]); /*출금신청 수정*/ Route::post('doctorapp/withdraw_update',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@withdraw_update' ]); /*출금신청 삭제*/ Route::post('doctorapp/withdraw_destroy',[ // 'as' => 'userapp.register', 'uses' => 'DoctorAppController@withdraw_destroy' ]); ?> <file_sep>/routes/userapp.php <?php // 유저앱 url 라우팅 // /*테스트용 */ // Route::post('userapp/test',[ // 'uses' => 'UserAppController@test' // ]); /*테스트용 */ /*사용자 등록*/ Route::post('userapp/register',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@register' ]); /*사용자 로그인*/ Route::post('userapp/login',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@login' ]); /*사용자 토큰 검증*/ Route::post('userapp/check_token',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@check_token' ]); /*사용자 로그아웃*/ Route::post('userapp/logout',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@logout' ]); /*사용자 fcm토큰 재설정*/ Route::post('userapp/fcm_token',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@fcm_token' ]); /*사용자 전화번호 중복확인*/ Route::post('userapp/check_phone',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@check_phone' ]); /*사용자 아이디 중복확인*/ Route::post('userapp/check_id',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@check_id' ]); /*사용자 닉네임 중복확인*/ Route::post('userapp/check_nick',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@check_nick' ]); /*사용자 이용권 갯수*/ Route::post('userapp/ticket',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@ticket' ]); /*사용자 마이페이지*/ Route::post('userapp/mypage',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@mypage' ]); /*사용자 마이페이지 수정*/ Route::post('userapp/mypage_update',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@mypage_update' ]); /*사용자 반려동물 목록*/ Route::post('userapp/pet_list',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@pet_list' ]); /*사용자 반려동물 등록*/ Route::post('userapp/pet_register',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@pet_register' ]); /*사용자 반려동물 상세*/ Route::post('userapp/pet_detail',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@pet_detail' ]); /*사용자 반려동물 수정*/ Route::post('userapp/pet_update',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@pet_update' ]); /*사용자 반려동물 삭제*/ Route::post('userapp/pet_destroy',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@pet_destroy' ]); /*비밀번호 찾기*/ Route::post('userapp/find_pw',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@find_pw' ]); /*아이디 찾기*/ Route::post('userapp/find_id',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@find_id' ]); /*상품 목록 불러오기*/ Route::post('userapp/product',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@product' ]); /*결제신청*/ Route::post('userapp/payment',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@payment' ]); /*결제 내역 목록*/ Route::post('userapp/payment_list',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@payment_list' ]); /*결제 내역 상세*/ Route::post('userapp/payment_load',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@payment_load' ]); /*환불 신청*/ Route::post('userapp/refund',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@refund' ]); /*환불 신청 내역 목록*/ Route::post('userapp/refund_list',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@refund_list' ]); /*환불 신청 상세*/ Route::post('userapp/refund_load',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@refund_load' ]); /*환불 신청 수정*/ Route::post('userapp/refund_update',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@refund_update' ]); /*환불 신청 삭제*/ Route::post('userapp/refund_destroy',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@refund_destroy' ]); /*평점 등록*/ Route::post('userapp/rating',[ // 'as' => 'userapp.register', 'uses' => 'UserAppController@rating' ]); ?> <file_sep>/app/withdraw_list.php <?php namespace App; use Illuminate\Database\Eloquent\Model; class withdraw_list extends Model { //타임스탬프 자동입력 public $timestamps = false; //DB 이름 연동 protected $table = "withdraw_list"; //대용량할당 protected $fillable = ['doctor_id','price', 'fee','state','get_money','coment']; }
8f9a6b286df52f8253a29a21c3f59baa45c3c332
[ "Markdown", "SQL", "PHP" ]
34
PHP
sangbeomyou/Qpet_Server
b55e1c12d49eec33155a4285f65f29beaa7f5fef
18e4904517510e141f3a89d7edb807d6518cc211
refs/heads/master
<repo_name>drayoden/arcade<file_sep>/README.md #### Experimenting with the Arcade python library - see the site: (https://arcade.academy/) <file_sep>/asteroids/test.py import math # testing some trig functions... print(f"testing atan2...") x = 4 y = 2 print(f"x = {x}, y = {y}") rads = math.atan2(y,x) print(f"atan2(y/x): {rads} (rad)") degs = math.degrees(rads) print(f"atan2(y/x): {degs} (deg)")
1b0e438ab494b0c58a1513ccca732503832be9c2
[ "Markdown", "Python" ]
2
Markdown
drayoden/arcade
7b094e6204e37f90a3e02330792de0fc22c081aa
7e2f39925dc2bfb3fcf372eab8030a8728d83565
refs/heads/master
<file_sep><?php require_once 'database.php'; session_start(); class Auth { function authorization($login, $password) { if(($login == 'admin') && ($password == '<PASSWORD>')) { $_SESSION['isAuth'] = true; header('Location: index.html '); } else { echo 'Не удалось авторизоваться'; } } } ?><file_sep><?php require 'htmlTemplate.php'; require 'Query.php'; require 'database.php'; session_start(); if(!isset($_SESSION['isAuth'])) { header('Location: auth.html '); } echo $htmlBegin; if($_GET['value'] == student) { $object = new DatabaseQuery(); $object->getDataStudent($host, $user, $password, $database); echo $htmlEnd; } if($_GET['value'] == payment) { $object = new DatabaseQuery(); $object->getDataPayment($host, $user, $password, $database); echo $htmlEnd; } if($_GET['value'] == personalAccount) { $object = new DatabaseQuery(); $object->getDataPersonalAccount($host, $user, $password, $database); echo $htmlEnd; } if($_GET['value'] == faculty) { $object = new DatabaseQuery(); $object->getDataFaculty($host, $user, $password, $database); echo $htmlEnd; } if($_GET['value'] == study_group) { $object = new DatabaseQuery(); $object->getDataStudentGroup($host, $user, $password, $database); echo $htmlEnd; } if($_GET['value'] == specialty) { $object = new DatabaseQuery(); $object->getDataSpecialty($host, $user, $password, $database); echo $htmlEnd; } ?><file_sep><?php require 'htmlTemplate.php'; require 'Query.php'; require 'database.php'; session_start(); if(!isset($_SESSION['isAuth'])) { header('Location: auth.html '); } echo $htmlBegin; if($_GET['value'] == student) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = 'SELECT ID_student, FIO_student, group_name FROM student INNER JOIN study_group ON (student.ID_group = study_group.ID_group)'; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); $queryGroup = 'SELECT * FROM study_group'; $resultGroup = mysqli_query($link, $queryGroup) or die("Ошибка " . mysqli_error($link)); $dataGroup = mysqli_fetch_all($resultGroup, MYSQLI_ASSOC); //print_r($dataGroup); echo ' <script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.js"></script> <script type="text/javascript"> "use strict"; $(document).ready(function(){ $("table tr input, table tr select").on("change", (e) => { let elem = e.target; if (elem.tagName === "INPUT") { // input console.log(elem.value); alert("INPUT"); } else { // select console.log(elem.options[elem.selectedIndex]); alert("SELECT"); } }); }); </script>'; echo '<form method = "POST" action = "save.php"> <h2>Студенты</h2> <table class = "table table-hover table-striped"> <thead class = "thead-inverse thead-dark"> <tr> <th>Номер студента</th> <th>ФИО студента</th> <th>Название группы</th> </tr> </thead> <tbody>'; while($data = mysqli_fetch_assoc($result)) { echo '<tr> <td scope="row">'.$data['ID_student'].'</th> <td scope="row"> <input id="input" type="text" size="30" name="FIO_student" value="'.$data['FIO_student'].'"> </td> <td scope="row"> <select id="select" name="ID_group" class="form-control"> <option selected value="'.$data['ID_group'].'">'.$data['group_name'].'</option>'; foreach ($dataGroup as $key => $value) { echo '<option value="'.$value['ID_group'].'">'.$value['group_name'].'</option>'; } '</select> </td> </tr>'; } echo '</tbody> </table> <button type="submit" name="studentEnter" class="btn btn-primary">Сохранить</button> </form>'; echo $htmlEnd; } if($_GET['value'] == payment) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = 'SELECT ID_payment, Date_payment, Total_summ, FIO_student FROM payment INNER JOIN student ON (payment.ID_student = student.ID_student) ORDER BY ID_payment'; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); $queryStudent = 'SELECT * FROM student'; $resultStudent = mysqli_query($link, $queryStudent) or die("Ошибка " . mysqli_error($link)); $dataStudent = mysqli_fetch_all($resultStudent, MYSQLI_ASSOC); //print_r($dataStudent); echo '<form method = "POST" action = "edit.php"> <h2>Оплата</h2> <table class = "table table-hover table-striped"> <thead class = "thead-inverse thead-dark"> <tr> <th>Номер оплаты</th> <th>Дата оплаты</th> <th>Сумма оплаты</th> <th>ФИО студента</th> </tr> </thead> <tbody>'; while($data = mysqli_fetch_assoc($result)) { echo '<tr> <th scope="row">'.$data['ID_payment'].'</th> <th scope="row"> <input type="date" name="Date_payment" value="'.$data['Date_payment'].'"> </th> <th scope="row"> <input type="text" size="5" name="Total_summ" value="'.$data['Total_summ'].'"> </th> <th scope="row"> <select name="ID_group" class="form-control"> <option selected value="'.$data['ID_student'].'">'.$data['FIO_student'].'</option>'; foreach ($dataStudent as $key => $value) { echo '<option value="'.$value['ID_student'].'">'.$value['FIO_student'].'</option>'; } '</select> </th> </tr>'; } echo '</tbody> </table>'; echo $htmlEnd; } if($_GET['value'] == faculty) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = 'SELECT * FROM faculty'; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); echo '<form method = "POST" action = "edit.php"> <h2>Факультеты</h2> <table class = "table table-hover table-striped"> <thead class = "thead-inverse thead-dark"> <tr> <th>Номер факультета</th> <th>Название факультета</th> </tr> </thead> <tbody>'; while($data = mysqli_fetch_assoc($result)) { echo '<tr> <th scope="row">'.$data['ID_faculty'].'</th> <th scope="row"> <input type="text" size="35" name="name_faculty" value="'.$data['name_faculty'].'"> </th> </tr>'; } echo '</tbody> </table>'; echo $htmlEnd; } if($_GET['value'] == study_group) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = 'SELECT ID_group, group_name, name_specialty, name_faculty, Strength FROM study_group INNER JOIN specialty ON (study_group.ID_specialty = specialty.ID_specialty) INNER JOIN faculty ON (study_group.ID_faculty = faculty.ID_faculty)'; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); /* * данные для вывода специальностей */ $querySpecialty = 'SELECT * FROM specialty'; $resultSpecialty = mysqli_query($link, $querySpecialty) or die("Ошибка " . mysqli_error($link)); $dataSpecialty = mysqli_fetch_all($resultSpecialty, MYSQLI_ASSOC); /* * данные для вывода факультетов по специальностям */ $queryFaculty = 'SELECT * FROM faculty'; $resultFaculty = mysqli_query($link, $queryFaculty) or die("Ошибка " . mysqli_error($link)); $dataFaculty = mysqli_fetch_all($resultFaculty, MYSQLI_ASSOC); //print_r($dataFaculty); echo '<form method = "POST" action = "edit.php"> <h2>Учебные группы</h2> <table class = "table table-hover table-striped"> <thead class = "thead-inverse thead-dark"> <tr> <th>Номер группы</th> <th>Название группы</th> <th>Название специальности</th> <th>Название факультета</th> <th>Вместимость группы</th> </tr> </thead> <tbody>'; while($data = mysqli_fetch_assoc($result)) { echo '<tr> <th scope="row">'.$data['ID_group'].'</th> <th scope="row"> <input type="text" name="group_name" value="'.$data['group_name'].'"> </th> <th scope="row"> <select name="ID_specialty" class="form-control"> <option selected value="'.$data['ID_specialty'].'">'.$data['name_specialty'].'</option>'; foreach ($dataSpecialty as $key => $value) { echo '<option value="'.$value['ID_specialty'].'">'.$value['name_specialty'].'</option>'; } echo '</select> </th> <th scope="row"> <select name="ID_faculty" class="form-control"> <option selected value="'.$data['ID_faculty'].'">'.$data['name_faculty'].'</option>'; foreach ($dataFaculty as $key => $value) { echo '<option value="'.$value['ID_faculty'].'">'.$value['name_faculty'].'</option>'; } echo '</select> </th> <th scope="row"> <input type="text" size="1" name="Strength" value="'.$data['Strength'].'"> </th> </tr>'; } echo '</tbody> </table>'; echo $htmlEnd; } if($_GET['value'] == specialty) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = 'SELECT * FROM specialty'; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); echo '<form method = "POST" action = "edit.php"> <h2>Специальность</h2> <table class = "table table-hover table-striped"> <thead class = "thead-inverse thead-dark"> <tr> <th>Номер специальности</th> <th>Название специальности</th> <th>Адрес площадки</th> </tr> </thead> <tbody>'; while($data = mysqli_fetch_assoc($result)) { echo '<tr> <th scope="row">'.$data['ID_specialty'].'</th> <th scope="row"> <input type="text" size="35" name="name_specialty" value="'.$data['name_specialty'].'"> </th> <th scope="row"> <input type="text" size="35" name="address_univercity" value="'.$data['address_univercity'].'"> </th> </tr>'; } echo '</tbody> </table>'; echo $htmlEnd; } if($_GET['value'] == personalAccount) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = 'SELECT ID_account, Date_create, Course_number, Balance, FIO_student FROM personal_account INNER JOIN student ON (personal_account.ID_student = student.ID_student)'; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); $queryStudent = 'SELECT * FROM student'; $resultStudent = mysqli_query($link, $queryStudent) or die("Ошибка " . mysqli_error($link)); $dataStudent = mysqli_fetch_all($resultStudent, MYSQLI_ASSOC); //print_r($dataStudent); echo '<form method = "POST" action = "parse.php"> <h2>Лицевой счет</h2> <table class = "table table-hover table-striped"> <thead class = "thead-inverse thead-dark"> <tr> <th>Номер счета</th> <th>Дата открытия</th> <th>Курс студента</th> <th>Баланс</th> <th>ФИО студента</th> </tr> </thead> <tbody>'; while($data = mysqli_fetch_assoc($result)) { echo '<tr> <th scope="row">'.$data['ID_account'].'</th> <th scope="row"> <input type="date" name="Date_create" value="'.$data['Date_create'].'"> </th> <th scope="row"> <input type="text" size="5" name="Course_number" value="'.$data['Course_number'].'"> </th> <th scope="row"> <input type="text" size="5" name="Balance" value="'.$data['Balance'].'"> </th> <th scope="row"> <select name="ID_group" class="form-control"> <option selected value="'.$data['ID_student'].'">'.$data['FIO_student'].'</option>'; foreach ($dataStudent as $key => $value) { echo '<option value="'.$value['ID_student'].'">'.$value['FIO_student'].'</option>'; } '</select> </th> </tr>'; } echo '</tbody> </table> <button type="submit" name="saveAccount" class="btn btn-primary">Сохранить</button> </form>'; echo $htmlEnd; } ?><file_sep><script type="text/javascript"> "use strict"; $(document).ready(function(){ $("table tr input, table tr select").on("change", (e) => { let elem = e.target; if (elem.tagName === "INPUT") { // input console.log(elem.value); alert("INPUT"); } else { // select console.log(elem.options[elem.selectedIndex]); alert("SELECT"); } }); }); </script><file_sep><?php require 'htmlTemplate.php'; require 'Query.php'; require 'database.php'; session_start(); echo $htmlBegin; if(isset($_POST['array'])) { echo ' <table class = "table table-hover table-striped"> <thead class = "thead-inverse thead-dark"> <tr> <th>Номер студента</th> <th>ФИО студента</th> <th>Название группы</th> </tr> </thead> <tbody>'; foreach ($_POST['array'] as $key => $value) { echo ' <tr> <th scope="row"></th> <th scope="row">'.$value.'</th> </tr> '; } echo '</tbody> </table>'; echo $htmlEnd; } ?><file_sep><?php require_once 'Auth.php'; $object = new Auth(); $object->authorization($_POST['login'], $_POST['password']); ?><file_sep><?php $htmlBegin = '<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="<KEY>" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="<KEY>" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="<KEY>" crossorigin="anonymous"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="<KEY>" crossorigin="anonymous"> <!--<link href="style.css" rel="stylesheet">--> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script> <script src="validate.js"></script> <title>Главная</title> </head> <body> <div class="container"> <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> <a class="navbar-brand" href="index.html">CourseWork</a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarSupportedContent"> <ul class="navbar-nav mr-auto"> <li class="nav-item"> <a class="nav-link active" href="index.html">Главная</a> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Просмотр</a> <form action="select.php" method="GET"> <div class="dropdown-menu"> <a class="dropdown-item" href="select.php?value=student">Студенты</a> <a class="dropdown-item" href="select.php?value=payment">Оплата</a> <a class="dropdown-item" href="select.php?value=personalAccount">Лицевой счет</a> <a class="dropdown-item" href="select.php?value=specialty">Специальности</a> <a class="dropdown-item" href="select.php?value=study_group">Группы</a> <a class="dropdown-item" href="select.php?value=faculty">Факультеты</a> </div> </form> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Добавление</a> <form action="insert.php" method="GET"> <div class="dropdown-menu"> <a class="dropdown-item" href="insert.php?value=student">Студенты</a> <a class="dropdown-item" href="insert.php?value=payment">Оплата</a> <a class="dropdown-item" href="insert.php?value=personalAccount">Лицевой счет</a> <a class="dropdown-item" href="insert.php?value=specialty">Специальности</a> <a class="dropdown-item" href="insert.php?value=study_group">Группы</a> <a class="dropdown-item" href="insert.php?value=faculty">Факультеты</a> </div> </form> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Редактирование</a> <form action="edit.php" method="GET"> <div class="dropdown-menu"> <a class="dropdown-item" href="edit.php?value=student">Студенты</a> <a class="dropdown-item" href="edit.php?value=payment">Оплата</a> <a class="dropdown-item" href="edit.php?value=personalAccount">Лицевой счет</a> <a class="dropdown-item" href="edit.php?value=specialty">Специальности</a> <a class="dropdown-item" href="edit.php?value=study_group">Группы</a> <a class="dropdown-item" href="edit.php?value=faculty">Факультеты</a> </div> </form> </li> <li class="nav-item"> <a class="nav-link" href="report.php">Отчет</a> </li> </ul> </div> </nav> </div> <div class="container md-6">'; $htmlEnd = '</div> </body> </html>'; ?><file_sep>CREATE TABLE Faculty ( ID_faculty INTEGER NOT NULL, name_faculty VARCHAR(50) NOT NULL ); ALTER TABLE Faculty ADD PRIMARY KEY (ID_faculty); CREATE TABLE Payment ( ID_payment INTEGER NOT NULL, Date_payment DATE NOT NULL, Total_summ INTEGER NOT NULL, ID_student INTEGER NULL ); ALTER TABLE Payment ADD PRIMARY KEY (ID_payment); CREATE TABLE Personal_account ( ID_account INTEGER NOT NULL, Date_create DATE NOT NULL, Course_number INTEGER NOT NULL, Balance INTEGER NOT NULL, ID_student INTEGER NULL ); ALTER TABLE Personal_account ADD PRIMARY KEY (ID_account); CREATE TABLE Specialty ( ID_specialty VARCHAR(50) NOT NULL, name_specialty VARCHAR(50) NOT NULL, address_univercity VARCHAR(50) NOT NULL ); ALTER TABLE Specialty ADD PRIMARY KEY (ID_specialty); CREATE TABLE Student ( ID_student INTEGER NOT NULL, FIO_student VARCHAR(50) NOT NULL, ID_group INTEGER NULL ); ALTER TABLE Student ADD PRIMARY KEY (ID_student); CREATE TABLE Study_group ( ID_group INTEGER NOT NULL, ID_specialty VARCHAR(50) NULL, ID_faculty INTEGER NULL, Strength INTEGER NOT NULL ); ALTER TABLE Study_group ADD PRIMARY KEY (ID_group); ALTER TABLE Payment ADD FOREIGN KEY R_2 (ID_student) REFERENCES Student (ID_student); ALTER TABLE Personal_account ADD FOREIGN KEY R_8 (ID_student) REFERENCES Student (ID_student); ALTER TABLE Student ADD FOREIGN KEY R_5 (ID_group) REFERENCES Study_group (ID_group); ALTER TABLE Study_group ADD FOREIGN KEY R_3 (ID_faculty) REFERENCES Faculty (ID_faculty); ALTER TABLE Study_group ADD FOREIGN KEY R_4 (ID_specialty) REFERENCES Specialty (ID_specialty);<file_sep><?php session_start(); $host = 'localhost'; // адрес сервера $user = 'root'; // имя пользователя $password = ''; // <PASSWORD> $database = 'courseWork'; // имя базы данных ?><file_sep><?php session_start(); if(!isset($_SESSION['isAuth'])) { header('Location: auth.html '); } echo '<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="<KEY>" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="<KEY>" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="<KEY>" crossorigin="anonymous"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="<KEY>" crossorigin="anonymous"> <!--<link href="style.css" rel="stylesheet">--> <title>Отчет</title> </head> <body> <div class="container"> <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> <a class="navbar-brand" href="index.html">CourseWork</a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarSupportedContent"> <ul class="navbar-nav mr-auto"> <li class="nav-item"> <a class="nav-link active" href="index.html">Главная</a> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Просмотр</a> <form action="select.php" method="GET"> <div class="dropdown-menu"> <a class="dropdown-item" href="select.php?value=student">Студенты</a> <a class="dropdown-item" href="select.php?value=payment">Оплата</a> <a class="dropdown-item" href="select.php?value=personalAccount">Лицевой счет</a> <a class="dropdown-item" href="select.php?value=specialty">Специальности</a> <a class="dropdown-item" href="select.php?value=study_group">Группы</a> <a class="dropdown-item" href="select.php?value=faculty">Факультеты</a> </div> </form> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Добавление</a> <form action="insert.php" method="GET"> <div class="dropdown-menu"> <a class="dropdown-item" href="insert.php?value=student">Студенты</a> <a class="dropdown-item" href="insert.php?value=payment">Оплата</a> <a class="dropdown-item" href="insert.php?value=personalAccount">Лицевой счет</a> <a class="dropdown-item" href="insert.php?value=specialty">Специальности</a> <a class="dropdown-item" href="insert.php?value=study_group">Группы</a> <a class="dropdown-item" href="insert.php?value=faculty">Факультеты</a> </div> </form> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Редактирование</a> <form action="edit.php" method="GET"> <div class="dropdown-menu"> <a class="dropdown-item" href="edit.php?value=student">Студенты</a> <a class="dropdown-item" href="edit.php?value=payment">Оплата</a> <a class="dropdown-item" href="edit.php?value=personalAccount">Лицевой счет</a> <a class="dropdown-item" href="edit.php?value=specialty">Специальности</a> <a class="dropdown-item" href="edit.php?value=study_group">Группы</a> <a class="dropdown-item" href="edit.php?value=faculty">Факультеты</a> </div> </form> </li> <li class="nav-item"> <a class="nav-link" href="report.php">Отчет</a> </li> </ul> </div> </nav> </div>'; ?> <?php require 'htmlTemplate.php'; require 'Query.php'; require 'database.php'; $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query= "SELECT FIO_student, group_name, cost_education, SUM(p.Total_summ) as Total_pay FROM student INNER JOIN study_group ON student.ID_group = study_group.ID_group INNER JOIN specialty ON study_group.ID_specialty = specialty.ID_specialty /* подзапрос для получения платежей за текущий месяц */ LEFT JOIN ( Select * From payment p Where date_format(p.Date_payment, '%Y%m') = date_format(NOW(), '%Y%m') ) payed ON student.Id_student = payed.Id_student LEFT JOIN payment p ON student.Id_student = p.Id_student /* проверяем студентов у которых нет платежей */ Where payed.Id_student is null GROUP BY FIO_student, group_name, cost_education"; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); $data = mysqli_fetch_all($result, MYSQLI_ASSOC); $queryFaculty = 'SELECT * FROM faculty'; $resultFaculty = mysqli_query($link, $queryFaculty) or die("Ошибка " . mysqli_error($link)); $dataFaculty = mysqli_fetch_all($resultFaculty, MYSQLI_ASSOC); /*echo ' <div class="container" md-6> <div class="form-group"> <label for="name_faculty">Название факультета</label> <select name="name_faculty" class="form-control" id="exampleFormControlSelect1"> <option selected>Выберите факультет</option>'; foreach ($dataFaculty as $key => $value) { echo '<option value="'.$value['ID_faculty'].'">'.$value['name_faculty'].'</option>'; } echo '</select> </div>';*/ /*echo ' <div class="form-group"> <label for="Course_number">Номер курса (год обучения)</label> <select name="Course_number" class="form-control" id="exampleFormControlSelect2"> <option selected>Выберите год обучения</option>; <option value="1">1 курс</option>; <option value="2">2 курс</option>; <option value="3">3 курс</option>; <option value="4">4 курс</option>; </select> </div> ';*/ echo ' <div class="container" md-6> <h2>Отчет о задолженности студентов</h2> <table class = "table table-hover table-striped"> <thead class = "thead-inverse thead-dark"> <tr> <th>ФИО студента</th> <th>Группа</th> <th>Сумма поступлений</th> <th>Задолженность по оплате</th> <th>Стоимость обучения</th> </tr> </thead> <tbody>'; foreach ($data as $key => $value) { $debt = $value['cost_education'] - $value['Total_pay']; echo ' <tr> <th scope="row">'.$value['FIO_student'].'</th> <th scope="row">'.$value['group_name'].'</th> <th scope="row">'.$value['Total_pay'].'</th> <th scope="row">'.$debt.'</th> <th scope="row">'.$value['cost_education'].'</th> </tr> '; } echo '</tbody> </table> </div> </div> '; ?> <?php echo '</body> </html>' ?> <file_sep><?php require_once 'database.php'; session_start(); class DatabaseQuery { /* * выборка данных из * таблиц базы данных * вкладка "Просмотр" */ function getDataFaculty($host, $user, $password, $database) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = 'SELECT * FROM faculty'; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); echo '<h2>Факультеты</h2> <table class = "table table-hover table-striped"> <thead class = "thead-inverse thead-dark"> <tr> <th>Номер факультета</th> <th>Название факультета</th> </tr> </thead> <tbody>'; while($data = mysqli_fetch_assoc($result)) { echo '<tr><th scope="row">'.$data['ID_faculty'].'</th> <th scope="row">'.$data['name_faculty'].'</th></tr>'; } echo '</tbody> </table>'; mysqli_close($link); } function getDataPayment($host, $user, $password, $database) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = 'SELECT ID_payment, Date_payment, Total_summ, FIO_student FROM payment INNER JOIN student ON (payment.ID_student = student.ID_student) ORDER BY ID_payment'; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); echo '<h2>Оплата</h2> <table class = "table table-hover table-striped"> <thead class = "thead-inverse thead-dark"> <tr> <th>Номер оплаты</th> <th>Дата оплаты</th> <th>Сумма оплаты</th> <th>ФИО студента</th> </tr> </thead> <tbody>'; while($data = mysqli_fetch_assoc($result)) { echo '<tr><th scope="row">'.$data['ID_payment'].'</th> <th scope="row">'.$data['Date_payment'].'</th> <th scope="row">'.$data['Total_summ'].'</th> <th scope="row">'.$data['FIO_student'].'</th></tr>'; } echo '</tbody> </table>'; mysqli_close($link); } function getDataPersonalAccount($host, $user, $password, $database) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = 'SELECT ID_account, Date_create, Course_number, Balance, FIO_student FROM personal_account INNER JOIN student ON (personal_account.ID_student = student.ID_student)'; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); echo '<h2>Лицевой счет</h2> <table class = "table table-hover table-striped"> <thead class = "thead-inverse thead-dark"> <tr> <th>Номер счета</th> <th>Дата открытия</th> <th>Курс студента</th> <th>Баланс</th> <th>ФИО студента</th> </tr> </thead> <tbody>'; while($data = mysqli_fetch_assoc($result)) { echo '<tr><th scope="row">'.$data['ID_account'].'</th> <th scope="row">'.$data['Date_create'].'</th> <th scope="row">'.$data['Course_number'].'</th> <th scope="row">'.$data['Balance'].'</th> <th scope="row">'.$data['FIO_student'].'</th></tr>'; } echo '</tbody> </table>'; mysqli_close($link); } function getDataSpecialty($host, $user, $password, $database) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = 'SELECT * FROM specialty'; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); echo '<h2>Специальности</h2> <table class = "table table-hover table-striped"> <thead class = "thead-inverse thead-dark"> <tr> <th>Номер специальности</th> <th>Название специальности</th> <th>Адрес учебной площадки</th> <th>Стоимость обучения (семестр)</th> </tr> </thead> <tbody>'; while($data = mysqli_fetch_assoc($result)) { echo '<tr><th scope="row">'.$data['ID_specialty'].'</th> <th scope="row">'.$data['name_specialty'].'</th> <th scope="row">'.$data['address_univercity'].'</th> <th scope="row">'.$data['cost_education'].'</th>'; } echo '</tbody> </table>'; mysqli_close($link); } function getDataStudent($host, $user, $password, $database) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = 'SELECT ID_student, FIO_student, group_name FROM student INNER JOIN study_group ON (student.ID_group = study_group.ID_group)'; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); echo '<h2>Студенты</h2> <table class = "table table-hover table-striped"> <thead class = "thead-inverse thead-dark"> <tr> <th>Номер студента</th> <th>ФИО студента</th> <th>Название группы</th> </tr> </thead> <tbody>'; while($data = mysqli_fetch_assoc($result)) { echo '<tr><th scope="row">'.$data['ID_student'].'</th> <th scope="row">'.$data['FIO_student'].'</th> <th scope="row">'.$data['group_name'].'</th>'; } echo '</tbody> </table>'; mysqli_close($link); } function getDataStudentGroup($host, $user, $password, $database) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = 'SELECT ID_group, group_name, name_specialty, name_faculty, Strength FROM study_group INNER JOIN specialty ON (study_group.ID_specialty = specialty.ID_specialty) INNER JOIN faculty ON (study_group.ID_faculty = faculty.ID_faculty)'; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); echo '<h2>Группы</h2> <table class = "table table-hover table-striped"> <thead class = "thead-inverse thead-dark"> <tr> <th>Номер группы</th> <th>Название группы</th> <th>Название специальности</th> <th>Название факультета</th> <th>Вместимость группы</th> </tr> </thead> <tbody>'; while($data = mysqli_fetch_assoc($result)) { echo '<tr><th scope="row">'.$data['ID_group'].'</th> <th scope="row">'.$data['group_name'].'</th> <th scope="row">'.$data['name_specialty'].'</th> <th scope="row">'.$data['name_faculty'].'</th> <th scope="row">'.$data['Strength'].'</th>'; } echo '</tbody> </table>'; mysqli_close($link); } /* * добавление данных в * таблицы базы данных * вкладка "Добавление" */ function addFaculty($host, $user, $password, $database, $name_faculty) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = "INSERT INTO faculty (ID_faculty, name_faculty) VALUES (NULL, '$name_faculty')"; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); mysqli_close($link); } function addAccount($host, $user, $password, $database, $course_number, $ID_student) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = "INSERT INTO personal_account (Date_create, Course_number, ID_student) VALUES (CURRENT_DATE(), '$course_number', '$ID_student')"; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); mysqli_close($link); } function addPayment($host, $user, $password, $database, $date_payment, $total_summ, $ID_student) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = "INSERT INTO payment (ID_payment, Date_payment, Total_summ, ID_student) VALUES (NULL, '$date_payment', '$total_summ', '$ID_student')"; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); mysqli_close($link); } function addSpecialty($host, $user, $password, $database, $name_specialty, $address_univercity, $cost_education) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = "INSERT INTO specialty (ID_specialty, name_specialty, address_univercity, cost_education) VALUES (NULL, '$name_specialty', '$address_univercity', '$cost_education')"; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); mysqli_close($link); } function addStudent($host, $user, $password, $database, $FIO_student, $ID_group) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = "INSERT INTO student (ID_student, FIO_student, ID_group) VALUES (NULL, '$FIO_student', '$ID_group')"; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); mysqli_close($link); } function addGroup($host, $user, $password, $database, $group_name, $ID_specialty, $ID_faculty, $Strength) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = "INSERT INTO study_group (ID_group, group_name, ID_specialty, ID_faculty, Strength) VALUES (NULL, '$group_name', '$ID_specialty', '$ID_faculty', '$Strength')"; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); mysqli_close($link); } /* * изменение данных в таблицах базы данных * вкладка "Редактирование" * за основу берется соответствующий метод * из методов выборки, но некоторые ячейки * таблицы являются input`ами для изменения * данных. Появляется кнопка "Сохранить" */ function editDataStudent($host, $user, $password, $database) { mysqli_close($link); } } ?><file_sep><?php require 'htmlTemplate.php'; require 'Query.php'; require 'database.php'; session_start(); if(!isset($_SESSION['isAuth'])) { header('Location: auth.html '); } echo $htmlBegin; if($_GET['value'] == student) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = 'SELECT * FROM study_group'; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); echo '<form method = "POST" action = "insert.php"> <h2>Добавить студента</h2> <div class="form-group"> <label for="exampleFormControlInput1">ФИО студента</label> <input type="text" name="FIO_student" class="form-control" id="exampleFormControlInput1" placeholder="<NAME>"> </div> <div class="form-group"> <label for="exampleFormControlSelect3">Студент</label> <select name="ID_group" class="form-control" id="exampleFormControlSelect1"> <option selected>Выберите группу</option>'; while($data = mysqli_fetch_assoc($result)) { echo '<option value="'.$data['ID_group'].'">'.$data['group_name'].'</option>'; } echo '</select> </div> <button type="submit" name="studentEnter" class="btn btn-primary">Добавить студента</button> </form>'; echo $htmlEnd; } if($_GET['value'] == payment) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = 'SELECT * FROM student'; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); echo '<form method = "POST" action = "insert.php"> <h2>Добавить оплату</h2> <div class="form-group"> <label for="exampleFormControlInput1">Дата оплаты</label> <input type="date" name="date_payment" class="form-control" id="exampleFormControlInput1" placeholder="2019-12-12"> </div> <div class="form-group"> <label for="exampleFormControlInput2">Сумма оплаты</label> <input type="text" name="total_summ" class="form-control" id="exampleFormControlInput2" placeholder="10 000"> </div> <div class="form-group"> <label for="exampleFormControlSelect3">Студент</label> <select name="ID_student" class="form-control" id="exampleFormControlSelect1"> <option selected>Выберите студента</option>'; while($data = mysqli_fetch_assoc($result)) { echo '<option value="'.$data['ID_student'].'">'.$data['FIO_student'].'</option>'; } echo '</select> </div> <button type="submit" name="paymentEnter" class="btn btn-primary">Добавить оплату</button> </form>'; echo $htmlEnd; } if($_GET['value'] == faculty) { echo '<form method = "POST" action = "insert.php"> <h2>Добавить Факультет</h2> <div class="form-group row"> <label for="colFormLabel" class="col-sm-2 col-form-label">Название факультета</label> <div class="col-sm-10"> <input type="text" name="name_faculty" class="form-control" id="colFormLabel" required placeholder="Факультет права"> </div> </div> <button type="submit" name="facultyEnter" class="btn btn-primary">Добавить Факультет</button> </form>'; echo $htmlEnd; } if($_GET['value'] == study_group) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $querySpecialty = 'SELECT * FROM specialty'; $resultSpecialty = mysqli_query($link, $querySpecialty) or die("Ошибка " . mysqli_error($link)); $queryFaculty = 'SELECT * FROM faculty'; $resultFaculty = mysqli_query($link, $queryFaculty) or die("Ошибка " . mysqli_error($link)); echo '<form method = "POST" action = "insert.php"> <h2>Добавить группу</h2> <div class="form-group"> <label for="exampleFormControlInput1">Название группы</label> <input type="text" name="group_name" class="form-control" id="exampleFormControlInput1" placeholder="МВА-150"> </div> <div class="form-group"> <label for="exampleFormControlSelect3">Специальность</label> <select name="ID_specialty" class="form-control" id="exampleFormControlSelect1"> <option selected>Выберите специальность</option>'; while($dataSpecialty = mysqli_fetch_assoc($resultSpecialty)) { echo '<option value="'.$dataSpecialty['ID_specialty'].'">'.$dataSpecialty['name_specialty'].'</option>'; } echo '</select> </div> <div class="form-group"> <label for="exampleFormControlSelect3">Факультет</label> <select name="ID_faculty" class="form-control" id="exampleFormControlSelect1"> <option selected>Выберите Факультет</option>'; while($dataFaculty = mysqli_fetch_assoc($resultFaculty)) { echo '<option value="'.$dataFaculty['ID_faculty'].'">'.$dataFaculty['name_faculty'].'</option>'; } echo '</select> </div> <div class="form-group"> <label for="exampleFormControlInput1">Вместительность группы</label> <input type="text" name="Strength" class="form-control" id="exampleFormControlInput1" placeholder="20"> </div> <button type="submit" name="groupEnter" class="btn btn-primary">Добавить группу</button> </form>'; echo $htmlEnd; } if($_GET['value'] == specialty) { echo '<form method = "POST" action = "insert.php"> <h2>Добавить специальность</h2> <div class="form-group"> <label for="exampleFormControlInput1">Название специальности</label> <input type="text" name="name_specialty" class="form-control" id="exampleFormControlInput1" placeholder="Генная инженерия"> </div> <div class="form-group"> <label for="exampleFormControlInput2">Адрес площадки</label> <input type="text" name="address_univercity" class="form-control" id="exampleFormControlInput2" placeholder="Улица Грибоедова, 20"> </div> <div class="form-group"> <label for="exampleFormControlInput2">Стоимость обучения</label> <input type="text" name="cost_education" class="form-control" id="exampleFormControlInput3" placeholder="100 000"> </div> <button type="submit" name="specialtyEnter" class="btn btn-primary">Добавить специальность</button> </form>'; echo $htmlEnd; } if($_GET['value'] == personalAccount) { $link = mysqli_connect($host, $user, $password, $database) or die("Ошибка " . mysqli_error($link)); $query = 'SELECT * FROM student'; $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); echo '<form method = "POST" action = "insert.php"> <h2>Добавить лицевой счет</h2> <div class="form-group"> <label for="exampleFormControlInput1">Курс студента</label> <input type="text" name="course_number" class="form-control" id="exampleFormControlInput1" placeholder="1"> </div> <div class="form-group"> <label for="exampleFormControlSelect3">Студент</label> <select name="ID_student" class="form-control" id="exampleFormControlSelect1"> <option selected>Выберите студента</option>'; while($data = mysqli_fetch_assoc($result)) { echo '<option value="'.$data['ID_student'].'">'.$data['FIO_student'].'</option>'; } echo '</select> </div> <button type="submit" name="accountEnter" class="btn btn-primary">Добавить лицевой счет</button> </div> </form>'; echo $htmlEnd; } if(isset($_POST['facultyEnter'])) { $object = new DatabaseQuery(); $object->addFaculty($host, $user, $password, $database, $_POST['name_faculty']); } if(isset($_POST['paymentEnter'])) { $object = new DatabaseQuery(); $object->addPayment($host, $user, $password, $database, $_POST['date_payment'], $_POST['total_summ'], $_POST['ID_student']); } if(isset($_POST['specialtyEnter'])) { $object = new DatabaseQuery(); $object->addSpecialty($host, $user, $password, $database, $_POST['name_specialty'], $_POST['address_univercity'], $_POST['cost_education']); } if(isset($_POST['studentEnter'])) { $object = new DatabaseQuery(); $object->addStudent($host, $user, $password, $database, $_POST['FIO_student'], $_POST['ID_group']); } if(isset($_POST['groupEnter'])) { $object = new DatabaseQuery(); $object->addGroup($host, $user, $password, $database, $_POST['group_name'], $_POST['ID_specialty'], $_POST['ID_faculty'], $_POST['Strength']); } if(isset($_POST['accountEnter'])) { $object = new DatabaseQuery(); $object->addAccount($host, $user, $password, $database, $_POST['course_number'], $_POST['ID_student']); } ?>
c5892d9fea6445edbba1a999d22e2db768ccfd02
[ "JavaScript", "SQL", "PHP" ]
12
PHP
Lvcifera/courseWork
89112dd9b0e0be1aa8149d01f3dcdf02a719a80c
e4f18392f89329db86d5711023e846e1db4fde01
refs/heads/master
<repo_name>cossackgh/cardolini.js<file_sep>/README.md cardolini.js ============ Workflow for Cardolini.ru Base library on-line editor Cardolini.ru <file_sep>/cardolini.js // Cardolini.js version beta 0.81 //============= Init canvas fabric ====================// var fntB = false; // Font Style Bold var fntI = false; // Font Style Italic var shapeS = false; var imgBgrnd = false; // Set Background Inage var bgFill = false; // Set Background Fill color var nmUploadF = ''; // Name upload file name var copiedObjects = new Array(); // Array objects in group copied object var copiedObject = null; // Copied object var on_off_panel = false; // Switch side panel with background images var on_off_panel2 = false; // Switch side panel with design object var currcol = "#00f"; // Set defaul color var wPaper = 210; var hPaper = 297; var flipCanvas = false; var wCmm = 0; var hCmm = 0; var editormode = true; // ================= Create NEW canvas object ========================== // var canvas = new fabric.Canvas('canvas'); fabric.Object.prototype.transparentCorners = false; canvas.controlsAboveOverlay = true; // ================== Set size Background Rectangle in pixel ======================== // var bgRect = new fabric.Rect({ top : 0, left : 0, width : widthCanvas, height : heightCanvas, selectable: false, fill : 'rgb(250,250,250)' }); // ================== Set clipping Background Rectangle ======================== // var bgRectClip = new fabric.Rect({ top : 13, left : 13, width : widthCanvas-26, height : heightCanvas-26, fill : 'rgb(255,255,255)' }); // ============= Load Settings fropm JSON ======================================= // var loadJSON = null; console.log( "name product ====> "+ getNameproduct); var jqxhr = $.getJSON( "../setting.json", function(ldt) { loadJSON = ldt; $.each( ldt.Nameproduct, function( key, val ) { if (key == getNameproduct) { loadJSON = val; console.log( "KEY = "+ key + " | VAL = " + loadJSON.BG[0].chapter); Reset(); } //items.push( "<li id='" + key + "'>" + val + "</li>" ); }); //console.log( "success and = "+ loadJSON); }) .done(function(data) { //console.log( "second success" ); //console.log('loaded data= ' + data.bcard.BG[1].path); }) .fail(function() { console.log( "error" ); }) .always(function() { //console.log( "complete" ); }); // Perform other work here ... // Set another completion function for the request above //console.log('loaded data INNER= ' + loadJSON.bcard.BG[0].chapter); // ================== Set Backround Image from "urlImg" ========================= // function setBgImg (urlImg) { //console.log('set bg image! bg fill = '+bgFill); canvas.remove(bgRect); $("#colorbgrnd").css({display: 'none'}); var imgbg = new Image() imgbg.src = urlImg; var bgImg = canvas.setBackgroundImage(imgbg.src, canvas.renderAll.bind(canvas), { width: widthCanvas, height: heightCanvas, originX: 'left', originY: 'top', left: 0, top: 0 }); } //============= Set background without image ========================= // function setWOBgImg (){ $("#colorbgrnd").css({display: 'block'}); //canvas.add(bgRect).sendToBack(bgRect); canvas.setBackgroundImage(null); //console.log('clear bg image! bg fill = '+newRectBg.fill); canvas.renderAll(); } function ajax_download(url, data) { var $iframe, iframe_doc, iframe_html; if (($iframe = $('#download_iframe')).length === 0) { $iframe = $("<iframe id='download_iframe'" + " style='display: none' src='about:blank'></iframe>" ).appendTo("body"); } iframe_doc = $iframe[0].contentWindow || $iframe[0].contentDocument; if (iframe_doc.document) { iframe_doc = iframe_doc.document; } iframe_html = "<html><head></head><body><form method='POST' action='" + url +"'>" iframe_html += "<input type='hidden' name='data' value='"+data+"'>"; iframe_html +="</form></body></html>"; iframe_doc.open(); iframe_doc.write(iframe_html); $(iframe_doc).find('form').submit(); } // ============== Save As SVG =========================== // function saveSVG(){ var blob = new Blob([canvas.toSVG()], {type: "text/plain;charset=utf-8"}); saveAs(blob, "download.svg"); } // ============ Add New Rectangle to canvas =================== // function addRect(){ var newRect = new fabric.Rect({ top : 70, left : 100, width : 200, height : 200, fill : 'rgb(200,200,200)' }); canvas.add(newRect).setActiveObject(newRect); selectObjParam(); canvas.renderAll(); } //==================== Add new Circle to canvas ==========================// function addCircle(){ var newCirc = new fabric.Circle({ top: 100, left: 100, radius: 75, fill : 'rgb(200,200,200)' }); canvas.add(newCirc).setActiveObject(newCirc); selectObjParam(); canvas.renderAll(); } //=========================Add new Text to bcard =======================// function addText(){ var newTextadd = new fabric.Text('Текст можно редактировать двойным кликом', { fontFamily: 'Ubuntu', left: 100, top: 150, fontSize: 24, fontStyle: "normal", fontWeight: "normal", lineHeight: "1"}); canvas.add(newTextadd).setActiveObject(newTextadd); selectObjParam(); canvas.renderAll(); } //====================== Deleted selected Object (group Objects) ========================// function deleteObj() { if (canvas.getActiveObject()) { var selectOb = canvas.getActiveObject(); canvas.remove(selectOb); } if (canvas.getActiveGroup()) { canvas.getActiveGroup().forEachObject(function(a) { canvas.remove(a); }); canvas.discardActiveGroup(); } canvas.deactivateAll(); hideTools(); canvas.renderAll(); } //======================= Copy selected objects ========================// function copyObj2() { var obj = canvas.getActiveObject(); if (!obj) return; if (fabric.util.getKlass(obj.type).async) { obj.clone(function (clone) { clone.set({left: 100, top: 100}); canvas.add(clone); }); } else { canvas.add(obj.clone().set({left: 100, top: 100})); } canvas.discardActiveObject(); canvas.renderAll(); } /*Function put down layer select Object*/ //======================= Copy display ON Tools button ========================// function onBtn (nameBtn) { $('#' + nameBtn).css('display','block'); } //======================= Copy display OFF Tools button ========================// function offBtn (nameBtn) { $('#' + nameBtn).css('display','none'); } //======================= Drop down selected object (to ground layer) ========================// function dnObj() { var selectOb = canvas.getActiveObject(); canvas.sendBackwards(selectOb).renderAll(); } //======================= Bring down selected object 1 layer ========================// function bringdnObj() { var selectOb = canvas.getActiveObject(); canvas.sendToBack(selectOb).renderAll(); } //======================= Bring up selected object (to front layer) ========================// function upObj() { var selectOb = canvas.getActiveObject(); canvas.bringForward(selectOb).renderAll(); } //======================= Bring up selected object 1 layer ========================// function bringupObj() { var selectOb = canvas.getActiveObject(); canvas.bringToFront(selectOb).renderAll(); } //======================= Set selected text to BOLD ========================// function setFontB () { var selectOb = canvas.getActiveObject(); if (!selectOb) return; if (!fntB) { selectOb.setFontWeight('bold'); $(".btnFntB").css("background-image", "url(../img/buttons/btn-bold-on.png)"); fntB = true; } else { selectOb.setFontWeight('normal'); $(".btnFntB").css("background-image", "url(../img/buttons/btn-bold.png)"); fntB = false; } canvas.renderAll(); } //=================== Function set select Text font in Italic==========================// function setFontI () { var selectOb = canvas.getActiveObject(); if (!selectOb) return; if (!fntI) { selectOb.setFontStyle('italic'); $(".btnFntI").css("background-image", "url(../img/buttons/btn-italic-on.png)"); fntI=true; } else { selectOb.setFontStyle('normal'); $(".btnFntI").css("background-image", "url(../img/buttons/btn-italic.png)"); fntI=false; } canvas.renderAll(); } // ===================== Function clear canvas and put blank b-card ===================== // function Reset(){ console.log ('select btn = ' + loadJSON.Settings.printJPEG); if (loadJSON.Settings.printJPEG) { $('#btnSvJPG').css("display","block"); } else $('#btnSvJPG').css("display","none"); if (loadJSON.Settings.webJPEG) { $('#btnSvWWW').css("display","block"); } else $('#btnSvWWW').css("display","none"); if (loadJSON.Settings.printPDF) { $('#btnSvPDF').css("display","block"); } else $('#btnSvPDF').css("display","none"); $("#soflow-color-obj > option").removeAttr("selected"); $('#soflow-color-obj option[value="'+loadJSON.Object[0].chapter+'"]').attr("selected", true); $('#soflow-color-obj').val(loadJSON.Object[0].chapter); //// ===============!!!!!!!!!!!!!! Worked in FF IE etc. !!!!!!!!!!!!!!!!=====================// setObjSelect($('#soflow-color-obj')); $("#soflow-color > option").removeAttr("selected"); $('#soflow-color option[value="'+loadJSON.BG[0].chapter+'"]').attr("selected", true); $('#soflow-color').val(loadJSON.BG[0].chapter); //// ===============!!!!!!!!!!!!!! Worked in FF IE etc. !!!!!!!!!!!!!!!!=====================// setTmplSelect ($('#soflow-color')); canvas.clear(); $.ajax({ url: loadJSON.shablon, success: function (data){ canvas.loadFromJSON(data, canvas.renderAll.bind(canvas)); //console.log( "success DATA : " + data); } }); /*canvas.setOverlayImage('../images/bg/base/calendar.png', canvas.renderAll.bind(canvas),{ width: widthCanvas, height: heightCanvas, originX: 'left', originY: 'top', left: 0, top: 0 });*/ hideTools(); canvas.clipTo = function(ctx) { bgRectClip.render(ctx); }; getfillGrp('#111'); canvas.renderAll(); } // ====================== Function generate PDF page with created b-card ======================== // function openPDF() { $(".loadfile").css({visibility: 'visible', height: '100px'}); $(".savepdf").css({visibility: 'hidden', height: '0px'}); var dataURL = canvas.toDataURL({ format: 'jpg', quality: 1, //multiplier: 1.494 multiplier: loadJSON.Dimension.zoomkprint }); $.ajax({ url: "../tcpdf/examples/pdf-gen-jpg.php", data: {imageurl:dataURL,widthObj:wCmm,heightObj:hCmm, wPaper: wPaper, hPaper: hPaper, fObj: flipCanvas}, cache: false, dataType: 'json', type : 'POST', success: function(data) { //console.log('return from PHP = ' +data.result+' file name = '+data.filename); if (data.result) { $(".loadfile").css({visibility: 'hidden', height: '0px'}); $(".savepdf").css({visibility: 'visible', height: '100px'}); $("#savepdfbtn").attr({ href: data.filename}); } } }); } // ====================== Function start save PDF page with created b-card ======================== // function saveAsPDF(){ $('.savepdf').css('visibility','hidden'); create_jpg_web(); // create JPG file from canvas if (widthCanvas < heightCanvas) { flipCanvas = true; var wC = heightCanvas; var hC = widthCanvas; wCmm = height_in_mm; hCmm = width_in_mm; } else { flipCanvas = false; var wC = widthCanvas; var hC = heightCanvas; wCmm = width_in_mm; hCmm = height_in_mm; } openPDF(); } // ====================== ?????????????????????????? ======================== // function observeNumeric(property) { document.getElementById(property).onchange = function() { canvas.getActiveObject()[property] = this.value; canvas.renderAll(); }; } // ====================== Function align selected object to left ======================== // function alignLeft (){ var selectedGr = canvas.getActiveGroup(); if (!selectedGr) return; var pointC = new fabric.Point(0,0); var deltaX = 0; var coordY1 = 0; var coordY2 = 0; i=0; selectedGr.forEachObject(function(obj) { i++; obj.setOriginX('left'); obj.setOriginY('top'); //console.log( i + ' Point Left = ' + obj.left ); var boundObj = obj.getBoundingRect(); if (i > 1 ){ pointC.x = obj.left; deltaX = boundObj.left - coordY1; //console.log(i + ' DELTA= ' + deltaX); pointC.x -= deltaX; pointC.y = obj.top; obj.setLeft(pointC.x); } else { coordY1 = boundObj.left; } //console.log(' LEFT N '+i + ' = ' + boundObj.left + ' LEFT1 = ' + coordY1 ); }); canvas.discardActiveGroup(); selectGrpParam(); canvas.renderAll(); } // ====================== Function align selected object to right ======================== // function alignRight (){ var selectedGr = canvas.getActiveGroup(); if (!selectedGr) return; var pointC = new fabric.Point(0,0); var deltaX = 0; var firstObjW = 0; var coordY1 = 0; var coordY2 = 0; i=0; selectedGr.forEachObject(function(obj) { i++; obj.setOriginX('left'); obj.setOriginY('top'); //console.log( i + ' Point Left = ' + obj.left ); var boundObj = obj.getBoundingRect(); if (i > 1 ){ pointC.x = obj.left; deltaX = boundObj.left - coordY1; //console.log(i + ' DELTA= ' + deltaX); pointC.x -= deltaX+boundObj.width-firstObjW; pointC.y = obj.top; obj.setLeft(pointC.x); } else { coordY1 = boundObj.left; firstObjW = boundObj.width; } //console.log(' LEFT N '+i + ' = ' + boundObj.left + ' LEFT1 = ' + coordY1 ); }); canvas.discardActiveGroup(); selectGrpParam(); canvas.renderAll(); } // ====================== Function align selected object to center of horizontal ======================== // function alignHCenter (){ var selectedGr = canvas.getActiveGroup(); if (!selectedGr) return; var pointC = new fabric.Point(0,0); var deltaX = 0; var firstObjW = 0; var coordY1 = 0; var coordY2 = 0; i=0; selectedGr.forEachObject(function(obj) { var boundObj = obj.getBoundingRect(); i++; obj.setOriginX('left'); obj.setOriginY('top'); console.log( i + ' Point Left = ' + obj.left ); if (i > 1 ){ pointC.x = obj.left; deltaX = boundObj.left - coordY1; //console.log(i + ' DELTA= ' + deltaX); pointC.x -= deltaX+boundObj.width/2-firstObjW/2; pointC.y = obj.top; obj.setLeft(pointC.x); } else { coordY1 = boundObj.left; firstObjW = boundObj.width; } //console.log(' LEFT N '+i + ' = ' + boundObj.left + ' LEFT1 = ' + coordY1 ); }); canvas.discardActiveGroup(); selectGrpParam(); canvas.renderAll(); } // ====================== Function align selected object to center of vartical ======================== // function alignVCenter (){ var selectedGr = canvas.getActiveGroup(); if (!selectedGr) return; var pointC = new fabric.Point(0,0); var deltaY = 0; var firstObjH = 0; var coordY1 = 0; var coordY2 = 0; i=0; selectedGr.forEachObject(function(obj) { i++; obj.setOriginX('left'); obj.setOriginY('top'); //console.log( i + ' Point Left = ' + obj.left ); var boundObj = obj.getBoundingRect(); if (i > 1 ){ pointC.y = obj.top; deltaY = boundObj.top - coordY1; //console.log(i + ' DELTA= ' + deltaY); pointC.x = obj.left pointC.y -= deltaY+boundObj.height/2-firstObjH/2; obj.setTop(pointC.y); } else { coordY1 = boundObj.top; firstObjH = boundObj.height; } //console.log(' LEFT N '+i + ' = ' + boundObj.left + ' LEFT1 = ' + coordY1 ); }); canvas.discardActiveGroup(); selectGrpParam(); canvas.renderAll(); } // ====================== Function align selected object to top ======================== // function alignTop (){ var selectedGr = canvas.getActiveGroup(); if (!selectedGr) return; var pointC = new fabric.Point(0,0); var deltaY = 0; var firstObjH = 0; var coordY1 = 0; var coordY2 = 0; i=0; selectedGr.forEachObject(function(obj) { i++; obj.setOriginX('left'); obj.setOriginY('top'); //console.log( i + ' Point Left = ' + obj.left ); var boundObj = obj.getBoundingRect(); if (i > 1 ){ pointC.y = obj.top; deltaY = boundObj.top - coordY1; console.log(i + ' DELTA= ' + deltaY); pointC.x = obj.left pointC.y -= deltaY; obj.setTop(pointC.y); } else { coordY1 = boundObj.top; firstObjH = boundObj.height; } //console.log(' LEFT N '+i + ' = ' + boundObj.left + ' LEFT1 = ' + coordY1 ); }); canvas.discardActiveGroup(); selectGrpParam(); canvas.renderAll(); } // ====================== Function align selected object to bottom ======================== // function alignBottom (){ var selectedGr = canvas.getSelectionElement(); if (!selectedGr) return; var selectedGr = canvas.getActiveGroup(); var pointC = new fabric.Point(0,0); var deltaY = 0; var firstObjH = 0; var coordY1 = 0; var coordY2 = 0; i=0; selectedGr.forEachObject(function(obj) { i++; obj.setOriginX('left'); obj.setOriginY('top'); //console.log( i + ' Point Left = ' + obj.left ); var boundObj = obj.getBoundingRect(); if (i > 1 ){ pointC.y = obj.top; deltaY = boundObj.top - coordY1; console.log(i + ' DELTA= ' + deltaY); pointC.x = obj.left pointC.y -= deltaY+boundObj.height-firstObjH; obj.setTop(pointC.y); } else { coordY1 = boundObj.top; firstObjH = boundObj.height; } }); canvas.deactivateAllWithDispatch(); selectGrpParam(); canvas.renderAll(); } // ====================== Function GET parameters from selected objects (group)======================== // function selectGrpParam(options) { var fillColGrp = ''; if (!canvas.getActiveGroup()){ console.log('None select= '); console.log('Bground img = ' + canvas.backgroundImage); if (canvas.backgroundImage == null){ hideTools(); canvas.renderAll(); } else hideTools(); } else { console.log('Selected = ' + canvas.selection); showAllBtn(false); offBtn ('btnUp'); offBtn ('btnDn'); offBtn ('btnFlipH'); offBtn ('btnFlipV'); i = 0; compare = true; var selectOb = canvas.getActiveGroup().forEachObject(function(obj){ i++; if (i > 1) { if (fillColGrp != obj.getFill()) compare = false; } else { fillColGrp = obj.getFill(); } }); var selectObj=canvas.getActiveGroup(); var currcol = fillColGrp; if (compare) getfillGrp(fillColGrp); else getfillGrp('#111'); } } // ====================== Function GET parameters from selected object ======================== // function selectObjParam(options) { if (!canvas.getActiveObject()){ if (canvas.getActiveGroup()){ // ========= ??????????????? } console.log('None select= '); console.log('Bground img = ' + canvas.backgroundImage); if (canvas.backgroundImage == null){ hideTools(); canvas.renderAll(); } else { hideTools(); } } else { console.log('Selected = ' + canvas.selection); var selectObj=canvas.getActiveObject(); var currcol = selectObj.getFill(); switch(selectObj.type) { case 'path-group' : currcol = selectObj.paths[0].getFill(); break; case 'text': currcol = selectObj.getFill(); break; case 'circle': currcol = selectObj.getFill(); break; case 'rect': currcol = selectObj.getFill(); break; } console.log('color select obj = ' + currcol); showAllBtn (selectObj.isType('text')); getfillObj(currcol); if (selectObj.isType('text')) { $('#colorelement').css('display','block'); $("#fontFamily > option").removeAttr("selected"); $('#fontFamily option[value="'+selectObj.getFontFamily()+'"]').attr("selected", true); $('#fontFamily').val(selectObj.getFontFamily()); //// ===============!!!!!!!!!!!!!! Worked in FF IE etc. !!!!!!!!!!!!!!!!=====================// canvas.renderAll(); console.log( 'Font Family sss= '+selectObj.getFontFamily()); // =========== switch button "bold" & "italic" =============== // switch(selectObj.getFontStyle()) { case 'normal' : $(".btnFntI").css("background-image", "url(../img/buttons/btn-italic.png)"); fntI = false; break; case 'italic' : $(".btnFntI").css("background-image", "url(../img/buttons/btn-italic-on.png)"); fntI = true; break; } switch(selectObj.getFontWeight()) { case 'normal' : $(".btnFntB").css("background-image", "url(../img/buttons/btn-bold.png)"); fntB = false; break; case 'bold' : $(".btnFntB").css("background-image", "url(../img/buttons/btn-bold-on.png)"); fntB = true; break; } canvas.renderAll(); } else { /*==========*/ } } } // ============ Load Basic Template images ================ // $( "#soflow-color" ).change(function () { setTmplSelect ($(this)); }); function setTmplSelect(ch) { for (n=0; n < loadJSON.BG.length; n++) { //console.log( 'name part = ' + loadJSON.BG[n].chapter); if (ch.val() == loadJSON.BG[n].chapter) $('.thmbimg'+(n+1)).css('display','block'); else $('.thmbimg'+(n+1)).css('display','none'); } } // ============ Load Objects ================ // $( "#soflow-color-obj" ).change(function () { setObjSelect($(this)); }); function setObjSelect(ch) { for (n=0; n < loadJSON.Object.length; n++) { //console.log( 'name part = ' + loadJSON.bcard.Object[n].chapter); if (ch.val() == loadJSON.Object[n].chapter) $('.thmbobj'+(n+1)).css('display','block'); else $('.thmbobj'+(n+1)).css('display','none'); } } // ============= Click Select Size Product ====================== // $("#selectSize").click(function() { console.log( 'Click SIZE'); $('.fluid.size-menu').animate({"height": "toggle", "opacity": "toggle"}, "slow"); }); // ============ Click button ON/OFF Panel images ================ // $("#btnBg2").bind( "click", function() { console.log( 'Click TAB'); switch(on_off_panel) { case false : $('.panel-bg-thempl').animate({"right": "-10px"}, "slow"); $('.panel-bg-themp2').animate({"right": "-405px"}, "slow"); on_off_panel = true; break; case true : $('.panel-bg-thempl').animate({"right": "-350px"}, "slow"); $('.panel-bg-themp2').animate({"right": "-350px"}, "slow"); on_off_panel = false; break; } }); // ============ Click button ON/OFF Panel Objects ================ // $("#btnObj2").bind( "click", function() { switch(on_off_panel2) { case false : $('.panel-bg-thempl').animate({"right": "-405px"}, "slow"); $('.panel-bg-themp2').animate({"right": "-10px"}, "slow"); on_off_panel2 = true; break; case true : $('.panel-bg-thempl').animate({"right": "-350px"}, "slow"); $('.panel-bg-themp2').animate({"right": "-350px"}, "slow"); on_off_panel2 = false; break; } }); // ========= Click button Upload Image =============== // $('#btnUpload').click(function() { $.fancybox.open([ { href : '#modal-upload', title : 'Загрузить картинку' } ], { maxWidth : 800, maxHeight : 600, fitToView : false, width : '70%', height : '70%', autoSize : false, closeClick : false, openEffect : 'fade', closeEffect : 'fade' }); }); // ========= Click button Edit Text =============== // $('#btnEditT').click(function() { var activeObject = canvas.getActiveObject(); if (activeObject) { if (activeObject.isType('text')){ console.log("type selected = " + activeObject); editText(activeObject); $.fancybox.open([ { href : '#inline1', title : 'Редактирование текста' } ], { maxWidth : 800, maxHeight : 400, fitToView : false, width : '70%', height : '70%', autoSize : false, closeClick : false, openEffect : 'fade', closeEffect : 'fade' }); } } }); function editText(activeTextObject) { var textGet = activeTextObject.getText(); console.log('12'+textGet); $('#cnvEdit').attr( "value", textGet ); $('#cnvEdit').val( textGet ); }; // ========= Event double click to Text object and edit Text =============== // canvas.dblclick(function(e) { var activeObject = canvas.getActiveObject(); if (activeObject && activeObject.isType('text')) { editText(activeObject); $.fancybox.open([ { href : '#inline1', title : 'Редактирование текста' } ], { maxWidth : 800, maxHeight : 400, fitToView : false, width : '70%', height : '70%', autoSize : false, closeClick : false, openEffect : 'fade', closeEffect : 'fade' }); } }); // ================ POP-UP SAVE JPEG ==================== // function dawnloadJPEG () { $.fancybox.open([ { href : '#saveBcardJPG', title : 'Записать JPG' } ], { maxWidth : 800, maxHeight : 600, fitToView : false, width : '70%', height : '70%', autoSize : false, closeClick : false, openEffect : 'fade', closeEffect : 'fade' }); } // ================ Close POP-UP SAVE JPEG ==================== // $('#okTheme').click(function() { $.fancybox.close( true ); }); // ============================================================ // // ================ Event click mouse to canvas ==================== // canvas.on('mouse:up', function(options){ if (canvas.getActiveGroup()){ //console.log('Select GROUP'); selectGrpParam(options); } else { if (canvas.getActiveObject()){ selectObjParam(options); } else hideAllBtn(); } } ); // ============= Function keycapture ==================== // document.onkeydown = function(e) { if (46 === e.keyCode) { console.log('delete press'); // 46 is Delete key var activeObject = canvas.getActiveObject(); if (!activeObject) { } else { //deleteObj(); } // do stuff to delete selected elements } }; // ================ Click btn SAVE PDF ==================== // $("#btnSvPDF").bind( "click", function(){ popupPDF (); }); // ================ Close POP-UP SAVE PDF ==================== // $('#pdfcancel').click(function() { $.fancybox.close( true ); }); // ================ Close POP-UP SAVE PDF ==================== // $('#savepdfbtn').click(function() { $.fancybox.close( true ); }); // ================ POP-UP SAVE PDF ==================== // function popupPDF () { console.log('in gen pdf preview png!!!!'); //create_jpg_web (); $.fancybox.open([ { href : '#modal-save-pdf', title : 'Сохранить в PDF' } ], { maxWidth : 800, maxHeight : 600, fitToView : false, width : '70%', height : '70%', autoSize : false, closeClick : false, openEffect : 'fade', closeEffect : 'fade' }); } // ================ Click Cancel upload image ====================== // $('#uploadcancelbtn').click(function() { $.fancybox.close( true ); }); // ================ Function POP-UP Upload images ====================== // function popupUploadImg () { console.log('upload img modal win!!!!'); create_jpg_web (); $.fancybox.open([ { href : '#modal-save-pdf', title : 'Сохранить в PDF' } ], { maxWidth : 800, maxHeight : 600, fitToView : false, width : '70%', height : '70%', autoSize : false, closeClick : false, openEffect : 'fade', closeEffect : 'fade' }); } // ================ END POP-UP Upload Image ==================== // // ================ Function Show All instrument button ====================== // function showAllBtn (fntOn) { onBtn ('btnCopy'); onBtn ('btnDel'); onBtn ('btnUp'); onBtn ('btnDn'); onBtn ('btnFlipH'); onBtn ('btnFlipV'); onBtn ('btnLock'); onBtn ('sectEdit'); onBtn ('colorelement'); //Show Font Button //if (fntOn) { onBtn ('btnBold'); onBtn ('btnItalic'); onBtn ('fntLeft'); onBtn ('fntCenter'); onBtn ('fntRight'); onBtn ('fontFamily'); onBtn ('btnEditT'); //} } // ================ Function Hide All instrument button ====================== // function hideAllBtn () { offBtn ('btnCopy'); offBtn ('btnDel'); offBtn ('btnUp'); offBtn ('btnDn'); offBtn ('btnFlipH'); offBtn ('btnFlipV'); offBtn ('btnLock'); offBtn ('sectEdit'); offBtn ('colorelement'); //Hide Font Button /*offBtn ('btnBold'); offBtn ('btnItalic'); offBtn ('fntLeft'); offBtn ('fntCenter'); offBtn ('fntRight'); offBtn ('fontFamily'); offBtn ('btnEditT'); */ } // ================ Function Hide All button and colors ====================== // function hideTools() { hideAllBtn(); $('#colorelement').css('display','none'); $('#fntEdit').css('display','none'); } // ================ Function Colour panel Object ====================== // function getfillObj(curc) { $(".basic").spectrum({ chooseText: "Ok", color: curc, showInput: true, showAlpha: false, showPalette: true, showAlpha: true, palette: [ ['black', 'white', '#E30613','#FFED00', '#009640', '#009FE3'], ['#312783', '#E6007E', '#BE1622','#E6332A', '#E94E1B', '#F39200'], ['#575756', '#878787', '#B2B2B2','#DADADA', '#DEDC00', '#95C11F'], ['#008D36', '#006633', '#2FAC66','#00A19A', '#1D71B8', '#2D2E83'], ['#29235C', '#662483', '#951B81','#A3195B', '#D60B52', '#E71D73'], ['#CBBBA0', '#A48A7B', '#7B6A58','#634E42', '#CA9E67', '#B17F4A'], ['#936037', '#7D4E24', '#683C11','#432918', '#80676C', '#92A8B4'] ], change: function(color) { var selectOb = canvas.getActiveObject(); //console.log('type obj = '+selectOb.type); //console.log('set color = '+color); switch(selectOb.type) { case 'path-group' : if (selectOb.paths) { for (var i = 0; i < selectOb.paths.length; i++) { selectOb.paths[i].setFill(color.toString()); } } break; case 'text': selectOb.setFill(color.toString()); break; case 'circle': selectOb.setFill(color.toString()); break; case 'rect': selectOb.setFill(color.toString()); break; } //canvas.add(selectOb); canvas.renderAll(); } }); } // ================ Function Colour panel Group Object ====================== // function getfillGrp(curc) { $(".basic").spectrum({ chooseText: "Ok", color: curc, showInput: true, showAlpha: false, showPalette: true, showAlpha: true, palette: [ ['black', 'white', '#E30613','#FFED00', '#009640', '#009FE3'], ['#312783', '#E6007E', '#BE1622','#E6332A', '#E94E1B', '#F39200'], ['#575756', '#878787', '#B2B2B2','#DADADA', '#DEDC00', '#95C11F'], ['#008D36', '#006633', '#2FAC66','#00A19A', '#1D71B8', '#2D2E83'], ['#29235C', '#662483', '#951B81','#A3195B', '#D60B52', '#E71D73'], ['#CBBBA0', '#A48A7B', '#7B6A58','#634E42', '#CA9E67', '#B17F4A'], ['#936037', '#7D4E24', '#683C11','#432918', '#80676C', '#92A8B4'] ], change: function(color) { var selectOb = canvas.getActiveGroup().forEachObject(function(obj){ //obj['fill'] = color.toString(); //console.log('type obj = '+obj.type); //console.log('set color Grp = '+color); switch(obj.type) { case 'path-group' : if (obj.paths) { for (var i = 0; i < obj.paths.length; i++) { obj.paths[i].setFill(color.toString()); } } break; case 'text': obj.setFill(color.toString()); break; case 'circle': obj.setFill(color.toString()); break; case 'rect': obj.setFill(color.toString()); break; } }); canvas.renderAll(); } }); } // ================ Function Colour panel Background ====================== // $(".basicbg").spectrum({ chooseText: "Ok", color: bgRect.fill, showInput: true, showAlpha: false, showPalette: true, palette: [ ['black', 'white', '#E30613'], ['#FFED00', '#009640', '#009FE3'], ['#312783', '#E6007E', '#BE1622'], ['#E6332A', '#E94E1B', '#F39200'], ['#575756', '#878787', '#B2B2B2'], ['#DADADA', '#DEDC00', '#95C11F'], ['#008D36', '#006633', '#2FAC66'] ], change: function(color) { canvas.setBackgroundColor(color.toString(), canvas.renderAll.bind(canvas)); //bgRect.fill = color.toString(); canvas.renderAll(); } }); // ================ Function Add SVG Object ====================== // function addSVGFile(shapeName){ console.log('adding shape', shapeName); fabric.loadSVGFromURL( shapeName, function(objects, options) { var loadedObject = fabric.util.groupSVGElements(objects, options); loadedObject.set({ left: 100, top: 100 }) .setCoords(); canvas.add(loadedObject).setActiveObject(loadedObject); selectObjParam(); canvas.renderAll(); }); } // ================ Function Add PNG Object ====================== // function addPNGFile(imgName){ console.log('adding PNG', imgName); var imgPNGName = new Image() imgPNGName.src = imgName; fabric.Image.fromURL(imgName, function(img) { canvas.add(img.set({ left: 5, top: 5, }).scale(0.5)).setActiveObject(img); selectObjParam(); canvas.renderAll(); }); } // ================ Function Add uploaded Object ====================== // function uploadImg(urlimg){ fabric.Image.fromURL(urlimg, function(img) { canvas.add(img.set({ left: 5, top: 5, }).scale(0.5)).setActiveObject(img); selectObjParam(); }); canvas.renderAll(); } // ================= Function round to discret number ================== // function roundTo(value, base){ return Math.floor((value + base / 2) / base) * base; } // ================ Event rotating object and discret to 5 degree ====================== // canvas.on("object:rotating", function(rotEvtData) { var targetObj = rotEvtData.target; var snapAngle = roundTo(targetObj.angle, 5); targetObj.setAngle(snapAngle).setCoords(); canvas.renderAll(); }); // ================ Function Flip Horizontal ====================== // function flipHorizontal(selectOb) { if (selectOb.getFlipX()) selectOb.setFlipX(false); else selectOb.setFlipX(true); canvas.renderAll(); } // ================ Function Flip Horizontal ====================== // function flipVertical(selectOb) { if (selectOb.getFlipY()) selectOb.setFlipY(false); else selectOb.setFlipY(true); canvas.renderAll(); } // ============ Click Insert object to canvas ================ // $(".dataobj").bind( "click", function(){ var re = /(?:\.([^.]+))?$/; var ext = re.exec($(this).attr("src"))[1]; //console.log('CLICK='+ext); switch(ext) { case 'svg' : addSVGFile($(this).attr("src")); break; case 'png' : addPNGFile($(this).attr("src")); break; } }); // ============ END Insert object to canvas ================ // // ============= SET Click BG Image ==============================// $(".databgimg").bind( "click", function(){ //console.log('CLICK'); var srcPathThmb = $(this).attr("src"); console.log('full path= '+ srcPathThmb); var re = new RegExp("/thmb/", "g"); var regtempl = new RegExp("/templ/", "g"); var srcPathImg = srcPathThmb.replace(re, '/'); var urlThisTempl = srcPathThmb.replace('.jpg', '.cardln'); urlThisTempl = urlThisTempl.replace(re, '/templ/'); //urlThisTempl.replace('.jpg', '.cardln'); canvas.setBackgroundColor(null, canvas.renderAll.bind(canvas)); console.log('image path= '+ urlThisTempl + 'editor mode -> ' +editormode ); if (editormode) setBgImg(srcPathImg); else loadTempl(urlThisTempl); }); //========================================================= // // ================ Click button Reset to default canvas ====================== // $("#btnReset").click(function(){ Reset(); }); //========================================================= // // ================ Click button Save PDF ====================== // $("#btnSvPDF").click(function(){ saveAsPDF(); canvas.clipTo = function(ctx) { bgRectClip.render(ctx); }; canvas.renderAll(); }); //========================================================= // // ================ Click button Save JPG ====================== // $("#btnSvJPG").click(function(){ create_jpg_print(); console.log('end JPG '); canvas.clipTo = function(ctx) { bgRectClip.render(ctx); }; }); //========================================================= // // ================ Click button Save JPG ====================== // $("#btnSvWWW").click(function(){ create_jpg_toweb(); console.log('end JPG WEB'); canvas.clipTo = function(ctx) { bgRectClip.render(ctx); }; }); //========================================================= // // ================ Click button Add Rectangle ====================== // $("#btnRec").click(function(){ addRect(); }); // ================ Click button Add Circle ====================== // $("#btnCircle").click(function(){ addCircle(); }); // ================ Click button Add text ====================== // $("#btnText").click(function(){ addText(); }); // ================ Click button Copy Object ====================== // $("#btnCopy").click(function(){ copyObj2(); }); // ================ Click button Delete Object ====================== // $("#btnDel").click(function(){ deleteObj(); }); // ================ Click button Up Layer ====================== // $("#btnUp").click(function(){ upObj(); }); // ================ Double Click button Up Layer ====================== // $("#btnUp").dblclick(function(){ bringupObj(); }); // ================ Click button Dawn Layer ====================== // $("#btnDn").click(function(){ dnObj(); }); // ================ Double Click button Dawn Layer ====================== // $("#btnDn").dblclick(function(){ bringdnObj(); }); // ================ Click button Bold Text ====================== // $("#btnBold").click(function(){ setFontB(); }); // ================ Click button Italic Text ====================== // $("#btnItalic").click(function(){ setFontI(); }); // ================ Click button Clear Background Image ====================== // $("#btnClearBG").click(function(){ setWOBgImg(); }); // ================ Click button Align Left ====================== // $("#btnAlLeft").click(function(){ alignLeft(); }); // ================ Click button Align Right ====================== // $("#btnAlRight").click(function(){ alignRight(); }); // ================ Click button Align Horizontal Center ====================== // $("#btnAlHCenter").click(function(){ alignHCenter(); }); // ================ Click button Align Vertical Center ====================== // $("#btnAlVCenter").click(function(){ alignVCenter(); }); // ================ Click button Align Top ====================== // $("#btnAlTop").click(function(){ alignTop(); }); // ================ Click button Align Bottom ====================== // $("#btnAlBottom").click(function(){ alignBottom(); }); // ================ Click button Align Text Left ====================== // $("#fntLeft").click(function(){ satAlignText('left'); }); // ================ Click button Align Text Center ====================== // $("#fntCenter").click(function(){ satAlignText('center'); }); // ================ Click button Align Text Right ====================== // $("#fntRight").click(function(){ satAlignText('right'); }); // ================ Click button Save Canvas to File ====================== // $("#btnSaveCanvas").click(function(){ canvas.namecard = getNameproduct; canvas.version = "b0.8"; //var dataCanv2 = JSON.stringify(canvas.toJSON(['namecard'])); var dataCanv = JSON.stringify(canvas.toJSON(['namecard','version'])); //console.log(JSON.stringify(canvas)); $.fancybox.open([ { href : '#saveBcardTmpl', title : 'Записать в шаблон' } ], { maxWidth : 800, maxHeight : 200, fitToView : false, width : '70%', height : '70%', autoSize : false, closeClick : false, openEffect : 'fade', closeEffect : 'fade' }); $.ajax({ url: "save-canvas.php", data: {dataJSON:dataCanv}, cache: false, dataType: 'text', type : 'POST', success: function(data) { var dataJ = JSON.parse(data); if (dataJ.result) { console.log('Save data Canvas infile = ' + dataJ.result); $("#dwldCanv").css( "display", "block"); $("#dwldCanv").attr({ href: dataJ.pathfilecnv}); } } }); }); // ================ Click button Cancel Save Canvas to File ====================== // $('#savecancelbtn').click(function() { $("#dwldCanv").css( "display", "none" ); $.fancybox.close( true ); }); // ================ Click button in POP-UP Save Canvas to File ====================== // $('#btnSaveCanvasTmpl').click(function() { $("#dwldCanv").css( "display", "none" ); $.fancybox.close( true ); }); // ============= END Save Canvas to file ===================== // // ============= Click button Load Canvas Template ===================== // $("#btnLoadCanvas").click(function(){ $.fancybox.open([ { href : '#modal-load-thmp', title : 'Открыть в шаблон' } ], { maxWidth : 800, maxHeight : 150, fitToView : false, width : '70%', height : '70%', autoSize : false, closeClick : false, openEffect : 'fade', closeEffect : 'fade' }); //console.log('Load data Canvas!!!' ); }); // ================ Click button Cancel Load Canvas File ====================== // $('#loadcancelbtn').click(function() { $.fancybox.close( true ); }); // =============== Function Read Canvas Template from file ================== // function loadTempl(urlcanv) { //console.log ('load template'); $.ajax({ url: "loadtmpl.php", data: {urltmpl:urlcanv}, cache: false, dataType: 'json', type : 'POST', success: function(data) { if (data.result) { //console.log('Get Text = ' + data.tmplcanv); var obj = JSON.parse(data.tmplcanv); canvas.loadFromJSON(obj, canvas.renderAll.bind(canvas)); } } }); } // =============== Function Read Canvas Template from Dialog Box ================== // function readSingleFile(evt) { console.log('READ File -> ' + evt.target.files[0]); //Retrieve the first (and only!) File from the FileList object var f = evt.target.files[0]; if (f) { var r = new FileReader(); r.onload = function(e) { var contents = e.target.result; var obj = JSON.parse(contents); //console.log('LOAD data Canvas = ' + JSON.parse(obj).namecard); console.log('LOAD data Canvas = ' + obj.namecard); //location.href="bcard.php?product="+obj.namecard+","; if (obj.namecard == getNameproduct) canvas.loadFromJSON(obj, canvas.renderAll.bind(canvas)); else location.href="bcard.php?product="+obj.namecard + '&reloadpage=true'; //canvas.loadFromJSON(contents, canvas.renderAll.bind(canvas)); } r.readAsText(f); $.fancybox.close( true ); $("#fileloadtempl").val(''); } else { alert("Failed to load file"); } } document.getElementById('fileloadtempl').addEventListener('change', readSingleFile, false); // ============= END Load Canvas to file ===================== // //============== Dawnload JPEG file ==================== // function create_jpg_print() { $("#dwldJPEG").css("display", "none"); $.fancybox.open([ { href : '#saveBcardJPG', title : 'Записать JPG' } ], { maxWidth : 800, maxHeight : 600, fitToView : false, width : '70%', height : '70%', autoSize : false, closeClick : false, openEffect : 'fade', closeEffect : 'fade' }); canvas.deactivateAll(); canvas.clipTo = null; var dataURL = canvas.toDataURL({ format: 'jpg', quality: 1, /* left: 13, top: 13, width: 594, height: 330,*/ multiplier: loadJSON.Dimension.zoomkprint }); $.ajax({ url: "save-png.php", data: {imageurl:dataURL, resolution:300}, cache: false, dataType: 'json', type : 'POST', success: function(data) { if (data.result) { console.log('Url JPG = ' +data.imgURL+' file result = '+data.imgpng); $("#img-jpg-save").attr({ src: data.imgpng}); $("#dwldJPEG").attr({ href: data.imgURL}); $("#dwldJPEG").css("display", "block"); } } }); } //==============SAVE JPEG file==================== // function create_jpg_web () { canvas.deactivateAll(); canvas.clipTo = null; var dataURL = canvas.toDataURL({ format: 'jpg', quality: 0.7, /* left: 13, top: 13, width: 594, height: 330,*/ multiplier: 1 }); $.ajax({ url: "save-png.php", data: {imageurl:dataURL, resolution:72}, cache: false, dataType: 'json', type : 'POST', success: function(data) { console.log('return from PHP png preview = ' +data.result+' file result = '+data.imgpng); if (data.result) { $("#img-png").attr({ src: data.imgpng}); } } }); } //==============SAVE JPEG file for print ==================== // function create_jpg_print2 () { canvas.deactivateAll(); canvas.clipTo = null; var dataURL = canvas.toDataURL({ format: 'jpg', quality: 1, /* left: 13, top: 13, width: 594, height: 330,*/ multiplier: 1.5 }); $.ajax({ url: "save-png.php", data: {imageurl:dataURL, resolution:300}, cache: false, dataType: 'json', type : 'POST', success: function(data) { console.log('return from PHP png preview = ' +data.result+' file result = '+data.imgpng); if (data.result) { $("#img-png").attr({ src: data.imgpng}); } } }); } //==============SAVE JPEG file for WEB pop-up ==================== // function create_jpg_toweb() { $("#dwldJPEG").css("display", "none"); $.fancybox.open([ { href : '#saveBcardJPG', title : 'Записать JPG' } ], { maxWidth : 800, maxHeight : 600, fitToView : false, width : '70%', height : '70%', autoSize : false, closeClick : false, openEffect : 'fade', closeEffect : 'fade' }); canvas.deactivateAll(); canvas.clipTo = null; var dataURL = canvas.toDataURL({ format: 'jpg', quality: 0.8, /* left: 13, top: 13, width: 594, height: 330,*/ multiplier: 1 }); $.ajax({ url: "save-png.php", data: {imageurl:dataURL, resolution:72}, cache: false, dataType: 'json', type : 'POST', success: function(data) { console.log('return from PHP png preview = ' +data.result+' file result = '+data.imgpng); if (data.result) { console.log('Url JPG = ' +data.imgURL+' file result = '+data.imgpng); $("#img-jpg-save").attr({ src: data.imgpng}); $("#dwldJPEG").attr({ href: data.imgURL}); $("#dwldJPEG").css("display", "block"); } } }); } // =================== Function set Font Family ======================= \\ function setFont(nameF) { var selectOb = canvas.getActiveObject(); selectOb.setFontFamily(nameF); canvas.renderAll(); canvas.deactivateAllWithDispatch(); canvas.renderAll(); } // =================== END Function set Font Family======================= // // =================== Function set Align Text ======================= // function satAlignText(alignF) { var selectOb = canvas.getActiveObject(); if (!selectOb) return; selectOb.textAlign = alignF; canvas.renderAll(); } // =================== END Function set Align Text ======================= // // ============= Click button Lock selected object ===================== // $("#btnLock").click(function(){ var selectGrp = canvas.getActiveGroup(); if (selectGrp) { selectGrp.forEachObject(function(obj){ obj.set('active', false); obj.selectable = false; }); } else { var selectOb = canvas.getActiveObject(); selectOb.set('active', false); selectOb.selectable = false; } canvas.deactivateAll(); hideTools(); canvas.renderAll(); }); // ============= Click button UNLock all locked objects ===================== // $("#btnUnlockAll").click(function(){ var selectOb = canvas.forEachObject(function(obj){ obj.selectable = true; }); selectObjParam(); canvas.renderAll(); }); // ============= Click button Flip Horizontal ===================== // $("#btnFlipH").click(function(){ flipHorizontal(canvas.getActiveObject()); }); // ============= Click button flip Vertical ===================== // $("#btnFlipV").click(function(){ flipVertical(canvas.getActiveObject()); }); // ============= Click button Upload image ===================== // $('#fileupload').fileupload({ url: 'public_html/uploadimg/', dataType: 'json', disableImageResize: /Android(?!.*Chrome)|Opera/ .test(window.navigator.userAgent), imageMaxWidth: 1600, imageMaxHeight: 800, previewMaxWidth: 100, previewMaxHeight: 100, acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, previewCrop: true, imagePreviewName: 'pre-11', done: function (e, data) { console.log('data ret error = '+ data.files.push(data.files[data.index])); $.each(data.result.files, function (index, file) { nmUploadF = file.name; console.log('File Path = '+file.url); var pathupload = 'server/php/files/'+nmUploadF; uploadImg(file.url); }); }, progressall: function (e, data) { var progress = parseInt(data.loaded / data.total * 100, 10); $('#progress .bar').css('width', progress + '%'); if(progress>=100) { $.fancybox.close( true ); $('#progress .bar').css('width','0%'); } } }); // ============= Click button TAB Groupe Tool 0 ===================== // $("#tool0").click(function(){ $('#tool0').addClass('active'); $('#tool1').removeClass('active'); $('#tool2').removeClass('active'); $('#tool3').removeClass('active'); $('#tool4').removeClass('active'); $('.file').css('display','block'); $('.base').css('display','none'); $('.alighn').css('display','none'); $('.text').css('display','none'); $('.element').css('display','none'); }); // ============= Click button TAB Groupe Tool 1 ===================== // $("#tool1").click(function(){ $('#tool0').removeClass('active'); $('#tool1').addClass('active'); $('#tool2').removeClass('active'); $('#tool3').removeClass('active'); $('#tool4').removeClass('active'); $('.file').css('display','none'); $('.base').css('display','block'); $('.alighn').css('display','none'); $('.text').css('display','none'); $('.element').css('display','none'); }); // ============= Click button TAB Groupe Tool 2 ===================== // $("#tool2").click(function(){ $('#tool0').removeClass('active'); $('#tool1').removeClass('active'); $('#tool2').addClass('active'); $('#tool3').removeClass('active'); $('#tool4').removeClass('active'); $('.file').css('display','none'); $('.alighn').css('display','block'); $('.base').css('display','none'); $('.text').css('display','none'); $('.element').css('display','none'); }); // ============= Click button TAB Groupe Tool 3 ===================== // $("#tool3").click(function(){ $('#tool0').removeClass('active'); $('#tool1').removeClass('active'); $('#tool2').removeClass('active'); $('#tool3').addClass('active'); $('#tool4').removeClass('active'); $('.file').css('display','none'); $('.text').css('display','block'); $('.base').css('display','none'); $('.alighn').css('display','none'); $('.element').css('display','none'); }); // ============= Click button TAB Groupe Tool 4 ===================== // $("#tool4").click(function(){ $('#tool0').removeClass('active'); $('#tool1').removeClass('active'); $('#tool2').removeClass('active'); $('#tool3').removeClass('active'); $('#tool4').addClass('active'); $('.file').css('display','none'); $('.element').css('display','block'); $('.alighn').css('display','none'); $('.base').css('display','none'); $('.text').css('display','none'); }); // ============= Events upload files ===================== // $('#fileupload') .bind('fileuploadadd', function (e, data) {console.log('fileuploadadd');}) .bind('fileuploadsubmit', function (e, data) {console.log('fileuploadsubmit');}) .bind('fileuploadsend', function (e, data) {console.log('fileuploadsend');}) .bind('fileuploadprocess', function (e, data) {''}) .bind('fileuploaddone', function (e, data) {''}) .bind('fileuploadfail', function (e, data) {console.log('fileuploadfail');}) .bind('fileuploadalways', function (e, data) {console.log('fileuploadalways');}) .bind('fileuploadprogress', function (e, data) {console.log('fileuploadprogress');}) .bind('fileuploadprogressall', function (e, data) {console.log('fileuploadprogressall');}) .bind('fileuploadstart', function (e) {console.log('fileuploadstart');}) .bind('fileuploadstop', function (e) {console.log('fileuploadstop'); selectObjParam(); canvas.renderAll(); }) .bind('fileuploadchange', function (e, data) {console.log('fileuploadchange');}) .bind('fileuploadpaste', function (e, data) {console.log('fileuploadpaste');}) .bind('fileuploaddrop', function (e, data) {console.log('fileuploaddrop');}) .bind('fileuploaddragover', function (e) {console.log('fileuploaddragover');}) .bind('fileuploadchunksend', function (e, data) {console.log('fileuploadchunksend');}) .bind('fileuploadchunkdone', function (e, data) {console.log('fileuploadchunkdone');}) .bind('fileuploadchunkfail', function (e, data) {console.log('fileuploadchunkfail');}) .bind('fileuploadchunkalways', function (e, data) {console.log('fileuploadchunkalways');}); // ============= Change FontFamily in Select ===================== // $( "#fontFamily" ).change(function () { var nameFontF = $( "#fontFamily" ).val(); setFont(nameFontF); }); // ============= Click button Edit Text ===================== // $('#okEdit').click(function() { var value = $( "#cnvEdit" ).val(); console.log('edit text = '+ value); canvas.getActiveObject().setText(value); canvas.renderAll(); $.fancybox.close( true ); }); // ============= Click button Close ===================== // $('#closeBtn').click(function() { $.fancybox.close( true ); }); // ============= Click button Cancel Edit Text ===================== // $('#cancelEdit').click(function() { $.fancybox.close( true ); }); // ============= Click button Cancel Alert Load Canvas ===================== // $('#OkOpenFile').click(function() { $.fancybox.close( true ); }); // ============= Click button Cancel Save JPEG File ===================== // $('#cancelSaveJPG').click(function() { canvas.clipTo = function(ctx) { bgRectClip.render(ctx); }; $("#img-jpg-save").attr({ src: 'img/1px.gif'}); $.fancybox.close( true ); canvas.renderAll(); }); // ============= Click button Download as JPEG ===================== // $('#dwldJPEG').click(function() { canvas.clipTo = function(ctx) { bgRectClip.render(ctx); }; $("#img-jpg-save").attr({ src: 'img/1px.gif'}); $.fancybox.close( true ); canvas.renderAll(); }); // ============= Reset if Load All Page ===================== // $( function() { console.log('All page load? BUT...'); //$('#canvas').css({"border": "0px"}); $('.upper-canvas').css({"border": "0px"}); $('.fluid.size-menu').animate({"height": "toggle", "opacity": "toggle"}, "fast"); //$('#soflow-color-obj').val() = loadJSON.Object[0].chapter; // ============= ALERT Load Canvas Template ===================== // console.log('RELOAD == ' + reloadP); if (reloadP) { $.fancybox.open([ { href : '#alertOpenCanvas', title : 'ВНИМАНИЕ' } ], { maxWidth : 800, maxHeight : 250, fitToView : false, width : '70%', height : '70%', autoSize : false, closeClick : false, openEffect : 'fade', closeEffect : 'fade' }); } //Reset(); });
29a3dfb3992b63b1921adb1a53c42c9b2747ea83
[ "Markdown", "JavaScript" ]
2
Markdown
cossackgh/cardolini.js
7d8c02015133b5b50ea0b5f869be36761556f42f
0a09e5652c5fa1ee3ff5247e4652cc9a4191b528
refs/heads/main
<file_sep>(function($) { "use strict"; $.Index = function(settings) { var config = { is_dark: false }; if (settings) { $.extend(config, settings); } $("#payment_chart").addClass('loading'); $("#payment_chart2").addClass('loading'); //counters $('.counter').each(function() { $(this).prop('Counter', 0).animate({ Counter: $(this).text() }, { duration: 3500, step: function(now) { $(this).text(Math.ceil(now)); } }); }); //chart $.ajax({ type: 'GET', url: config.url + "/helper.php?action=getIndexStats", dataType: 'json' }).done(function(json) { var legend = ''; json.legend.map(function(val) { legend += val; }); $("#legend").html(legend); Morris.Line({ element: 'payment_chart', data: json.data, xkey: 'm', ykeys: json.label, labels: json.label, parseTime: false, gridTextFamily: "Wojo Sans", gridTextWeight: 500, lineWidth: 4, pointSize: 6, lineColors: json.color, gridTextColor: config.is_dark ? "rgba(255,255,255,0.6)" : "rgba(0,0,0,0.6)", gridTextSize: 14, fillOpacity: '.75', hideHover: 'auto', preUnits: json.preUnits, behaveLikeLine: true, hoverCallback: function(index, json, content) { var text = $(content)[1].textContent; return content.replace(text, text.replace(json.preUnits, "")); }, smooth: true, resize: true, xLabelAngle: 0, }); $("#payment_chart").removeClass('loading'); }); //chart $.ajax({ type: 'GET', url: config.url + "/helper.php?action=getMainStats", dataType: 'json' }).done(function(json) { var data = json.data; json.legend.map(function(v) { return $("#legend2").append(v); }); Morris.Area({ element: 'payment_chart2', data: data, xkey: 'm', ykeys: json.label, labels: json.label, parseTime: false, gridTextFamily: "Wojo Sans", gridTextWeight: 500, lineWidth: 4, pointSize: 6, lineColors: json.color, gridTextColor: config.is_dark ? "rgba(255,255,255,0.6)" : "rgba(0,0,0,0.6)", fillOpacity: '.65', hideHover: 'auto', xLabelAngle: 0, preUnits: json.preUnits, smooth: true, resize: true, xLabelAngle: 0, }); $("#payment_chart2").removeClass('loading'); }); //counters var sparkline = function() { $('.sparkline').sparkline('html', { enableTagOptions: true, tagOptionsPrefix: "data" }); }; var sparkResize; $(window).resize(function() { clearTimeout(sparkResize); sparkResize = setTimeout(sparkline, 500); chart1(); chart2(); }); sparkline(); var barEl1 = $("#chart1"); var barValues1 = barEl1.attr('data-values').split(','); var barValueCount1 = barValues1.length; var barSpacing1 = 4; var chart1 = function() { barEl1.sparkline(barValues1, { type: 'bar', height: 55, barWidth: Math.round((barEl1.parent().width() - (barValueCount1 - 1) * barSpacing1) / barValueCount1), barSpacing: barSpacing1, zeroAxis: false, barColor: '#0A48B3' }); }; var barEl2 = $("#chart2"); var barValues2 = barEl2.attr('data-values').split(','); var barValueCount2 = barValues2.length; var barSpacing2 = 5; var chart2 = function() { barEl2.sparkline(barValues2, { type: 'bar', height: 55, barWidth: Math.round((barEl2.parent().width() - (barValueCount2 - 1) * barSpacing2) / barValueCount2), barSpacing: barSpacing2, zeroAxis: false, barColor: '#11cdef' }); }; chart1(); chart2(); }; })(jQuery);<file_sep><?php /** * Index * * @package Wojo Framework * @author <EMAIL> * @copyright 2016 * @version $Id: index.php, v1.00 2016-06-05 10:12:05 gewa Exp $ */ define("_WOJO", true); include ('init.php'); $router = new Router(); $tpl = App::View(BASEPATH . 'view/'); $core = App::Core(); //admin routes $router->mount('/admin', function() use ($router, $tpl) { //admin login $router->match('GET|POST', '/login', function () use ($tpl) { if (App::Auth()->is_Admin()) { Url::redirect(SITEURL . '/admin/'); exit; } $tpl->template = 'admin/login.tpl.php'; $tpl->title = Lang::$word->LOGIN; }); //admin index $router->get('/', 'Admin@Index'); //admin users $router->mount('/users', function() use ($router, $tpl) { $router->match('GET|POST', '/', 'Users@Index'); $router->match('GET|POST', '/grid', 'Users@Index'); $router->get('/history/(\d+)', 'Users@History'); $router->get('/edit/(\d+)', 'Users@Edit'); $router->get('/new', 'Users@Save'); }); //admin memberships $router->mount('/memberships', function() use ($router, $tpl) { $router->match('GET', '/', 'Membership@Index'); $router->get('/history/(\d+)', 'Membership@History'); $router->get('/edit/(\d+)', 'Membership@Edit'); $router->get('/new', 'Membership@Save'); }); //admin email templates $router->mount('/templates', function() use ($router, $tpl) { $router->get('/', 'Content@Templates'); $router->get('/edit/(\d+)', 'Content@TemplateEdit'); }); //admin countries $router->mount('/countries', function() use ($router, $tpl) { $router->get('/', 'Content@Countries'); $router->get('/edit/(\d+)', 'Content@CountryEdit'); }); //admin coupons $router->mount('/coupons', function() use ($router, $tpl) { $router->get('/', 'Content@Coupons'); $router->get('/edit/(\d+)', 'Content@CouponEdit'); $router->get('/new', 'Content@CouponSave'); }); //admin pages $router->mount('/pages', function() use ($router, $tpl) { $router->get('/', 'Content@Pages'); $router->get('/edit/(\d+)', 'Content@PageEdit'); $router->get('/new', 'Content@PageSave'); }); //admin custom fields $router->mount('/fields', function() use ($router, $tpl) { $router->get('/', 'Content@Fields'); $router->get('/edit/(\d+)', 'Content@FieldEdit'); $router->get('/new', 'Content@FieldSave'); }); //admin news $router->mount('/news', function() use ($router, $tpl) { $router->get('/', 'Content@News'); $router->get('/edit/(\d+)', 'Content@NewsEdit'); $router->get('/new', 'Content@NewsSave'); }); //admin account $router->mount('/myaccount', function() use ($router, $tpl) { $router->get('/', 'Admin@Account'); $router->get('/password', '<PASSWORD>'); }); //admin gateways $router->mount('/gateways', function() use ($router, $tpl) { $router->get('/', 'Admin@Gateways'); $router->get('/edit/(\d+)', 'Admin@GatewayEdit'); }); //admin permissions $router->mount('/permissions', function() use ($router, $tpl) { $router->get('/', 'Admin@Permissions'); $router->get('/privileges/(\d+)', 'Admin@Privileges'); }); //admin maintenance manager $router->get('/maintenance', 'Admin@Maintenance'); //admin backup $router->get('/backup', 'Admin@Backup'); //admin files $router->get('/files', 'Admin@Files'); //admin newsletter $router->get('/mailer', 'Admin@Mailer'); //admin system $router->get('/system', 'Admin@System'); //admin transactions $router->match('GET|POST', '/transactions', 'Admin@Transactions'); //admin configuration $router->get('/configuration', 'Admin@Configuration'); //admin help $router->get('/help', 'Admin@Help'); //admin trash $router->get('/trash', 'Admin@Trash'); //admin language manager $router->get('/language', 'Lang@Index'); //logout $router->get('/logout', function() { App::Auth()->logout(); Url::redirect(SITEURL . '/admin/'); }); }); //front end routes $router->match('GET|POST', '/', 'Front@Index'); if(App::Core()->reg_allowed) { $router->match('GET|POST', '/register', 'Front@Register'); } $router->get('/contact', 'Front@Contact'); $router->get('/activation', 'Front@Activation'); $router->get('/packages', 'Front@Packages'); $router->get('/news', 'Front@News'); $router->get('/validate', 'Front@Validate'); $router->get('/privacy', 'Front@Privacy'); $router->match('GET|POST', '/password/([a-z0-9_-]+)', 'Front@Password'); $router->match('GET|POST', '/page/([a-z0-9_-]+)', 'Front@Page'); $router->mount('/dashboard', function() use ($router, $tpl) { $router->match('GET|POST', '/', 'Front@Dashboard'); $router->get('/history', 'Front@History'); $router->get('/profile', 'Front@Profile'); $router->get('/downloads', 'Front@Downloads'); }); //Custom Routes add here $router->get('/logout', function() { App::Auth()->logout(); Url::redirect(SITEURL . '/'); }); //404 $router->set404(function () use($core, $router) { $tpl = App::View(BASEPATH . 'view/'); $tpl->dir = $router->segments[0] == "admin" ? 'admin/' : 'front/'; $tpl->core = $core; $tpl->segments = $router->segments; $tpl->template = $router->segments[0] == "admin" ? 'admin/404.tpl.php' : 'front/404.tpl.php'; $tpl->title = Lang::$word->META_ERROR; $tpl->keywords = null; $tpl->description = null; $tpl->pages = Db::run()->select(Content::pTable, array("title", "slug"), array("active" => 1))->results(); echo $tpl->render(); }); // Run router $router->run(function () use($tpl, $router) { $tpl->segments = $router->segments; $tpl->core = App::Core(); echo $tpl->render(); }); <file_sep><?php /** * Permissions * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: permissions.tpl.php, v1.00 2020-05-05 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); if (!Auth::checkAcl("owner")) : print Message::msgError(Lang::$word->NOACCESS); return; endif; ?> <?php switch(Url::segment($this->segments)): case "privileges": ?> <!-- Start privileges --> <h2><?php echo Lang::$word->M_TITLE2;?></h2> <p><?php echo str_replace("[ROLE]", '<span class="wojo bold text">' . $this->role->name . '</span>', Lang::$word->M_SUB4);?> <?php echo ($this->role->code != "owner") ? '<span class="wojo bold text"><i>' . Lang::$word->M_INFO . '</i></span>' : null;?></p> <div class="wojo segment"> <table class="wojo basic responsive table" id="pTable"> <thead> <tr> <th class="disabled"><?php echo Lang::$word->TYPE;?></th> <th class="disabled"><?php echo Lang::$word->ADD;?></th> <th class="disabled"><?php echo Lang::$word->EDIT;?></th> <th class="disabled"><?php echo Lang::$word->APPROVE;?></th> <th class="disabled"><?php echo Lang::$word->MANAGE;?></th> <th class="disabled"><?php echo Lang::$word->DELETE;?></th> </tr> </thead> <tbody> <?php foreach ($this->result as $type => $rows): echo '<tr>'; echo '<td>' . $type . '</td>'; echo '<td>'; foreach ($rows as $i => $row): if (isset($row->mode) and $row->mode == "add") { $checked = ($row->active == 1) ? ' checked="checked"' : null; $is_owner = ($this->role->code == "owner") ? ' disabled="disabled"' : null; echo '<div class="wojo fitted checkbox" data-id="' . $row->id . '"><input id="perm_' . $row->id . '" type="checkbox" data-val="' . $row->active . '" value="' . $row->id . '" name="view-' . $row->id . '" ' . $is_owner . $checked . '><label for="perm_' . $row->id . '"></label><span data-tooltip="' . $row->description . '"><i class="icon question sign"></i></span></div> '; } endforeach; echo '</td>'; echo '<td>'; foreach ($rows as $row): if (isset($row->mode) and $row->mode == "edit") { $checked = ($row->active == 1) ? ' checked="checked"' : null; $is_owner = ($this->role->code == "owner") ? ' disabled="disabled"' : null; echo '<div class="wojo fitted checkbox" data-id="' . $row->id . '"><input id="perm_' . $row->id . '" type="checkbox" data-val="' . $row->active . '" value="' . $row->id . '" name="view-' . $row->id . '" ' . $is_owner . $checked . '><label for="perm_' . $row->id . '"></label><span data-tooltip="' . $row->description . '"><i class="icon question sign"></i></span></div>'; } endforeach; echo '</td>'; echo '<td>'; foreach ($rows as $row): if (isset($row->mode) and $row->mode == "approve") { $checked = ($row->active == 1) ? ' checked="checked"' : null; $is_owner = ($this->role->code == "owner") ? ' disabled="disabled"' : null; echo '<div class="wojo fitted checkbox" data-id="' . $row->id . '"><input id="perm_' . $row->id . '" type="checkbox" data-val="' . $row->active . '" value="' . $row->id . '" name="view-' . $row->id . '" ' . $is_owner . $checked . '><label for="perm_' . $row->id . '"></label><span data-tooltip="' . $row->description . '"><i class="icon question sign"></i></span></div>'; } endforeach; echo '</td>'; echo '<td>'; foreach ($rows as $row): if (isset($row->mode) and $row->mode == "manage") { $checked = ($row->active == 1) ? ' checked="checked"' : null; $is_owner = ($this->role->code == "owner") ? ' disabled="disabled"' : null; echo '<div class="wojo fitted checkbox" data-id="' . $row->id . '"><input id="perm_' . $row->id . '" type="checkbox" data-val="' . $row->active . '" value="' . $row->id . '" name="view-' . $row->id . '" ' . $is_owner . $checked . '><label for="perm_' . $row->id . '"></label><span data-tooltip="' . $row->description . '"><i class="icon question sign"></i></span></div>'; } endforeach; echo '</td>'; echo '<td>'; foreach ($rows as $row): if (isset($row->mode) and $row->mode == "delete") { $checked = ($row->active == 1) ? ' checked="checked"' : null; $is_owner = ($this->role->code == "owner") ? ' disabled="disabled"' : null; echo '<div class="wojo fitted checkbox" data-id="' . $row->id . '"><input id="perm_' . $row->id . '" type="checkbox" data-val="' . $row->active . '" value="' . $row->id . '" name="view-' . $row->id . '" ' . $is_owner . $checked . '><label for="perm_' . $row->id . '"></label><span data-tooltip="' . $row->description . '"><i class="icon question sign"></i></span></div>'; } endforeach; echo '</td>'; echo '</tr>'; endforeach; ?> </tbody> </table> </div> <script type="text/javascript"> // <![CDATA[ $(document).ready(function() { $("#pTable").on('click', '.wojo.checkbox input', function() { var status = $(this).prop('checked') ? 1 : 0; var id = $(this).parent().data('id'); $.post("<?php echo ADMINVIEW . "/helper.php";?>", { action: "changeRole", id: id, active: status }); }); }); // ]]> </script> <?php break;?> <?php default: ?> <h2><?php echo Lang::$word->M_TITLE1;?></h2> <p class="wojo small text"><?php echo Lang::$word->M_SUB3;?></p> <div class="wojo cards screen-3 tablet-3 mobile-1"> <?php foreach ($this->data as $row):?> <div class="card"> <div class="content"> <img src="<?php echo ADMINVIEW;?>/images/<?php echo $row->code;?>.svg" alt=""> <h5><?php echo $row->name;?></h5> <p id="item_<?php echo $row->id;?>" class="wojo small grey text"><?php echo Validator::truncate($row->description, 100);?></p> </div> <div class="footer divided center aligned"> <a href="<?php echo Url::url(Router::$path, "privileges/" . $row->id);?>" class="wojo icon circular inverted negative button"><i class="icon lock"></i></a> <a data-set='{"option":[{"action":"editRole","id": <?php echo $row->id;?>}], "label":"<?php echo Lang::$word->UPDATE;?>", "url":"helper.php", "parent":"#item_<?php echo $row->id;?>", "complete":"replace", "modalclass":"normal"}' class="wojo icon primary circular inverted button action"> <i class="icon pencil"></i></a> </div> </div> <?php endforeach;?> </div> <?php break;?> <?php endswitch;?><file_sep><?php /** * Backup Manager * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: backup.tpl.php, v1.00 2020-02-05 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); if(!Auth::hasPrivileges('manage_backup')): print Message::msgError(Lang::$word->NOACCESS); return; endif; ?> <div class="row gutters align middle"> <div class="columns mobile-100 phone-100"> <h2><?php echo Lang::$word->DBM_TITLE;?></h2> <p class="wojo small text"><?php echo Lang::$word->DBM_INFO;?></p> </div> <div class="columns auto mobile-100 phone-100"> <a data-set='{"option":[{"iaction":"databaseBackup", "id":1}], "url":"/helper.php", "complete":"prepend", "parent":"#backupList"}' class="wojo small secondary button iaction"><i class="icon plus alt"></i><?php echo Lang::$word->DBM_ADD;?></a> </div> </div> <div class="wojo segment"> <div class="wojo relaxed divided fluid list" id="backupList"> <?php if ($this->data):?> <?php foreach ($this->data as $i => $row):?> <?php $i++;?> <?php $latest = ($row == App::Core()->backup) ? " highlite" : null;?> <div class="item<?php echo $latest;?>"> <div class="content"><span class="wojo small bold text"><?php echo $i;?>.</span> <?php echo str_replace(".sql", "", $row);?></div> <div class="content auto"><span class="wojo small dark inverted label"><?php echo File::getFileSize($this->dbdir . '/' . $row, "kb", true);?></span> <a href="<?php echo UPLOADURL . '/backups/' . $row;?>" data-content="<?php echo Lang::$word->DOWNLOAD;?>" class="wojo icon positive inverted circular button button"><i class="download icon"></i></a> <a data-set='{"option":[{"restore": "restoreBackup","title": "<?php echo $row;?>","id":1}],"action":"restore","parent":".item"}' class="wojo icon primary inverted circular button data"><i class="icon refresh"></i></a> <a data-set='{"option":[{"delete": "deleteBackup","title": "<?php echo $row;?>","id":1}],"action":"delete","parent":".item"}' class="wojo icon negative inverted circular button data"><i class="icon trash"></i></a></div> </div> <?php endforeach;?> <?php unset($row);?> <?php endif;?> </div> </div><file_sep><?php /** * Resend Notification * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: resendNotification.tpl.php, v1.00 2020-03-02 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); if(!$this->data) : Message::invalid("ID" . Filter::$id); return; endif; ?> <div class="body"> <div class="wojo small form"> <form method="post" id="modal_form" name="modal_form"> <p><?php echo str_replace("[NAME]", '<span class="wojo bold text">' . $this->data->email . '</span>', Lang::$word->M_INFO4);?></p> </form> </div> </div><file_sep><?php /** * File Manager * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: files.tpl.php, v1.00 2020-02-09 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); if(!Auth::hasPrivileges('manage_files')): print Message::msgError(Lang::$word->NOACCESS); return; endif; ?> <div class="row gutters align middle"> <div class="columns mobile-100 phone-100"> <h3><?php echo Lang::$word->META_T35;?></h3> <p class="wojo small text"><?php echo str_replace("[LIMIT]", '<span class="wojo bold positive text">' . ini_get('upload_max_filesize') . '</span>', Lang::$word->FM_INFO);?></p> </div> <div class="columns auto mobile-100 phone-100"> <div class="wojo small primary button stacked uploader" id="drag-and-drop-zone"> <label><i class="icon plus alt"></i> <?php echo Lang::$word->UPLOAD;?> <input type="file" multiple name="files[]"> </label> </div> </div> </div> <div id="fileList" class="wojo small fluid relaxed celled items"></div> <div class="wojo segment"> <div class="wojo divided horizontal list"> <div class="disabled item wojo bold text"> <?php echo Lang::$word->FILTER_O;?> </div> <a href="<?php echo Url::url(Router::$path);?>" class="item<?php echo Url::setActive("type", false);?>"> <?php echo Lang::$word->FM_ALL_F;?> </a> <a href="<?php echo Url::url(Router::$path, "?type=audio");?>" class="item <?php echo Url::isActive("type", "audio");?>"> <i class="icon musical notes"></i> <?php echo Lang::$word->FM_AUD_F;?> </a> <a href="<?php echo Url::url(Router::$path, "?type=video");?>" class="item <?php echo Url::isActive("type", "video");?>"> <i class="icon movie"></i> <?php echo Lang::$word->FM_VID_F;?> </a> <a href="<?php echo Url::url(Router::$path, "?type=image");?>" class="item <?php echo Url::isActive("type", "image");?>"> <i class="icon photo"></i> <?php echo Lang::$word->FM_AMG_F;?> </a> <a href="<?php echo Url::url(Router::$path, "?type=document");?>" class="item <?php echo Url::isActive("type", "document");?>"> <i class="icon files"></i> <?php echo Lang::$word->FM_DOC_F;?> </a> <a href="<?php echo Url::url(Router::$path, "?type=archive");?>" class="item <?php echo Url::isActive("type", "archive");?>"> <i class="icon book"></i> <?php echo Lang::$word->FM_ARC_F;?> </a> </div> <div class="vertical padding"> <div class="wojo divided horizontal link list align-center"> <div class="disabled item wojo bold text"> <?php echo Lang::$word->SORTING_O;?> </div> <a href="<?php echo Url::url(Router::$path);?>" class="item<?php echo Url::setActive("order", false);?>"> <?php echo Lang::$word->RESET;?> </a> <a href="<?php echo Url::url(Router::$path, "?order=name|DESC");?>" class="item<?php echo Url::setActive("order", "name");?>"> <?php echo Lang::$word->NAME;?> </a> <a href="<?php echo Url::url(Router::$path, "?order=alias|DESC");?>" class="item<?php echo Url::setActive("order", "alias");?>"> <?php echo Lang::$word->FM_ALIAS;?> </a> <a href="<?php echo Url::url(Router::$path, "?order=filesize|DESC");?>" class="item<?php echo Url::setActive("order", "filesize");?>"> <?php echo Lang::$word->FM_FSIZE;?> </a> <div class="item"><a href="<?php echo Url::sortItems(Url::url(Router::$path), "order");?>" data-tooltip="ASC/DESC"><i class="icon triangle unfold more link"></i></a> </div> </div> </div> <div class="center aligned"> <?php echo Validator::alphaBits(Url::url(Router::$path), "letter");?> </div> </div> <div class="row grid gutters screen-3 tablet-3 mobile-2 phone-1" id="fileData"> <?php if($this->data):?> <?php foreach ($this->data as $row):?> <div class="columns" id="item_<?php echo $row->id;?>"> <div class="wojo attached card"> <div class="header divided"> <div class="wojo small bold text truncate"><?php echo $row->name;?></div> <p class="wojo small text"><?php echo Date::doDate("long_date", $row->created);?></p> </div> <div class="content"> <div class="wojo small fluid list"> <div class="item align middle"> <img src="<?php echo SITEURL;?>/assets/images/filetypes/<?php echo File::getFileType($row->name);?>" class="wojo small rounded shadow image"> <div class="columns"> <p class="header"><?php echo $row->alias;?></p> <p class="wojo tiny text"><?php echo File::getSize($row->filesize);?></p> </div> </div> </div> </div> <div class="footer divided"> <div class="row align middle"> <div class="columns"> <a data-set='{"option":[{"action":"renameFile","id": <?php echo $row->id;?>}], "label":"<?php echo Lang::$word->ASSIGN;?>", "url":"helper.php", "parent":"#item_<?php echo $row->id;?>", "complete":"replace", "modalclass":"normal"}' class="wojo small positive icon inverted button action"><i class="icon pencil"></i></a> <a data-set='{"option":[{"delete": "deleteFile","title": "<?php echo Validator::sanitize($row->alias, "chars");?>","id":<?php echo $row->id;?>,"name": "<?php echo $row->name;?>"}],"action":"delete", "parent":"#item_<?php echo $row->id;?>"}' class="wojo small negative icon inverted button data"><i class="icon close"></i></a> </div> <div class="columns auto"> <span data-tooltip="<?php echo($row->fileaccess > 0 ? Lang::$word->ASSIGNED : Lang::$word->UNASSIGNED);?>"><?php echo($row->fileaccess > 0 ? '<i class="icon positive check"></i>' : '<i class="icon negative minus"></i>');?></span> </div> </div> </div> </div> </div> <?php endforeach;?> <?php endif;?> </div> <div class="row gutters align middle"> <div class="columns auto mobile-100 phone-100"> <div class="wojo small thick text"><?php echo Lang::$word->TOTAL . ': ' . $this->pager->items_total;?> / <?php echo Lang::$word->CURPAGE . ': ' . $this->pager->current_page . ' '. Lang::$word->OF . ' ' . $this->pager->num_pages;?></div> </div> <div class="columns right aligned mobile-100 phone-100"><?php echo $this->pager->display_pages();?></div> </div> <script src="<?php echo ADMINVIEW;?>/js/files.js"></script> <script type="text/javascript"> // <![CDATA[ $(document).ready(function() { $("#fileData").Manager({ url: "<?php echo ADMINVIEW;?>", surl: "<?php echo SITEURL;?>", lang: { removeText: "<?php echo Lang::$word->REMOVE;?>" } }); }); // ]]> </script><file_sep><?php /** * Email Templates * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: templates.tpl.php, v1.00 2020-02-05 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); if(!Auth::hasPrivileges('manage_email')): print Message::msgError(Lang::$word->NOACCESS); return; endif; ?> <?php switch(Url::segment($this->segments)): case "edit": ?> <!-- Start edit --> <h3><?php echo Lang::$word->META_T11;?></h3> <form method="post" id="wojo_form" name="wojo_form"> <div class="wojo segment form"> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->ET_NAME;?> <i class="icon asterisk"></i></label> <div class="wojo input"> <input type="text" placeholder="<?php echo Lang::$word->ET_NAME;?>" value="<?php echo $this->data->name;?>" name="name"> </div> </div> <div class="field five wide"> <label><?php echo Lang::$word->ET_SUBJECT;?> <i class="icon asterisk"></i></label> <div class="wojo input"> <input type="text" placeholder="<?php echo Lang::$word->ET_SUBJECT;?>" value="<?php echo $this->data->subject;?>" name="subject"> </div> </div> </div> <div class="wojo fields"> <div class="basic field"> <textarea class="bodypost" name="body"><?php echo str_replace("[SITEURL]", SITEURL, $this->data->body);?></textarea> <p class="wojo small icon negative text"> <i class="icon negative info sign"></i> <?php echo Lang::$word->NOTEVAR;?></p> </div> </div> <div class="wojo divider"></div> <div class="wojo fields"> <div class="field"> <label><?php echo Lang::$word->ET_DESC;?></label> <div class="wojo small input"> <textarea class="small" placeholder="<?php echo Lang::$word->ET_DESC;?>" name="help"><?php echo $this->data->help;?></textarea> </div> </div> </div> </div> <div class="center aligned"> <a href="<?php echo Url::url("/admin/templates");?>" class="wojo simple button"><?php echo Lang::$word->CANCEL;?></a> <button type="button" data-action="processTemplate" name="dosubmit" class="wojo primary button"><?php echo Lang::$word->ET_UPDATE;?></button> </div> <input type="hidden" name="id" value="<?php echo $this->data->id;?>"> </form> <?php break;?> <?php default: ?> <h3><?php echo Lang::$word->ET_TITLE;?></h3> <p class="wojo small text"><?php echo Lang::$word->ET_SUB;?></p> <?php if($this->data):?> <div class="wojo segment"> <table class="wojo basic table"> <thead> <tr> <th class="disabled center aligned"><i class="icon disabled id"></i></th> <th><?php echo Lang::$word->ET_NAME;?></th> <th><?php echo Lang::$word->ET_SUBJECT;?></th> <th class="disabled center aligned"><?php echo Lang::$word->ACTIONS;?></th> </tr> </thead> <?php foreach ($this->data as $row):?> <tr id="item_<?php echo $row->id;?>"> <td class="auto"><span class="wojo small label"><?php echo $row->id;?></span></td> <td><a href="<?php echo Url::url(Router::$path, "edit/" . $row->id);?>"> <?php echo $row->name;?></a></td> <td><?php echo $row->subject;?></td> <td class="auto"><a href="<?php echo Url::url(Router::$path, "edit/" . $row->id);?>" class="wojo icon primary inverted circular button"><i class="icon note"></i></a></td> </tr> <?php endforeach;?> </table> </div> <?php endif;?> <?php break;?> <?php endswitch;?> <file_sep><?php /** * Login Page * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: login.tpl.php, v1.00 2020-02-05 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); if (is_dir("../../setup")) : die("<div style='text-align:center'>" . "<span style='padding: 5px; border: 1px solid #999; background-color:#EFEFEF;" . "font-family: Verdana; font-size: 11px; margin-left:auto; margin-right:auto'>" . "<b>Warning:</b> Please delete setup directory!</span></div>"); endif; ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title><?php echo $this->title;?></title> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <link href="<?php echo ADMINVIEW;?>/css/base.css" rel="stylesheet" type="text/css"> <link href="<?php echo ADMINVIEW;?>/css/transition.css" rel="stylesheet" type="text/css"> <link href="<?php echo ADMINVIEW;?>/css/progress.css" rel="stylesheet" type="text/css"> <link href="<?php echo ADMINVIEW;?>/css/icon.css" rel="stylesheet" type="text/css"> <link href="<?php echo ADMINVIEW;?>/css/message.css" rel="stylesheet" type="text/css"> <link href="<?php echo ADMINVIEW;?>/css/login.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="<?php echo SITEURL;?>/assets/jquery.js"></script> <script type="text/javascript" src="<?php echo SITEURL;?>/assets/global.js"></script> </head> <body> <div class="wrap"> <div id="formContent"> <h2><?php echo Utility::sayHello();?></h2> <div class="avatar"> <img src="<?php echo UPLOADURL;?>/avatars/default.svg" id="icon" alt="User Icon"> </div> <div id="loginform"> <form id="admin_form" name="admin_form" method="post"> <input type="text" name="username" placeholder="<?php echo Lang::$word->USERNAME;?>"> <input type="<PASSWORD>" name="password" placeholder="<?php echo Lang::$word->M_PASSWORD;?>"> <button id="doSubmit" type="button" name="submit"><?php echo Lang::$word->LOGIN;?></button> </form> <div class="formFooter"> <a id="passreset" class="underlineHover"><?php echo Lang::$word->M_PASSWORD_RES;?>?</a> </div> </div> <div id="passform" class="hide-all"> <input type="text" name="pEmail" id="pEmail" class="input-container" placeholder="<?php echo Lang::$word->M_EMAIL;?>"> <button id="dopass" type="button" name="doopass"><?php echo Lang::$word->SUBMIT;?></button> <div class="formFooter"> <a id="backto" class="underlineHover"><?php echo Lang::$word->M_SUB14;?></a> </div> </div> </div> <footer> Copyright &copy;<?php echo date('Y') . ' '. App::Core()->company;?> </footer> </div> <script type="text/javascript" src="<?php echo ADMINVIEW;?>/js/login.js"></script> <script type="text/javascript"> $(document).ready(function() { $.Login({ url: "<?php echo FRONTVIEW;?>", surl: "<?php echo SITEURL;?>" }); }); </script> </body> </html><file_sep><?php /** * News Manager * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: news.tpl.php, v1.00 2020-03-05 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); if(!Auth::hasPrivileges('manage_news')): print Message::msgError(Lang::$word->NOACCESS); return; endif; ?> <?php switch(Url::segment($this->segments)): case "edit": ?> <!-- Start edit --> <h2><?php echo Lang::$word->META_T19;?></h2> <form method="post" id="wojo_form" name="wojo_form"> <div class="wojo segment form"> <div class="wojo fields"> <div class="field"> <label><?php echo Lang::$word->NAME;?> <i class="icon asterisk"></i></label> <div class="wojo input"> <input type="text" placeholder="<?php echo Lang::$word->NAME;?>" value="<?php echo $this->data->title;?>" name="title"> </div> </div> </div> <div class="wojo fields"> <div class="field"> <textarea class="bodypost" name="body"><?php echo str_replace("[SITEURL]", SITEURL, $this->data->body);?></textarea> </div> </div> <div class="wojo fields"> <div class="field"> <label><?php echo Lang::$word->PUBLISHED;?></label> <div class="wojo checkbox radio inline"> <input name="active" type="radio" value="1" <?php Validator::getChecked($this->data->active, 1); ?> id="active_1"> <label for="active_1"><?php echo Lang::$word->YES;?></label> </div> <div class="wojo checkbox radio inline"> <input name="active" type="radio" value="0" <?php Validator::getChecked($this->data->active, 0); ?> id="active_0"> <label for="active_0"><?php echo Lang::$word->NO;?></label> </div> </div> </div> <div class="center aligned"> <a href="<?php echo Url::url("/admin/news");?>" class="wojo simple button"><?php echo Lang::$word->CANCEL;?></a> <button type="button" data-action="processNews" name="dosubmit" class="wojo primary button"><?php echo Lang::$word->NW_UPDATE;?></button> </div> </div> <input type="hidden" name="id" value="<?php echo $this->data->id;?>"> </form> <?php break;?> <?php case "new": ?> <h2><?php echo Lang::$word->NW_SUB2;?></h2> <form method="post" id="wojo_form" name="wojo_form"> <div class="wojo segment form"> <div class="wojo fields"> <div class="field"> <label><?php echo Lang::$word->NAME;?> <i class="icon asterisk"></i></label> <div class="wojo input"> <input type="text" placeholder="<?php echo Lang::$word->NAME;?>" name="title"> </div> </div> </div> <div class="wojo fields"> <div class="field"> <textarea class="bodypost" name="body"></textarea> </div> </div> <div class="wojo fields"> <div class="field"> <label><?php echo Lang::$word->PUBLISHED;?></label> <div class="wojo checkbox radio inline"> <input name="active" type="radio" value="1" id="active_1"> <label for="active_1"><?php echo Lang::$word->YES;?></label> </div> <div class="wojo checkbox radio inline"> <input name="active" type="radio" value="0" checked="checked" id="active_0"> <label for="active_0"><?php echo Lang::$word->NO;?></label> </div> </div> </div> <div class="center aligned"> <a href="<?php echo Url::url("/admin/fields");?>" class="wojo simple button"><?php echo Lang::$word->CANCEL;?></a> <button type="button" data-action="processNews" name="dosubmit" class="wojo primary button"><?php echo Lang::$word->NW_SUB2;?></button> </div> </div> </form> <?php break;?> <?php default: ?> <div class="row gutters align middle"> <div class="columns mobile-100 phone-100"> <h2><?php echo Lang::$word->NW_TITLE;?></h2> <p class="wojo small text"><?php echo Lang::$word->NW_INFO;?></p> </div> <div class="columns auto mobile-100 phone-100"> <a href="<?php echo Url::url(Router::$path, "new/");?>" class="wojo small primary button stacked"><i class="icon plus alt"></i><?php echo Lang::$word->NW_SUB1;?></a> </div> </div> <?php if(!$this->data):?> <div class="center aligned"><img src="<?php echo ADMINVIEW;?>/images/notfound.png" alt=""> <p class="wojo small demi caps text"><?php echo Lang::$word->NW_NONEWS;?></p> </div> <?php else:?> <?php foreach ($this->data as $row):?> <div class="wojo card" id="item_<?php echo $row->id;?>"> <div class="header"> <div class="row horizontal gutters"> <div class="columns auto align middle"><i class="icon huge disabled news"></i></div> <div class="columns"> <p class="wojo black small text"><?php echo Date::doDate("short_date", $row->created);?></p> <a class="wojo thick text" href="<?php echo Url::url(Router::$path, "edit/" . $row->id);?>"><?php echo $row->title;?></a> <p><small><?php echo Lang::$word->BY;?>: <?php echo $row->author;?></small></p> </div> <div class="column auto"> <a data-set='{"option":[{"trash": "trashNews","title": "<?php echo Validator::sanitize($row->title, "chars");?>","id": <?php echo $row->id;?>}],"action":"trash","parent":"#item_<?php echo $row->id;?>"}' class="wojo negative small inverted icon button data"><i class="icon trash"></i></a> </div> </div> </div> </div> <?php endforeach;?> <?php endif;?> <?php break;?> <?php endswitch;?><file_sep><?php /** * Load Language Section * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: loadLanguageSection.tpl.php, v1.00 2020-01-08 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <?php $i = 0; $html = ''; switch ($_GET['type']): case "filter": foreach ($this->section as $pkey): $i++; $html .= ' <div class="item"> <div class="content"><span data-editable="true" data-set=\'{"action": "editPhrase", "id": ' . $i . ',"key":"' . $pkey['data'] . '", "path":"lang"}\'>' . $pkey . '</span></div> <div class="content auto"><span class="wojo small dark inverted label">' . $pkey['data'] . '</span></div> </div>'; endforeach; break; default: foreach ($this->xmlel as $pkey): $i++; $html .= ' <div class="item"> <div class="content"><span data-editable="true" data-set=\'{"action": "editPhrase", "id": ' . $i . ',"key":"' . $pkey['data'] . '", "path":"lang"}\'>' . $pkey . '</span></div> <div class="content auto"><span class="wojo small dark inverted label">' . $pkey['data'] . '</span></div> </div>'; endforeach; break; endswitch; echo $html;<file_sep><?php /** * Index * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: index.tpl.php, v1.00 2020-01-08 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <div class="wojo-grid"> <div class="wojo raised auto segment"> <div class="row align middle gutters"> <div class="columns"> <h3><?php echo Lang::$word->M_SUB16;?></h3> </div> <?php if(App::Core()->reg_allowed):?> <div class="columns auto"><a href="<?php echo Url::url("/register");?>" class="wojo primary button"><?php echo Lang::$word->M_SUB17;?></a> </div> <?php endif;?> </div> <h2 class="center aligned"><?php echo Utility::sayHello();?></h2> <div class="center aligned margin bottom"> <img src="<?php echo UPLOADURL;?>/avatars/default.svg" id="icon" alt="User Icon"> </div> <div id="loginform" class="wojo form"> <form id="admin_form" name="admin_form" method="post"> <div class="wojo block fields"> <div class="field"> <label><?php echo Lang::$word->USERNAME;?> <i class="icon asterisk"></i></label> <input type="text" name="username" placeholder="<?php echo Lang::$word->USERNAME;?>"> </div> <div class="field"> <label><?php echo Lang::$word->M_PASSWORD;?> <i class="icon asterisk"></i></label> <input type="password" name="password" placeholder="<?php echo Lang::$word->M_PASSWORD;?>"> </div> <div class="field"> <button id="doSubmit" type="button" name="submit" class="wojo fluid secondary button"><?php echo Lang::$word->LOGIN;?></button> </div> </div> </form> <div class="center aligned"> <a id="passreset"><?php echo Lang::$word->M_PASSWORD_RES;?>?</a> </div> </div> <div id="passform" class="wojo form hide-all"> <div class="wojo block fields"> <div class="field"> <label><?php echo Lang::$word->M_EMAIL;?> <i class="icon asterisk"></i></label> <input type="text" name="pEmail" id="pEmail" class="input-container" placeholder="<?php echo Lang::$word->M_EMAIL;?>"> </div> <div class="field"> <button id="dopass" type="button" name="doopass" class="wojo secondary fluid button"><?php echo Lang::$word->SUBMIT;?></button> </div> </div> <div class="center aligned"> <a id="backto"><?php echo Lang::$word->M_SUB14;?></a> </div> </div> </div> </div> <script type="text/javascript" src="<?php echo FRONTVIEW;?>/js/login.js"></script> <script type="text/javascript"> $(document).ready(function() { $.Login({ url: "<?php echo FRONTVIEW;?>", surl: "<?php echo SITEURL;?>" }); }); </script><file_sep><div class="wojo fof card"> <div class="content"> <h1><?php echo Lang::$word->META_ERROR;?></h1> <p><?php echo Lang::$word->META_ERROR1;?> :(</p> <p><?php echo Lang::$word->META_ERROR2;?></p> </div> </div><file_sep><?php /** * Page * * @package Wojo Framework * @author <EMAIL> * @copyright 2021 * @version $Id: page.tpl.php, v1.00 2021-05-08 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <div class="wojo-grid"> <h1><?php echo $this->row->title;?></h1> <?php if($this->row->page_type == "membership"):?> <?php if(Membership::is_valid(explode(",", $this->row->membership_id))):?> <?php echo Url::out_url($this->row->body);?> <?php else:?> <div class="wojo negative relaxed icon message align middle"> <i class="icon big white lock"></i> <div class="content"> <h1 class="wojo white basic text"><?php echo Lang::$word->PG_MERROR_2;?></h1> </div> </div> <?php if($this->packages):?> <ul class="wojo list"> <?php foreach ($this->packages as $row):?> <li class="item"><i class="icon asterisk"></i><?php echo $row->title;?></li> <?php endforeach;?> </ul> <?php endif;?> <?php endif;?> <?php else:?> <?php echo Url::out_url($this->row->body);?> <?php endif;?> </div><file_sep><?php /** * My Account * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: myaccount.tpl.php, v1.00 2020-01-08 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <?php switch(Url::segment($this->segments)): case "password": ?> <!-- Start password --> <h2><?php echo Lang::$word->M_SUB2;?></h2> <form method="post" id="wojo_form" name="wojo_form"> <div class="wojo segment form"> <div class="wojo fields align middle"> <div class="field four wide labeled"> <label><?php echo Lang::$word->NEWPASS;?> <i class="icon asterisk"></i></label> </div> <div class="field"> <input type="text" name="password"> </div> </div> <div class="wojo fields align middle"> <div class="field four wide labeled"> <label><?php echo Lang::$word->CONPASS;?> <i class="icon asterisk"></i></label> </div> <div class="field"> <input type="text" name="<PASSWORD>"> </div> </div> <div class="center aligned"> <a href="<?php echo Url::url("/admin/myaccount");?>" class="wojo small simple button"><?php echo Lang::$word->CANCEL;?></a> <button type="button" data-action="updatePassword" name="dosubmit" class="wojo primary button"><?php echo Lang::$word->M_PASSUPDATE;?></button> </div> </div> </form> <?php break;?> <!-- Start default --> <?php default: ?> <h2><?php echo Lang::$word->M_TITLE;?></h2> <form method="post" id="wojo_form" name="wojo_form"> <div class="row gutters"> <div class="columns mobile-100 mobile order-2"> <div class="wojo segment form"> <div class="wojo fields align middle"> <div class="field four wide labeled"> <label><?php echo Lang::$word->M_FNAME;?> <i class="icon asterisk"></i></label> </div> <div class="field"> <input type="text" value="<?php echo $this->data->fname;?>" name="fname"> </div> </div> <div class="wojo fields align middle"> <div class="field four wide labeled"> <label><?php echo Lang::$word->M_LNAME;?> <i class="icon asterisk"></i></label> </div> <div class="field"> <input type="text" value="<?php echo $this->data->lname;?>" name="lname"> </div> </div> <div class="wojo fields align middle"> <div class="field four wide labeled"> <label><?php echo Lang::$word->M_EMAIL;?> <i class="icon asterisk"></i></label> </div> <div class="field"> <input type="text" value="<?php echo $this->data->email;?>" name="email"> </div> </div> <div class="wojo fields disabled align middle"> <div class="field four wide labeled"> <label><?php echo Lang::$word->CREATED;?></label> </div> <div class="field"> <input type="text" value="<?php echo Date::doDate("short_date", $this->data->created);?>" readonly> </div> </div> <div class="wojo fields disabled align middle"> <div class="field four wide labeled"> <label><?php echo Lang::$word->M_LASTLOGIN;?></label> </div> <div class="field"> <input type="text" value="<?php echo Date::doDate("short_date", $this->data->lastlogin);?>"> </div> </div> <div class="wojo fields disabled align middle"> <div class="field four wide labeled"> <label><?php echo Lang::$word->M_LASTIP;?></label> </div> <div class="field"> <input type="text" value="<?php echo $this->data->lastip;?>"> </div> </div> <div class="right aligned"> <button type="button" data-action="updateAccount" name="dosubmit" class="wojo primary button"><?php echo Lang::$word->M_UPDATE;?></button> </div> </div> </div> <div class="auto columns mobile-100 mobile order-1"> <div class="wojo segment form"> <div class="basic field"> <input type="file" name="avatar" data-type="image" data-exist="<?php echo ($this->data->avatar) ? UPLOADURL . '/avatars/' . $this->data->avatar : UPLOADURL . '/avatars/blank.svg';?>" accept="image/png, image/jpeg"> </div> </div> </div> </div> </form> <?php break;?> <?php endswitch;?> <file_sep><?php /** * User Manager * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: _users_list.tpl.php, v1.00 2020-01-08 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <div class="row gutters align middle"> <div class="columns auto mobile-100 mobile-order-1"> <h2><?php echo Lang::$word->META_T2;?></h2> </div> <div class="columns right aligned mobile-50 phone-100 mobile-order-2"> <a href="<?php echo Url::url(Router::$path, "new/");?>" class="wojo small primary stacked button"><i class="icon plus alt"></i><?php echo Lang::$word->M_TITLE5;?></a> </div> <div class="columns auto mobile-50 mobile-order-3"> <a class="wojo small disabled icon button"><i class="icon unordered list"></i></a> <a href="<?php echo Url::url(Router::$path, "grid/");?>" class="wojo small primary icon button"><i class="icon grid list"></i></a> <a href="<?php echo ADMINVIEW . '/helper.php?action=exportUsers';?>" class="wojo small button"><?php echo Lang::$word->EXPORT;?></a> </div> </div> <div class="row gutters align center"> <div class="columns screen-40 tablet-50 mobile-100 phone-100"> <form method="post" id="wojo_form" name="wojo_form" class="wojo form"> <div class="wojo action input"> <input name="find" placeholder="<?php echo Lang::$word->SEARCH;?>" type="text"> <button class="wojo small primary icon button"> <i class="icon find"></i></button> </div> </form> </div> </div> <div class="center aligned"> <div class="wojo small divided horizontal list"> <div class="disabled item wojo bold text"> <?php echo Lang::$word->SORTING_O;?> </div> <a href="<?php echo Url::url(Router::$path);?>" class="item<?php echo Url::setActive("order", false);?>"> <?php echo Lang::$word->RESET;?> </a> <a href="<?php echo Url::url(Router::$path, "?order=membership_id|DESC");?>" class="item<?php echo Url::setActive("order", "membership_id");?>"> <?php echo Lang::$word->MEMBERSHIP;?> </a> <a href="<?php echo Url::url(Router::$path, "?order=email|DESC");?>" class="item<?php echo Url::setActive("order", "email");?>"> <?php echo Lang::$word->M_EMAIL;?> </a> <a href="<?php echo Url::url(Router::$path, "?order=fname|DESC");?>" class="item<?php echo Url::setActive("order", "fname");?>"> <?php echo Lang::$word->NAME;?> </a> <div class="item"><a href="<?php echo Url::sortItems(Url::url(Router::$path), "order");?>" data-tooltip="ASC/DESC"><i class="icon triangle unfold more link"></i></a> </div> </div> </div> <div class="center aligned margin top"> <?php echo Validator::alphaBits(Url::url(Router::$path), "letter");?> </div> <?php if(!$this->data):?> <div class="center aligned"><img src="<?php echo ADMINVIEW;?>/images/notfound.png" alt=""> <p class="wojo small demi caps text"><?php echo Lang::$word->M_INFO6;?></p> </div> <?php else:?> <?php foreach($this->data as $row):?> <div class="wojo card" id="item_<?php echo $row->id;?>"> <div class="header divided"> <div class="row horizontal gutters"> <div class="columns auto"><img src="<?php echo UPLOADURL;?>/avatars/<?php echo $row->avatar ? $row->avatar : "blank.svg" ;?>" alt="" class="wojo avatar image"></div> <div class="columns auto"> <p class="wojo black small icon text"><i class="icon date"></i> <?php echo Date::doDate("short_date", $row->created);?></p> <h4 class="wojo semi medium text"> <?php if(Auth::hasPrivileges('edit_user')):?> <a class="grey" href="<?php echo Url::url(Router::$path, "edit/" . $row->id);?>"><?php echo $row->fullname;?></a> <?php else:?> <?php echo $row->fullname;?> <?php endif;?> </h4> </div> <div class="columns phone-100"> <div><?php echo Utility::userType($row->type);?></div> </div> <div class="columns auto phone-100"> <?php echo Utility::status($row->active, $row->id);?> </div> </div> </div> <div class="footer"> <div class="row align middle"> <div class="columns"> <div class="wojo horizontal small list"> <div class="item"> <div class="header"><?php echo Lang::$word->M_EMAIL1;?> <span class="description"><a href="<?php echo Url::url("/admin/mailer", "?email=" . urlencode($row->email));?>"><?php echo $row->email;?></a> </span> </div> </div> <div class="item"> <div class="header"><?php echo Lang::$word->MEMBERSHIP;?> <span class="description"><?php echo ($row->membership_id) ? '<a href="' . Url::url("/admin/memberships/edit/" . $row->membership_id) . '">' . $row->mtitle . '</a> <small> @' . Date::doDate("short_date", $row->mem_expire) . '</small>' : '-/-';?></span> </div> </div> </div> </div> <div class="columns auto"> <a data-dropdown="#userDrop_<?php echo $row->id;?>" class="wojo small primary inverted icon circular button"> <i class="icon vertical ellipsis"></i> </a> <div class="wojo dropdown small pointing top-right" id="userDrop_<?php echo $row->id;?>"> <?php if(Auth::hasPrivileges('edit_user')):?> <a class="item" href="<?php echo Url::url(Router::$path, "edit/" . $row->id);?>"><i class="icon pencil"></i> <?php echo Lang::$word->EDIT;?></a> <?php endif;?> <a class="item" href="<?php echo Url::url(Router::$path, "history/" . $row->id);?>"><i class="icon history"></i> <?php echo Lang::$word->HISTORY;?></a> <?php if(Auth::hasPrivileges('delete_user')):?> <div class="divider"></div> <a data-set='{"option":[{"trash":"trashUser","title": "<?php echo Validator::sanitize($row->fullname, "chars");?>","id": "<?php echo $row->id;?>"}],"action":"trash","subtext":"<?php echo Validator::sanitize(Lang::$word->DELCONFIRM3, "chars");?>","parent":"#item_<?php echo $row->id;?>"}' class="item wojo demi text data"> <i class="icon trash"></i><?php echo Lang::$word->TRASH;?> </a> <?php endif;?> </div> </div> </div> </div> </div> <?php endforeach;?> <?php endif;?> <div class="row gutters align middle"> <div class="columns auto mobile-100 phone-100"> <div class="wojo small semi text"><?php echo Lang::$word->TOTAL . ': ' . $this->pager->items_total;?> / <?php echo Lang::$word->CURPAGE . ': ' . $this->pager->current_page . ' '. Lang::$word->OF . ' ' . $this->pager->num_pages;?></div> </div> <div class="columns right aligned mobile-100 phone-100"><?php echo $this->pager->display_pages();?></div> </div><file_sep><?php /** * Rename File * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: renameFile.tpl.php, v1.00 2020-03-02 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); if(!$this->data) : Message::invalid("ID" . Filter::$id); return; endif; ?> <div class="body"> <div class="wojo small form"> <form method="post" id="modal_form" name="modal_form"> <p class="wojo small semi text"><?php echo Lang::$word->NAME;?>: <?php echo $this->data->name;?></p> <div class="wojo block fields"> <div class="field"> <label><?php echo Lang::$word->FM_ALIAS;?> <i class="icon asterisk"></i></label> <input type="text" placeholder="<?php echo Lang::$word->FM_ALIAS;?>" value="<?php echo $this->data->alias;?>" name="alias"> </div> <div class="basic field"> <label><?php echo Lang::$word->FM_MACCESS;?></label> <div class="row grid screen-2 tablet-2 mobile-2 phone-1"> <?php echo Utility::loopOptionsMultiple($this->mlist, "id", "title", $this->data->fileaccess, "fileaccess", "normal");?> </div> </div> </div> </form> </div> </div><file_sep><?php /** * Contact * * @package Wojo Framework * @author <EMAIL> * @copyright 2016 * @version $Id: contact.tpl.php, v1.00 2016-01-08 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <div class="wojo-grid"> <div class="wojo raised segment"> <h2><?php echo Lang::$word->META_T30;?></h2> <p><?php echo Lang::$word->CNT_INFO;?></p> <form method="post" id="wojo_form" name="wojo_form"> <div class="wojo form"> <div class="wojo block fields"> <div class="field"> <label><?php echo Lang::$word->CNT_NAME;?> <i class="icon asterisk"></i></label> <input type="text" placeholder="<?php echo Lang::$word->CNT_NAME;?>" value="<?php echo (App::Auth()->logged_in) ? App::Auth()->name : null;?>" name="name"> </div> <div class="field"> <label><?php echo Lang::$word->M_EMAIL;?> <i class="icon asterisk"></i></label> <input type="text" placeholder="<?php echo Lang::$word->M_EMAIL;?>" value="<?php echo (App::Auth()->logged_in) ? App::Auth()->email : null;?>" name="email"> </div> <div class="field"> <label><?php echo Lang::$word->ET_SUBJECT;?></label> <select name="subject"> <option value=""><?php echo Lang::$word->CNT_SUBJECT_1;?></option> <option value="<?php echo Lang::$word->CNT_SUBJECT_2;?>"><?php echo Lang::$word->CNT_SUBJECT_2;?></option> <option value="<?php echo Lang::$word->CNT_SUBJECT_3;?>"><?php echo Lang::$word->CNT_SUBJECT_3;?></option> <option value="<?php echo Lang::$word->CNT_SUBJECT_4;?>"><?php echo Lang::$word->CNT_SUBJECT_4;?></option> <option value="<?php echo Lang::$word->CNT_SUBJECT_5;?>"><?php echo Lang::$word->CNT_SUBJECT_5;?></option> <option value="<?php echo Lang::$word->CNT_SUBJECT_6;?>"><?php echo Lang::$word->CNT_SUBJECT_6;?></option> <option value="<?php echo Lang::$word->CNT_SUBJECT_7;?>"><?php echo Lang::$word->CNT_SUBJECT_7;?></option> </select> </div> <div class="field"> <label><?php echo Lang::$word->MESSAGE;?> <i class="icon asterisk"></i></label> <textarea placeholder="<?php echo Lang::$word->MESSAGE;?>" name="notes"></textarea> </div> <div class="field"> <label><?php echo Lang::$word->CAPTCHA;?> <i class="icon asterisk"></i></label> <div class="wojo labeled input"> <input name="captcha" placeholder="<?php echo Lang::$word->CAPTCHA;?>" type="text"> <div class="wojo simple label"><?php echo Session::captcha();?></div> </div> </div> <div class="field"> <div class="wojo checkbox"> <input name="agree" type="checkbox" value="1" id="agree_1"> <label for="agree_1"><a href="<?php echo Url::url("/privacy");?>" target="_blank"><?php echo Lang::$word->AGREE;?></a> </label> </div> </div> </div> <div class="center aligned"> <button class="wojo secondary button" data-action="contact" name="dosubmit" type="button"><span class="wojo bold small caps text"><?php echo Lang::$word->CNT_SUBMIT;?></span></button> </div> </div> </form> </div> </div><file_sep><?php /** * Footer * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: footer.tpl.php, v1.00 2020-05-05 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <!-- Footer --> </div> </main> <footer> Copyright &copy;<?php echo date('Y') . ' '. $this->core->company;?> <i class="icon middle wojologo"></i> Powered by: wojo works v <?php echo $this->core->wojov;?> </footer> <script type="text/javascript" src="<?php echo FRONTVIEW;?>/js/master.js"></script> <?php Debug::displayInfo();?> <script type="text/javascript"> // <![CDATA[ $(document).ready(function() { $.Master({ url: "<?php echo FRONTVIEW;?>", surl: "<?php echo SITEURL;?>", lang: { button_text: "<?php echo Lang::$word->BROWSE;?>", empty_text: "<?php echo Lang::$word->NOFILE;?>", } }); }); // ]]> </script> <?php if(Utility::in_array_any(["dashboard"], $this->segments)):?> <script type="text/javascript" src="https://js.stripe.com/v3/"></script> <?php endif;?> </body> </html> <file_sep><?php /** * Privacy * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: privacy.tpl.php, v1.00 2020-02-08 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <div class="wojo-grid"> <div class="wojo raised segment"> <h2><?php echo Lang::$word->META_T36;?></h2> <p> 1.     <strong>Introduction</strong><br> 1.1    We are committed to safeguarding the privacy of [our website visitors and service users].<br> 1.2    This policy applies where we are acting as a data controller with respect to the personal data of [our website visitors and service users]; in other words, where we determine the purposes and means of the processing of that personal data.<br> 1.3    We use cookies on our website. Insofar as those cookies are not strictly necessary for the provision of [our website and services], we will ask you to consent to our use of cookies when you first visit our website.<br> 1.4    Our website incorporates privacy controls which affect how we will process your personal data. By using the privacy controls, you can [specify whether you would like to receive direct marketing communications and limit the publication of your information]. You can access the privacy controls via <em>[URL]</em>.<br> 1.5    In this policy, &quot;we&quot;, &quot;us&quot; and &quot;our&quot; refer to <em>[data controller name]</em>.[ For more information about us, see Section 13.]<br> <br> ... <mark>edit policy page in /view/front/privacy.tpl.php</mark> </div> </div> <file_sep><?php /** * Countries * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: countries.tpl.php, v1.00 2020-05-05 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); if (!Auth::checkAcl("owner")) : print Message::msgError(Lang::$word->NOACCESS); return; endif; ?> <?php switch(Url::segment($this->segments)): case "edit": ?> <!-- Start edit --> <h2><?php echo Lang::$word->CNT_EDIT;?></h2> <form method="post" id="wojo_form" name="wojo_form"> <div class="wojo segment form"> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->NAME;?> <i class="icon asterisk"></i></label> <input type="text" placeholder="<?php echo Lang::$word->NAME;?>" value="<?php echo $this->data->name;?>" name="name"> </div> <div class="field five wide"> <label><?php echo Lang::$word->CNT_ABBR;?> <i class="icon asterisk"></i></label> <input type="text" placeholder="<?php echo Lang::$word->CNT_ABBR;?>" value="<?php echo $this->data->abbr;?>" name="abbr"> </div> </div> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->TRX_TAX;?></label> <div class="wojo right labeled input"> <input type="text" placeholder="<?php echo Lang::$word->TRX_TAX;?>" value="<?php echo $this->data->vat;?>" name="vat"> <div class="wojo label">%</div> </div> </div> <div class="field five wide"> <label><?php echo Lang::$word->SORTING;?></label> <input type="text" placeholder="<?php echo Lang::$word->SORTING;?>" value="<?php echo $this->data->sorting;?>" name="sorting"> </div> </div> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->ACTIVE;?></label> <div class="wojo checkbox radio inline"> <input name="active" type="radio" value="1" <?php Validator::getChecked($this->data->active, 1); ?> id="active1"> <label for="active1"><?php echo Lang::$word->YES;?></label> </div> <div class="wojo checkbox radio inline"> <input name="active" type="radio" value="0" <?php Validator::getChecked($this->data->active, 0); ?> id="active2"> <label for="active2"><?php echo Lang::$word->NO;?></label> </div> </div> <div class="field five wide"> <label><?php echo Lang::$word->DEFAULT;?></label> <div class="wojo checkbox radio inline"> <input name="home" type="radio" value="1" <?php Validator::getChecked($this->data->home, 1); ?> id="home1"> <label for="home1"><?php echo Lang::$word->YES;?></label> </div> <div class="wojo checkbox radio inline"> <input name="home" type="radio" value="0" <?php Validator::getChecked($this->data->home, 0); ?> id="home2"> <label for="home2"><?php echo Lang::$word->NO;?></label> </div> </div> </div> <div class="center aligned"> <a href="<?php echo Url::url("/admin/countries");?>" class="wojo simple button"><?php echo Lang::$word->CANCEL;?></a> <button type="button" data-action="processCountry" name="dosubmit" class="wojo primary button"><?php echo Lang::$word->CNT_UPDATE;?></button> </div> </div> <input type="hidden" name="id" value="<?php echo $this->data->id;?>"> </form> <?php break;?> <?php default: ?> <h3><?php echo Lang::$word->CNT_TITLE;?></h3> <p class="wojo small text"><?php echo Lang::$word->CNT_INFO;?></p> <?php if(!$this->data):?> <div class="content-center"><img src="<?php echo ADMINVIEW;?>/images/notfound.png" alt=""> <p class="wojo small thick caps text"><?php echo Lang::$word->CNT_NOCOUNTRY;?></p> </div> <?php else:?> <div class="wojo segment"> <table class="wojo basic responsive table" id="editable"> <thead> <tr> <th class="disabled center aligned"><i class="icon disabled id"></i></th> <th><?php echo Lang::$word->NAME;?></th> <th><?php echo Lang::$word->CNT_ABBR;?></th> <th><?php echo Lang::$word->TRX_TAX;?></th> <th><?php echo Lang::$word->SORTING;?></th> <th class="disabled center aligned"><?php echo Lang::$word->ACTIONS;?></th> </tr> </thead> <?php foreach ($this->data as $row):?> <tr id="item_<?php echo $row->id;?>"> <td class="auto"><span class="wojo small dark inverted label"><?php echo $row->id;?></span></td> <td><a href="<?php echo Url::url(Router::$path, "edit/" . $row->id);?>"> <?php echo $row->name;?></a></td> <td><span class="wojo small label"><?php echo $row->abbr;?></span></td> <td><span data-editable="true" data-set='{"action": "editTax", "id": <?php echo $row->id;?>}'><?php echo $row->vat;?></span>%</td> <td><?php echo $row->sorting;?></td> <td class="auto"><a href="<?php echo Url::url(Router::$path, "edit/" . $row->id);?>" class="wojo icon circular inverted positive button"><i class="icon note"></i></a></td> </tr> <?php endforeach;?> </table> </div> <?php endif;?> <?php break;?> <?php endswitch;?><file_sep><?php /** * Password * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: password.tpl.php, v1.00 2019-05-05 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <div class="wojo-grid"> <div class="wojo raised auto segment"> <h2><?php echo Lang::$word->NEWPASS;?></h2> <form method="post" id="wojo_form" name="wojo_form"> <div class="wojo form"> <div class="wojo block fields"> <div class="field"> <label><?php echo Lang::$word->NEWPASS;?> <i class="icon asterisk"></i></label> <input placeholder="<?php echo Lang::$word->NEWPASS;?>" name="password" type="<PASSWORD>"> </div> </div> <div class="wojo fields"> <div class="field center aligned"> <button class="wojo secondary button" data-action="password" name="dosubmit" type="button"><?php echo Lang::$word->SUBMIT;?></button> </div> </div> </div> <input type="hidden" name="token" value="<?php echo $this->segments[1];?>"> </form> </div> </div><file_sep><?php /** * Membership Manager * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: _memberships_grid.tpl.php, v1.00 2020-02-08 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <div class="row gutters align middle"> <div class="columns mobile-100 phone-100"> <h2><?php echo Lang::$word->META_T6;?></h2> <p class="wojo small text"><?php echo Lang::$word->MEM_SUB;?></p> </div> <div class="columns auto mobile-100 phone-100"> <a href="<?php echo Url::url(Router::$path, "new/");?>" class="wojo small primary button stacked"><i class="icon plus alt"></i><?php echo Lang::$word->MEM_SUB1;?></a> </div> </div> <?php if(!$this->data):?> <div class="center aligned"><img src="<?php echo ADMINVIEW;?>/images/notfound.png" alt=""> <p class="wojo small demi caps text"><?php echo Lang::$word->MEM_NOMEM;?></p> </div> <?php else:?> <div class="wojo cards screen-3 tablet-2 mobile-1"> <?php foreach($this->data as $row):?> <div class="card" id="item_<?php echo $row->id;?>"> <div class="content center aligned"> <?php if($row->thumb):?> <img src="<?php echo UPLOADURL;?>/memberships/<?php echo $row->thumb;?>" alt=""> <?php else:?> <img src="<?php echo UPLOADURL;?>/memberships/default.svg" alt=""> <?php endif;?> <h4><?php echo Utility::formatMoney($row->price);?> <?php echo $row->title;?></h4> <p class="wojo tiny text"><?php echo Validator::truncate($row->description,40);?></p> <a href="<?php echo Url::url(Router::$path, "history/" . $row->id);?>" class="wojo small icon label"><?php echo $row->total;?> <?php echo Lang::$word->TRX_SALES;?></a> </div> <div class="footer divided"> <div class="row"> <div class="columns"> <a href="<?php echo Url::url(Router::$path, "edit/" . $row->id);?>" class="wojo icon inverted positive small button"><i class="icon pencil"></i></a> </div> <div class="columns auto"> <a data-set='{"option":[{"trash": "trashMembership","title": "<?php echo Validator::sanitize($row->title, "chars");?>","id": <?php echo $row->id;?>}],"action":"trash","parent":"#item_<?php echo $row->id;?>"}' class="wojo icon inverted negative small button data"><i class="icon trash"></i></a> </div> </div> </div> </div> <?php endforeach;?> </div> <?php endif;?><file_sep><?php /** * Load Database Backup * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: loadDatabaseBackup.tpl.php, v1.00 2020-01-08 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <div class="item"> <div class="content"> <span class="wojo small bold text">-1.</span> <?php echo str_replace(".sql", "", $this->backup);?></div> <div class="content auto"><span class="wojo small dark inverted label"><?php echo File::getFileSize($this->dbdir . '/' . $this->backup, "kb", true);?></span> <a href="<?php echo UPLOADURL . '/backups/' . $this->backup;?>" data-content="<?php echo Lang::$word->DOWNLOAD;?>" class="wojo icon positive inverted circular button button"><i class="download icon"></i></a> <a data-set='{"option":[{"restore": "restoreBackup","title": "<?php echo $this->backup;?>","id":1}],"action":"restore","parent":".item"}' class="wojo icon primary inverted circular button data"><i class="icon refresh"></i></a> <a data-set='{"option":[{"delete": "deleteBackup","title": "<?php echo $this->backup;?>","id":1}],"action":"delete","parent":".item"}' class="wojo icon negative inverted circular button data"><i class="icon trash"></i></a> </div> </div><file_sep><?php /** * Coupons * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: coupons.tpl.php, v1.00 2020-05-05 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); if(!Auth::hasPrivileges('manage_coupons')): print Message::msgError(Lang::$word->NOACCESS); return; endif; ?> <?php switch(Url::segment($this->segments)): case "edit": ?> <!-- Start edit --> <h2><?php echo Lang::$word->META_T13;?></h2> <form method="post" id="wojo_form" name="wojo_form"> <div class="wojo segment form"> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->NAME;?> <i class="icon asterisk"></i></label> <div class="wojo input"> <input type="text" placeholder="<?php echo Lang::$word->NAME;?>" value="<?php echo $this->data->title;?>" name="title"> </div> </div> <div class="field five wide"> <label><?php echo Lang::$word->DC_CODE;?> <i class="icon asterisk"></i></label> <div class="wojo input"> <input type="text" placeholder="<?php echo Lang::$word->DC_CODE;?>" value="<?php echo $this->data->code;?>" name="code"> </div> </div> </div> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->DC_SUB3;?> <i class="icon asterisk"></i></label> <a data-dropdown="#membership_id" class="wojo light right button"><?php echo Lang::$word->ADM_MEMBS;?> <i class="icon chevron down"></i></a> <div class="wojo static dropdown small pointing top-left" id="membership_id"> <div class="mw400"> <div class="row grid phone-1 mobile-1 tablet-2 screen-2"> <?php echo Utility::loopOptionsMultiple($this->mlist, "id", "title", $this->data->membership_id, "membership_id");?> </div> </div> </div> </div> <div class="field three wide"> <label><?php echo Lang::$word->DC_DISC;?> <i class="icon asterisk"></i></label> <input type="text" placeholder="<?php echo Lang::$word->DC_DISC;?>" value="<?php echo $this->data->discount;?>" name="discount"> </div> <div class="field two wide"> <label><?php echo Lang::$word->DC_DISC;?></label> <select name="type"> <option value="p"<?php if($this->data->type == "p") echo ' selected="selected"';?>><?php echo Lang::$word->DC_TYPE_P;?></option> <option value="a"<?php if($this->data->type == "a") echo ' selected="selected"';?>><?php echo Lang::$word->DC_TYPE_A;?></option> </select> </div> </div> <div class="wojo fields"> <div class="field"> <label><?php echo Lang::$word->PUBLISHED;?></label> <div class="wojo checkbox radio inline"> <input name="active" type="radio" value="1" <?php Validator::getChecked($this->data->active, 1); ?> id="active_1"> <label for="active_1"><?php echo Lang::$word->YES;?></label> </div> <div class="wojo checkbox radio inline"> <input name="active" type="radio" value="0" <?php Validator::getChecked($this->data->active, 0); ?> id="active_0"> <label for="active_0"><?php echo Lang::$word->NO;?></label> </div> </div> </div> <div class="center aligned"> <a href="<?php echo Url::url("/admin/coupons");?>" class="wojo simple button"><?php echo Lang::$word->CANCEL;?></a> <button type="button" data-action="processCoupon" name="dosubmit" class="wojo primary button"><?php echo Lang::$word->DC_SUB2;?></button> </div> </div> <input type="hidden" name="id" value="<?php echo $this->data->id;?>"> </form> <?php break;?> <?php case "new": ?> <h2><?php echo Lang::$word->META_T14;?></h2> <form method="post" id="wojo_form" name="wojo_form"> <div class="wojo segment form"> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->NAME;?> <i class="icon asterisk"></i></label> <div class="wojo input"> <input type="text" placeholder="<?php echo Lang::$word->NAME;?>" name="title"> </div> </div> <div class="field five wide"> <label><?php echo Lang::$word->DC_CODE;?> <i class="icon asterisk"></i></label> <div class="wojo input"> <input type="text" placeholder="<?php echo Lang::$word->DC_CODE;?>" name="code"> </div> </div> </div> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->DC_SUB3;?> <i class="icon asterisk"></i></label> <a data-dropdown="#membership_id" class="wojo light right button"><?php echo Lang::$word->ADM_MEMBS;?> <i class="icon chevron down"></i></a> <div class="wojo static dropdown small pointing top-left" id="membership_id"> <div class="mw400"> <div class="row grid phone-1 mobile-1 tablet-2 screen-2"> <?php echo Utility::loopOptionsMultiple($this->mlist, "id", "title", false, "membership_id");?> </div> </div> </div> </div> <div class="field three wide"> <label><?php echo Lang::$word->DC_DISC;?> <i class="icon asterisk"></i></label> <input type="text" placeholder="<?php echo Lang::$word->DC_DISC;?>" name="discount"> </div> <div class="field two wide"> <label><?php echo Lang::$word->DC_DISC;?></label> <select name="type"> <option value="p"><?php echo Lang::$word->DC_TYPE_P;?></option> <option value="a"><?php echo Lang::$word->DC_TYPE_A;?></option> </select> </div> </div> <div class="wojo fields"> <div class="field"> <label><?php echo Lang::$word->PUBLISHED;?></label> <div class="wojo checkbox radio inline"> <input name="active" type="radio" value="1" id="active_1"> <label for="active_1"><?php echo Lang::$word->YES;?></label> </div> <div class="wojo checkbox radio inline"> <input name="active" type="radio" value="0" checked="checked" id="active_0"> <label for="active_0"><?php echo Lang::$word->NO;?></label> </div> </div> </div> <div class="center aligned"> <a href="<?php echo Url::url("/admin/coupons");?>" class="wojo simple button"><?php echo Lang::$word->CANCEL;?></a> <button type="button" data-action="processCoupon" name="dosubmit" class="wojo primary button"><?php echo Lang::$word->DC_SUB1;?></button> </div> </div> </form> <?php break;?> <?php default: ?> <div class="row gutters align middle"> <div class="columns mobile-100 phone-100"> <h2><?php echo Lang::$word->DC_TITLE;?></h2> <p class="wojo small text"><?php echo Lang::$word->DC_SUB;?></p> </div> <div class="columns auto mobile-100 phone-100"> <a href="<?php echo Url::url(Router::$path, "new/");?>" class="wojo small primary button stacked"><i class="icon plus alt"></i><?php echo Lang::$word->DC_SUB1;?></a> </div> </div> <?php if(!$this->data):?> <div class="center aligned"><img src="<?php echo ADMINVIEW;?>/images/notfound.png" alt=""> <p class="wojo small demi caps text"><?php echo Lang::$word->DC_NONDISC;?></p> </div> <?php else:?> <div class="wojo cards screen-3 tablet-3 mobile-1"> <?php foreach ($this->data as $row):?> <div class="card" id="item_<?php echo $row->id;?>"> <div class="content dimmable <?php echo ($row->active == 0) ? "active" : "";?>"> <a href="<?php echo Url::url(Router::$path, "edit/" . $row->id);?>"> <img src="<?php echo ADMINVIEW;?>/images/coupon.svg" alt=""></a> <p class="center aligned"><a href="<?php echo Url::url(Router::$path, "edit/" . $row->id);?>"><?php echo $row->title;?></a> </p> </div> <div class="divided footer"> <div class="row align middle"> <div class="columns"> <a data-set='{"option":[{"trash": "trashCoupon","title": "<?php echo Validator::sanitize($row->title, "chars");?>","id": <?php echo $row->id;?>}],"action":"trash","parent":"#item_<?php echo $row->id;?>"}' class="wojo negative small inverted icon button data"><i class="icon trash"></i></a> </div> <div class="columns auto"> <div class="wojo fitted toggle checkbox is_dimmable" data-set='{"option":[{"action": "couponStatus","id":<?php echo $row->id;?>}],"parent":"#item_<?php echo $row->id;?>"}'> <input name="active" type="checkbox" value="1" <?php Validator::getChecked($row->active, 1);?> id="cpn_<?php echo $row->id;?>"> <label for="cpn_<?php echo $row->id;?>"><?php echo Lang::$word->ACTIVE;?></label> </div> </div> </div> </div> </div> <?php endforeach;?> </div> <?php endif;?> <?php break;?> <?php endswitch;?><file_sep><?php /** * Gateways * * @package Wojo Framework * @author <EMAIL> * @copyright 2016 * @version $Id: gateways.tpl.php, v1.00 2016-05-05 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); if (!Auth::checkAcl("owner")) : print Message::msgError(Lang::$word->NOACCESS); return; endif; ?> <?php switch(Url::segment($this->segments)): case "edit": ?> <!-- Start edit --> <h2><?php echo Lang::$word->GW_TITLE1;?></h2> <form method="post" id="wojo_form" name="wojo_form"> <div class="wojo segment form"> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->GW_NAME;?> <i class="icon asterisk"></i></label> <div class="wojo input"> <input type="text" placeholder="<?php echo Lang::$word->GW_NAME;?>" value="<?php echo $this->data->displayname;?>" name="displayname"> </div> </div> <div class="field five wide"> <label><?php echo $this->data->extra_txt;?> <i class="icon asterisk"></i></label> <div class="wojo input"> <input type="text" placeholder="<?php echo $this->data->extra_txt;?>" value="<?php echo $this->data->extra;?>" name="extra"> </div> </div> </div> <div class="wojo fields"> <div class="field five wide"> <label><?php echo $this->data->extra_txt2;?></label> <div class="wojo input"> <input type="text" placeholder="<?php echo $this->data->extra_txt2;?>" value="<?php echo $this->data->extra2;?>" name="extra2"> </div> </div> <div class="field five wide"> <label><?php echo $this->data->extra_txt3;?> </label> <div class="wojo input"> <input type="text" placeholder="<?php echo $this->data->extra_txt3;?>" value="<?php echo $this->data->extra3;?>" name="extra3"> </div> </div> </div> <div class="wojo fields"> <div class="field"> <label><?php echo Lang::$word->GW_LIVE;?></label> <div class="wojo checkbox radio inline"> <input name="live" type="radio" value="1" <?php Validator::getChecked($this->data->live, 1); ?> id="live1"> <label for="live1"><?php echo Lang::$word->YES;?></label> </div> <div class="wojo checkbox radio inline"> <input name="live" type="radio" value="0" <?php Validator::getChecked($this->data->live, 0); ?> id="live2"> <label for="live2"><?php echo Lang::$word->NO;?></label> </div> </div> <div class="field"> <label><?php echo Lang::$word->ACTIVE;?></label> <div class="wojo checkbox radio inline"> <input name="active" type="radio" value="1" <?php Validator::getChecked($this->data->active, 1); ?> id="active1"> <label for="active1"><?php echo Lang::$word->YES;?></label> </div> <div class="wojo checkbox radio inline"> <input name="active" type="radio" value="0" <?php Validator::getChecked($this->data->active, 0); ?> id="active2"> <label for="active2"><?php echo Lang::$word->NO;?></label> </div> </div> </div> <div class="wojo fields"> <div class="field"> <label><?php echo Lang::$word->GW_IPNURL;?></label> <input type="text" readonly value="<?php echo SITEURL.'/gateways/' . $this->data->dir . '/ipn.php';?>"> </div> </div> <div class="center aligned"> <a href="<?php echo Url::url("/admin/gateways");?>" class="wojo simple button"><?php echo Lang::$word->CANCEL;?></a> <button type="button" data-action="processGateway" name="dosubmit" class="wojo primary button"><?php echo Lang::$word->GW_UPDATE;?></button> </div> </div> <input type="hidden" name="id" value="<?php echo $this->data->id;?>"> </form> <?php break;?> <?php default: ?> <h2><?php echo Lang::$word->GW_TITLE;?></h2> <p class="wojo small text"><?php echo Lang::$word->GW_SUB;?></p> <?php if($this->data):?> <div class="wojo cards screen-3 tablet-3 mobile-1"> <?php foreach ($this->data as $row):?> <div class="card"> <div class="content dimmable <?php echo ($row->active == 0) ? "active" : "";?>" id="item_<?php echo $row->id;?>"> <a href="<?php echo Url::url(Router::$path, "edit/" . $row->id);?>"> <img src="<?php echo SITEURL;?>/gateways/<?php echo $row->dir;?>/logo_large.png" alt=""></a> </div> <div class="divided footer"> <div class="row align middle"> <div class="columns"> <a href="<?php echo Url::url(Router::$path, "edit/" . $row->id);?>"><?php echo $row->displayname;?></a> </div> <div class="columns auto"> <div class="wojo fitted toggle checkbox is_dimmable" data-set='{"option":[{"action": "gatewayStatus","id":<?php echo $row->id;?>}],"parent":"#item_<?php echo $row->id;?>"}' > <input name="active" type="checkbox" value="1" <?php Validator::getChecked($row->active, 1); ?> id="gateway_<?php echo $row->id;?>"> <label for="gateway_<?php echo $row->id;?>"><?php echo Lang::$word->ACTIVE;?></label> </div> </div> </div> </div> </div> <?php endforeach;?> </div> <?php endif;?> <?php break;?> <?php endswitch;?><file_sep>(function($) { "use strict"; $.Master = function(settings) { var config = { weekstart: 0, ampm: 0, url: '', lang: { button_text: "Choose file...", empty_text: "No file...", } }; if (settings) { $.extend(config, settings); } /* == Input focus == */ $(document).on("focusout", '.wojo.input input, .wojo.input textarea', function() { $('.wojo.input').removeClass('focus'); }); $(document).on("focusin", '.wojo.input input, .wojo.input textarea', function() { $(this).closest('.input').addClass('focus'); }); /* == Dark Light Theme == */ $(document).on('click', '.atheme-switch', function() { var mode = $(this).attr("data-mode"); $("body").attr("data-theme", (mode === "light") ? "dark" : "light"); $(this).attr("data-mode", (mode === "light") ? "dark" : "light"); $("span", this).text((mode === "light") ? "Dark" : "Light"); Cookies.set("MMPF_THEME", (mode === "light") ? "dark" : "light", { expires: 360, path: '/', sameSite: 'strict' }); window.location.href = window.location.href; }); /* == Account actions == */ $(".add-cart").on("click", function() { $(".wojo.cards .card").removeClass('active'); $(this).closest('.card').addClass('active'); var id = $(this).data('id'); $.post(config.url + "/controller.php", { action: "buyMembership", id: id }, function(json) { $("#mResult").html(json.message); $('html, body').animate({ scrollTop: $("#mResult").offset().top }, 2000); }, "json"); }); $("#mResult").on("click", ".sGateway", function() { $("#mResult .sGateway").removeClass('primary'); $(this).addClass('primary'); var id = $(this).data('id'); $.post(config.url + "/controller.php", { action: "selectGateway", id: id }, function(json) { $("#mResult #gdata").html(json.message); $('html, body').animate({ scrollTop: $("#gdata").offset().top }, 2000); }, "json"); }); $("#mResult").on("click", "#cinput", function() { var id = $(this).data('id'); var $this = $(this); var $parent = $(this).parent(); var $input = $("input[name=coupon]"); if (!$input.val()) { $parent.addClass('error'); } else { $parent.addClass('loading'); $.post(config.url + "/controller.php", { action: "getCoupon", id: id, code: $input.val() }, function(json) { if (json.type === "success") { $parent.removeClass('error'); $this.toggleClass('find check'); $parent.prop('disabled', true); $(".totaltax").html(json.tax); $(".totalamt").html(json.gtotal); $(".disc").html(json.disc); $(".disc").parent().addClass('highlite'); } else { $parent.addClass('error'); } $parent.removeClass('loading'); }, "json"); } }); /* == Avatar Upload == */ $('[data-type="image"]').wavatar({ text: config.lang.selPic, validators: { maxWidth: 3200, maxHeight: 1800 }, reject: function(file, errors) { if (errors.mimeType) { $.wNotice(decodeURIComponent(file.name + ' must be an image.'), { autoclose: 4000, type: "error", title: 'Error' }); } if (errors.maxWidth || errors.maxHeight) { $.wNotice(decodeURIComponent(file.name + ' must be width:3200px, and height:1800px max.'), { autoclose: 4000, type: "error", title: 'Error' }); } } }); /* == Master Form == */ $(document).on('click', 'button[name=dosubmit]', function() { var $button = $(this); var action = $(this).data('action'); var $form = $(this).closest("form"); var asseturl = $(this).data('url'); function showResponse(json) { setTimeout(function() { $($button).removeClass("loading").prop("disabled", false); }, 500); $.wNotice(json.message, { autoclose: 12000, type: json.type, title: json.title }); if (json.type === "success" && json.redirect) { $('main').transition("scaleOut", { duration: 4000, complete: function() { window.location.href = json.redirect; } }); } } function showLoader() { $($button).addClass("loading").prop("disabled", true); } var options = { target: null, beforeSubmit: showLoader, success: showResponse, type: "post", url: asseturl ? config.url + "/" + asseturl + "/controller.php" : config.url + "/controller.php", data: { action: action }, dataType: 'json' }; $($form).ajaxForm(options).submit(); }); /* == Clear Session Debug Queries == */ $("#debug-panel").on('click', 'a.clear_session', function() { $.get(config.url + '/controller.php', { ClearSessionQueries: 1 }); $(this).css('color', '#222'); }); }; })(jQuery);<file_sep><?php /** * Header * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: header.tpl.php, v1.00 2020-10-05 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); if (!App::Auth()->is_Admin()) { Url::redirect(SITEURL . '/admin/login/'); exit; } ?> <!DOCTYPE html> <head> <meta charset="utf-8"> <title><?php echo $this->title;?></title> <link href="<?php echo ADMINVIEW . '/cache/' . Cache::cssCache(array('base.css','transition.css','label.css','form.css','dropdown.css','input.css','button.css','message.css','image.css','list.css','table.css','icon.css','card.css','modal.css','editor.css','tooltip.css','menu.css','progress.css','utility.css','style.css'), ADMINBASE);?>" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="<?php echo SITEURL;?>/assets/jquery.js"></script> <script type="text/javascript" src="<?php echo SITEURL;?>/assets/global.js"></script> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="apple-mobile-web-app-capable" content="yes"> </head> <body data-theme="<?php echo Session::cookieExists("MMPA_THEME", "dark") ? "dark" : "light";?>"> <header> <div class="wojo-grid"> <div class="row horizontal small gutters align middle"> <div class="columns"> <a href="<?php echo Url::url("/admin");?>" class="logo"> <?php echo (App::Core()->logo) ? '<img src="' . SITEURL . '/uploads/' . $this->core->logo . '" alt="' . $this->core->company . '">': $this->core->company;?> </a> </div> <div class="columns auto"> <div class="wojo buttons" data-dropdown="#dropdown-uMenu" id="uName"> <div class="wojo transparent button"><?php echo App::Auth()->name;?></div> <div class="wojo primary inverted icon button"><?php echo Utility::getInitials(App::Auth()->name);?></div> </div> <div class="wojo small dropdown top-right" id="dropdown-uMenu"> <div class="wojo small circular center image"> <img src="<?php echo UPLOADURL;?>/avatars/<?php echo (App::Auth()->avatar) ? App::Auth()->avatar : "blank.svg";?>" alt=""> </div> <h5 class="wojo small dimmed text center aligned"><?php echo App::Auth()->name;?></h5> <a class="item" href="<?php echo Url::url("/admin/myaccount");?>"><i class="icon user"></i> <?php echo Lang::$word->M_MYACCOUNT;?></a> <a class="item" href="<?php echo Url::url("/admin/myaccount/password");?>"><i class="icon lock"></i> <?php echo Lang::$word->M_SUB2;?></a> <a class="atheme-switch item" data-mode="<?php echo Session::cookieExists("MMPA_THEME", "dark") ? "dark" : "light";?>"><i class="icon contrast"></i><span><?php echo Session::cookieExists("MMPA_THEME", "dark") ? "Light" : "Dark";?></span></a> <div class="divider"></div> <a class="item" href="<?php echo Url::url("/admin/logout");?>"><i class="icon power"></i> <?php echo Lang::$word->LOGOUT;?></a> </div> </div> <?php if (Auth::checkAcl("owner")):?> <div class="columns auto"> <a data-dropdown="#dropdown-aMenu" class="wojo icon simple transparent button"> <i class="icon cogs"></i> </a> <div class="wojo small dropdown top-right" id="dropdown-aMenu"> <a class="item" href="<?php echo Url::url("/admin/configuration");?>"><i class="icon sliders vertical alt"></i> <?php echo Lang::$word->ADM_CONFIG;?></a> <a class="item" href="<?php echo Url::url("/admin/permissions");?>"><i class="icon lock"></i> <?php echo Lang::$word->ADM_PERMS;?></a> <a class="item" href="<?php echo Url::url("/admin/language");?>"><i class="icon flag"></i> <?php echo Lang::$word->ADM_LNGMNG;?></a> <a class="item" href="<?php echo Url::url("/admin/maintenance");?>"><i class="icon settings alt"></i> <?php echo Lang::$word->ADM_MTNC;?></a> <a class="item" href="<?php echo Url::url("/admin/system");?>"><i class="icon laptop"></i> <?php echo Lang::$word->ADM_SYSTEM;?></a> <a class="item" href="<?php echo Url::url("/admin/backup");?>"><i class="icon database"></i> <?php echo Lang::$word->ADM_BACKUP;?></a> <a class="item" href="<?php echo Url::url("/admin/gateways");?>"><i class="icon wallet"></i> <?php echo Lang::$word->ADM_GATE;?></a> <a class="item" href="<?php echo Url::url("/admin/transactions");?>"><i class="icon credit card"></i> <?php echo Lang::$word->ADM_TRANS;?></a> <div class="divider"></div> <a class="item" href="<?php echo Url::url("/admin/trash");?>"><i class="icon trash"></i> <?php echo Lang::$word->ADM_TRASH;?></a> </div> </div> <?php endif;?> <div class="columns auto hide-all" id="mobileToggle"> <a class="wojo transparent icon button menu-mobile"><i class="icon white reorder"></i></a> </div> </div> </div> </header> <div class="navbar"> <div class="wojo-grid"> <nav class="wojo menu"> <ul> <li<?php if (Utility::in_array_any(["templates","countries","coupons","fields","news","mailer", "pages"], $this->segments)) echo ' class="active"';?>> <a href="#"> <img src="<?php echo ADMINVIEW;?>/images/content.svg"> <span class="title"><?php echo Lang::$word->ADM_CONTENT;?></span> <i class="icon chevron down"></i></a> <ul> <li><a<?php if (in_array("pages", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/pages");?>"><?php echo Lang::$word->ADM_PAGES;?></a> </li> <li><a<?php if (in_array("templates", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/templates");?>"><?php echo Lang::$word->ADM_EMTPL;?></a> </li> <li><a<?php if (in_array("countries", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/countries");?>"><?php echo Lang::$word->ADM_CNTR;?></a> </li> <li><a<?php if (in_array("coupons", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/coupons");?>"><?php echo Lang::$word->ADM_COUPONS;?></a> </li> <li><a<?php if (in_array("fields", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/fields");?>"><?php echo Lang::$word->ADM_CFIELDS;?></a> </li> <li><a<?php if (in_array("news", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/news");?>"><?php echo Lang::$word->ADM_NEWS;?></a> </li> <li><a<?php if (in_array("mailer", $this->segments)) echo ' class="active"';?> href="<?php echo Url::url("/admin/mailer");?>"><?php echo Lang::$word->ADM_NEWSL;?></a> </li> </ul> </li> <li<?php if (in_array("memberships", $this->segments)) echo ' class="active"';?>> <a href="<?php echo Url::Url("/admin/memberships");?>"> <img src="<?php echo ADMINVIEW;?>/images/memberships.svg"> <span class="title"><?php echo Lang::$word->ADM_MEMBS;?></span> </a> </li> <li<?php if (in_array("users", $this->segments)) echo ' class="active"';?>> <a href="<?php echo Url::Url("/admin/users");?>"> <img src="<?php echo ADMINVIEW;?>/images/users.svg"> <span class="title"><?php echo Lang::$word->ADM_USERS;?></span> </a> </li> <li<?php if (in_array("files", $this->segments)) echo ' class="active"';?>> <a href="<?php echo Url::Url("/admin/files");?>"> <img src="<?php echo ADMINVIEW;?>/images/files.svg"> <span class="title"><?php echo Lang::$word->ADM_FILES;?></span> </a> </li> <li<?php if (in_array("help", $this->segments)) echo ' class="active"';?>> <a href="<?php echo Url::Url("/admin/help");?>"> <img src="<?php echo ADMINVIEW;?>/images/help.svg"> <span class="title"><?php echo Lang::$word->ADM_HELP;?></span> </a> </li> </ul> </nav> </div> </div> <main> <div class="wojo-grid"> <div class="wojo small breadcrumb"> <?php echo Url::crumbs($this->crumbs ? $this->crumbs : $this->segments, "//", Lang::$word->HOME);?> </div><file_sep><?php /** * Configuration * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: configuration.tpl.php, v1.00 2020-05-05 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); if (!Auth::checkAcl("owner")) : print Message::msgError(Lang::$word->NOACCESS); return; endif; ?> <h2><?php echo Lang::$word->META_T25;?></h2> <p class="wojo small text"><?php echo Lang::$word->CG_INFO;?></p> <form method="post" id="wojo_form" name="wojo_form"> <div class="wojo segment form"> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->CG_SITENAME;?> <i class="icon asterisk"></i></label> <input type="text" placeholder="<?php echo Lang::$word->CG_SITENAME;?>" value="<?php echo $this->data->company;?>" name="company"> </div> <div class="field five wide"> <label><?php echo Lang::$word->CG_WEBEMAIL;?> <i class="icon asterisk"></i></label> <input type="text" placeholder="<?php echo Lang::$word->CG_WEBEMAIL;?>" value="<?php echo $this->data->site_email;?>" name="site_email"> </div> </div> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->CG_DIR;?> </label> <input type="text" placeholder="<?php echo Lang::$word->CG_DIR;?>" value="<?php echo $this->data->site_dir;?>" name="site_dir"> </div> <div class="field five wide"> <label><?php echo Lang::$word->CG_WEBEMAIL1;?> </label> <input type="text" placeholder="<?php echo Lang::$word->CG_WEBEMAIL1;?>" value="<?php echo $this->data->psite_email;?>" name="psite_email"> </div> </div> <div class="wojo fields align middle"> <div class="field auto"> <label><?php echo Lang::$word->CG_LOGO;?> </label> <input type="file" name="logo" id="logo" class="filestyle" data-input="false"> </div> <div class="field"> <label><?php echo Lang::$word->CG_LOGODEL;?></label> <div class="wojo small inline fitted checkbox"> <input name="dellogo" type="checkbox" value="1" id="dellogo"> <label for="dellogo"><?php echo Lang::$word->CG_LOGODEL;?></label> </div> </div> <div class="field auto"> <label><?php echo Lang::$word->CG_LOGO1;?> </label> <input type="file" name="plogo" id="plogo" class="filestyle" data-input="false"> </div> <div class="field"> <label><?php echo Lang::$word->CG_LOGODEL;?> </label> <div class="wojo small inline fitted checkbox"> <input name="dellogop" type="checkbox" value="1" id="plogodel"> <label for="plogodel"><?php echo Lang::$word->CG_LOGODEL;?></label> </div> </div> </div> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->CG_LONGDATE;?> <i class="icon asterisk"></i></label> <select name="long_date"> <?php echo Date::getLongDate($this->data->long_date);?> </select> </div> <div class="field three wide"> <label><?php echo Lang::$word->CG_SHORTDATE;?> <i class="icon asterisk"></i></label> <select name="short_date"> <?php echo Date::getShortDate($this->data->short_date);?> </select> </div> <div class="field two wide"> <label><?php echo Lang::$word->CG_TIMEFORMAT;?> <i class="icon asterisk"></i></label> <select name="time_format"> <?php echo Date::getTimeFormat($this->data->time_format);?> </select> </div> </div> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->CG_WEEKSTART;?></label> <select name="weekstart"> <?php echo Date::weekList(true, true, $this->data->weekstart);?> </select> </div> <div class="field three wide"> <label><?php echo Lang::$word->CG_CALDATE;?> <i class="icon asterisk"></i></label> <select name="calendar_date"> <?php echo Date::getCalendarDate($this->data->calendar_date);?> </select> </div> <div class="field two wide"> <label><?php echo Lang::$word->CG_PERPAGE;?> <i class="icon asterisk"></i></label> <input type="text" placeholder="<?php echo Lang::$word->CG_PERPAGE;?>" value="<?php echo $this->data->perpage;?>" name="perpage"> </div> </div> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->CG_DTZ;?></label> <select name="dtz"> <?php echo Date::getTimezones();?> </select> </div> <div class="field three wide"> <label><?php echo Lang::$word->CG_LANG;?></label> <select name="lang"> <?php foreach(Lang::fetchLanguage() as $langlist):?> <option value="<?php echo substr($langlist, 0, 2);?>" <?php echo Validator::getSelected($this->data->lang, substr($langlist, 0, 2));?>><?php echo strtoupper(substr($langlist, 0, 2));?></option> <?php endforeach;?> </select> </div> <div class="field two wide"> <label><?php echo Lang::$word->CG_LOCALES;?></label> <select name="locale"> <?php echo Date::localeList($this->data->locale);?> </select> </div> </div> <div class="wojo auto very wide divider"></div> <div class="wojo fields"> <div class="field"> <label><?php echo Lang::$word->CG_REGVERIFY;?></label> <div class="wojo checkbox radio fitted inline"> <input name="reg_verify" type="radio" value="1" id="reg_verify_1" <?php Validator::getChecked($this->data->reg_verify, 1); ?>> <label for="reg_verify_1"><?php echo Lang::$word->YES;?></label> </div> <div class="wojo checkbox radio fitted inline"> <input name="reg_verify" type="radio" value="0" id="reg_verify_0" <?php Validator::getChecked($this->data->reg_verify, 0); ?>> <label for="reg_verify_0"><?php echo Lang::$word->NO;?></label> </div> </div> <div class="field"> <label><?php echo Lang::$word->CG_AUTOVERIFY;?></label> <div class="wojo checkbox radio fitted inline"> <input name="auto_verify" type="radio" value="1" id="auto_verify_1" <?php Validator::getChecked($this->data->auto_verify, 1); ?>> <label for="auto_verify_1"><?php echo Lang::$word->YES;?></label> </div> <div class="wojo checkbox radio fitted inline"> <input name="auto_verify" type="radio" value="0" id="auto_verify_0" <?php Validator::getChecked($this->data->auto_verify, 0); ?>> <label for="auto_verify_0"><?php echo Lang::$word->NO;?></label> </div> </div> </div> <div class="wojo fields"> <div class="field"> <label><?php echo Lang::$word->CG_REGALOWED;?></label> <div class="wojo checkbox radio fitted inline"> <input name="reg_allowed" type="radio" value="1" id="reg_allowed_1" <?php Validator::getChecked($this->data->reg_allowed, 1); ?>> <label for="reg_allowed_1"><?php echo Lang::$word->YES;?></label> </div> <div class="wojo checkbox radio fitted inline"> <input name="reg_allowed" type="radio" value="0" id="reg_allowed_0" <?php Validator::getChecked($this->data->reg_allowed, 0); ?>> <label for="reg_allowed_0"><?php echo Lang::$word->NO;?></label> </div> </div> <div class="field"> <label><?php echo Lang::$word->CG_NOTIFY_ADMIN;?></label> <div class="wojo checkbox radio fitted inline"> <input name="notify_admin" type="radio" value="1" id="notify_admin_1" <?php Validator::getChecked($this->data->notify_admin, 1); ?>> <label for="notify_admin_1"><?php echo Lang::$word->YES;?></label> </div> <div class="wojo checkbox radio fitted inline"> <input name="notify_admin" type="radio" value="0" id="notify_admin_0" <?php Validator::getChecked($this->data->notify_admin, 0); ?>> <label for="notify_admin_0"><?php echo Lang::$word->NO;?></label> </div> </div> </div> <div class="wojo fields"> <div class="field"> <label><?php echo Lang::$word->CG_CURRENCY;?></label> <input type="text" placeholder="<?php echo Lang::$word->CG_CURRENCY;?>" value="<?php echo $this->data->currency;?>" name="currency"> </div> <div class="field"> <label><?php echo Lang::$word->CG_ETAX;?></label> <div class="wojo checkbox radio fitted inline"> <input name="enable_tax" type="radio" value="1" id="enable_tax_1" <?php Validator::getChecked($this->data->enable_tax, 1); ?>> <label for="enable_tax_1"><?php echo Lang::$word->YES;?></label> </div> <div class="wojo checkbox radio fitted inline"> <input name="enable_tax" type="radio" value="0" id="enable_tax_0" <?php Validator::getChecked($this->data->enable_tax, 0); ?>> <label for="enable_tax_0"><?php echo Lang::$word->NO;?></label> </div> </div> </div> <div class="wojo fields"> <div class="field"> <label><?php echo Lang::$word->CG_FILEDIR;?> <i class="icon asterisk"></i></label> <input type="text" placeholder="<?php echo Lang::$word->CG_FILEDIR;?>" value="<?php echo $this->data->file_dir;?>" name="file_dir"> </div> <div class="field"> </div> </div> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->CG_TWID;?></label> <div class="wojo icon input"> <input type="text" placeholder="<?php echo Lang::$word->CG_TWID;?>" value="<?php echo $this->data->social->twitter;?>" name="twitter"> <i class="icon twitter"></i> </div> </div> <div class="field five wide"> <label><?php echo Lang::$word->CG_FBID;?></label> <div class="wojo icon input"> <input type="text" placeholder="<?php echo Lang::$word->CG_FBID;?>" value="<?php echo $this->data->social->facebook;?>" name="facebook"> <i class="icon facebook"></i> </div> </div> </div> <div class="wojo auto very wide divider"></div> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->CG_MEMBERSHIP;?> </label> <div class="wojo toggle checkbox"> <input name="enable_dmembership" type="checkbox" id="enable_dmembership" value="1" <?php Validator::getChecked($this->data->enable_dmembership, 1); ?>> <label for="enable_dmembership"><?php echo Lang::$word->YES;?></label> </div> <p class="wojo small positive text"><em><?php echo Lang::$word->CG_MEMBERSHIP_T;?></em></p> </div> <div class="field five wide"> <label><?php echo Lang::$word->META_T29;?> </label> <select name="dmembership"> <option value="0">-/-</option> <?php echo Utility::loopOptions($this->mlist, "id", "title", $this->data->dmembership);?> </select> </div> </div> <div class="wojo auto very wide divider"></div> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->CG_INVDATA;?> </label> <textarea class="altpost" name="inv_info"><?php echo $this->data->inv_info;?></textarea> </div> <div class="field five wide"> <label><?php echo Lang::$word->CG_INVNOTE;?> </label> <textarea class="altpost" name="inv_note"><?php echo $this->data->inv_note;?></textarea> </div> </div> <div class="wojo auto very wide divider"></div> <div class="wojo fields"> <div class="field"> <label><?php echo Lang::$word->CG_OFFLINE;?></label> <textarea class="altpost" name="offline_info"><?php echo $this->data->offline_info;?></textarea> </div> </div> <div class="wojo auto very wide divider"></div> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->CG_MAILER;?></label> <select name="mailer" id="mailerchange"> <option value="SMAIL" <?php echo Validator::getSelected($this->data->mailer, "SMAIL");?>>Sendmail</option> <option value="SMTP" <?php echo Validator::getSelected($this->data->mailer, "SMTP");?>>SMTP Mailer</option> </select> </div> <div class="field showsmail<?php echo ($this->data->mailer == "SMAIL") ? '' : ' hide-all';?>"> <label><?php echo Lang::$word->CG_SMAILPATH;?></label> <input type="text" placeholder="<?php echo Lang::$word->CG_SMAILPATH;?>" value="<?php echo $this->data->sendmail;?>" name="sendmail"> </div> </div> <div class="showsmtp<?php echo ($this->data->mailer == "SMTP") ? '' : ' hide-all';?>"> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->CG_SMTP_HOST;?> <i class="icon asterisk"></i></label> <input type="text" placeholder="<?php echo Lang::$word->CG_SMTP_HOST;?>" value="<?php echo $this->data->smtp_host;?>" name="smtp_host"> </div> <div class="field five wide"> <label><?php echo Lang::$word->CG_SMTP_USER;?></label> <input type="text" placeholder="<?php echo Lang::$word->CG_SMTP_USER;?>" value="<?php echo $this->data->smtp_user;?>" name="smtp_user"> </div> </div> <div class="wojo fields"> <div class="field three wide"> <label><?php echo Lang::$word->CG_SMTP_PASS;?></label> <input type="text" placeholder="<?php echo Lang::$word->CG_SMTP_PASS;?>" value="<?php echo $this->data->smtp_pass;?>" name="smtp_pass"> </div> <div class="field three wide"> <label><?php echo Lang::$word->CG_SMTP_PORT;?></label> <input type="text" placeholder="<?php echo Lang::$word->CG_SMTP_PORT;?>" value="<?php echo $this->data->smtp_port;?>" name="smtp_port"> </div> <div class="field four wide"> <label><?php echo Lang::$word->CG_SMTP_SSL;?></label> <div class="wojo checkbox radio fitted inline"> <input name="is_ssl" type="radio" value="1" id="is_ssl_1" <?php Validator::getChecked($this->data->is_ssl, 1); ?>> <label for="is_ssl_1">SSL</label> </div> <div class="wojo checkbox radio fitted inline"> <input name="is_ssl" type="radio" value="0" id="is_ssl_0" <?php Validator::getChecked($this->data->is_ssl, 0); ?>> <label for="is_ssl_0">TSL</label> </div> </div> </div> </div> </div> <div class="center aligned"> <button type="button" data-action="processConfig" name="dosubmit" class="wojo primary button"><?php echo Lang::$word->CG_UPDATE;?></button> </div> </form> <script type="text/javascript"> // <![CDATA[ $(document).ready(function () { $('#mailerchange').change(function () { var val = $("#mailerchange option:selected").val(); if(val === "SMTP") { $('.showsmtp').show() ; $('.showsmail').hide(); } else { $('.showsmtp').hide() ; $('.showsmail').show(); } }); }); // ]]> </script><file_sep><?php /** * Trash * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: trash.tpl.php, v1.00 2020-02-05 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); if (!Auth::checkAcl("owner")) : print Message::msgError(Lang::$word->NOACCESS); return; endif; ?> <div class="row align middle gutters"> <div class="columns"> <h3><?php echo Lang::$word->TRS_TITLE;?></h3> <p class="wojo small text"><?php echo Lang::$word->TRS_INFO;?></p> </div> <?php if($this->data):?> <div class="columns auto"> <a data-set='{"option":[{"delete": "trashAll","title": "<?php echo Validator::sanitize(Lang::$word->TRS_TEMPTY, "chars");?>"}],"action":"delete", "parent":"#self","redirect":"<?php echo Url::url("/admin/trash");?>"}' class="wojo small negative button data"> <?php echo Lang::$word->TRS_TEMPTY;?> </a> </div> <?php endif;?> </div> <?php if(!$this->data):?> <div class="center aligned"><img src="<?php echo ADMINVIEW;?>/images/trash_empty.svg" alt="" class="wojo center big image"> <p class="wojo semi grey text"><?php echo Lang::$word->TRS_NOTRS;?></p> </div> <?php else:?> <?php foreach($this->data as $type => $rows):?> <?php switch($type): ?> <?php case "user":?> <table class="wojo small segment table"> <thead> <tr> <th colspan="2"><h5 class="basic"><?php echo Lang::$word->ADM_USERS;?></h5></th> </tr> </thead> <?php foreach($rows as $row):?> <?php $dataset = Utility::jSonToArray($row->dataset);?> <tr id="user_<?php echo $row->id;?>"> <td><?php echo $dataset->fname;?> <?php echo $dataset->lname;?></td> <td class="auto"><div class="wojo mini buttons"> <a data-set='{"option":[{"restore": "restoreUser","title": "<?php echo Validator::sanitize($dataset->fname . ' ' . $dataset->lname, "chars");?>","id": "<?php echo $row->id;?>"}],"action":"restore","subtext":"<?php echo Lang::$word->DELCONFIRM11;?>", "parent":"#user_<?php echo $row->id;?>"}' class="wojo positive button data"> <?php echo Lang::$word->RESTORE;?> </a> <a data-set='{"option":[{"delete": "deleteUser","title": "<?php echo Validator::sanitize($dataset->fname . ' ' . $dataset->lname, "chars");?>","id": "<?php echo $row->id;?>"}],"action":"delete", "parent":"#user_<?php echo $row->id;?>"}' class="wojo negative button data"> <?php echo Lang::$word->TRS_DELGOOD;?> </a> </div></td> </tr> <?php endforeach;?> <?php unset($dataset);?> </table> <?php break;?> <?php case "membership":?> <table class="wojo small segment table"> <thead> <tr> <th colspan="2"><h5 class="basic"><?php echo Lang::$word->ADM_MEMBS;?></h5></th> </tr> </thead> <?php foreach($rows as $row):?> <?php $dataset = Utility::jSonToArray($row->dataset);?> <tr id="membership_<?php echo $row->id;?>"> <td><?php echo $dataset->title;?></td> <td class="auto"><div class="wojo mini buttons"> <a data-set='{"option":[{"restore": "restoreMembership","title": "<?php echo Validator::sanitize($dataset->title, "chars");?>","id": "<?php echo $row->id;?>"}],"action":"restore","subtext":"<?php echo Lang::$word->DELCONFIRM11;?>", "parent":"#membership_<?php echo $row->id;?>"}' class="wojo positive button data"> <?php echo Lang::$word->RESTORE;?> </a> <a data-set='{"option":[{"delete": "deleteMembership","title": "<?php echo Validator::sanitize($dataset->title, "chars");?>","id": "<?php echo $row->id;?>"}],"action":"delete", "parent":"#membership_<?php echo $row->id;?>"}' class="wojo negative button data"> <?php echo Lang::$word->TRS_DELGOOD;?> </a> </div></td> </tr> <?php endforeach;?> <?php unset($dataset);?> </table> <?php break;?> <?php case "news":?> <table class="wojo small segment table"> <thead> <tr> <th colspan="2"><h5 class="basic"><?php echo Lang::$word->ADM_NEWS;?></h5></th> </tr> </thead> <?php foreach($rows as $row):?> <?php $dataset = Utility::jSonToArray($row->dataset);?> <tr id="news_<?php echo $row->id;?>"> <td><?php echo $dataset->title;?></td> <td class="auto"><div class="wojo mini buttons"> <a data-set='{"option":[{"restore": "restoreNews","title": "<?php echo Validator::sanitize($dataset->title, "chars");?>","id": "<?php echo $row->id;?>"}],"action":"restore","subtext":"<?php echo Lang::$word->DELCONFIRM11;?>", "parent":"#news_<?php echo $row->id;?>"}' class="wojo positive button data"> <?php echo Lang::$word->RESTORE;?> </a> <a data-set='{"option":[{"delete": "deleteNews","title": "<?php echo Validator::sanitize($dataset->title, "chars");?>","id": "<?php echo $row->id;?>"}],"action":"delete", "parent":"#news_<?php echo $row->id;?>"}' class="wojo negative button data"> <?php echo Lang::$word->TRS_DELGOOD;?> </a> </div></td> </tr> <?php endforeach;?> <?php unset($dataset);?> </table> <?php break;?> <?php case "coupon":?> <table class="wojo small segment table"> <thead> <tr> <th colspan="2"><h5 class="basic"><?php echo Lang::$word->ADM_COUPONS;?></h5></th> </tr> </thead> <?php foreach($rows as $row):?> <?php $dataset = Utility::jSonToArray($row->dataset);?> <tr id="coupon_<?php echo $row->id;?>"> <td><?php echo $dataset->title;?></td> <td class="auto"><div class="wojo mini buttons"> <a data-set='{"option":[{"restore": "restoreCoupon","title": "<?php echo Validator::sanitize($dataset->title, "chars");?>","id": "<?php echo $row->id;?>"}],"action":"restore","subtext":"<?php echo Lang::$word->DELCONFIRM11;?>", "parent":"#coupon_<?php echo $row->id;?>"}' class="wojo positive button data"> <?php echo Lang::$word->RESTORE;?> </a> <a data-set='{"option":[{"delete": "deleteCoupon","title": "<?php echo Validator::sanitize($dataset->title, "chars");?>","id": "<?php echo $row->id;?>"}],"action":"delete", "parent":"#coupon_<?php echo $row->id;?>"}' class="wojo negative button data"> <?php echo Lang::$word->TRS_DELGOOD;?> </a> </div></td> </tr> <?php endforeach;?> <?php unset($dataset);?> </table> <?php break;?> <?php break;?> <?php case "page":?> <table class="wojo small segment table"> <thead> <tr> <th colspan="2"><h5 class="basic"><?php echo Lang::$word->ADM_COUPONS;?></h5></th> </tr> </thead> <?php foreach($rows as $row):?> <?php $dataset = Utility::jSonToArray($row->dataset);?> <tr id="coupon_<?php echo $row->id;?>"> <td><?php echo $dataset->title;?></td> <td class="auto"><div class="wojo mini buttons"> <a data-set='{"option":[{"restore": "restorePage","title": "<?php echo Validator::sanitize($dataset->title, "chars");?>","id": "<?php echo $row->id;?>"}],"action":"restore","subtext":"<?php echo Lang::$word->DELCONFIRM11;?>", "parent":"#coupon_<?php echo $row->id;?>"}' class="wojo positive button data"> <?php echo Lang::$word->RESTORE;?> </a> <a data-set='{"option":[{"delete": "deletePage","title": "<?php echo Validator::sanitize($dataset->title, "chars");?>","id": "<?php echo $row->id;?>"}],"action":"delete", "parent":"#coupon_<?php echo $row->id;?>"}' class="wojo negative button data"> <?php echo Lang::$word->TRS_DELGOOD;?> </a> </div></td> </tr> <?php endforeach;?> <?php unset($dataset);?> </table> <?php break;?> <?php endswitch;?> <?php endforeach;?> <?php endif;?><file_sep><?php /** * Custom Fields * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: fields.tpl.php, v1.00 2020-02-05 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); if(!Auth::hasPrivileges('manage_fields')): print Message::msgError(Lang::$word->NOACCESS); return; endif; ?> <?php switch(Url::segment($this->segments)): case "edit": ?> <!-- Start edit --> <h2><?php echo Lang::$word->META_T16;?></h2> <form method="post" id="wojo_form" name="wojo_form"> <div class="wojo segment form"> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->NAME;?> <i class="icon asterisk"></i></label> <div class="wojo input"> <input type="text" placeholder="<?php echo Lang::$word->NAME;?>" value="<?php echo $this->data->title;?>" name="title"> </div> </div> <div class="field five wide"> <label><?php echo Lang::$word->CF_TIP;?></label> <div class="wojo input"> <input type="text" placeholder="<?php echo Lang::$word->CF_TIP;?>" value="<?php echo $this->data->tooltip;?>" name="tooltip"> </div> </div> </div> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->PUBLISHED;?></label> <div class="wojo checkbox radio inline"> <input name="active" type="radio" value="1" <?php Validator::getChecked($this->data->active, 1); ?> id="active_1"> <label for="active_1"><?php echo Lang::$word->YES;?></label> </div> <div class="wojo checkbox radio inline"> <input name="active" type="radio" value="0" <?php Validator::getChecked($this->data->active, 0); ?> id="active_0"> <label for="active_0"><?php echo Lang::$word->NO;?></label> </div> </div> <div class="field five wide"> <label><?php echo Lang::$word->CF_REQUIRED;?></label> <div class="wojo checkbox radio inline"> <input name="required" type="radio" value="1" <?php Validator::getChecked($this->data->required, 1); ?> id="required_1"> <label for="required_1"><?php echo Lang::$word->YES;?></label> </div> <div class="wojo checkbox radio inline"> <input name="required" type="radio" value="0" <?php Validator::getChecked($this->data->required, 0); ?> id="required_0"> <label for="required_0"><?php echo Lang::$word->NO;?></label> </div> </div> </div> <div class="center aligned"> <a href="<?php echo Url::url("/admin/fields");?>" class="wojo simple button"><?php echo Lang::$word->CANCEL;?></a> <button type="button" data-action="processField" name="dosubmit" class="wojo primary button"><?php echo Lang::$word->CF_UPDATE;?></button> </div> </div> <input type="hidden" name="id" value="<?php echo $this->data->id;?>"> </form> <?php break;?> <?php case "new": ?> <h2><?php echo Lang::$word->META_T17;?></h2> <form method="post" id="wojo_form" name="wojo_form"> <div class="wojo segment form"> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->NAME;?> <i class="icon asterisk"></i></label> <div class="wojo input"> <input type="text" placeholder="<?php echo Lang::$word->NAME;?>" name="title"> </div> </div> <div class="field five wide"> <label><?php echo Lang::$word->CF_TIP;?></label> <div class="wojo input"> <input type="text" placeholder="<?php echo Lang::$word->CF_TIP;?>" name="tooltip"> </div> </div> </div> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->PUBLISHED;?></label> <div class="wojo checkbox radio inline"> <input name="active" type="radio" value="1" id="active_1"> <label for="active_1"><?php echo Lang::$word->YES;?></label> </div> <div class="wojo checkbox radio inline"> <input name="active" type="radio" value="0" checked="checked" id="active_0"> <label for="active_0"><?php echo Lang::$word->NO;?></label> </div> </div> <div class="field five wide"> <label><?php echo Lang::$word->CF_REQUIRED;?></label> <div class="wojo checkbox radio inline"> <input name="required" type="radio" value="1" id="required_1"> <label for="required_1"><?php echo Lang::$word->YES;?></label> </div> <div class="wojo checkbox radio inline"> <input name="required" type="radio" value="0" checked="checked" id="required_0"> <label for="required_0"><?php echo Lang::$word->NO;?></label> </div> </div> </div> <div class="center aligned"> <a href="<?php echo Url::url("/admin/fields");?>" class="wojo simple button"><?php echo Lang::$word->CANCEL;?></a> <button type="button" data-action="processField" name="dosubmit" class="wojo primary button"><?php echo Lang::$word->CF_ADD;?></button> </div> </div> </form> <?php break;?> <?php default: ?> <div class="row gutters align middle"> <div class="columns mobile-100 phone-100"> <h2><?php echo Lang::$word->CF_TITLE;?></h2> <p class="wojo small text"><?php echo Lang::$word->CF_INFO;?></p> </div> <div class="columns auto mobile-100 phone-100"> <a href="<?php echo Url::url(Router::$path, "new/");?>" class="wojo small primary button stacked"><i class="icon plus alt"></i><?php echo Lang::$word->CF_ADD;?></a> </div> </div> <?php if(!$this->data):?> <div class="center aligned"><img src="<?php echo ADMINVIEW;?>/images/notfound.png" alt=""> <p class="wojo small demi caps text"><?php echo Lang::$word->CF_NOFIELDS;?></p> </div> <?php else:?> <div class="wojo cards screen-3 tablet-3 mobile-1" id="sortable"> <?php foreach ($this->data as $row):?> <div class="card" id="item_<?php echo $row->id;?>" data-id="<?php echo $row->id;?>"> <div class="header"> <div class="row"> <div class="columns"> <div class="wojo simple label"><i class="icon reorder link"></i></div> </div> <div class="columns auto"> <a data-set='{"option":[{"delete": "deleteField","title": "<?php echo Validator::sanitize($row->title, "chars");?>","id": <?php echo $row->id;?>}],"action":"delete","parent":"#item_<?php echo $row->id;?>"}' class="wojo negative small inverted icon button data"><i class="icon trash"></i></a> </div> </div> </div> <div class="content"> <h5 class="center aligned"><a href="<?php echo Url::url(Router::$path, "edit/" . $row->id);?>"><?php echo $row->title;?></a> </h5> </div> </div> <?php endforeach;?> </div> <?php endif;?> <script type="text/javascript" src="<?php echo SITEURL;?>/assets/sortable.js"></script> <script type="text/javascript"> // <![CDATA[ $(document).ready(function() { $("#sortable").sortable({ ghostClass: "ghost", handle: ".label", animation: 600, onUpdate: function(e) { var order = this.toArray(); $.ajax({ type: 'post', url: "<?php echo ADMINVIEW . '/helper.php';?>", dataType: 'json', data: { iaction: "sortFields", sorting: order } }); } }); }); // ]]> </script> <?php break;?> <?php endswitch;?><file_sep><?php /** * Register * * @package Wojo Framework * @author <EMAIL> * @copyright 2016 * @version $Id: register.tpl.php, v1.00 2016-01-08 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <div class="wojo-grid"> <div class="wojo raised auto segment"> <div class="row align middle gutters"> <div class="columns"> <h3><?php echo Lang::$word->M_SUB17;?></h3> </div> <div class="columns auto"> <a href="<?php echo Url::url('');?>" class="wojo primary button"><?php echo Lang::$word->M_SUB16;?></a> </div> </div> <form method="post" id="wojo_form" name="wojo_form"> <div class="wojo form"> <div class="wojo block fields"> <div class="field"> <label><?php echo Lang::$word->M_EMAIL;?> <i class="icon asterisk"></i></label> <input type="text" placeholder="<?php echo Lang::$word->M_EMAIL;?>" name="email"> </div> <div class="field"> <label><?php echo Lang::$word->M_PASSWORD;?> <i class="icon asterisk"></i></label> <input type="password" placeholder="<?php echo Lang::$word->M_PASSWORD;?>" name="password"> </div> </div> <div class="wojo fields"> <div class="field"> <label><?php echo Lang::$word->M_FNAME;?> <i class="icon asterisk"></i></label> <input type="text" placeholder="<?php echo Lang::$word->M_FNAME;?>" name="fname"> </div> <div class="field"> <label><?php echo Lang::$word->M_LNAME;?> <i class="icon asterisk"></i></label> <input type="text" placeholder="<?php echo Lang::$word->M_LNAME;?>" name="lname"> </div> </div> <?php echo $this->custom_fields;?> <?php if($this->core->enable_tax):?> <div class="wojo block fields"> <div class="field"> <input type="text" placeholder="<?php echo Lang::$word->M_ADDRESS;?>" name="address"> </div> <div class="field"> <input type="text" placeholder="<?php echo Lang::$word->M_CITY;?>" name="city"> </div> <div class="field"> <input type="text" placeholder="<?php echo Lang::$word->M_STATE;?>" name="state"> </div> <div class="field"> <input type="text" placeholder="<?php echo Lang::$word->M_ZIP;?>" name="zip"> </div> <div class="field"> <select name="country"> <?php echo Utility::loopOptions($this->clist, "abbr", "name");?> </select> </div> </div> <?php endif;?> <div class="wojo block fields"> <div class="field"> <div class="wojo labeled input"> <input name="captcha" placeholder="<?php echo Lang::$word->CAPTCHA;?>" type="text"> <div class="wojo simple label"><?php echo Session::captcha();?></div> </div> </div> </div> <div class="wojo block fields"> <div class="field"> <div class="wojo checkbox"> <input name="agree" type="checkbox" value="1" id="agree_1"> <label for="agree_1"><a href="<?php echo Url::url("/privacy");?>" target="_blank"><?php echo Lang::$word->AGREE;?></a> </label> </div> </div> </div> <button class="wojo fluid secondary button" data-action="register" name="dosubmit" type="button"><?php echo Lang::$word->M_SUB17;?></button> </div> </form> </div> </div><file_sep><?php /** * Language Manager * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: language.tpl.php, v1.00 2020-02-05 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); if(!Auth::hasPrivileges('manage_languages')): print Message::msgError(Lang::$word->NOACCESS); return; endif; ?> <h2><?php echo Lang::$word->META_T21;?></h2> <p class="wojo small text"><?php echo Lang::$word->LG_SUB2;?></p> <div class="wojo form"> <div class="row gutters align center"> <div class="columns screen-30 tablet-50 mobile-100 phone-100"> <div class="wojo icon input"> <input id="filter" type="text" placeholder="<?php echo Lang::$word->SEARCH;?>"> <i class="find icon"></i> </div> </div> <div class="columns screen-30 tablet-50 mobile-100 phone-100"> <select name="pgroup" id="pgroup" data-abbr="<?php echo Core::$language;?>"> <option data-type="all" value="all"><?php echo Lang::$word->LG_SUB4;?></option> <?php foreach($this->sections as $rows):?> <option data-type="filter" value="<?php echo $rows;?>"><?php echo $rows;?></option> <?php endforeach;?> <?php unset($rows);?> </select> </div> </div> </div> <div class="wojo segment"> <?php $i = 0;?> <div class="wojo small relaxed fluid celled list align middle" id="editable"> <?php foreach ($this->data as $pkey) :?> <?php $i++;?> <div class="item align middle"> <div class="content"><span data-editable="true" data-set='{"action": "editPhrase", "id": <?php echo $i;?>,"key":"<?php echo $pkey['data'];?>", "path":"lang"}'><?php echo $pkey;?></span></div> <div class="content auto phone-hide"><span class="wojo small dark inverted label"><?php echo $pkey['data'];?></span></div> </div> <?php endforeach;?> </div> </div> <script src="<?php echo ADMINVIEW;?>/js/language.js"></script> <script type="text/javascript"> // <![CDATA[ $(document).ready(function() { $.Language({ url: "<?php echo ADMINVIEW;?>", }); }); // ]]> </script> <file_sep><?php /** * User Manager * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: _users_edit.tpl.php, v1.00 2020-02-08 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <h2><?php echo Lang::$word->META_T3;?></h2> <form method="post" id="wojo_form" name="wojo_form"> <div class="wojo segment form"> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->M_FNAME;?> <i class="icon asterisk"></i></label> <input type="text" placeholder="<?php echo Lang::$word->M_FNAME;?>" value="<?php echo $this->data->fname;?>" name="fname"> </div> <div class="field five wide"> <label><?php echo Lang::$word->M_LNAME;?> <i class="icon asterisk"></i></label> <input type="text" placeholder="<?php echo Lang::$word->M_LNAME;?>" value="<?php echo $this->data->lname;?>" name="lname"> </div> </div> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->M_EMAIL;?> <i class="icon asterisk"></i></label> <input type="text" placeholder="<?php echo Lang::$word->M_EMAIL;?>" value="<?php echo $this->data->email;?>" name="email"> </div> <div class="field"> <label><?php echo Lang::$word->NEWPASS;?></label> <div class="wojo input icon"> <input type="text" name="password"> <i class="lock icon"></i> </div> </div> </div> <div class="wojo fields"> <div class="field three wide"> <label><?php echo Lang::$word->M_SUB8;?> </label> <select name="membership_id"> <option value="0">-/-</option> <?php echo Utility::loopOptions($this->mlist, "id", "title", $this->data->membership_id);?> </select> </div> <div class="field two wide"> <label><?php echo Lang::$word->M_SUB8;?> </label> <div class="wojo fitted inline toggle checkbox"> <input name="update_membership" type="checkbox" value="1" id="update_membership"> <label for="update_membership"><?php echo Lang::$word->YES;?></label> </div> </div> <div class="field three wide"> <label><?php echo Lang::$word->M_SUB15;?></label> <input placeholder="<?php echo Lang::$word->TO;?>" name="mem_expire" type="text" value="<?php echo Date::doDate("calendar", Date::NumberOfDays('+ 30 day'));?>" readonly class="datepick"> </div> <div class="field two wide"> <label><?php echo Lang::$word->M_SUB15;?></label> <div class="wojo fitted inline toggle checkbox"> <input name="extend_membership" type="checkbox" value="1" id="extend_membership"> <label for="extend_membership"><?php echo Lang::$word->YES;?></label> </div> </div> </div> <div class="wojo fields"> <div class="field five wide"> <label><?php echo Lang::$word->M_SUB23;?></label> <div class="wojo fitted inline checkbox"> <input name="add_trans" type="checkbox" value="1" id="add_trans"> <label for="add_trans"><?php echo Lang::$word->YES;?></label> </div> </div> </div> <div class="wojo simple segment"> <h5><?php echo Lang::$word->CSF_TITLE;?></h5> <?php echo $this->custom_fields;?></div> <div class="wojo fields align middle"> <div class="field four wide labeled"> <label><?php echo Lang::$word->M_ADDRESS;?></label> </div> <div class="field"> <input type="text" placeholder="<?php echo Lang::$word->M_ADDRESS;?>" value="<?php echo $this->data->address;?>" name="address"> </div> </div> <div class="wojo fields align middle"> <div class="field four wide labeled"> <label><?php echo Lang::$word->M_CITY;?></label> </div> <div class="field"> <input type="text" placeholder="<?php echo Lang::$word->M_CITY;?>" value="<?php echo $this->data->city;?>" name="city"> </div> </div> <div class="wojo fields align middle"> <div class="field four wide labeled"> <label><?php echo Lang::$word->M_STATE;?></label> </div> <div class="field"> <div class="wojo action input"> <input type="text" placeholder="<?php echo Lang::$word->M_STATE;?>" value="<?php echo $this->data->state;?>" name="state"> </div> </div> </div> <div class="wojo fields align middle"> <div class="field four wide labeled"> <label><?php echo Lang::$word->M_ZIP;?></label> </div> <div class="field"> <input type="text" placeholder="<?php echo Lang::$word->M_ZIP;?>" value="<?php echo $this->data->zip;?>" name="zip"> </div> </div> <div class="wojo fields align middle"> <div class="field four wide labeled"> <label><?php echo Lang::$word->M_COUNTRY;?></label> </div> <div class="field"> <select name="country"> <?php echo Utility::loopOptions($this->clist, "abbr", "name", $this->data->country);?> </select> </div> </div> <div class="wojo simple segment scrollbox h360"> <h5><?php echo Lang::$word->M_SUB26;?></h5> <?php if($this->userfiles):?> <div class="row grid small gutters screen-4 tablet-3 mobile-1 phone-1"> <?php foreach($this->userfiles as $file):?> <?php $is_checked = in_array($file->id, explode(",", $this->data->user_files)) ? ' checked="checked"' : null;?> <div class="columns"> <div class="wojo checkbox inline fitted"> <input type="checkbox" name="user_files[]" value="<?php echo $file->id;?>"<?php echo $is_checked;?> id="user_files_<?php echo $file->id;?>"> <label for="user_files_<?php echo $file->id;?>"><?php echo Validator::truncate($file->alias, 30);?></label> </div> </div> <?php endforeach;?> </div> <?php endif;?> </div> <div class="wojo fields"> <div class="field four wide"> <div class="field"> <label><?php echo Lang::$word->CREATED;?></label> <?php echo Date::doDate("long_date", $this->data->created);?> </div> <div class="field"> <label><?php echo Lang::$word->M_LASTLOGIN;?></label> <?php echo $this->data->lastlogin ? Date::doDate("long_date", $this->data->lastlogin) : Lang::$word->NEVER;?> </div> <div class="field"> <label><?php echo Lang::$word->M_LASTIP;?></label> <?php echo $this->data->lastip;?> </div> </div> <div class="field six wide"> <div class="field"> <label><?php echo Lang::$word->STATUS;?></label> <div class="wojo checkbox radio fitted inline"> <input name="active" type="radio" value="y" id="active_y" <?php Validator::getChecked($this->data->active, "y"); ?>> <label for="active_y"><?php echo Lang::$word->ACTIVE;?></label> </div> <div class="wojo checkbox radio fitted inline"> <input name="active" type="radio" value="n" id="active_n" <?php Validator::getChecked($this->data->active, "n"); ?>> <label for="active_n"><?php echo Lang::$word->INACTIVE;?></label> </div> <div class="wojo checkbox radio fitted inline"> <input name="active" type="radio" value="t" id="active_t" <?php Validator::getChecked($this->data->active, "t"); ?>> <label for="active_t"><?php echo Lang::$word->PENDING;?></label> </div> <div class="wojo checkbox radio fitted inline"> <input name="active" type="radio" value="b" id="active_b" <?php Validator::getChecked($this->data->active, "b"); ?>> <label for="active_b"><?php echo Lang::$word->BANNED;?></label> </div> </div> <div class="field"> <label><?php echo Lang::$word->M_SUB9;?></label> <div class="wojo checkbox radio fitted inline"> <input name="type" type="radio" value="staff" id="staff" <?php Validator::getChecked($this->data->type, "staff"); ?>> <label for="staff"><?php echo Lang::$word->STAFF;?></label> </div> <div class="wojo checkbox radio fitted inline"> <input name="type" type="radio" value="editor" id="editor" <?php Validator::getChecked($this->data->type, "editor"); ?>> <label for="editor"><?php echo Lang::$word->EDITOR;?></label> </div> <div class="wojo checkbox radio fitted inline"> <input name="type" type="radio" value="member" id="member" <?php Validator::getChecked($this->data->type, "member"); ?>> <label for="member"><?php echo Lang::$word->MEMBER;?></label> </div> </div> <div class="field"> <label><?php echo Lang::$word->M_SUB10;?></label> <div class="wojo checkbox radio fitted inline"> <input name="newsletter" type="radio" value="1" id="newsletter_1" <?php Validator::getChecked($this->data->newsletter, 1); ?>> <label for="newsletter_1"><?php echo Lang::$word->YES;?></label> </div> <div class="wojo checkbox radio fitted inline"> <input name="newsletter" type="radio" value="0" id="newsletter_0" <?php Validator::getChecked($this->data->newsletter, 0); ?>> <label for="newsletter_0"><?php echo Lang::$word->NO;?></label> </div> </div> </div> </div> <div class="wojo fields"> <div class="field"> <textarea placeholder="<?php echo Lang::$word->M_SUB11;?>" name="notes"><?php echo $this->data->notes;?></textarea> </div> </div> <div class="center aligned"> <a href="<?php echo Url::url("/admin/users");?>" class="wojo small simple button"><?php echo Lang::$word->CANCEL;?></a> <button type="button" data-action="processUser" name="dosubmit" class="wojo primary button"><?php echo Lang::$word->M_UPDATE;?></button> </div> </div> <input type="hidden" name="id" value="<?php echo $this->data->id;?>"> </form><file_sep>(function($) { "use strict"; $.Login = function(settings) { var config = { url: "frontview", surl: "siteurl", lang: { now: "Now", } }; if (settings) { $.extend(config, settings); } $("#backto").on('click', function() { $("#loginform").slideDown(); $("#passform").slideUp(); }); $("#passreset").on('click', function() { $("#loginform").slideUp(); $("#passform").slideDown(); }); $("#doSubmit").on('click', function() { var $btn = $(this); $btn.addClass('loading').prop("disabled", true); var username = $("input[name=username]").val(); var password = $("input[name=password]").val(); $.ajax({ type: 'post', url: config.url + "/controller.php", data: { 'action': 'adminLogin', 'username': username, 'password': <PASSWORD> }, dataType: "json", success: function(json) { if(json.type === "error") { $.wNotice(decodeURIComponent(json.message), { autoclose: 6000, type: json.type, title: json.title }); } else { window.location.href = config.surl + "/admin/"; } $btn.removeClass('loading').prop("disabled", false); } }); }); $("#dopass").on('click', function() { var $btn = $(this); $btn.addClass('loading'); var email = $("input[name=pEmail]").val(); $.ajax({ type: 'post', url: config.url + "/controller.php", data: { 'action': 'aResetPass', 'email': email, }, dataType: "json", success: function(json) { $.wNotice(decodeURIComponent(json.message), { autoclose: 6000, type: json.type, title: json.title }); if (json.type === "success") { $btn.prop("disabled", true); $("input[name=pEmail]").val(''); } $btn.removeClass('loading'); } }); }); }; })(jQuery);<file_sep><?php /** * Membership Manager * * @package Wojo Framework * @author <EMAIL> * @copyright 2016 * @version $Id: _memberships_history.tpl.php, v1.00 2016-07-08 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <div class="row"> <div class="columns"> <h3><?php echo Lang::$word->META_T9;?> <small>// <?php echo $this->data->title;?></small></h3> </div> <div class="columns auto"><a href="<?php echo ADMINVIEW . '/helper.php?action=exportMembershipPayments&amp;id=' . $this->data->id;?>" class="wojo small primary button"><?php echo Lang::$word->EXPORT;?></a></div> </div> <div class="wojo segment"> <div id="legend" class="wojo small horizontal list align-right"></div> <div id="payment_chart" class="h300"></div> </div> <?php if($this->plist):?> <div class="wojo segment"> <table class="wojo basic responsive table"> <thead> <tr> <th data-sort="string"><?php echo Lang::$word->USER;?></th> <th data-sort="int"><?php echo Lang::$word->TRX_AMOUNT;?></th> <th data-sort="int"><?php echo Lang::$word->TRX_TAX;?></th> <th data-sort="int"><?php echo Lang::$word->TRX_COUPON;?></th> <th data-sort="int"><?php echo Lang::$word->TRX_TOTAMT;?></th> <th data-sort="int"><?php echo Lang::$word->CREATED;?></th> </tr> </thead> <?php foreach ($this->plist as $row):?> <tr> <td><a class="inverted" href="<?php echo Url::url("/admin/users/edit", $row->user_id);?>"><?php echo $row->name;?></a></td> <td><?php echo $row->rate_amount;?></td> <td><?php echo $row->tax;?></td> <td><?php echo $row->coupon;?></td> <td><?php echo $row->total;?></td> <td data-sort-value="<?php echo strtotime($row->created);?>"><?php echo Date::doDate("short_date", $row->created);?></td> </tr> <?php endforeach;?> </table> <div class="wojo small primary passive inverted button"><?php echo Lang::$word->TRX_TOTAMT;?> <?php echo Utility::formatMoney(Stats::doArraySum($this->plist, "total"));?></div> </div> <div class="row gutters align middle"> <div class="columns auto mobile-100 phone-100"> <div class="wojo small thick text"><?php echo Lang::$word->TOTAL . ': ' . $this->pager->items_total;?> / <?php echo Lang::$word->CURPAGE . ': ' . $this->pager->current_page . ' '. Lang::$word->OF . ' ' . $this->pager->num_pages;?></div> </div> <div class="columns right aligned mobile-100 phone-100"><?php echo $this->pager->display_pages();?></div> </div> <?php endif;?> <script type="text/javascript" src="<?php echo SITEURL;?>/assets/morris.min.js"></script> <script type="text/javascript" src="<?php echo SITEURL;?>/assets/raphael.min.js"></script> <script type="text/javascript"> // <![CDATA[ $(document).ready(function() { $("#payment_chart").parent().addClass('loading'); $.ajax({ type: 'GET', url: "<?php echo ADMINVIEW . '/helper.php?action=getMembershipPaymentsChart&id=' . $this->data->id;?>&timerange=all", dataType: 'json' }).done(function(json) { var legend = ''; json.legend.map(function(val) { legend += val; }); $("#legend").html(legend); Morris.Line({ element: 'payment_chart', data: json.data, xkey: 'm', ykeys: json.label, labels: json.label, parseTime: false, lineWidth: 4, pointSize: 6, lineColors: json.color, gridTextColor: "rgba(0,0,0,0.6)", gridTextSize: 14, fillOpacity: '.75', hideHover: 'auto', preUnits: json.preUnits, smooth: true, resize: true, }); $("#payment_chart").parent().removeClass('loading'); }); }); // ]]> </script><file_sep><?php /** * Header * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: header.tpl.php, v1.00 2020-10-05 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <!DOCTYPE html> <head> <meta charset="utf-8"> <title><?php echo isset($this) ? $this->title : App::Core()->company;?></title> <?php if(isset($this->keywords)):?> <meta name="keywords" content="<?php echo $this->keywords;?>"> <meta name="description" content="<?php echo $this->description;?>"> <?php endif;?> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="apple-mobile-web-app-capable" content="yes"> <script type="text/javascript" src="<?php echo SITEURL;?>/assets/jquery.js"></script> <script type="text/javascript" src="<?php echo SITEURL;?>/assets/global.js"></script> <link href="<?php echo FRONTVIEW . '/cache/' . Cache::cssCache(array('base.css','transition.css','label.css','form.css','dropdown.css','input.css','button.css','message.css','image.css','list.css','table.css','icon.css','card.css','modal.css','editor.css','tooltip.css','menu.css','progress.css','utility.css','style.css'), FRONTBASE);?>" rel="stylesheet" type="text/css" /> </head> <body data-theme="<?php echo Session::cookieExists("MMPF_THEME", "dark") ? "dark" : "light";?>"> <header> <a id="nav" data-dropdown="#dropdown-aMenu" class="wojo icon button"><i class="icon reorder"></i></a> <div class="wojo small dropdown pointing top-right" id="dropdown-aMenu"> <?php if(App::Auth()->is_User()):?> <a href="<?php echo Url::url("/dashboard");?>" class="item"><i class="icon dashboard"></i><?php echo Lang::$word->ADM_DASH;?></a> <?php else:?> <a href="<?php echo Url::url('');?>" class="item"><i class="icon lock"></i><?php echo Lang::$word->M_SUB16;?></a> <a href="<?php echo Url::url("/register");?>" class="item"><i class="icon note"></i><?php echo Lang::$word->M_SUB17;?></a> <?php endif;?> <?php if($this->pages):?> <div class="divider"></div> <?php foreach($this->pages as $row):?> <a href="<?php echo Url::url("/page", $row->slug);?>" class="item"><?php echo $row->title;?></a> <?php endforeach;?> <?php endif;?> <div class="divider"></div> <a href="<?php echo Url::url("/packages");?>" class="item"><i class="icon membership"></i><?php echo Lang::$word->ADM_MEMBS;?></a> <a href="<?php echo Url::url("/contact");?>" class="item"><i class="icon email"></i><?php echo Lang::$word->CONTACT;?></a> <a href="<?php echo Url::url("/news");?>" class="item"><i class="icon news"></i><?php echo Lang::$word->ADM_NEWS;?></a> <div class="divider"></div> <a class="atheme-switch item" data-mode="<?php echo Session::cookieExists("MMPF_THEME", "dark") ? "dark" : "light";?>"><i class="icon contrast"></i><span><?php echo Session::cookieExists("MMPF_THEME", "dark") ? "Light" : "Dark";?></span></a> <?php if(App::Auth()->is_User()):?> <a href="<?php echo Url::url("/logout");?>" class="item"><i class="icon power"></i><?php echo Lang::$word->LOGOUT;?></a> <?php endif;?> </div> <div id="logo"> <a href="<?php echo SITEURL;?>/" class="logo"><?php echo ($this->core->logo) ? '<img src="' . SITEURL . '/uploads/' . $this->core->logo . '" alt="'. $this->core->company . '">': $this->core->company;?></a> </div> <div class="shape"> <svg preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg" width="100%" height="140px" viewBox="20 -20 300 100" xml:space="preserve"> <path d="M30.913 43.944s42.911-34.464 87.51-14.191c77.31 35.14 113.304-1.952 146.638-4.729 48.654-4.056 69.94 16.218 69.94 16.218v54.396H30.913V43.944z" class="wojo white fill" opacity=".4"/> <path d="M-35.667 44.628s42.91-34.463 87.51-14.191c77.31 35.141 113.304-1.952 146.639-4.729 48.653-4.055 69.939 16.218 69.939 16.218v54.396H-35.667V44.628z" class="wojo white fill" opacity=".4"/> <path d="M-34.667 62.998s56-45.667 120.316-27.839C167.484 57.842 197 41.332 232.286 30.428c53.07-16.399 104.047 36.903 104.047 36.903l1.333 36.667-372-2.954-.333-38.046z" class="wojo white fill"/> </svg> </div> </header> <main><file_sep><?php /** * Dashboard * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: dashboard.tpl.php, v1.00 2020-01-08 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <div class="center aligned"><img src="<?php echo UPLOADURL;?>/avatars/<?php echo (App::Auth()->avatar) ? App::Auth()->avatar : "blank.png";?>" alt="" class="avatar"></div> <div class="wojo-grid"> <div class="center aligned big margin bottom"> <div class="wojo stacked buttons"> <a class="wojo dark button passive"><?php echo Lang::$word->ADM_MEMBS;?></a> <a class="wojo secondary button" href="<?php echo Url::url("/dashboard/history");?>"><?php echo Lang::$word->HISTORY;?></a> <a class="wojo secondary button" href="<?php echo Url::url("/dashboard/profile");?>"><?php echo Lang::$word->M_SUB18;?></a> <a class="wojo secondary button" href="<?php echo Url::url("/dashboard/downloads");?>"><?php echo Lang::$word->DOWNLOADS;?></a> </div> </div> <?php if($this->data):?> <div class="wojo cards screen-3 tablet-2 mobile-1 phone-1 gutters"> <?php foreach($this->data as $row):?> <div class="card<?php echo $this->user->membership_id == $row->id ? ' active' : null;?>" id="item_<?php echo $row->id;?>"> <div class="content"> <?php if($row->thumb):?> <img src="<?php echo UPLOADURL;?>/memberships/<?php echo $row->thumb;?>" alt=""> <?php else:?> <img src="<?php echo UPLOADURL;?>/memberships/default.svg" alt=""> <?php endif;?> <h4 class="center aligned margin top"><?php echo Utility::formatMoney($row->price);?> <?php echo $row->title;?></h4> <p class="wojo small text"><?php echo Lang::$word->MEM_REC1;?> <?php echo ($row->recurring) ? Lang::$word->YES : Lang::$word->NO;?></p> <p class="wojo small text"><?php echo $row->days;?>@<?php echo Date::getPeriodReadable($row->period);?></p> <p class="wojo tiny text"><?php echo $row->description;?></p> <?php if($this->user->membership_id != $row->id):?> <p><a class="wojo small primary button add-cart" data-id="<?php echo $row->id;?>"><?php echo ($row->price <> 0) ? Lang::$word->M_SUB19 : Lang::$word->M_SUB20;?></a> </p> <?php endif;?> </div> </div> <?php endforeach;?> <?php unset($row);?> </div> <?php endif;?> <div id="mResult"></div> </div><file_sep><?php /** * Downloads * * @package Wojo Framework * @author <EMAIL> * @copyright 2016 * @version $Id: downloads.tpl.php, v1.00 2016-01-08 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <div class="center aligned"><img src="<?php echo UPLOADURL;?>/avatars/<?php echo (App::Auth()->avatar) ? App::Auth()->avatar : "blank.png";?>" alt="" class="avatar"></div> <div class="wojo-grid"> <div class="center aligned margin bottom"> <div class="wojo stacked buttons"> <a class="wojo secondary button" href="<?php echo Url::url("/dashboard");?>"><?php echo Lang::$word->ADM_MEMBS;?></a> <a class="wojo secondary button" href="<?php echo Url::url("/dashboard/history");?>"><?php echo Lang::$word->HISTORY;?></a> <a class="wojo secondary button" href="<?php echo Url::url("/dashboard/profile");?>"><?php echo Lang::$word->M_SUB18;?></a> <a class="wojo passive dark button"><?php echo Lang::$word->DOWNLOADS;?></a> </div> </div> <?php if(!$this->data and !$this->userfiles):?> <div class="center aligned"><img src="<?php echo ADMINVIEW;?>/images/notfound.png" alt=""> <p class="wojo small thick caps text"><?php echo Lang::$word->AD_NO_DOWN;?></p> </div> <?php else:?> <?php if($this->data):?> <p class="right aligned"><span class="wojo simple label"><?php echo count($this->data);?> <?php echo Lang::$word->FM_FILES;?></span></p> <div class="row gutters"> <?php foreach($this->data as $i => $row):?> <?php if(!($i % 2) && $i > 0):?> </div> <div class="row gutters"> <?php endif;?> <div class="columns screen-50 tablet-50 mobile-100 phone-100"> <div class="wojo fluid relaxed celled list"> <div class="item align middle"> <img src="<?php echo SITEURL;?>/assets/images/filetypes/<?php echo File::getFileType($row->name);?>" class="wojo small rounded shadow image"> <div class="columns"> <p class="header"><?php echo $row->alias;?></p> <span class="wojo small text"><?php echo Date::doDate("long_date", $row->created);?></span> <p class="wojo small text"><?php echo File::getSize($row->filesize);?> - <a href="<?php echo FRONTVIEW;?>/controller.php?token=<?php echo $row->token;?>"><?php echo Lang::$word->DOWNLOAD;?></a> </p> </div> </div> </div> </div> <?php endforeach;?> </div> <?php endif;?> <?php if($this->userfiles):?> <p class="right aligned"><span class="wojo simple label"><?php echo count($this->userfiles);?> <?php echo Lang::$word->FM_FILES;?></span></p> <div class="row gutters"> <?php foreach($this->userfiles as $i => $row):?> <?php if(!($i % 2) && $i > 0):?> </div> <div class="row gutters"> <?php endif;?> <div class="columns screen-50 tablet-50 mobile-100 phone-100"> <div class="wojo fluid relaxed celled list"> <div class="item align middle"> <img src="<?php echo SITEURL;?>/assets/images/filetypes/<?php echo File::getFileType($row->name);?>" class="wojo small rounded shadow image"> <div class="columns"> <p class="header"><?php echo $row->alias;?></p> <span class="wojo small text"><?php echo Date::doDate("long_date", $row->created);?></span> <p class="wojo small text"><?php echo File::getSize($row->filesize);?> - <a href="<?php echo FRONTVIEW;?>/controller.php?token=<?php echo $row->token;?>"><?php echo Lang::$word->DOWNLOAD;?></a> </p> </div> </div> </div> </div> <?php endforeach;?> </div> <?php endif;?> <?php endif;?> </div><file_sep><?php /** * Load File * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: loadFile.tpl.php, v1.00 2020-03-02 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); if(!$data) : Message::invalid("ID" . Filter::$id); return; endif; ?> <div class="columns" id="item_<?php echo $data->id;?>"> <div class="wojo attached card"> <div class="header divided"> <div class="wojo small bold text truncate"><?php echo $data->name;?></div> <p class="wojo small text"><?php echo Date::doDate("long_date", $data->created);?></p> </div> <div class="content"> <div class="wojo small fluid list"> <div class="item align middle"> <img src="<?php echo SITEURL;?>/assets/images/filetypes/<?php echo File::getFileType($data->name);?>" class="wojo small rounded shadow image"> <div class="columns"> <p class="header"><?php echo $data->alias;?></p> <p class="wojo tiny text"><?php echo File::getSize($data->filesize);?></p> </div> </div> </div> </div> <div class="footer divided"> <div class="row align middle"> <div class="columns"> <a data-set='{"option":[{"action":"renameFile","id": <?php echo $data->id;?>}], "label":"<?php echo Lang::$word->ASSIGN;?>", "url":"helper.php", "parent":"#item_<?php echo $data->id;?>", "complete":"replace", "modalclass":"normal"}' class="wojo small positive icon inverted button action"><i class="icon pencil"></i></a> <a data-set='{"option":[{"delete": "deleteFile","title": "<?php echo Validator::sanitize($data->alias, "chars");?>","id":<?php echo $data->id;?>,"name": "<?php echo $data->name;?>"}],"action":"delete", "parent":"#item_<?php echo $data->id;?>"}' class="wojo small negative icon inverted button data"><i class="icon close"></i></a> </div> <div class="columns auto"> <span class="wojo small light inverted static icon button"><?php echo($data->fileaccess > 0 ? '<i class="icon positive check"></i>' : '<i class="icon negative minus"></i>');?></span> </div> </div> </div> </div> </div><file_sep><?php /** * News * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: news.tpl.php, v1.00 2019-05-05 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <div class="wojo-grid"> <div class="wojo raised segment"> <h2><?php echo Lang::$word->NW_TITLE1;?></h2> <?php if($this->data):?> <?php foreach ($this->data as $row):?> <div class="wojo basic card" id="item_<?php echo $row->id;?>"> <div class="header"> <div class="row horizontal gutters"> <div class="columns auto align middle"><i class="icon huge disabled news"></i></div> <div class="columns"> <p class="wojo black small text"><?php echo Date::doDate("short_date", $row->created);?></p> <?php echo $row->title;?> <p><small><?php echo Lang::$word->BY;?>: <?php echo $row->author;?></small></p> </div> </div> </div> <div class="content"> <?php echo str_replace("[SITEURL]", SITEURL, $row->body);?> </div> </div> <?php endforeach;?> <?php endif;?> </div> </div><file_sep><?php /** * Index * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: index.tpl.php, v1.00 2020-03-05 10:12:05 gewa Exp $ */ if (!defined("_WOJO")) die('Direct access to this location is not allowed.'); ?> <h2><?php echo Lang::$word->META_T27;?></h2> <div class="row gutters"> <div class="columns screen-25 tablet-50 mobile-50 phone-100"> <div class="wojo basic segment"> <div class="center aligned"><span class="wojo positive massive text"><?php echo $this->counters[0];?></span></div> <div class="center aligned wojo positive text"><?php echo Lang::$word->AD_RUSER;?></div> </div> </div> <div class="columns screen-25 tablet-50 mobile-50 phone-100"> <div class="wojo basic segment"> <div class="center aligned"><span class="wojo secondary massive text"><?php echo $this->counters[1];?></span></div> <div class="center aligned wojo secondary text"><?php echo Lang::$word->AD_AUSER;?></div> </div> </div> <div class="columns screen-25 tablet-50 mobile-50 phone-100"> <div class="wojo basic segment"> <div class="center aligned"><span class="wojo negative massive text"><?php echo $this->counters[2];?></span></div> <div class="center aligned wojo negative text"><?php echo Lang::$word->AD_PUSER;?></div> </div> </div> <div class="columns screen-25 tablet-50 mobile-50 phone-100"> <div class="wojo basic segment"> <div class="center aligned"><span class="wojo primary massive text"><?php echo $this->counters[3];?></span></div> <div class="center aligned wojo primary text"><?php echo Lang::$word->AD_AMEM;?></div> </div> </div> </div> <?php if(Auth::checkAcl("owner")):?> <h4><?php echo Lang::$word->AD_TYEAR;?></h4> <div class="row gutters align bottom"> <div class="columns screen-80 tablet-70 mobile-100 phone-100"> <div id="legend" class="wojo small horizontal list"></div> <div id="payment_chart" class="wojo segment h360"></div> </div> <div class="columns screen-20 tablet-30 mobile-100 phone-100"> <div class="wojo basic segment"> <div class="small padding"> <p class="wojo semi text"><?php echo Utility::formatMoney($this->stats['totalsum']);?></p> <div id="chart1" data-values="<?php echo $this->stats['amount_str'];?>"></div> </div> </div> <div class="wojo basic segment"> <div class="small padding"> <p class="wojo semi text"><?php echo $this->stats['totalsales'];?> <?php echo Lang::$word->TRX_SALES;?></p> <div id="chart2" data-values="<?php echo $this->stats['sales_str'];?>"></div> </div> </div> </div> </div> <h4><?php echo Lang::$word->TRX_POPMEM;?></h4> <div id="legend2" class="wojo small horizontal list align-right"></div> <div id="payment_chart2" class="wojo segment h360"></div> <?php endif;?> <?php if(Auth::checkAcl("owner")):?> <script type="text/javascript" src="<?php echo SITEURL;?>/assets/morris.min.js"></script> <script type="text/javascript" src="<?php echo SITEURL;?>/assets/raphael.min.js"></script> <script type="text/javascript" src="<?php echo SITEURL;?>/assets/sparkline.min.js"></script> <script src="<?php echo ADMINVIEW;?>/js/index.js"></script> <script type="text/javascript"> // <![CDATA[ $(document).ready(function() { $.Index({ url: "<?php echo ADMINVIEW;?>", }); }); // ]]> </script> <?php endif;?><file_sep><?php /** * Helper * * @package Wojo Framework * @author <EMAIL> * @copyright 2020 * @version $Id: helper.php, v1.00 2020-02-05 10:12:05 gewa Exp $ */ define("_WOJO", true); require_once("../../init.php"); if (!App::Auth()->is_Admin()) exit; $gAction = Validator::get('action'); $pAction = Validator::post('action'); $iAction = Validator::post('iaction'); $title = Validator::post('title') ? Validator::sanitize($_POST['title']) : null; /* == GET Actions == */ switch ($gAction) : /* == Edit Role == */ case "editRole": $tpl = App::View(BASEPATH . 'view/admin/snippets/'); $tpl->data = Db::run()->first(Users::rTable, null, array('id' => Filter::$id)); $tpl->template = 'editRole.tpl.php'; echo $tpl->render(); break; /* == Load Language Section == */ case "languageSection": $xmlel = simplexml_load_file(BASEPATH . Lang::langdir . Core::$language . ".lang.xml"); $section = $xmlel->xpath('/language/phrase[@section="' . Validator::sanitize($_GET['section']) . '"]'); $tpl = App::View(BASEPATH . 'view/admin/snippets/'); $tpl->xmlel = $xmlel; $tpl->section = $section; $tpl->template = 'loadLanguageSection.tpl.php'; $json['html'] = $tpl->render(); print json_encode($json); break; /* == All Sales Chart == */ case "getSalesChart": $data = Stats::getAllSalesStats(); print json_encode($data); break; /* == All Sales Export == */ case "exportAllTransactions": header("Pragma: no-cache"); header('Content-Type: text/csv; charset=utf-8'); header('Content-Disposition: attachment; filename=AllPayments.csv'); $data = fopen('php://output', 'w'); fputcsv($data, array('TXN ID', 'Item', 'User', 'Amount', 'TAX/VAT', 'Coupon', 'Total Amount', 'Currency', 'Processor', 'Created')); $result = Stats::exportAllTransactions(); if($result): foreach ($result as $row) : fputcsv($data, $row); endforeach; endif; break; /* == Export Users == */ case "exportUsers": header("Pragma: no-cache"); header('Content-Type: text/csv; charset=utf-8'); header('Content-Disposition: attachment; filename=UserList.csv'); $data = fopen('php://output', 'w'); fputcsv($data, array('Name', 'Membership', 'Expire', 'Email', 'Newsletter', 'Created')); $result = Stats::exportUsers(); if($result): foreach ($result as $row) : fputcsv($data, $row); endforeach; endif; break; /* == Export User Payments == */ case "exportUserPayments": header("Pragma: no-cache"); header('Content-Type: text/csv; charset=utf-8'); header('Content-Disposition: attachment; filename=UserPayments.csv'); $data = fopen('php://output', 'w'); fputcsv($data, array('TXN ID', 'Name', 'Amount', 'TAX/VAT', 'Coupon', 'Total Amount', 'Currency', 'Processor', 'Created')); $result = Stats::exportUserPayments(Filter::$id); if($result): foreach ($result as $row) : fputcsv($data, $row); endforeach; endif; break; /* == User Payments Chart == */ case "getUserPaymentsChart": $data = Stats::getUserPaymentsChart(Filter::$id); print json_encode($data); break; /* == Rename File == */ case "renameFile": $tpl = App::View(BASEPATH . 'view/admin/snippets/'); $tpl->template = 'renameFile.tpl.php'; $tpl->data = Db::run()->first(Content::fTable, null, array('id' => Filter::$id)); $tpl->mlist = App::Membership()->getMembershipList(); echo $tpl->render(); break; /* == Membership Payments Chart == */ case "getMembershipPaymentsChart": $data = Stats::getMembershipPaymentsChart(Filter::$id); print json_encode($data); break; /* == Export Membership Payments == */ case "exportMembershipPayments": header("Pragma: no-cache"); header('Content-Type: text/csv; charset=utf-8'); header('Content-Disposition: attachment; filename=MembershipPayments.csv'); $data = fopen('php://output', 'w'); fputcsv($data, array('TXN ID', 'User', 'Amount', 'TAX/VAT', 'Coupon', 'Total Amount', 'Currency', 'Processor', 'Created')); $result = Stats::exportMembershipPayments(Filter::$id); if($result): foreach ($result as $row) : fputcsv($data, $row); endforeach; endif; break; /* == Index Payments Chart == */ case "getIndexStats": $data = Stats::indexSalesStats(); print json_encode($data); break; /* == Main Stats == */ case "getMainStats": $data = Stats::getMainStats(); print json_encode($data); break; /* == Resend Notification == */ case "resendNotification": $tpl = App::View(BASEPATH . 'view/admin/snippets/'); $tpl->template = 'resendNotification.tpl.php'; $tpl->data = Db::run()->first(Users::mTable, array("id", "email", "CONCAT(fname,' ',lname) as name"), array('id' => Filter::$id)); echo $tpl->render(); break; endswitch; /* == Post Actions == */ switch ($pAction) : /* == Update Role Description == */ case "editRole": App::Users()->updateRoleDescription(); break; /* == Chnage Role == */ case "changeRole": if(Auth::checkAcl("owner")): Db::run()->update(Users::rpTable, array("active" => intval($_POST['active'])), array("id" => Filter::$id)); endif; break; /* == Update Language Phrase == */ case "editPhrase": if (file_exists(BASEPATH . Lang::langdir . Core::$language . ".lang.xml")): $xmlel = simplexml_load_file(BASEPATH . Lang::langdir . Core::$language . ".lang.xml"); $node = $xmlel->xpath("/language/phrase[@data = '" . $_POST['key'] . "']"); $node[0][0] = $title; $xmlel->asXML(BASEPATH . Lang::langdir . Core::$language . ".lang.xml"); $json['title'] = $title; print json_encode($json); endif; break; /* == Update Country Tax == */ case "editTax": if (empty($_POST['title'])): print '0.000'; exit; endif; $data['vat'] = Validator::sanitize($_POST['title'], "float"); Db::run()->update(Content::cTable, $data, array('id' => Filter::$id)); $json['title'] = $title; print json_encode($json); break; /* == Chnage Cooupon Status == */ case "couponStatus": Db::run()->update(Content::dcTable, array("active" => intval($_POST['active'])), array("id" => Filter::$id)); break; /* == Chnage Gateway Status == */ case "gatewayStatus": if(Auth::checkAcl("owner")): Db::run()->update(Admin::gTable, array("active" => intval($_POST['active'])), array("id" => Filter::$id)); endif; break; /* == Rename File == */ case "renameFile": App::Content()->renameFile(); break; /* == Process Notification == */ case "resendNotification": App::Users()->resendNotification(); break; endswitch; /* == Instant Actions == */ switch ($iAction) : /* == Database Backup == */ case "databaseBackup": dbTools::doBackup(); break; /* == Sort Custom Fields == */ case "sortFields": $i = 0; $query = "UPDATE `" . Content::cfTable . "` SET `sorting` = CASE "; $idlist = ''; foreach ($_POST['sorting'] as $item): $i++; $query .= " WHEN id = " . $item . " THEN " . $i . " "; $idlist .= $item . ','; endforeach; $idlist = substr($idlist, 0, -1); $query .= " END WHERE id IN (" . $idlist . ")"; Db::run()->pdoQuery($query); break; /* == File Upload == */ case "fileUpload": if (!empty($_FILES['file']['name'])): $upl = Upload::instance(Content::FS, Content::FE); $upl->process("file", App::Core()->file_dir, 'SOURCE_'); if (empty(Message::$msgs)): $data = array( 'alias' => $upl->fileInfo['name'], 'name' => $upl->fileInfo['fname'], 'filesize' => $upl->fileInfo['size'], 'extension' => $upl->fileInfo['ext'], 'type' => $upl->fileInfo['type_short'], 'token' => Utility::randomString(16), 'fileaccess' => 0, ); $last_id = Db::run()->insert(Content::fTable, $data)->getLastInsertId(); $row = Db::run()->first(Content::fTable, null, array('id' => $last_id)); $json['status'] = "success"; $json['filename'] = $data['name']; $json['type'] = File::getFileType($data['name']); $json['id'] = $last_id; $json['html'] = Utility::getSnippets(ADMINBASE . "/snippets/loadFile.tpl.php", $data = $row); else: $json['type'] = "error"; $json['message'] = Message::$msgs['name']; endif; print json_encode($json); endif; break; endswitch; /* == Clear Session Temp Queries == */ if (isset($_GET['ClearSessionQueries'])): App::Session()->remove('debug-queries'); App::Session()->remove('debug-warnings'); App::Session()->remove('debug-errors'); print 1; endif;
c3e85d040996c52d456ff2016d4bb20ce58f570b
[ "JavaScript", "PHP" ]
42
JavaScript
Jidenna/Prepare-and-Host-your-Membership-Manager-Application
4cce0e8746e8353917f550b878697f2e70f42f38
84ee80446663e095c435f25eb235bff9ea8cb619
refs/heads/master
<repo_name>jtc10/portfolio<file_sep>/script.js const ul = document.getElementsByTagName('ul'); const button = document.getElementsByClassName('scroll'); // Smooth Scroll function smoothScroll(target, duration) { let targetSection = document.querySelector(target); //console.log('targetSection: ' + targetSection); let targetPosition = targetSection.getBoundingClientRect().top; //console.log('targetPosition: ' + targetPosition); let startPosition = window.pageYOffset; //console.log('startPosition: ' + startPosition); // let distance = targetPosition - startPosition; // console.log('distance: ' + distance); let startTime = null; function animation(currentTime) { if (startTime === null) startTime = currentTime; let timeElapsed = currentTime - startTime; const run = ease(timeElapsed, startPosition, targetPosition, duration); window.scrollTo(0, run); if (timeElapsed < duration) requestAnimationFrame(animation); } function ease(t, b, c, d) { t /= d / 2 ; if (t < 1) return c / 2 * t * t + b; t--; return -c / 2 * (t * (t - 2) - 1) + b; } requestAnimationFrame(animation); } ul[0].addEventListener('click', function (e) { let target = ''; if (e.target && e.target.className == 'about') { target = '.about-section'; smoothScroll(target, 1000); }else if (e.target && e.target.className == 'portfolio') { target = '.portfolio-section'; smoothScroll(target, 1000); }else if (e.target && e.target.className == 'contact') { target = '.contact-section'; smoothScroll(target, 1000); } }); button[0].addEventListener('click', function () { let target = '.about-section'; smoothScroll(target, 1000); }); button[1].addEventListener('click', function () { let target = '.portfolio-section'; smoothScroll(target, 1000); }); button[2].addEventListener('click', function () { let target = '.contact-section'; smoothScroll(target, 1000); });
49f36912100242f0cd10528cb67b2c72b386ed17
[ "JavaScript" ]
1
JavaScript
jtc10/portfolio
7a8915365498e5f8e1948b4e952498b7c4d54e1a
3f1587fc414b8d4b2c6b91020a0581fe6958606f
refs/heads/master
<repo_name>shirireddy/task2<file_sep>/Calaculator/CalciTestCase.java /* * Test cases for Calcli */ class CalcliTestCase{ public void testOperation() { Calculator c = new Calculator(); assertEquals(25, c.Operation(13,12,"Addition")); assertEquals(10, c.Operation(12,2,"Subtraction")); assertEquals(16, c.Operation(8,2,"Multiplication")); } }<file_sep>/SimpleCompoundInterest/SimpleCompoundInterestTest.java /** * * @author <NAME> * */ public class SimpleCompoundInterestTestCase { @Test public void TestCaseSimpleInterest() { SimpleCompoundInterest simplecompoundinterest; simpleInterest = new SimpleCompoundInterest(50500, 3.8f, 2); assertEquals(3838, simpleInterest.SimpleInterest()); simpleInterest = new SimpleCompoundInterest(50500, 2.7f, 5); assertEquals(6817.5, simpleInterest.SimpleInterest()); } @Test void TestCaseCompoundIntrest() { SimpleCompoundInterest compoundInterest; compoundInterest = new SimpleCompoundInterest(10000, 1.5f, 5); assertEquals(1077.28, compoundInterest.CompoundInterest()); compoundInterest = new SimpleCompoundInterest(25000, 2.5f, 5); assertEquals(2828.52, compoundInterest.CompoundInterest()); } }
c3b292de32f2ebe077f8700b45b97d1ab3998ef1
[ "Java" ]
2
Java
shirireddy/task2
5652cd7d3239d99aa6008e31022cb0ffdc51611d
bc514bde0b4c9e7280890b775e5af4360a89918a
refs/heads/master
<file_sep># A-frame Experiment 3: OBD2 Car Data Visualization ## Description Visualizing car telemetrics data in 3D via A-frame, recorded with [OBD Fusion](https://www.obdsoftware.net/software/obdfusion). NOTE: work in progress. <hr> ## Installation To install the Node dependencies: > npm install ## Development To serve the site from webpack-dev-server with live updates: > npm run dev ## Build To build source files: > npm run build ## Run To run on a simple express server after build: > npm run start ## Demo Live demo [https://exactlyallan.github.io/obdViz/](https://exactlyallan.github.io/obdViz/) ## License This program is free software and is distributed under an [MIT License](LICENSE). <file_sep>// Data parser // For data generated by OBD fusion app // https://www.obdsoftware.net/software/obdfusion // Load Data file via http://papaparse.com/ var Papa = require('papaparse') // Papa parse file var papaFile = function(input, callback) { // if file selected if (input.files.length > 0) { //var status = document.querySelector('.chrom-stats') //status.innerHTML = "Loading Data..." Papa.parse(input.files[0], { delimiter: "", // auto-detect newline: "", // auto-detect quoteChar: '"', comments: "#", dynamicTyping: true, // get ints etc header: false, // easier to parse array skipEmptyLines: true, error: function(err, file, inputElem, reason) { console.log("File loading error:", err, reason) callback( null ) }, complete: function(results) { console.log("File loaded: ", results); callback( results ) } }) } } // Map parsed results to array useable for viz var parseDatafile = function(rawData) { // if error if(rawData === null){ return (null) }2 // data var dataObj = {} // data max and min concurrently // PSA: 65536 args https://bugs.webkit.org/show_bug.cgi?id=80797 var dataObjMaxMin = {} // collect headers and remove white space var headerAry = rawData.data[0].map((d,i)=>{ return(d.trim()) }) // add keys dataObj.headers = headerAry; for(var j=0; j<headerAry.length; j++){ dataObj[headerAry[j]] = []; dataObjMaxMin[headerAry[j]] = {max:0, min:0} } // collect data, loop through each row skipping first header row for(var i=1; i<rawData.data.length; i++){ // loop through each col, checking for max and min for(var k=0; k<headerAry.length; k++){ dataObjMaxMin[headerAry[k]].max = Math.max(dataObjMaxMin[headerAry[k]].max, rawData.data[i][k]) dataObjMaxMin[headerAry[k]].min = Math.min(dataObjMaxMin[headerAry[k]].min, rawData.data[i][k]) dataObj[headerAry[k]].push(rawData.data[i][k]) } } return ({data:dataObj, maxmin:dataObjMaxMin}) } // export module.exports = { papaFile: papaFile, parseDatafile: parseDatafile } <file_sep> AFRAME.registerComponent('data-line-component', { schema: { index: { type: 'int' }, name: { type: 'string' }, dataRow: { type: 'array' }, lat: { type: 'array' }, long: { type: 'array' }, max: { type: 'number' }, min: { type: 'number' } }, multiple: true, init: function() { console.log("data-line-component init...") }, update: function() { el = this.el data = this.data console.log("data:", data) var vectors = [] var valueScale = 10; var latBase = data.dataRow[1] var longBase = data.dataRow[1] for(var i=0; i<data.dataRow.length; i++){ var x = data.lat[i] - latBase // offset to 0 var z = data.long[i] - longBase // offset to 0 var y = (( data.dataRow[i] - data.min ) / ( data.max - data.min )) * valueScale // normalized vectors.push(new THREE.Vector3(x, y, z)) } console.log(vectors) var path = new THREE.CatmullRomCurve3(vectors); var geometry = new THREE.TubeBufferGeometry( path, 900, 1, 2, false ); var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); var mesh = new THREE.Mesh( geometry, material ); el.setObject3D('line-'+name, mesh) } });
0bacbb5cb26e0cf286f5f09fbcd0b6d16644eda0
[ "Markdown", "JavaScript" ]
3
Markdown
exactlyallan/obdViz
a57ddc74c2a81f3d17975c65586ed12686924a9e
dbe0decfaa5330c89d8d4aba1fc0ce8928116a55
refs/heads/master
<file_sep>package com.meetdesk.view; import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.View; /** * Created by ekobudiarto on 12/4/16. */ public class UIViewPager extends ViewPager { private static final int MATCH_PARENT = 1073742592; private int currentPageNumber; private int pageCount; public UIViewPager(Context context) { super(context); prepareUI(); } public UIViewPager(Context context, AttributeSet attrs) { super(context, attrs); prepareUI(); } private void prepareUI() { setOffscreenPageLimit(pageCount); } @Override protected void onScrollChanged(int l, int t, int oldl, int oldt) { super.onScrollChanged(l, t, oldl, oldt); getParent().requestDisallowInterceptTouchEvent(true); } @Override protected void onPageScrolled(int position, float offset, int offsetPixels) { super.onPageScrolled(position, offset, offsetPixels); getParent().requestDisallowInterceptTouchEvent(true); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int height = 0; if (getChildCount() != 0) { View child = getChildAt(currentPageNumber); child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); int h = child.getMeasuredHeight(); if (h > height) height = h; } heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY); super.onMeasure(widthMeasureSpec, heightMeasureSpec); } public void onPrevPage() { measure(MATCH_PARENT, 0); } public void onNextPage() { measure(MATCH_PARENT, 0); } } <file_sep>package com.meetdesk; import android.content.Intent; import android.graphics.Bitmap; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.Toast; import com.facebook.login.LoginManager; import com.google.android.gms.auth.api.Auth; import com.meetdesk.activity.ActivityAuth; import com.meetdesk.external.jeremyfeinstein.slidingmenu.lib.SlidingMenu; import com.meetdesk.external.uil.core.assist.FailReason; import com.meetdesk.external.uil.core.listener.ImageLoadingListener; import com.meetdesk.fragment.FragmentHelp; import com.meetdesk.fragment.FragmentHotlist; import com.meetdesk.fragment.FragmentInbox; import com.meetdesk.fragment.FragmentProfile; import com.meetdesk.fragment.FragmentRequestMerchant; import com.meetdesk.fragment.FragmentTransaction; import com.meetdesk.fragment.FragmentWishList; import com.meetdesk.helper.HelperGeneral; import com.meetdesk.helper.HelperNative; import com.meetdesk.model.PrefAuthentication; import com.meetdesk.util.LazyImageLoader; import com.meetdesk.util.RecyclerViewItemDecoration; import com.meetdesk.view.UICircleImage; import com.meetdesk.view.UIText; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class BaseActivity extends FragmentActivity implements HelperGeneral.FragmentInterface{ SlidingMenu menu; boolean isShowMenu = true; ImageButton imagebuttonSlidemenuClose; UIText textFullname, textEmail; UICircleImage circleImageAvatar; RecyclerView recyclerViewMenu; ArrayList<String> dataID, dataTitle, dataIcon; SlidemenuAdapter adapter; LazyImageLoader imageLoader; UIText slidemenuFullname, slidemenuEmail; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_base); } @Override protected void onStart() { super.onStart(); initMenu(); initGeneral(); setupSlidemenu(); filldata(); } @Override public void onNavigate(BaseFragment fragmentSrc, Map<String, String> parameter) { } private void initGeneral() { dataID = new ArrayList<String>(); dataTitle = new ArrayList<String>(); dataIcon = new ArrayList<String>(); adapter = new SlidemenuAdapter(); imageLoader = new LazyImageLoader(BaseActivity.this); final PrefAuthentication authPref = new PrefAuthentication(BaseActivity.this); imagebuttonSlidemenuClose = (ImageButton) findViewById(R.id.slidemenu_close); textFullname = (UIText) findViewById(R.id.slidemenu_fullname); textEmail = (UIText) findViewById(R.id.slidemenu_email); circleImageAvatar = (UICircleImage) findViewById(R.id.slidemenu_avatar); recyclerViewMenu = (RecyclerView) findViewById(R.id.recyclerview_menu); slidemenuFullname = (UIText) findViewById(R.id.slidemenu_fullname); slidemenuEmail = (UIText) findViewById(R.id.slidemenu_email); imagebuttonSlidemenuClose.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { toggleMenu(); } }); slidemenuFullname.setText(authPref.getKeyUserFullname()); slidemenuEmail.setText(authPref.getKeyUserEmail()); String filename = authPref.getKeyUserAvatar(); if(!authPref.getKeyUserSource().equals("general")) { filename = authPref.getKeyUserAvatar().substring(authPref.getKeyUserAvatar().lastIndexOf("/")+1); } if(!HelperGeneral.checkInternalFile(filename, BaseActivity.this)) { String imageURL = HelperNative.getURL(11171) + authPref.getKeyUserAvatar(); if(!authPref.getKeyUserSource().equals("general")) { imageURL = authPref.getKeyUserAvatar(); } final String finalFilename = filename; imageLoader.showImage(imageURL, circleImageAvatar, new ImageLoadingListener() { @Override public void onLoadingStarted(String imageUri, View view) { } @Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { } @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { HelperGeneral.saveBitmapInternal(finalFilename, BaseActivity.this, loadedImage); circleImageAvatar.setImageBitmap(loadedImage); } @Override public void onLoadingCancelled(String imageUri, View view) { } }); } if(HelperGeneral.checkInternalFile(filename, BaseActivity.this)) { imageLoader.showImage(HelperGeneral.getPrivatePath(filename, BaseActivity.this), circleImageAvatar); } } private void initMenu() { menu = new SlidingMenu(this); menu.setMode(SlidingMenu.SLIDING_WINDOW); menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN); menu.setShadowWidthRes(R.dimen.slidemenu_shadow); menu.setShadowDrawable(R.drawable.slidemenu_shadow); menu.setBehindOffsetRes(R.dimen.slidemenu_offset); menu.setFadeDegree(0.35f); menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT); menu.setMenu(R.layout.slidemenu_item); menu.setSlidingEnabled(isShowMenu); menu.bringToFront(); } public void setShowMenu(boolean show) { this.isShowMenu = show; } public void toggleMenu() { menu.toggle(true); } private void setupSlidemenu() { RecyclerViewItemDecoration decoration = new RecyclerViewItemDecoration(5); final LinearLayoutManager recycleLayoutManager = new LinearLayoutManager(getApplicationContext()); recyclerViewMenu.setLayoutManager(recycleLayoutManager); recyclerViewMenu.setItemAnimator(new DefaultItemAnimator()); recyclerViewMenu.setAdapter(adapter); recyclerViewMenu.addOnItemTouchListener(new HelperGeneral.RecyclerTouchListener(getApplicationContext(), recyclerViewMenu, new HelperGeneral.ClickListener() { @Override public void onClick(View view, int position) { if (dataID.get(position).equals("6")) { Map<String, String> param = new HashMap<String, String>(); FragmentTransaction transaction = new FragmentTransaction(); onNavigate(transaction, param); } if (dataID.get(position).equals("7")) { Map<String, String> param = new HashMap<String, String>(); FragmentProfile profile = new FragmentProfile(); onNavigate(profile, param); } if (dataID.get(position).equals("4")) { Map<String, String> param = new HashMap<String, String>(); FragmentRequestMerchant reqMerchant = new FragmentRequestMerchant(); onNavigate(reqMerchant, param); } if (dataID.get(position).equals("2")) { Map<String, String> param = new HashMap<String, String>(); FragmentInbox inbox = new FragmentInbox(); onNavigate(inbox, param); } if (dataID.get(position).equals("3")) { Map<String, String> param = new HashMap<String, String>(); FragmentWishList wishList = new FragmentWishList(); onNavigate(wishList, param); } if (dataID.get(position).equals("5")) { Map<String, String> param = new HashMap<String, String>(); FragmentHotlist hotlist = new FragmentHotlist(); onNavigate(hotlist, param); } if (dataID.get(position).equals("8")) { Map<String, String> param = new HashMap<String, String>(); FragmentHelp help = new FragmentHelp(); onNavigate(help, param); } if (dataID.get(position).equals("9")) { backToAuth(); } toggleMenu(); } @Override public void onLongClick(View view, int position) { } })); } private void backToAuth() { PrefAuthentication authentication = new PrefAuthentication(BaseActivity.this); String source = authentication.getKeyUserSource(); Intent i = new Intent(BaseActivity.this, ActivityAuth.class); i.putExtra("isLogout", true); i.putExtra("userSource", source); startActivity(i); finish(); } private void filldata() { dataID.add("1"); dataTitle.add("Home"); dataIcon.add("icon_sidemenu_home.png"); dataID.add("2"); dataTitle.add("Inbox"); dataIcon.add("icon_sidemenu_mail.png"); dataID.add("3"); dataTitle.add("Room Wish List"); dataIcon.add("icon_sidemenu_whislist.png"); dataID.add("4"); dataTitle.add("Rent Out Your Space"); dataIcon.add("icon_sidemenu_room.png"); dataID.add("5"); dataTitle.add("Hot Offer"); dataIcon.add("icon_sidemenu_hotlist.png"); dataID.add("6"); dataTitle.add("Transaction"); dataIcon.add("icon_sidemenu_transaction.png"); dataID.add("7"); dataTitle.add("Profile"); dataIcon.add("icon_sidemenu_profile.png"); dataID.add("8"); dataTitle.add("Help"); dataIcon.add("icon_sidemenu_help.png"); dataID.add("9"); dataTitle.add("Logout"); dataIcon.add("icon_sidemenu_logout.png"); adapter.notifyDataSetChanged(); } public SlidingMenu getMenu() { return this.menu; } public class SlidemenuAdapter extends RecyclerView.Adapter<SlidemenuAdapter.GalleryViewHolder>{ private static final int TYPE_HEADER = 0; private static final int TYPE_ITEM = 1; public SlidemenuAdapter() { } @Override public int getItemViewType(int position) { return TYPE_ITEM; } @Override public GalleryViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.item_list_slidemenu, parent, false); return new GalleryViewHolder(itemView); } @Override public void onBindViewHolder(final GalleryViewHolder holder, int position) { holder.viewTitle.setText(dataTitle.get(position)); imageLoader.showImage(HelperGeneral.getAssetsPath("images/" + dataIcon.get(position)), holder.viewIcon); } @Override public int getItemCount() { return dataID.size(); } public class GalleryViewHolder extends RecyclerView.ViewHolder{ ImageView viewIcon; UIText viewTitle; public GalleryViewHolder(View itemView) { super(itemView); viewIcon = (ImageView) itemView.findViewById(R.id.item_list_slidemenu_icon); viewTitle = (UIText) itemView.findViewById(R.id.item_list_slidemenu_title); } } public boolean isHeader(int position) { return position == 0; } } public void removeFragment(int countBeDelete) { List<Fragment> lists = getSupportFragmentManager().getFragments(); for(int i = countBeDelete;i > 0;i--) { BaseFragment fragment = (BaseFragment) lists.get(i); if(fragment != null) { getSupportFragmentManager().beginTransaction().remove(fragment).commit(); } } } } <file_sep>package com.meetdesk.fragment; import android.app.Activity; import android.graphics.Bitmap; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.RelativeLayout; import com.meetdesk.BaseActivity; import com.meetdesk.BaseFragment; import com.meetdesk.R; import com.meetdesk.external.uil.core.assist.FailReason; import com.meetdesk.external.uil.core.listener.ImageLoadingListener; import com.meetdesk.helper.HelperGeneral; import com.meetdesk.helper.HelperNative; import com.meetdesk.model.PrefAuthentication; import com.meetdesk.util.LazyImageLoader; import com.meetdesk.view.UICircleImageView; import com.meetdesk.view.UIText; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; /** * Created by ekobudiarto on 11/1/16. */ public class FragmentProfile extends BaseFragment{ View main_view; HelperGeneral.FragmentInterface iFragment; BaseActivity activity; public static final String TAG_FRAGMENT_PROFILE = "tag:fragment-profile"; ImageButton imagebuttonBack; UICircleImageView imageviewAvatar; RelativeLayout buttonEdit; LazyImageLoader imageLoader; UIText textFullname, textEmail, textAbout, textPhone, textLocation; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { main_view = inflater.inflate(R.layout.fragment_profile, container, false); return main_view; } @Override public void onAttach(Activity activity) { super.onAttach(activity); if(activity != null) { this.activity = (BaseActivity) activity; iFragment = (HelperGeneral.FragmentInterface) this.activity; } } @Override public void onStart() { super.onStart(); if(activity != null) { init(); getUser(); } } private void init() { imageLoader = new LazyImageLoader(activity); imagebuttonBack = (ImageButton) activity.findViewById(R.id.profile_imagebutton_back); imageviewAvatar = (UICircleImageView) activity.findViewById(R.id.profile_circleimage_avatar); buttonEdit = (RelativeLayout) activity.findViewById(R.id.profile_button_edit); textFullname = (UIText) activity.findViewById(R.id.profile_text_fullname); textAbout = (UIText) activity.findViewById(R.id.profile_text_about); textEmail = (UIText) activity.findViewById(R.id.profile_text_email); textPhone = (UIText) activity.findViewById(R.id.profile_text_phone); textLocation = (UIText) activity.findViewById(R.id.profile_text_location); imagebuttonBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { activity.onBackPressed(); } }); buttonEdit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Map<String, String> param = new HashMap<String, String>(); FragmentProfileEdit edit = new FragmentProfileEdit(); ArrayList<BaseFragment> fragmentUpdate = new ArrayList<BaseFragment>(); fragmentUpdate.add(FragmentProfile.this); edit.setFragmentUpdate(fragmentUpdate); iFragment.onNavigate(edit, param); } }); } private void getUser() { final PrefAuthentication auth = new PrefAuthentication(activity); textFullname.setText(auth.getKeyUserFullname()); textEmail.setText(auth.getKeyUserEmail()); textPhone.setText(auth.getKeyUserPhone()); textLocation.setText(auth.getKeyUserLocation()); textAbout.setText(auth.getKeyUserDesc()); if(!HelperGeneral.checkInternalFile(auth.getKeyUserAvatar(), activity)) { imageLoader.showImage(HelperNative.getURL(11171) + auth.getKeyUserAvatar(), imageviewAvatar, new ImageLoadingListener() { @Override public void onLoadingStarted(String imageUri, View view) { } @Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { } @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { HelperGeneral.saveBitmapInternal(auth.getKeyUserAvatar(), activity, loadedImage); imageviewAvatar.setImageBitmap(loadedImage); } @Override public void onLoadingCancelled(String imageUri, View view) { } }); } if(HelperGeneral.checkInternalFile(auth.getKeyUserAvatar(), activity)) { imageLoader.showImage(HelperGeneral.getPrivatePath(auth.getKeyUserAvatar(), activity), imageviewAvatar); } } @Override public void onUpdate() { super.onUpdate(); getUser(); } @Override public String getFragmentTAG() { return TAG_FRAGMENT_PROFILE; } } <file_sep>#include <jni.h> #include <android/log.h> JNIEXPORT jstring JNICALL Java_com_meetdesk_helper_HelperNative_getURL(JNIEnv * env, jobject obj, jint code) { if (code == 11171) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/upload/"); } else if (code == 11172) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/get-region-list"); } else if (code == 11173) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/product-category-list"); } else if (code == 11174) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/auth-register"); } else if (code == 11175) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/auth-login"); } else if (code == 11176) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/product-list"); } else if (code == 11177) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/product-detail"); } else if (code == 11178) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/product-hot-list"); } else if (code == 11179) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/room-wish-list"); } else if (code == 11180) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/room-wish-add"); } else if (code == 11181) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/room-wish-delete"); } else if (code == 11182) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/rent-out"); } else if (code == 11183) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/account-detail"); } else if (code == 11184) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/account-update"); } else if (code == 11185) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/upload-file"); } else if (code == 11186) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/auth-register-device"); } else if (code == 11187) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/message-detail-list"); } else if (code == 11188) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/message-list"); } else if (code == 11189) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/message-add"); } else if (code == 11190) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/message-detail-add"); } else if (code == 11191) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/auth-login-social"); } else if (code == 11192) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/booking-check"); } else if (code == 11193) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/booking-save"); } else if (code == 11194) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/booking-review"); } else if (code == 11195) { return (*env)->NewStringUTF(env, "http://meetdesk.cupslice.com/index.php/api/v1/booking-list"); } else { return (*env)->NewStringUTF(env, "no-data"); } }<file_sep>package com.meetdesk.fragment; import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import com.meetdesk.BaseActivity; import com.meetdesk.BaseFragment; import com.meetdesk.R; import com.meetdesk.controller.ControllerGeneral; import com.meetdesk.helper.HelperGeneral; import com.meetdesk.model.PrefAuthentication; import com.meetdesk.view.UIButton; import com.meetdesk.view.UIDialogLoading; import com.meetdesk.view.UIEditText; import com.meetdesk.view.UIToast; /** * Created by ekobudiarto on 11/1/16. */ public class FragmentRequestMerchant extends BaseFragment { View main_view; HelperGeneral.FragmentInterface iFragment; BaseActivity activity; public static final String TAG_FRAGMENT_REQ_MERCHANT = "tag:fragment-req-merchant"; ImageButton imagebuttonClose; UIButton buttonSend; UIEditText editEmail, editAddress, editPhone, editName, editAmenities, editSpaceDetail, editMessage; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { main_view = inflater.inflate(R.layout.fragment_request_merchant, container, false); return main_view; } @Override public void onAttach(Activity activity) { super.onAttach(activity); if(activity != null) { this.activity = (BaseActivity) activity; iFragment = (HelperGeneral.FragmentInterface) this.activity; } } @Override public void onStart() { super.onStart(); if(activity != null) { init(); } } private void init() { imagebuttonClose = (ImageButton) activity.findViewById(R.id.req_merchant_imagebutton_close); buttonSend = (UIButton) activity.findViewById(R.id.req_merchant_send); editEmail = (UIEditText) activity.findViewById(R.id.req_merchant_edittext_email); editAddress = (UIEditText) activity.findViewById(R.id.req_merchant_edittext_address); editPhone = (UIEditText) activity.findViewById(R.id.req_merchant_edittext_phone); editName = (UIEditText) activity.findViewById(R.id.req_merchant_edittext_merchantname); editAmenities = (UIEditText) activity.findViewById(R.id.req_merchant_edittext_amenities); editSpaceDetail = (UIEditText) activity.findViewById(R.id.req_merchant_edittext_detail); editMessage = (UIEditText) activity.findViewById(R.id.req_merchant_edittext_message); imagebuttonClose.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { activity.onBackPressed(); } }); buttonSend.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { doRequest(); } }); } private void doRequest() { new AsyncTask<Void, Integer, String>() { boolean success = false; String msg; UIDialogLoading dialog; String valueEmail, valueAddress, valuePhone, valueName, valueAmenities, valueDetail, valueMessage; @Override protected void onPreExecute() { super.onPreExecute(); dialog = new UIDialogLoading(activity); dialog.setCancelable(false); dialog.show(); valueEmail = editEmail.getText().toString(); valueAddress = editAddress.getText().toString(); valuePhone = editPhone.getText().toString(); valueName = editName.getText().toString(); valueAmenities = editAmenities.getText().toString(); valueDetail = editSpaceDetail.getText().toString(); valueMessage = editMessage.getText().toString(); } @Override protected String doInBackground(Void... params) { PrefAuthentication auth = new PrefAuthentication(activity); String[] field = new String[]{"token", "name", "address", "phone", "email", "space", "amenities", "message"}; String[] value = new String[]{auth.getKeyUserToken(), valueName, valueAddress, valuePhone, valueEmail, valueDetail, valueAmenities, valueMessage}; ControllerGeneral general = new ControllerGeneral(activity); general.setPostParameter(field, value); general.executeRentOut(); if(general.getSuccess()) { success = true; } msg = general.getMessage(); return ""; } @Override protected void onPostExecute(String s) { super.onPostExecute(s); if(dialog != null && dialog.isShowing()) { dialog.dismiss();; } if(success) { activity.onBackPressed(); } new UIToast(activity, msg).show(); } }.execute(); } } <file_sep>package com.meetdesk.fragment; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import com.meetdesk.BaseActivity; import com.meetdesk.BaseFragment; import com.meetdesk.R; import com.meetdesk.helper.HelperDB; import com.meetdesk.helper.HelperGeneral; import com.meetdesk.model.EntityProductCategory; import com.meetdesk.model.EntityRegion; import com.meetdesk.model.PrefAuthentication; import com.meetdesk.model.QueryProCat; import com.meetdesk.model.QueryRegion; import com.meetdesk.util.LazyImageLoader; import com.meetdesk.view.UIButton; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by ekobudiarto on 11/1/16. */ public class FragmentAuthSelectType extends BaseFragment { View main_view; HelperGeneral.FragmentInterface iFragment; BaseActivity activity; public static final String TAG_FRAGMENT_AUTH_SELECT_TYPE = "tag:fragment-auth-select-type"; UIButton buttonSelectCity, buttonSelectCategory, buttonSearch; LinearLayout buttonLogin, buttonSignup; ImageView imageviewBG; String selectedCityID = "0", selectedCityTitle = "Jakarta", selectedPlaceID = "0", selectedPlaceTitle = "Coworking Space"; int widthScreen = 0; LazyImageLoader imageLoader; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { main_view = inflater.inflate(R.layout.fragment_auth_select_type, container, false); return main_view; } @Override public void onAttach(Activity activity) { super.onAttach(activity); if(activity != null) { this.activity = (BaseActivity) activity; iFragment = (HelperGeneral.FragmentInterface) this.activity; } } @Override public void onStart() { super.onStart(); if(activity != null) { init(); setStatusDisplaySelectType(); } } private void init() { widthScreen = HelperGeneral.getScreenSize(activity, "w"); imageLoader = new LazyImageLoader(activity); buttonSelectCity = (UIButton) activity.findViewById(R.id.auth_select_type_city); buttonSelectCategory = (UIButton) activity.findViewById(R.id.auth_select_type_space); buttonSearch = (UIButton) activity.findViewById(R.id.auth_select_type_search); buttonLogin = (LinearLayout) activity.findViewById(R.id.auth_select_type_btn_login); buttonSignup = (LinearLayout) activity.findViewById(R.id.auth_select_type_btn_signup); imageviewBG = (ImageView) activity.findViewById(R.id.auth_select_type_bg); buttonLogin.getLayoutParams().width = (widthScreen / 2) - 2; buttonSignup.getLayoutParams().width = (widthScreen / 2) - 2; buttonSelectCity.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showDialogCity(); } }); buttonSelectCategory.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showDialogCategory(); } }); buttonLogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Map<String, String> param = new HashMap<String, String>(); FragmentAuthSignIn login = new FragmentAuthSignIn(); iFragment.onNavigate(login, param); } }); buttonSignup.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Map<String, String> param = new HashMap<String, String>(); FragmentAuthSignUp signup = new FragmentAuthSignUp(); iFragment.onNavigate(signup, param); } }); imageLoader.showImage("drawable://"+R.drawable.bg_auth_select, imageviewBG); } private void setStatusDisplaySelectType() { PrefAuthentication authPreferences = new PrefAuthentication(activity); authPreferences.setDisplaySelectType(false); authPreferences.commit(); } private void showDialogCity() { HelperDB db = new HelperDB(activity); QueryRegion region = new QueryRegion(db); List<EntityRegion> listData = region.GetAllRegion(); final String[] itemTitle = new String[listData.size()]; final String[] itemID = new String[listData.size()]; int i = 0; for(EntityRegion regionData : listData) { itemID[i] = Integer.toString(regionData.getRegionID()); itemTitle[i] = regionData.getRegionName(); i++; } final AlertDialog dialog = new AlertDialog.Builder(activity) .setTitle("Select City") .setItems(itemTitle, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { selectedCityID = itemID[which]; selectedCityTitle = itemTitle[which]; buttonSelectCity.setText(selectedCityTitle); dialog.dismiss(); } }).create(); dialog.show(); } private void showDialogCategory() { HelperDB db = new HelperDB(activity); QueryProCat proCat = new QueryProCat(db); List<EntityProductCategory> listData = proCat.GetAllCategory(); final String[] itemTitle = new String[listData.size()]; final String[] itemID = new String[listData.size()]; int i = 0; for(EntityProductCategory category : listData) { itemID[i] = Integer.toString(category.getCategoryID()); itemTitle[i] = category.getCategoryName(); i++; } final AlertDialog dialog = new AlertDialog.Builder(activity) .setTitle("Select Space Type") .setItems(itemTitle, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { selectedPlaceID = itemID[which]; selectedPlaceTitle = itemTitle[which]; buttonSelectCategory.setText(selectedPlaceTitle); dialog.dismiss(); } }).create(); dialog.show(); } } <file_sep>buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'io.fabric.tools:gradle:1.+' } } apply plugin: 'com.android.application' apply plugin: 'io.fabric' repositories { maven { url 'https://maven.fabric.io/public' } } android { compileSdkVersion 23 buildToolsVersion "23.0.1" defaultConfig { applicationId 'com.meetdesk' minSdkVersion 14 targetSdkVersion 22 versionCode 1 versionName "1.0" ndk { moduleName "meetdesk-library" } multiDexEnabled true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } productFlavors { } dexOptions { incremental true javaMaxHeapSize "2048M" jumboMode = true preDexLibraries = false } } dependencies { compile fileTree(dir: 'libs', include: ['*.so']) testCompile 'junit:junit:4.12' compile 'com.android.support:support-v4:23.0.1' compile ('com.android.support:appcompat-v7:23.0.1'){ exclude module:'support-v4' } compile ('com.android.support:design:23.0.1'){ exclude module:'support-v4' } compile ('com.squareup.picasso:picasso:2.5.2'){ exclude group:'com.android.support' } compile ('com.android.support:multidex:1.0.1'){ exclude module:'support-v4' } compile ('com.google.android.gms:play-services-analytics:10.0.1'){ exclude group:'com.android.support' } compile ('com.google.android.gms:play-services-location:10.0.1'){ exclude group:'com.android.support' } compile ('com.google.android.gms:play-services-auth:10.0.1'){ exclude group:'com.android.support' } compile ('com.google.firebase:firebase-core:10.0.1'){ exclude group:'com.android.support' } compile ('com.google.firebase:firebase-messaging:10.0.1'){ exclude group:'com.android.support' } compile ('com.android.support:cardview-v7:23.+'){ exclude group:'com.android.support' } compile ('com.android.support:recyclerview-v7:23.+'){ exclude group:'com.android.support' } compile ('com.android.support:palette-v7:23.+'){ exclude group:'com.android.support' } compile ('com.facebook.android:facebook-android-sdk:4.5.0'){ exclude group:'com.android.support' } compile ('com.wdullaer:materialdatetimepicker:3.0.0'){ exclude group:'com.android.support' } compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') { transitive = true; } } apply plugin: 'com.google.gms.google-services' <file_sep>package com.meetdesk.fragment; import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.ImageView; import com.meetdesk.BaseActivity; import com.meetdesk.BaseFragment; import com.meetdesk.R; import com.meetdesk.controller.ControllerProduct; import com.meetdesk.helper.HelperGeneral; import com.meetdesk.helper.HelperNative; import com.meetdesk.model.PrefAuthentication; import com.meetdesk.util.EndlessRecyclerViewScrollListener; import com.meetdesk.util.LazyImageLoader; import com.meetdesk.util.RecyclerViewItemDivider; import com.meetdesk.view.UIText; import com.meetdesk.view.UIToast; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; /** * Created by ekobudiarto on 9/16/16. */ public class FragmentHome extends BaseFragment { View main_view; HelperGeneral.FragmentInterface iFragment; BaseActivity activity; public static final String TAG_FRAGMENT_HOME = "tag:fragment-home"; ImageButton imagebuttonMenu, imagebuttonSelectRoom, imagebuttonSelectPlace; UIText uiTextPlace, uiTextCategory; RecyclerView recyclerHome; ArrayList<String> dataID, dataTitle, dataImage, dataDesc, dataRate, tempDate; HomeTabBuildingAdapter adapter; LazyImageLoader imageLoader; int l = 5, o = 0; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { main_view = inflater.inflate(R.layout.fragment_home, container, false); return main_view; } @Override public void onAttach(Activity activity) { super.onAttach(activity); if(activity != null) { this.activity = (BaseActivity) activity; iFragment = (HelperGeneral.FragmentInterface) this.activity; } } @Override public void onStart() { super.onStart(); if(activity != null) { init(); fillData(true); } } @Override public String getFragmentTAG() { return TAG_FRAGMENT_HOME; } private void init() { o = 0; dataID = new ArrayList<String>(); dataTitle = new ArrayList<String>(); dataImage = new ArrayList<String>(); dataRate = new ArrayList<String>(); dataDesc = new ArrayList<String>(); adapter = new HomeTabBuildingAdapter(); imageLoader = new LazyImageLoader(activity); imagebuttonMenu = (ImageButton) activity.findViewById(R.id.home_imagebutton_menu); imagebuttonSelectRoom = (ImageButton) activity.findViewById(R.id.home_imagebutton_select_room); imagebuttonSelectPlace = (ImageButton) activity.findViewById(R.id.home_imagebutton_select_place); uiTextPlace = (UIText) activity.findViewById(R.id.home_text_location); uiTextCategory = (UIText) activity.findViewById(R.id.home_text_category_place); recyclerHome = (RecyclerView) activity.findViewById(R.id.home_recycler); final LinearLayoutManager recycleLayoutManager = new LinearLayoutManager(activity); RecyclerViewItemDivider divider = new RecyclerViewItemDivider(activity, LinearLayoutManager.VERTICAL); recyclerHome.setLayoutManager(recycleLayoutManager); recyclerHome.setItemAnimator(new DefaultItemAnimator()); recyclerHome.addItemDecoration(divider); recyclerHome.setAdapter(adapter); recyclerHome.addOnItemTouchListener(new HelperGeneral.RecyclerTouchListener(activity, recyclerHome, new HelperGeneral.ClickListener() { @Override public void onClick(View view, int position) { Map<String, String> param = new HashMap<String, String>(); param.put("dataID", dataID.get(position)); FragmentDetail detail = new FragmentDetail(); iFragment.onNavigate(detail, param); } @Override public void onLongClick(View view, int position) { } })); recyclerHome.addOnScrollListener(new EndlessRecyclerViewScrollListener(recycleLayoutManager) { @Override public void onLoadMore(int page, int totalItemsCount) { fillData(false); } }); imagebuttonMenu.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { activity.toggleMenu(); } }); imagebuttonSelectRoom.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); imagebuttonSelectPlace.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Map<String, String> param = new HashMap<String, String>(); FragmentSelectType type = new FragmentSelectType(); iFragment.onNavigate(type, param); } }); } private void fillData(final boolean firstInit) { new AsyncTask<Void, Integer, String>() { boolean success = false; String msg; ArrayList<String> tempID, tempTitle, tempImage, tempDesc, tempRate, tempDate; @Override protected void onPreExecute() { super.onPreExecute(); if(firstInit) { o = 0; } tempID = new ArrayList<String>(); tempTitle = new ArrayList<String>(); tempImage = new ArrayList<String>(); tempRate = new ArrayList<String>(); tempDesc = new ArrayList<String>(); } @Override protected String doInBackground(Void... params) { PrefAuthentication auth = new PrefAuthentication(activity); ControllerProduct product = new ControllerProduct(activity); product.setToken(auth.getKeyUserToken()); product.setL(l); product.setO(o); product.executeHome(); if(product.getSuccess()) { success = true; tempID.addAll(product.getDataID()); tempTitle.addAll(product.getDataTitle()); tempImage.addAll(product.getDataImage()); tempRate.addAll(product.getDataRate()); tempDesc.addAll(product.getDataDesc()); o = product.getOffset(); } else { success = false; msg = product.getMessage(); } return ""; } @Override protected void onPostExecute(String s) { super.onPostExecute(s); if(success) { if(tempID.size() > 0) { for(int i = 0;i < tempID.size();i++) { dataID.add(tempID.get(i)); dataTitle.add(tempTitle.get(i)); dataImage.add(tempImage.get(i)); dataDesc.add(tempDesc.get(i)); dataRate.add(tempRate.get(i)); } adapter.notifyDataSetChanged(); } } else { new UIToast(activity, msg).show(); } } }.execute(); } public class HomeTabBuildingAdapter extends RecyclerView.Adapter<HomeTabBuildingAdapter.GalleryViewHolder>{ private static final int TYPE_HEADER = 0; private static final int TYPE_ITEM = 1; public HomeTabBuildingAdapter() { } @Override public int getItemViewType(int position) { return TYPE_ITEM; } @Override public GalleryViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.item_fragment_home, parent, false); return new GalleryViewHolder(itemView); } @Override public void onBindViewHolder(final GalleryViewHolder holder, int position) { String desc = HelperGeneral.getLimitedWords(dataDesc.get(position), 10); holder.viewTitle.setText(dataTitle.get(position)); holder.viewDesc.setText(desc); holder.viewRate.setText(dataRate.get(position)); imageLoader.showImage(HelperNative.getURL(11171) + dataImage.get(position), holder.viewIcon); } @Override public int getItemCount() { return dataID.size(); } public class GalleryViewHolder extends RecyclerView.ViewHolder{ ImageView viewIcon; UIText viewTitle, viewDesc, viewRate; public GalleryViewHolder(View itemView) { super(itemView); viewIcon = (ImageView) itemView.findViewById(R.id.item_home_image); viewTitle = (UIText) itemView.findViewById(R.id.item_home_title); viewDesc = (UIText) itemView.findViewById(R.id.item_home_desc); viewRate = (UIText) itemView.findViewById(R.id.item_home_rate); } } public boolean isHeader(int position) { return position == 0; } } } <file_sep>package com.meetdesk.activity; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.view.View; import android.widget.Toast; import com.crashlytics.android.Crashlytics; import com.facebook.CallbackManager; import com.facebook.FacebookCallback; import com.facebook.FacebookException; import com.facebook.login.LoginManager; import com.facebook.login.LoginResult; import com.facebook.login.widget.LoginButton; import com.meetdesk.BaseActivity; import com.meetdesk.BaseFragment; import com.meetdesk.R; import com.meetdesk.fragment.FragmentAuthSelectType; import com.meetdesk.fragment.FragmentAuthSignIn; import com.meetdesk.helper.HelperGeneral; import com.meetdesk.helper.HelperNative; import com.meetdesk.view.UIDialogConfirm; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import com.facebook.FacebookSdk; import io.fabric.sdk.android.Fabric; public class ActivityAuth extends BaseActivity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Fabric.with(this, new Crashlytics()); setContentView(R.layout.activity_auth); FacebookSdk.sdkInitialize(getApplicationContext()); } @Override protected void onStart() { super.onStart(); getMenu().setSlidingEnabled(false); addFragmentLogin(); } private void addFragmentLogin() { Map<String, String> param = new HashMap<String, String>(); FragmentAuthSignIn login = new FragmentAuthSignIn(); onNavigate(login, param); } private void addFragmentSelect() { Map<String, String> param = new HashMap<String, String>(); FragmentAuthSelectType authSelectType = new FragmentAuthSelectType(); onNavigate(authSelectType, param); } @Override public void onNavigate(BaseFragment fragmentSrc, Map<String, String> parameter) { if(!fragmentSrc.isAdded()) { fragmentSrc.setParameter(parameter); FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_left); ft.add(R.id.auth_fragment_container, fragmentSrc); ft.commit(); } } private boolean onBack() { List<Fragment> lists = getSupportFragmentManager().getFragments(); for(int i = lists.size() - 1;i > 0;i--) { try { BaseFragment fragment = (BaseFragment) lists.get(i); if (fragment != null) { getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_right).remove(fragment).commit(); return false; } }catch (Exception ex) { ex.printStackTrace(); return true; } } return true; } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); } @Override public void onBackPressed() { if(onBack()) { showDialogExit(); } } private void showDialogExit() { final UIDialogConfirm dialogConfirm = new UIDialogConfirm(ActivityAuth.this); dialogConfirm.setMessage("Anda ingin keluar dari Aplikasi?"); dialogConfirm.setDialogTitle(getResources().getString(R.string.dialog_confirm_title)); dialogConfirm.show(); dialogConfirm.getButtonYes().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialogConfirm.dismiss(); finish(); } }); dialogConfirm.getButtonNo().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialogConfirm.dismiss(); } }); } } <file_sep>package com.meetdesk.fragment; import android.app.Activity; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseExpandableListAdapter; import android.widget.ExpandableListView; import android.widget.RelativeLayout; import com.meetdesk.BaseActivity; import com.meetdesk.BaseFragment; import com.meetdesk.R; import com.meetdesk.helper.HelperGeneral; import com.meetdesk.util.LazyImageLoader; import com.meetdesk.view.UIButton; import com.meetdesk.view.UIText; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Map; /** * Created by ekobudiarto on 11/6/16. */ public class FragmentTransactionPending extends BaseFragment { View main_view; HelperGeneral.FragmentInterface iFragment; BaseActivity activity; public static final String TAG_FRAGMENT_TRANSACTION_PENDING = "tag:fragment-transaction-pending"; ExpandableListView listview; Map<String, String> param; ArrayList<String> parentID, parentTitle, parentStatus, parentDesc, parentPrice, parentDate, parentShowDate, childID, childDate, childCode, childDesc, childPrice; ArrayList<Boolean> parentShowRemoveButton; TransactionPendingAdapter adapter; LazyImageLoader imageLoader; HashMap<String, ArrayList<String>> childData; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { main_view = inflater.inflate(R.layout.fragment_transaction_pending, container, false); return main_view; } @Override public void onAttach(Activity activity) { super.onAttach(activity); if(activity != null) { this.activity = (BaseActivity) activity; iFragment = (HelperGeneral.FragmentInterface) this.activity; } } @Override public void onStart() { super.onStart(); if(activity != null) { init(); getData(); } } private void init() { param = getParameter(); parentID = new ArrayList<String>(); parentTitle = new ArrayList<String>(); parentStatus = new ArrayList<String>(); parentDesc = new ArrayList<String>(); parentPrice = new ArrayList<String>(); parentDate = new ArrayList<String>(); parentShowDate = new ArrayList<String>(); parentShowRemoveButton = new ArrayList<Boolean>(); childID = new ArrayList<String>(); childDate = new ArrayList<String>(); childCode = new ArrayList<String>(); childDesc = new ArrayList<String>(); childPrice = new ArrayList<String>(); childData = new HashMap<String, ArrayList<String>>(); imageLoader = new LazyImageLoader(activity); adapter = new TransactionPendingAdapter(); listview = (ExpandableListView) activity.findViewById(R.id.transaction_pending_listview); listview.setAdapter(adapter); } private void getData() { parentID.add("1"); parentID.add("2"); parentID.add("3"); parentID.add("4"); parentID.add("5"); parentTitle.add("Co-Working Space 1"); parentTitle.add("Co-Working Space 2"); parentTitle.add("Service Office 3"); parentTitle.add("Service Office 1"); parentTitle.add("Co-working Space 5"); parentPrice.add("2.000.000"); parentPrice.add("1.600.000"); parentPrice.add("3.400.000"); parentPrice.add("1.100.000"); parentPrice.add("1.750.000"); parentStatus.add("Payment"); parentStatus.add("Verification"); parentStatus.add("Verification"); parentStatus.add("Pending"); parentStatus.add("Payment"); parentDate.add("2016-10-01 11:05:00"); parentDate.add("2016-10-01 16:30:00"); parentDate.add("2016-09-20 08:00:00"); parentDate.add("2016-09-20 10:00:00"); parentDate.add("2016-09-20 12:00:00"); parentShowDate.add("1"); parentShowDate.add("0"); parentShowDate.add("1"); parentShowDate.add("0"); parentShowDate.add("0"); parentDesc.add("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam id neque rhoncus"); parentDesc.add("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam id neque rhoncus"); parentDesc.add("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam id neque rhoncus"); parentDesc.add("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam id neque rhoncus"); parentDesc.add("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam id neque rhoncus"); childID.add("1"); childID.add("2"); childID.add("3"); childID.add("4"); childID.add("5"); childDate.add("2016-10-01 11:05:00"); childDate.add("2016-10-01 16:30:00"); childDate.add("2016-09-20 08:00:00"); childDate.add("2016-09-20 10:00:00"); childDate.add("2016-09-20 12:00:00"); childCode.add("MD-120889-9500"); childCode.add("MD-160488-1710"); childCode.add("MD-150799-4840"); childCode.add("MD-167189-9535"); childCode.add("MD-122088-5821"); childDesc.add("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam id neque rhoncus"); childDesc.add("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam id neque rhoncus"); childDesc.add("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam id neque rhoncus"); childDesc.add("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam id neque rhoncus"); childDesc.add("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam id neque rhoncus"); childPrice.add("2.000.000"); childPrice.add("1.600.000"); childPrice.add("3.400.000"); childPrice.add("1.100.000"); childPrice.add("1.750.000"); ArrayList<String> subChild1 = new ArrayList<String>(); subChild1.add(childID.get(0)); ArrayList<String> subChild2 = new ArrayList<String>(); subChild2.add(childID.get(1)); ArrayList<String> subChild3 = new ArrayList<String>(); subChild3.add(childID.get(2)); ArrayList<String> subChild4 = new ArrayList<String>(); subChild4.add(childID.get(4)); ArrayList<String> subChild5 = new ArrayList<String>(); subChild5.add(childID.get(4)); childData.put(parentID.get(0), subChild1); childData.put(parentID.get(1), subChild2); childData.put(parentID.get(2), subChild3); childData.put(parentID.get(3), subChild4); childData.put(parentID.get(4), subChild5); adapter.notifyDataSetChanged(); } private String getPendingDateFormat(String date) { String result = ""; try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date newDate = sdf.parse(date); SimpleDateFormat sdf2 = new SimpleDateFormat("EEEE, dd MMMM yyyy"); result = sdf2.format(newDate); } catch (ParseException e) { result = ""; } return result; } private String getPendingTimeFormat(String time) { String result = ""; try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date newDate = sdf.parse(time); SimpleDateFormat sdf2 = new SimpleDateFormat("K a"); result = sdf2.format(newDate); } catch (ParseException e) { result = ""; } return result; } public class TransactionPendingAdapter extends BaseExpandableListAdapter { public TransactionPendingAdapter() { } @Override public int getGroupCount() { return parentID.size(); } @Override public int getChildrenCount(int groupPosition) { return childData.get(parentID.get(groupPosition)).size(); } @Override public Object getGroup(int groupPosition) { String[] obj = new String[7]; obj[0] = parentID.get(groupPosition); obj[1] = parentTitle.get(groupPosition); obj[2] = parentDesc.get(groupPosition); obj[3] = parentPrice.get(groupPosition); obj[4] = parentStatus.get(groupPosition); obj[5] = parentDate.get(groupPosition); obj[6] = parentShowDate.get(groupPosition); return obj; } @Override public Object getChild(int groupPosition, int childPosition) { String valueChildData = childData.get(parentID.get(groupPosition)).get(childPosition); int indexChild = 0; for(int i = 0;i < childID.size();i++) { if(valueChildData.equals(childID.get(i))) { indexChild = i; } } String obj[] = new String[5]; obj[0] = childID.get(indexChild); obj[1] = childDate.get(indexChild); obj[2] = childCode.get(indexChild); obj[3] = childDesc.get(indexChild); obj[4] = childPrice.get(indexChild); return obj; } @Override public long getGroupId(int groupPosition) { return groupPosition; } @Override public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Override public boolean hasStableIds() { return false; } @Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { final GroupViewHolder holder = new GroupViewHolder(); if(convertView == null) { convertView = LayoutInflater.from(activity).inflate(R.layout.item_fragment_transaction_pending_group, null); } holder.groupTitle = (UIText) convertView.findViewById(R.id.item_transaction_pending_title); holder.groupDesc = (UIText) convertView.findViewById(R.id.item_transaction_pending_desc); holder.groupPrice = (UIText) convertView.findViewById(R.id.item_transaction_pending_price); holder.groupStatus = (UIButton) convertView.findViewById(R.id.item_transaction_pending_status); holder.groupDate = (UIText) convertView.findViewById(R.id.item_transaction_pending_date); holder.groupTriangle = (RelativeLayout) convertView.findViewById(R.id.item_transaction_pending_triangle); String[] dataGroup = (String[]) getGroup(groupPosition); String desc = HelperGeneral.getLimitedWords(dataGroup[2], 10); String date = getPendingDateFormat(dataGroup[5]); String showDate = dataGroup[6]; holder.groupTitle.setText(dataGroup[1]); holder.groupDesc.setText(desc); holder.groupPrice.setText(dataGroup[3]); holder.groupStatus.setText(dataGroup[4]); holder.groupDate.setText(date); if(isExpanded) { holder.groupTriangle.setVisibility(View.VISIBLE); } if(!isExpanded) { holder.groupTriangle.setVisibility(View.GONE); } if(showDate.equals("1")) { holder.groupDate.setVisibility(View.VISIBLE); } if(!showDate.equals("1")) { holder.groupDate.setVisibility(View.GONE); } return convertView; } @Override public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { final ChildViewHolder holder = new ChildViewHolder(); if(convertView == null) { convertView = LayoutInflater.from(activity).inflate(R.layout.item_fragment_transaction_pending_child, null); } holder.viewChildDate = (UIText) convertView.findViewById(R.id.item_transaction_pending_child_date); holder.viewChildCode = (UIText) convertView.findViewById(R.id.item_transaction_pending_child_code); holder.viewChildDesc = (UIText) convertView.findViewById(R.id.item_transaction_pending_child_desc); holder.viewChildPrice = (UIText) convertView.findViewById(R.id.item_transaction_pending_child_price); String[] subChild = (String[]) getChild(groupPosition, childPosition); String desc = HelperGeneral.getLimitedWords(subChild[3], 10); String date = HelperGeneral.getDefaultDateFormat(subChild[1]); holder.viewChildDate.setText(date); holder.viewChildDesc.setText(desc); holder.viewChildCode.setText(subChild[2]); holder.viewChildPrice.setText(subChild[4]); return convertView; } @Override public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } class GroupViewHolder{ UIText groupTitle, groupDesc, groupPrice, groupDate; UIButton groupStatus; RelativeLayout groupTriangle; } class ChildViewHolder{ UIText viewChildDate,viewChildCode, viewChildDesc, viewChildPrice; } } } <file_sep>package com.meetdesk.helper; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.content.res.AssetManager; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Point; import android.location.Address; import android.location.Geocoder; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.Uri; import android.os.Build; import android.provider.Settings; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.view.Display; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; import com.google.android.gms.analytics.HitBuilders; import com.google.android.gms.analytics.Tracker; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GoogleApiAvailability; import com.google.android.gms.common.GooglePlayServicesUtil; import com.meetdesk.BaseActivity; import com.meetdesk.BaseFragment; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Created by ekobudiarto on 9/16/16. */ public class HelperGeneral { public interface FragmentInterface{ void onNavigate(BaseFragment fragmentSrc, Map<String, String> parameter); } public interface ClickListener { void onClick(View view, int position); void onLongClick(View view, int position); } public interface onLoadMoreListener{ void onLoadMore(); } public static String getJSON(String urlData) { String result = ""; try{ URL url = new URL(urlData); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setDoInput(true); urlConnection.setConnectTimeout(20 * 1000); urlConnection.setReadTimeout(20 * 1000); // Check the connection status if(urlConnection.getResponseCode() == 200) { // if response code = 200 ok InputStream in = new BufferedInputStream(urlConnection.getInputStream()); // Read the BufferedInputStream BufferedReader r = new BufferedReader(new InputStreamReader(in)); StringBuilder sb = new StringBuilder(); String line; while ((line = r.readLine()) != null) { sb.append(line); } result = sb.toString(); urlConnection.disconnect(); } else { result = ""; } }catch (MalformedURLException e){ //e.printStackTrace(); result = ""; }catch(IOException e){ //e.printStackTrace(); result = ""; }finally { } // Return the data from specified url return result; } public static boolean checkConnection(Context context) { ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivity != null) { NetworkInfo[] info = connectivity.getAllNetworkInfo(); if (info != null) for (int i = 0; i < info.length; i++) if (info[i].getState() == NetworkInfo.State.CONNECTED) { return true; } } return false; } public static String getDeviceID(Context c) { TelephonyManager tm = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE); return tm.getDeviceId(); } public static String getNetworkProvider(Context c) { TelephonyManager tm = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE); return tm.getNetworkOperatorName(); } public static String getCountryID(Context c) { String result = ""; TelephonyManager tm = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE); if (tm.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) { result = tm.getSimCountryIso(); } else { result = tm.getNetworkCountryIso(); } return result.toUpperCase(Locale.US); } public final static boolean isTablet(Context context) { return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE; } public static String getDeviceVersion() { return Build.VERSION.RELEASE; } public static String getDeviceBrand() { return Build.BRAND; } public static String getAppVersionName(Context context) { String result = ""; try { result = "v" + context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; } catch (PackageManager.NameNotFoundException e) { result = ""; } return result; } public static int getAppVersionCode(Context context) { int result = 0; try { result = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode; } catch (PackageManager.NameNotFoundException e) { result = 0; } return result; } public static boolean isAppInstalled(Context context, String packageName) { try { context.getPackageManager().getApplicationInfo(packageName, 0); return true; } catch (PackageManager.NameNotFoundException e) { return false; } } public static void openApplicationInPlayStore(Context context, String packages) { try { context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packages))); } catch (ActivityNotFoundException anfe) { context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + packages))); } } public static void openAppURL(Context context, String url) { try { context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); } catch (ActivityNotFoundException anfe) { context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); } } public static Bitmap getAssetBitmap(String filename, Context context) { Bitmap bmp = null; AssetManager assets = context.getAssets(); InputStream inputStream; try { inputStream = assets.open("files/" + filename); bmp = BitmapFactory.decodeStream(inputStream); } catch (IOException e) { // TODO Auto-generated catch block bmp = null; e.printStackTrace(); } return bmp; } public final static String getPrivatePath(String filename, Context context) { String result = ""; result = "file:///" + context.getFilesDir().getAbsolutePath() + "/" + filename; return result; } public final static String getAssetsPath(String filename) { return "assets://" + filename; } public static void sendAnalytic(Tracker tracker, String screen) { if (tracker != null) { tracker.setScreenName(screen); tracker.send(new HitBuilders.ScreenViewBuilder().build()); } } public static void DeleteInternalFile(String filename, Context mContext) { File dir = mContext.getFilesDir(); File file = new File(dir, filename); if(file.exists()) { file.delete(); } } public static int getScreenSize(Context context, String param) { int size = 0; WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); if (Build.VERSION.SDK_INT > 12) { Point sizePoint = new Point(); display.getSize(sizePoint); if(param.equals("w")) { size = sizePoint.x; } else { size = sizePoint.y; } } else { if(param.equals("w")) { size = display.getWidth(); } else { size = display.getHeight(); } } return size; } public static class RecyclerTouchListener implements RecyclerView.OnItemTouchListener { private GestureDetector gestureDetector; private ClickListener clickListener; public RecyclerTouchListener(Context context, final RecyclerView recyclerView, final ClickListener clickListener) { this.clickListener = clickListener; gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { @Override public boolean onSingleTapUp(MotionEvent e) { return true; } @Override public void onLongPress(MotionEvent e) { View child = recyclerView.findChildViewUnder(e.getX(), e.getY()); if (child != null && clickListener != null) { clickListener.onLongClick(child, recyclerView.getChildPosition(child)); } } }); } @Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { View child = rv.findChildViewUnder(e.getX(), e.getY()); if (child != null && clickListener != null && gestureDetector.onTouchEvent(e)) { clickListener.onClick(child, rv.getChildPosition(child)); } return false; } @Override public void onTouchEvent(RecyclerView rv, MotionEvent e) { } @Override public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { } } public static final int getColor(Context context, int id) { final int version = Build.VERSION.SDK_INT; if(version >= 23) { return ContextCompat.getColor(context, id); } else { return context.getResources().getColor(id); } } public static Bitmap doDownloadBitmap(String urls, Context context) { Bitmap result = null; try{ InputStream is = null; URL url = new URL(urls); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setDoInput(true); urlConnection.setConnectTimeout(20 * 1000); urlConnection.setReadTimeout(20 * 1000); // Check the connection status if(urlConnection.getResponseCode() == 200) { is = urlConnection.getInputStream(); result = BitmapFactory.decodeStream(is); is.close(); urlConnection.disconnect(); } else { result = null; } }catch (MalformedURLException e){ //e.printStackTrace(); result = null; }catch(IOException e){ //e.printStackTrace(); result = null; }finally { } return result; } public static String postJSON(String urlData, String[] field, String[] value) { String result = ""; try{ URL url = new URL(urlData); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setDoInput(true); urlConnection.setDoOutput(true); urlConnection.setRequestMethod("POST"); urlConnection.setConnectTimeout(20 * 1000); urlConnection.setReadTimeout(20 * 1000); Uri.Builder uriBuilder = new Uri.Builder(); for(int i = 0;i < field.length;i++) { uriBuilder.appendQueryParameter(field[i], value[i]); } String query = uriBuilder.build().getEncodedQuery(); OutputStream os = urlConnection.getOutputStream(); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(os, "UTF-8")); writer.write(query); writer.flush(); writer.close(); os.close(); // Check the connection status int responseCode = urlConnection.getResponseCode(); if(responseCode == 200) { // if response code = 200 ok InputStream in = new BufferedInputStream(urlConnection.getInputStream()); // Read the BufferedInputStream BufferedReader r = new BufferedReader(new InputStreamReader(in)); StringBuilder sb = new StringBuilder(); String line; while ((line = r.readLine()) != null) { sb.append(line); } result = sb.toString(); urlConnection.disconnect(); } else { result = ""; } }catch (MalformedURLException e){ //e.printStackTrace(); result = ""; }catch(IOException e){ //e.printStackTrace(); result = ""; }finally { } // Return the data from specified url return result; } public static final String GetJSONAssets(String jsonFile, Context context) { String jsonResult = null; try { InputStream is = context.getAssets().open("json/" + jsonFile); int size = is.available(); byte[] buffer = new byte[size]; is.read(buffer); is.close(); jsonResult = new String(buffer, "UTF-8"); } catch (IOException ex) { ex.printStackTrace(); return null; } return jsonResult; } public static String getLimitedWords(String content, int limit) { String result = ""; try { Pattern pattern = Pattern.compile("([\\S]+\\s*){1," + Integer.toString(limit) + "}"); Matcher matcher = pattern.matcher(content); matcher.find(); result = matcher.group(); } catch (Exception ex) { result = content; } return result; } public static String convertStandardJSONString(String data_json){ data_json = data_json.replace("\\", ""); data_json = data_json.replace("\"{", "{"); data_json = data_json.replace("}\",", "},"); data_json = data_json.replace("}\"", "}"); return data_json; } public static String getDefaultDateFormat(String date) { String result = ""; try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date newDate = sdf.parse(date); SimpleDateFormat sdf2 = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm"); result = sdf2.format(newDate); } catch (ParseException e) { result = ""; } return result; } public static String buildURL(String url, String[] field, String[] value) { String path = ""; Uri.Builder builder = Uri.parse(url).buildUpon(); for(int i = 0;i < field.length;i++) { builder.appendQueryParameter(field[i], value[i]); } path = builder.build().toString(); return path; } public static boolean checkInternalFile(String filename, Context mContext) { File dir = mContext.getFilesDir(); File file = new File(dir, filename); if(file.exists()) { return true; } else { return false; } } public static void saveBitmapInternal(String filename, Context context, Bitmap bitmap) { FileOutputStream fos; try { fos = context.openFileOutput(filename, Context.MODE_PRIVATE); bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos); fos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public static boolean checkGooglePlayServices(BaseActivity activity){ GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance(); int checkGooglePlayServices = apiAvailability.isGooglePlayServicesAvailable(activity); if (checkGooglePlayServices != ConnectionResult.SUCCESS) { if (apiAvailability.isUserResolvableError(checkGooglePlayServices)) { apiAvailability.getErrorDialog(activity, checkGooglePlayServices, 9000).show(); } else { activity.finish(); } return false; } return true; } public static ArrayList<String> getAddressMaps(Context context, double latitude, double longitude) { ArrayList<String> result = new ArrayList<String>(); Geocoder geocoder = new Geocoder(context, Locale.getDefault()); try { List<Address> listAddress = geocoder.getFromLocation(latitude, longitude, 1); result.add(0, listAddress.get(0).getLocality()); //City result.add(1, listAddress.get(0).getAdminArea()); //State result.add(2, listAddress.get(0).getPostalCode()); //Postal Code result.add(3, listAddress.get(0).getCountryName()); //Country Name result.add(4, listAddress.get(0).getCountryCode()); //Country Code result.add(5, listAddress.get(0).getSubAdminArea()); //kota } catch (IOException e) { //e.printStackTrace(); } return result; } public static void closeKeyboard(BaseActivity activity) { View v = activity.getCurrentFocus(); if(v != null) { InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(v.getWindowToken(), 0); } } public static boolean isLocationEnabled(Context context) { int locationMode = 0; String locationProviders; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){ try { locationMode = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.LOCATION_MODE); } catch (Settings.SettingNotFoundException e) { e.printStackTrace(); return false; } return locationMode != Settings.Secure.LOCATION_MODE_OFF; }else{ locationProviders = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); return !TextUtils.isEmpty(locationProviders); } } public static String upload(String urls, String uriFile, String[] field, String[] value) { String res = "0"; String fileName = uriFile; int serverResponseCode = 0; HttpURLConnection conn = null; DataOutputStream dos = null; String lineEnd = "\r\n"; String twoHyphens = "--"; String boundary = "*****"; int bytesRead, bytesAvailable, bufferSize; byte[] buffer; int maxBufferSize = 1 * 1024 * 1024; File sourceFile = new File(uriFile); if (!sourceFile.isFile()) { return "0"; } else { try { FileInputStream fileInputStream = new FileInputStream(sourceFile); URL url = new URL(urls); conn = (HttpURLConnection) url.openConnection(); conn.setDoInput(true); // Allow Inputs conn.setDoOutput(true); // Allow Outputs conn.setUseCaches(false); // Don't use a Cached Copy conn.setRequestMethod("POST"); conn.setRequestProperty("Connection", "Keep-Alive"); conn.setRequestProperty("ENCTYPE", "multipart/form-data"); conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary); conn.setRequestProperty("file", fileName); dos = new DataOutputStream(conn.getOutputStream()); for(int i = 0;i < field.length;i++){ dos.writeBytes(twoHyphens + boundary + lineEnd); dos.writeBytes("Content-Disposition: form-data; name=\""+field[i]+"\"" + lineEnd); dos.writeBytes(lineEnd); // assign value dos.writeBytes(value[i]); dos.writeBytes(lineEnd); dos.writeBytes(twoHyphens + boundary + lineEnd); } dos.writeBytes(twoHyphens + boundary + lineEnd); dos.writeBytes("Content-Disposition: form-data; name=\"file\";filename=" + fileName + lineEnd); dos.writeBytes(lineEnd); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); buffer = new byte[bufferSize]; bytesRead = fileInputStream.read(buffer, 0, bufferSize); while (bytesRead > 0) { dos.write(buffer, 0, bufferSize); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); bytesRead = fileInputStream.read(buffer, 0, bufferSize); } dos.writeBytes(lineEnd); dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd); serverResponseCode = conn.getResponseCode(); String serverResponseMessage = conn.getResponseMessage(); if(serverResponseCode == 200){ res = serverResponseMessage; } fileInputStream.close(); dos.flush(); dos.close(); InputStream in = null; try { in = conn.getInputStream(); byte[] buffers = new byte[1024]; int read; while ((read = in.read(buffers)) > 0) { res = new String(buffers, 0, read, "utf-8"); } } catch (IOException es) { es.printStackTrace(); res = "0"; } finally { in.close(); } } catch (MalformedURLException ex) { ex.printStackTrace(); res = "0"; } catch (Exception e) { e.printStackTrace(); res = "0"; } return res; } // End else block } public static Bitmap ResizeBitmap(String url, int maxWidth, int maxHeight, boolean increase){ Bitmap bm = BitmapFactory.decodeFile(url); int bmpWidth = bm.getWidth(); int bmpHeight = bm.getHeight(); int newWidth = 0; int newHeight = 0; if(bmpWidth < maxWidth || bmpHeight < maxHeight) { if(increase){ if(bmpWidth > bmpHeight) { double ratio = ((double) maxWidth) / bmpWidth; newWidth = (int) (ratio * bmpWidth); newHeight = (int) (ratio * bmpHeight); } else { double ratio = ((double) maxHeight) / bmpHeight; newWidth = (int) (ratio * bmpWidth); newHeight = (int) (ratio * bmpHeight); } } else { newWidth = bmpWidth; newHeight = bmpHeight; } } else { if(bmpWidth > bmpHeight) { double ratio = ((double) maxWidth) / bmpWidth; newWidth = (int) (ratio * bmpWidth); newHeight = (int) (ratio * bmpHeight); } else { double ratio = ((double) maxHeight) / bmpHeight; newWidth = (int) (ratio * bmpWidth); newHeight = (int) (ratio * bmpHeight); } } Bitmap resizedBitmap = Bitmap.createScaledBitmap(bm, newWidth, newHeight, true); return resizedBitmap; } public static String convertJSONToPathImage(String json) { String filename = ""; try { JSONObject obj = new JSONObject(json); if(obj.getBoolean("status")) { filename = obj.getString("filename"); } } catch (JSONException e) { e.printStackTrace(); } return filename; } } <file_sep>package com.meetdesk.fragment; import android.app.Activity; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import com.facebook.AccessToken; import com.facebook.CallbackManager; import com.facebook.FacebookCallback; import com.facebook.FacebookException; import com.facebook.GraphRequest; import com.facebook.GraphResponse; import com.facebook.login.LoginManager; import com.facebook.login.LoginResult; import com.facebook.login.widget.LoginButton; import com.google.android.gms.auth.api.Auth; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.gms.auth.api.signin.GoogleSignInOptions; import com.google.android.gms.auth.api.signin.GoogleSignInResult; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.SignInButton; import com.google.android.gms.common.api.GoogleApiClient; import com.meetdesk.BaseActivity; import com.meetdesk.BaseFragment; import com.meetdesk.R; import com.meetdesk.activity.MainActivity; import com.meetdesk.controller.ControllerAuthentication; import com.meetdesk.helper.HelperGeneral; import com.meetdesk.model.PrefAuthentication; import com.meetdesk.util.LazyImageLoader; import com.meetdesk.view.UIButton; import com.meetdesk.view.UIDialogLoading; import com.meetdesk.view.UIEditText; import com.meetdesk.view.UIToast; import org.json.JSONException; import org.json.JSONObject; import java.util.Arrays; import java.util.HashMap; import java.util.Map; /** * Created by ekobudiarto on 11/2/16. */ public class FragmentAuthSignIn extends BaseFragment implements GoogleApiClient.OnConnectionFailedListener { View main_view; HelperGeneral.FragmentInterface iFragment; BaseActivity activity; public static final String TAG_FRAGMENT_AUTH_SIGNIN = "tag:fragment-auth-signin"; private static final int RC_SIGN_IN = 9001; UIButton buttonSignIn, buttonCreateNew; ImageView imageviewBG; LazyImageLoader imageLoader; LoginButton btnLoginFB; CallbackManager callbackManager; UIEditText editUsername, editPassword; GoogleApiClient mGoogleApiClient; SignInButton btnLoginGoogle; boolean isLogout = false, isGoogleLogin = false; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { main_view = inflater.inflate(R.layout.fragment_auth_signin, container, false); return main_view; } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); callbackManager = CallbackManager.Factory.create(); buildGoogle(); } @Override public void onAttach(Activity activity) { super.onAttach(activity); if(activity != null) { this.activity = (BaseActivity) activity; iFragment = (HelperGeneral.FragmentInterface) this.activity; } } @Override public void onStart() { super.onStart(); if(activity != null) { init(); } } private void init() { imageLoader = new LazyImageLoader(activity); isLogout = activity.getIntent().getBooleanExtra("isLogout", false); buttonSignIn = (UIButton) activity.findViewById(R.id.auth_signin_send); buttonCreateNew = (UIButton) activity.findViewById(R.id.auth_signin_create); imageviewBG = (ImageView) activity.findViewById(R.id.auth_signin_bg); btnLoginFB = (LoginButton) activity.findViewById(R.id.auth_signin_button_facebook); btnLoginGoogle = (SignInButton) activity.findViewById(R.id.auth_signin_button_google); editUsername = (UIEditText) activity.findViewById(R.id.auth_signin_username); editPassword = (UIEditText) activity.findViewById(R.id.auth_signin_password); btnLoginFB.setReadPermissions(Arrays.asList("email")); btnLoginFB.setFragment(FragmentAuthSignIn.this); btnLoginFB.registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { isGoogleLogin = false; AccessToken fbToken = loginResult.getAccessToken(); getFBUserdata(fbToken); } @Override public void onCancel() { new UIToast(activity, "Something wrong with this device. Please restart this application").show(); } @Override public void onError(FacebookException error) { new UIToast(activity, "ERROR : " + error.getMessage().toString()).show(); } }); buttonSignIn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { isGoogleLogin = false; doLogin(); } }); btnLoginGoogle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { isGoogleLogin = true; doLoginGoogle(); } }); buttonCreateNew.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Map<String, String> param = new HashMap<String, String>(); FragmentAuthSignUp signUp = new FragmentAuthSignUp(); iFragment.onNavigate(signUp, param); } }); imageLoader.showImage("drawable://" + R.drawable.bg_auth, imageviewBG); doLogout(); } private void setPreferencesLoggedIn() { PrefAuthentication authPreferences = new PrefAuthentication(activity); authPreferences.setIsLoggedIn(true); authPreferences.commit(); } private void doLogin() { new AsyncTask<Void, Integer, String>() { UIDialogLoading dialog; boolean success = false; String msg, username, password; @Override protected void onPreExecute() { super.onPreExecute(); dialog = new UIDialogLoading(activity); dialog.setCancelable(false); dialog.show(); username = editUsername.getText().toString(); password = editPassword.getText().toString(); HelperGeneral.closeKeyboard(activity); } @Override protected String doInBackground(Void... params) { String[] field = new String[]{"token", "username", "password", "device_id"}; String[] value = new String[]{HelperGeneral.getDeviceID(activity), username, password, HelperGeneral.getDeviceID(activity)}; ControllerAuthentication authentication = new ControllerAuthentication(activity); authentication.setParameter(field, value); authentication.doLogin(); if(authentication.getSuccess()) { success = true; } msg = authentication.getMessage(); return ""; } @Override protected void onPostExecute(String s) { super.onPostExecute(s); if(dialog != null && dialog.isShowing()) { dialog.dismiss(); } if(success) { Intent i = new Intent(activity, MainActivity.class); activity.startActivity(i); activity.finish(); } new UIToast(activity, msg).show(); } }.execute(); } private void getFBUserdata(AccessToken token) { GraphRequest request = GraphRequest.newMeRequest( token, new GraphRequest.GraphJSONObjectCallback() { @Override public void onCompleted(JSONObject object, GraphResponse response) { // Application code String defaultGender = "0"; try { if(!object.getString("gender").equals("male")) { defaultGender = "1"; } JSONObject objPicture = object.getJSONObject("picture"); JSONObject objPictureData = objPicture.getJSONObject("data"); String sourceEngine = "facebook"; String tokenDefault = HelperGeneral.getDeviceID(activity); String fullname = object.getString("name"); String email = object.getString("email"); String gender = defaultGender; String birthdate = ""; String socialID = object.getString("id"); String avatar = objPictureData.getString("url"); String deviceID = tokenDefault; String[] valueSend = new String[]{tokenDefault, sourceEngine, fullname, email, gender, birthdate, socialID, avatar, deviceID}; doLoginSocial(valueSend); } catch (JSONException e) { e.printStackTrace(); new UIToast(activity, "ERROR Server " + e.getMessage().toString()).show(); } } }); Bundle parameters = new Bundle(); parameters.putString("fields", "name, email, gender, picture.type(large)"); request.setParameters(parameters); request.executeAsync(); } private void buildGoogle() { GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .requestProfile() .build(); // Build a GoogleApiClient with access to GoogleSignIn.API and the options above. mGoogleApiClient = new GoogleApiClient.Builder(activity) .enableAutoManage(activity, this) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build(); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); callbackManager.onActivityResult(requestCode, resultCode, data); if(isGoogleLogin) { if (requestCode == RC_SIGN_IN) { GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data); if (result.isSuccess()) { GoogleSignInAccount acct = result.getSignInAccount(); // Get account information String sourceEngine = "google"; String tokenDefault = HelperGeneral.getDeviceID(activity); String fullname = acct.getDisplayName(); String email = acct.getEmail(); String gender = "0"; String birthdate = ""; String socialID = acct.getId(); String avatar = acct.getPhotoUrl().toString(); String deviceID = tokenDefault; String[] valueSend = new String[]{tokenDefault, sourceEngine, fullname, email, gender, birthdate, socialID, avatar, deviceID}; doLoginSocial(valueSend); } } } } private void doLoginGoogle() { Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient); startActivityForResult(signInIntent, RC_SIGN_IN); } private void doLoginSocial(final String[] value) { new AsyncTask<Void, Integer, String>() { boolean success = false; String msg; UIDialogLoading dialog; @Override protected void onPreExecute() { super.onPreExecute(); dialog = new UIDialogLoading(activity); dialog.setCancelable(false); dialog.show(); } @Override protected String doInBackground(Void... params) { String[] field = new String[]{"token", "source_engine", "fullname", "email", "gender", "birthdate", "social_id", "avatar", "device_id"}; String[] newValue = new String[]{value[0], value[1], value[2], value[3], value[4], value[5], value[6], value[7], value[8]}; ControllerAuthentication authentication = new ControllerAuthentication(activity); authentication.setParameter(field, newValue); authentication.doLoginSocial(); if(authentication.getSuccess()) { success = true; } msg = authentication.getMessage(); return ""; } @Override protected void onPostExecute(String s) { super.onPostExecute(s); if(dialog != null && dialog.isShowing()) { dialog.dismiss(); } if(success) { Intent i = new Intent(activity, MainActivity.class); activity.startActivity(i); activity.finish(); } new UIToast(activity, msg).show(); } }.execute(); } public void doLogout() { if(isLogout) { String source = activity.getIntent().getStringExtra("userSource"); if(source.equals("facebook")) { LoginManager.getInstance().logOut(); new UIToast(activity, "Logout Success").show(); } else if(source.equals("google")) { new UIToast(activity, "Logout Success").show(); /*Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(new ResultCallback<Status>() { @Override public void onResult(Status status) { Toast.makeText(activity, "Logout Success", Toast.LENGTH_SHORT).show(); } });*/ } else { new UIToast(activity, "Logout Success").show(); PrefAuthentication authPreferences = new PrefAuthentication(activity); authPreferences.setIsLoggedIn(false); authPreferences.setDisplaySelectType(false); } } } @Override public void onDestroy() { super.onDestroy(); } @Override public void onConnectionFailed(ConnectionResult connectionResult) { new UIToast(activity, "Error Connection : " + connectionResult.getErrorMessage().toString()).show(); } } <file_sep>package com.meetdesk.fragment; import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseExpandableListAdapter; import android.widget.ExpandableListView; import android.widget.RelativeLayout; import com.meetdesk.BaseActivity; import com.meetdesk.BaseFragment; import com.meetdesk.R; import com.meetdesk.controller.ControllerBooking; import com.meetdesk.helper.HelperGeneral; import com.meetdesk.model.PrefAuthentication; import com.meetdesk.util.EndlessListViewScrollListener; import com.meetdesk.util.LazyImageLoader; import com.meetdesk.view.UIButton; import com.meetdesk.view.UIText; import com.meetdesk.view.UIToast; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; /** * Created by ekobudiarto on 11/6/16. */ public class FragmentTransactionHistory extends BaseFragment { View main_view; HelperGeneral.FragmentInterface iFragment; BaseActivity activity; public static final String TAG_FRAGMENT_TRANSACTION_HISTORY = "tag:fragment-transaction-history"; ExpandableListView listview; Map<String, String> param; ArrayList<String> bookingDetailID, productTitle, parentStatus, productDesc, packageID, bookingDetailDate, bookingDetailCode, packageDesc, bookingDetailAmount; ArrayList<Boolean> parentShowRemoveButton; TransactionHistoryAdapter adapter; LazyImageLoader imageLoader; HashMap<String, ArrayList<String>> childData; int l = 10, o = 0; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { main_view = inflater.inflate(R.layout.fragment_transaction_history, container, false); return main_view; } @Override public void onAttach(Activity activity) { super.onAttach(activity); if(activity != null) { this.activity = (BaseActivity) activity; iFragment = (HelperGeneral.FragmentInterface) this.activity; } } @Override public void onStart() { super.onStart(); if(activity != null) { init(); getData(true); } } private void init() { param = getParameter(); bookingDetailID = new ArrayList<String>(); productTitle = new ArrayList<String>(); parentStatus = new ArrayList<String>(); productDesc = new ArrayList<String>(); parentShowRemoveButton = new ArrayList<Boolean>(); packageID = new ArrayList<String>(); bookingDetailDate = new ArrayList<String>(); bookingDetailCode = new ArrayList<String>(); packageDesc = new ArrayList<String>(); bookingDetailAmount = new ArrayList<String>(); childData = new HashMap<String, ArrayList<String>>(); imageLoader = new LazyImageLoader(activity); adapter = new TransactionHistoryAdapter(); listview = (ExpandableListView) activity.findViewById(R.id.transaction_history_listview); listview.setAdapter(adapter); listview.setOnScrollListener(new EndlessListViewScrollListener() { @Override public void onLoadMore(int page, int totalItemsCount) { getData(false); } }); } @Override public void onUpdate() { super.onUpdate(); param = getParameter(); } private void getData(final boolean isFirstLoad) { new AsyncTask<Void, Integer, String>() { boolean success = false; String msg; ArrayList<String> tempBookingID, tempProductTitle, tempParentStatus, tempProductDesc, tempPackageID, tempBookingDate, tempBookingCode, tempPackageDesc, tempBookingAmount; ArrayList<Boolean> tempShowRemove; @Override protected void onPreExecute() { super.onPreExecute(); if(isFirstLoad) { o = 0; } tempBookingID = new ArrayList<String>(); tempProductTitle = new ArrayList<String>(); tempParentStatus = new ArrayList<String>(); tempProductDesc = new ArrayList<String>(); tempPackageID = new ArrayList<String>(); tempBookingDate = new ArrayList<String>(); tempBookingCode = new ArrayList<String>(); tempPackageDesc = new ArrayList<String>(); tempBookingAmount = new ArrayList<String>(); tempShowRemove = new ArrayList<Boolean>(); } @Override protected String doInBackground(Void... params) { PrefAuthentication auth = new PrefAuthentication(activity); ControllerBooking booking = new ControllerBooking(activity); booking.setO(o); booking.setL(l); booking.setToken(auth.getKeyUserToken()); booking.executeBookingList(); if(booking.getSuccess()) { success = true; tempBookingID.addAll(booking.getBookingDetailID()); tempProductTitle.addAll(booking.getProductTitle()); tempProductDesc.addAll(booking.getProductDesc()); tempPackageID.addAll(booking.getPackagePriceID()); tempPackageDesc.addAll(booking.getPackagePriceDesc()); tempBookingDate.addAll(booking.getBookingDetailDate()); tempBookingCode.addAll(booking.getBookingDetailCode()); tempBookingAmount.addAll(booking.getBookingDetailAmount()); o = booking.getOffset(); } else { success = false; msg = booking.getMessage(); } return ""; } @Override protected void onPostExecute(String s) { super.onPostExecute(s); if(success) { if(tempBookingID.size() > 0) { for(int i = 0;i < tempBookingID.size();i++) { bookingDetailID.add(tempBookingID.get(i)); productTitle.add(tempProductTitle.get(i)); parentStatus.add("Pending"); productDesc.add(tempProductDesc.get(i)); packageID.add(tempPackageID.get(i)); bookingDetailDate.add(tempBookingDate.get(i)); bookingDetailCode.add(tempBookingCode.get(i)); packageDesc.add(tempPackageDesc.get(i)); bookingDetailAmount.add(tempBookingAmount.get(i)); ArrayList<String> subChild1 = new ArrayList<String>(); subChild1.add(tempPackageID.get(i)); childData.put(tempBookingID.get(i), subChild1); } adapter.notifyDataSetChanged(); } } else { new UIToast(activity, msg).show(); } } }.execute(); /* ArrayList<String> subChild2 = new ArrayList<String>(); subChild2.add(packageID.get(1)); ArrayList<String> subChild3 = new ArrayList<String>(); subChild3.add(packageID.get(2)); ArrayList<String> subChild4 = new ArrayList<String>(); subChild4.add(packageID.get(4)); ArrayList<String> subChild5 = new ArrayList<String>(); subChild5.add(packageID.get(4)); childData.put(bookingDetailID.get(1), subChild2); childData.put(bookingDetailID.get(2), subChild3); childData.put(bookingDetailID.get(3), subChild4); childData.put(bookingDetailID.get(4), subChild5); adapter.notifyDataSetChanged();*/ } private void goConfirmation() { Map<String, String> param = new HashMap<String, String>(); FragmentConfirmation confirmation = new FragmentConfirmation(); iFragment.onNavigate(confirmation, param); } public class TransactionHistoryAdapter extends BaseExpandableListAdapter{ public TransactionHistoryAdapter() { } @Override public int getGroupCount() { return bookingDetailID.size(); } @Override public int getChildrenCount(int groupPosition) { return childData.get(bookingDetailID.get(groupPosition)).size(); } @Override public Object getGroup(int groupPosition) { String[] obj = new String[4]; obj[0] = bookingDetailID.get(groupPosition); obj[1] = productTitle.get(groupPosition); obj[2] = productDesc.get(groupPosition); obj[3] = parentStatus.get(groupPosition); return obj; } @Override public Object getChild(int groupPosition, int childPosition) { String valueChildData = childData.get(bookingDetailID.get(groupPosition)).get(childPosition); int indexChild = 0; for(int i = 0;i < packageID.size();i++) { if(valueChildData.equals(packageID.get(i))) { indexChild = i; } } String obj[] = new String[5]; obj[0] = packageID.get(indexChild); obj[1] = bookingDetailDate.get(indexChild); obj[2] = bookingDetailCode.get(indexChild); obj[3] = packageDesc.get(indexChild); obj[4] = bookingDetailAmount.get(indexChild); return obj; } @Override public long getGroupId(int groupPosition) { return groupPosition; } @Override public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Override public boolean hasStableIds() { return false; } @Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { final GroupViewHolder holder = new GroupViewHolder(); if(convertView == null) { convertView = LayoutInflater.from(activity).inflate(R.layout.item_fragment_transaction_history_group, null); } holder.groupTitle = (UIText) convertView.findViewById(R.id.item_transaction_history_title); holder.groupDesc = (UIText) convertView.findViewById(R.id.item_transaction_history_desc); holder.groupStatus = (UIText) convertView.findViewById(R.id.item_transaction_history_status); holder.groupProcess = (UIButton) convertView.findViewById(R.id.item_transaction_history_process); holder.groupTriangle = (RelativeLayout) convertView.findViewById(R.id.item_transaction_history_triangle); String[] dataGroup = (String[]) getGroup(groupPosition); String desc = HelperGeneral.getLimitedWords(dataGroup[2], 10); holder.groupTitle.setText(dataGroup[1]); holder.groupDesc.setText(desc); holder.groupStatus.setText(dataGroup[3]); holder.groupProcess.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { goConfirmation(); } }); if(isExpanded) { holder.groupTriangle.setVisibility(View.VISIBLE); } else { holder.groupTriangle.setVisibility(View.GONE); } return convertView; } @Override public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { final ChildViewHolder holder = new ChildViewHolder(); if(convertView == null) { convertView = LayoutInflater.from(activity).inflate(R.layout.item_fragment_transaction_history_child, null); } holder.viewChildDate = (UIText) convertView.findViewById(R.id.item_transaction_history_child_date); holder.viewChildCode = (UIText) convertView.findViewById(R.id.item_transaction_history_child_code); holder.viewChildDesc = (UIText) convertView.findViewById(R.id.item_transaction_history_child_desc); holder.viewChildPrice = (UIText) convertView.findViewById(R.id.item_transaction_history_child_price); String[] subChild = (String[]) getChild(groupPosition, childPosition); String desc = HelperGeneral.getLimitedWords(subChild[3], 10); String date = HelperGeneral.getDefaultDateFormat(subChild[1]); holder.viewChildDate.setText(date); holder.viewChildDesc.setText(desc); holder.viewChildCode.setText(subChild[2]); holder.viewChildPrice.setText(subChild[4]); return convertView; } @Override public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } class GroupViewHolder{ UIText groupTitle, groupDesc, groupStatus; UIButton groupProcess; RelativeLayout groupTriangle; } class ChildViewHolder{ UIText viewChildDate,viewChildCode, viewChildDesc, viewChildPrice; } } } <file_sep>package com.meetdesk.fragment; import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.ImageView; import com.meetdesk.BaseActivity; import com.meetdesk.BaseFragment; import com.meetdesk.R; import com.meetdesk.controller.ControllerProduct; import com.meetdesk.helper.HelperGeneral; import com.meetdesk.helper.HelperNative; import com.meetdesk.model.PrefAuthentication; import com.meetdesk.util.EndlessRecyclerViewScrollListener; import com.meetdesk.util.LazyImageLoader; import com.meetdesk.view.UIButton; import com.meetdesk.view.UIDialogConfirm; import com.meetdesk.view.UIDialogLoading; import com.meetdesk.view.UIText; import com.meetdesk.view.UIToast; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; /** * Created by ekobudiarto on 11/5/16. */ public class FragmentWishList extends BaseFragment { View main_view; HelperGeneral.FragmentInterface iFragment; BaseActivity activity; public static final String TAG_FRAGMENT_WHISLIST = "tag:fragment-whislist"; ImageButton imagebuttonBack; RecyclerView recycler; ArrayList<String> dataID, dataImage, dataTitle, dataDesc; ArrayList<Boolean> dataPrepareRemove; WishlistAdapter adapter; LazyImageLoader imageLoader; UIButton buttonEdit; boolean flagPrepareRemoving = true; int l = 10, o = 0; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { main_view = inflater.inflate(R.layout.fragment_wishlist, container, false); return main_view; } @Override public void onAttach(Activity activity) { super.onAttach(activity); if(activity != null) { this.activity = (BaseActivity) activity; iFragment = (HelperGeneral.FragmentInterface) this.activity; } } @Override public void onStart() { super.onStart(); if(activity != null) { init(); getData(false); } } private void init() { dataID = new ArrayList<String>(); dataTitle = new ArrayList<String>(); dataImage = new ArrayList<String>(); dataDesc = new ArrayList<String>(); dataPrepareRemove = new ArrayList<Boolean>(); adapter = new WishlistAdapter(); imageLoader = new LazyImageLoader(activity); imagebuttonBack = (ImageButton) activity.findViewById(R.id.wishlist_imagebutton_back); buttonEdit = (UIButton) activity.findViewById(R.id.wishlist_button_edit); recycler = (RecyclerView) activity.findViewById(R.id.wishlist_recycler); final LinearLayoutManager recycleLayoutManager = new LinearLayoutManager(activity); recycler.setLayoutManager(recycleLayoutManager); recycler.setItemAnimator(new DefaultItemAnimator()); recycler.setAdapter(adapter); recycler.addOnItemTouchListener(new HelperGeneral.RecyclerTouchListener(activity, recycler, new HelperGeneral.ClickListener() { @Override public void onClick(View view, int position) { Map<String, String> param = new HashMap<String, String>(); param.put("dataID", dataID.get(position)); FragmentDetail detail = new FragmentDetail(); iFragment.onNavigate(detail, param); } @Override public void onLongClick(View view, int position) { showDialogDelete(dataID.get(position)); } })); recycler.addOnScrollListener(new EndlessRecyclerViewScrollListener(recycleLayoutManager) { @Override public void onLoadMore(int page, int totalItemsCount) { getData(true); } }); imagebuttonBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { activity.onBackPressed(); } }); buttonEdit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (flagPrepareRemoving) { setAllPrepareRemove(true); buttonEdit.setText("Done"); flagPrepareRemoving = false; } else { setAllPrepareRemove(false); buttonEdit.setText("Edit"); flagPrepareRemoving = true; } } }); } private void getData(final boolean isLoadMore) { new AsyncTask<Void, Integer, String>() { boolean success = false; String msg; ArrayList<String> tempID, tempImage, tempTitle, tempDesc; @Override protected void onPreExecute() { super.onPreExecute(); if(!isLoadMore) { o = 0; } tempID = new ArrayList<String>(); tempImage = new ArrayList<String>(); tempTitle = new ArrayList<String>(); tempDesc = new ArrayList<String>(); } @Override protected String doInBackground(Void... params) { PrefAuthentication auth = new PrefAuthentication(activity); ControllerProduct product = new ControllerProduct(activity); product.setToken(auth.getKeyUserToken()); product.setL(l); product.setO(o); product.executeWishList(); if(product.getSuccess()) { success = true; tempID.addAll(product.getDataID()); tempTitle.addAll(product.getDataTitle()); tempDesc.addAll(product.getDataDesc()); tempImage.addAll(product.getDataImage()); o = product.getOffset(); } else { success = false; msg = product.getMessage(); } return ""; } @Override protected void onPostExecute(String s) { super.onPostExecute(s); if(success) { if(tempID.size() > 0) { for(int i = 0;i < tempID.size();i++) { dataID.add(tempID.get(i)); dataTitle.add(tempTitle.get(i)); dataDesc.add(tempDesc.get(i)); dataImage.add(tempImage.get(i)); dataPrepareRemove.add(false); } adapter.notifyDataSetChanged(); } } else { new UIToast(activity, msg).show(); } } }.execute(); } private void deleteData(final String id) { new AsyncTask<Void, Integer, String>() { boolean success = false; String msg; UIDialogLoading dialog; @Override protected void onPreExecute() { super.onPreExecute(); dialog = new UIDialogLoading(activity); dialog.setCancelable(false); dialog.show(); } @Override protected String doInBackground(Void... params) { PrefAuthentication auth = new PrefAuthentication(activity); String[] field = new String[]{"token", "product"}; String[] value = new String[]{auth.getKeyUserToken(), id}; ControllerProduct product = new ControllerProduct(activity); product.setPostParameter(field, value); product.executeWishDelete(); if(product.getSuccess()) { success = true; } msg = product.getMessage(); return ""; } @Override protected void onPostExecute(String s) { super.onPostExecute(s); if(dialog != null && dialog.isShowing()) { dialog.dismiss(); } if(success) { for(int i = 0;i < dataID.size();i++) { if(dataID.get(i).equals(id)) { dataID.remove(i); dataTitle.remove(i); dataImage.remove(i); dataDesc.remove(i); } } adapter.notifyDataSetChanged(); } new UIToast(activity, msg).show(); } }.execute(); } private void setAllPrepareRemove(boolean remove) { for(int i = 0;i < dataID.size();i++) { dataPrepareRemove.set(i, remove); } adapter.notifyDataSetChanged(); } private void showDialogDelete(final String id) { final UIDialogConfirm dialogConfirm = new UIDialogConfirm(activity); dialogConfirm.setMessage("Are you sure delete this from wishlist?"); dialogConfirm.setDialogTitle("Confirmation"); dialogConfirm.show(); dialogConfirm.getButtonYes().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialogConfirm.dismiss(); deleteData(id); } }); dialogConfirm.getButtonNo().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialogConfirm.dismiss(); } }); } public class WishlistAdapter extends RecyclerView.Adapter<WishlistAdapter.WishlistViewHolder>{ private static final int TYPE_HEADER = 0; private static final int TYPE_ITEM = 1; public WishlistAdapter() { } @Override public int getItemViewType(int position) { return TYPE_ITEM; } @Override public WishlistViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.item_fragment_wishlist, parent, false); return new WishlistViewHolder(itemView); } @Override public void onBindViewHolder(final WishlistViewHolder holder, final int position) { String desc = HelperGeneral.getLimitedWords(dataDesc.get(position), 10); holder.textTitle.setText(dataTitle.get(position)); holder.textDesc.setText(desc); imageLoader.showImage(HelperNative.getURL(11171) + dataImage.get(position), holder.viewIcon); if(dataPrepareRemove.get(position)) { holder.buttonRemove.setVisibility(View.VISIBLE); holder.buttonRemove.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showDialogDelete(dataID.get(position)); } }); } if(!dataPrepareRemove.get(position)) { holder.buttonRemove.setVisibility(View.GONE); } } @Override public int getItemCount() { return dataID.size(); } public class WishlistViewHolder extends RecyclerView.ViewHolder{ ImageView viewIcon; UIText textTitle, textDesc; UIButton buttonRemove, buttonDetail; public WishlistViewHolder(View itemView) { super(itemView); viewIcon = (ImageView) itemView.findViewById(R.id.item_wishlist_image); textTitle = (UIText) itemView.findViewById(R.id.item_wishlist_title); textDesc = (UIText) itemView.findViewById(R.id.item_wishlist_desc); buttonRemove = (UIButton) itemView.findViewById(R.id.item_wishlist_remove); buttonDetail = (UIButton) itemView.findViewById(R.id.item_wishlist_detail); } } public boolean isHeader(int position) { return position == 0; } } } <file_sep>package com.meetdesk.fragment; import android.app.Activity; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import com.meetdesk.BaseActivity; import com.meetdesk.BaseFragment; import com.meetdesk.R; import com.meetdesk.helper.HelperGeneral; import com.meetdesk.helper.HelperNative; import com.meetdesk.util.LazyImageLoader; import com.meetdesk.view.UIText; import com.meetdesk.view.UIHorizontallScroll; import java.util.ArrayList; /** * Created by ekobudiarto on 12/4/16. */ public class FragmentDetailFacilityList extends BaseFragment { View main_view; HelperGeneral.FragmentInterface iFragment; BaseActivity activity; public static final String TAG_FRAGMENT_SETTINGS = "tag:fragment-settings"; UIHorizontallScroll horizontalScroll; ArrayList<String> fac_id, fac_title,fac_icon; LinearLayout horizontalScrollLinear; LazyImageLoader imageLoader; int widthScreen = 0; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { main_view = inflater.inflate(R.layout.fragment_detail_facility_list, container, false); return main_view; } @Override public void onAttach(Activity activity) { super.onAttach(activity); if(activity != null) { this.activity = (BaseActivity) activity; iFragment = (HelperGeneral.FragmentInterface) this.activity; } } @Override public void onStart() { super.onStart(); if(activity != null) { init(); applyData(); } } private void init() { imageLoader = new LazyImageLoader(activity); widthScreen = HelperGeneral.getScreenSize(activity, "w"); horizontalScroll = (UIHorizontallScroll) activity.findViewById(R.id.fragment_detail_facility_list_horizontal); horizontalScrollLinear = (LinearLayout) activity.findViewById(R.id.fragment_detail_facility_list_linear); } public void setDataID(ArrayList<String> id) { this.fac_id = id; } public void setDataTitle(ArrayList<String> title) { this.fac_title = title; } public void setDataIcon(ArrayList<String> icon) { this.fac_icon = icon; } private void applyData() { if(fac_id.size() > 0) { for(int i = 0;i < fac_id.size();i++) { View item = LayoutInflater.from(activity).inflate(R.layout.fragment_detail_facility_list_item, null, false); horizontalScrollLinear.addView(item); item.getLayoutParams().width = widthScreen / 3; ImageView viewIcon = (ImageView) item.findViewById(R.id.fragment_detail_facility_list_item_icon); UIText viewTitle = (UIText) item.findViewById(R.id.fragment_detail_facility_list_item_title); viewTitle.setText(fac_title.get(i)); imageLoader.showImage(HelperNative.getURL(11171) + fac_icon.get(i), viewIcon); } } } @Override public void onUpdate() { super.onUpdate(); applyData(); } } <file_sep>package com.meetdesk.fragment; import android.app.Activity; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import com.meetdesk.BaseActivity; import com.meetdesk.BaseFragment; import com.meetdesk.R; import com.meetdesk.helper.HelperGeneral; import com.meetdesk.view.UIButton; /** * Created by ekobudiarto on 12/19/16. */ public class FragmentBookingThanks extends BaseFragment { View main_view; HelperGeneral.FragmentInterface iFragment; BaseActivity activity; public static final String TAG_FRAGMENT_BOOKING_THANKS = "tag:fragment-booking-thanks"; UIButton btnBackToHome; ImageButton imagebuttonBack; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { main_view = inflater.inflate(R.layout.fragment_booking_thanks, container, false); return main_view; } @Override public void onAttach(Activity activity) { super.onAttach(activity); if(activity != null) { this.activity = (BaseActivity) activity; iFragment = (HelperGeneral.FragmentInterface) this.activity; } } @Override public void onStart() { super.onStart(); if(activity != null) { init(); } } private void init() { btnBackToHome = (UIButton) activity.findViewById(R.id.fragment_booking_thanks_back_home); imagebuttonBack = (ImageButton) activity.findViewById(R.id.fragment_booking_thanks_back); btnBackToHome.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { activity.onBackPressed(); } }); imagebuttonBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { activity.onBackPressed(); } }); } } <file_sep>package com.meetdesk.helper; /** * Created by ekobudiarto on 11/22/16. */ public class HelperEntityColumn { public static final String DB_NAME = "db_md"; public static final int DB_VERSION = 1; public static final String TBL_REGION = "tbl_region"; public static final String TBL_PROCAT = "tbl_category"; public static final String COL_REGION_ID = "region_id"; public static final String COL_REGION_NAME = "region_name"; public static final String COL_REGION_CODE = "region_code"; public static final String COL_PROCAT_ID = "category_id"; public static final String COL_PROCAT_DESC = "category_desc"; public static final String COL_PROCAT_NAME = "category_name"; public static final String COL_PROCAT_ICON = "category_icon"; } <file_sep>package com.meetdesk.fragment; import android.annotation.SuppressLint; import android.app.Activity; import android.app.DatePickerDialog; import android.content.ContentUris; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.location.Location; import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.DatePicker; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationServices; import com.meetdesk.BaseActivity; import com.meetdesk.BaseFragment; import com.meetdesk.R; import com.meetdesk.controller.ControllerGeneral; import com.meetdesk.external.uil.core.assist.FailReason; import com.meetdesk.external.uil.core.listener.ImageLoadingListener; import com.meetdesk.helper.HelperGeneral; import com.meetdesk.helper.HelperNative; import com.meetdesk.model.PrefAuthentication; import com.meetdesk.util.LazyImageLoader; import com.meetdesk.view.UIButton; import com.meetdesk.view.UICircleImageView; import com.meetdesk.view.UIDialogConfirm; import com.meetdesk.view.UIDialogLoading; import com.meetdesk.view.UIEditText; import com.meetdesk.view.UIText; import com.meetdesk.view.UIToast; import java.io.File; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; /** * Created by ekobudiarto on 11/5/16. */ public class FragmentProfileEdit extends BaseFragment implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener{ View main_view; HelperGeneral.FragmentInterface iFragment; BaseActivity activity; public static final String TAG_FRAGMENT_PROFILE_EDIT = "tag:fragment-profile-edit"; ImageButton imagebuttonBack; UICircleImageView circleImage; UIEditText editFullname, editEmail, editPassword, editContact, editDesc; UIText editLocation; UIButton buttonBirthday, buttonSave; LinearLayout buttonMale, buttonFemale; RelativeLayout circleMale, circleFemale; DatePickerDialog dateDialog; LazyImageLoader imageLoader; int selectedGender = 0; String selectedBirthday = "", currentLocation = "", selectedImagePath = ""; double currentLatitude = 0, currentLongitude = 0; ArrayList<BaseFragment> fragmentUpdate; private Uri mImageCaptureUri; private static final int PICK_FROM_FILE = 3; Location mLastLocation; GoogleApiClient mGoogleApi; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { main_view = inflater.inflate(R.layout.fragment_profile_edit, container, false); return main_view; } @Override public void onAttach(Activity activity) { super.onAttach(activity); if(activity != null) { this.activity = (BaseActivity) activity; iFragment = (HelperGeneral.FragmentInterface) this.activity; } } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); initGoogleAPI(); first_load(savedInstanceState); } @Override public void onStart() { mGoogleApi.connect(); super.onStart(); if(activity != null) { init(); showNotifEnableGPS(); componentAction(); getData(); } } @Override public void onStop() { mGoogleApi.disconnect(); super.onStop(); } private void init() { fragmentUpdate = getFragmentUpdate(); imageLoader = new LazyImageLoader(activity); imagebuttonBack = (ImageButton) activity.findViewById(R.id.profile_edit_imagebutton_back); circleImage = (UICircleImageView) activity.findViewById(R.id.profile_edit_circleimage_avatar); editFullname = (UIEditText) activity.findViewById(R.id.profile_edit_fullname); editEmail = (UIEditText) activity.findViewById(R.id.profile_edit_email); editPassword = (UIEditText) activity.findViewById(R.id.profile_edit_password); editContact = (UIEditText) activity.findViewById(R.id.profile_edit_contact); editLocation = (UIText) activity.findViewById(R.id.profile_edit_location); editDesc = (UIEditText) activity.findViewById(R.id.profile_edit_about); buttonBirthday = (UIButton) activity.findViewById(R.id.profile_edit_birthday); buttonMale = (LinearLayout) activity.findViewById(R.id.profile_edit_radio_male); buttonFemale = (LinearLayout) activity.findViewById(R.id.profile_edit_radio_female); buttonSave = (UIButton) activity.findViewById(R.id.profile_edit_save); circleMale = (RelativeLayout) activity.findViewById(R.id.profile_edit_holder_circle_male); circleFemale = (RelativeLayout) activity.findViewById(R.id.profile_edit_holder_circle_female); } private void componentAction() { circleImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { choosePicture(); } }); editEmail.setEnabled(false); editLocation.setEnabled(false); buttonMale.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { selectedGender = 0; circleMale.setBackgroundResource(R.drawable.bg_circle_blue); circleFemale.setBackgroundResource(R.drawable.bg_circle_border_grey); } }); buttonFemale.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { selectedGender = 1; circleMale.setBackgroundResource(R.drawable.bg_circle_border_grey); circleFemale.setBackgroundResource(R.drawable.bg_circle_blue); } }); imagebuttonBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { activity.onBackPressed(); } }); buttonSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { doUpdateProfile(); } }); buttonBirthday.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showDateDialog(); } }); } private void getData() { final PrefAuthentication auth = new PrefAuthentication(activity); editFullname.setText(auth.getKeyUserFullname()); editEmail.setText(auth.getKeyUserEmail()); editContact.setText(auth.getKeyUserPhone()); editLocation.setText(auth.getKeyUserLocation()); editDesc.setText(auth.getKeyUserDesc()); setDefaultDate(auth.getKeyUserBirthdate()); if(auth.getKeyUserGender().equals("0")) { circleMale.setBackgroundResource(R.drawable.bg_circle_blue); circleFemale.setBackgroundResource(R.drawable.bg_circle_border_grey); } if(!auth.getKeyUserGender().equals("0")) { circleMale.setBackgroundResource(R.drawable.bg_circle_border_grey); circleFemale.setBackgroundResource(R.drawable.bg_circle_blue); } if(!HelperGeneral.checkInternalFile(auth.getKeyUserAvatar(), activity)) { imageLoader.showImage(HelperNative.getURL(11171) + auth.getKeyUserAvatar(), circleImage, new ImageLoadingListener() { @Override public void onLoadingStarted(String imageUri, View view) { } @Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { } @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { HelperGeneral.saveBitmapInternal(auth.getKeyUserAvatar(), activity, loadedImage); circleImage.setImageBitmap(loadedImage); } @Override public void onLoadingCancelled(String imageUri, View view) { } }); } if(HelperGeneral.checkInternalFile(auth.getKeyUserAvatar(), activity)) { imageLoader.showImage(HelperGeneral.getPrivatePath(auth.getKeyUserAvatar(), activity), circleImage); } } private void showDateDialog() { Calendar c = Calendar.getInstance(); final int y = c.get(Calendar.YEAR); int m = c.get(Calendar.MONTH); int d = c.get(Calendar.DAY_OF_MONTH); dateDialog = new DatePickerDialog(activity, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { if(year < (y - 10)) { Calendar newDate = Calendar.getInstance(); newDate.set(year, monthOfYear, dayOfMonth); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); selectedBirthday = sdf.format(newDate.getTime()); SimpleDateFormat sdf2 = new SimpleDateFormat("dd MMM yyyy"); String newDate2 = sdf2.format(newDate.getTime()); buttonBirthday.setText(newDate2); } else { new UIToast(activity, "This app required age minimum 10 years old. Please select your valid birthdate.").show(); } dateDialog.dismiss(); } }, y, m, d); dateDialog.show(); } private void setDefaultDate(String date) { if(!date.equals("")) { selectedBirthday = date; SimpleDateFormat sdfDefault = new SimpleDateFormat("yyyy-MM-dd"); String newDate = ""; try { Date defaultDate = sdfDefault.parse(date); SimpleDateFormat sdf2 = new SimpleDateFormat("dd MMM yyyy"); newDate = sdf2.format(defaultDate); } catch (ParseException e) { //e.printStackTrace(); newDate = ""; } buttonBirthday.setText(newDate); } else { Calendar c = Calendar.getInstance(); int y = c.get(Calendar.YEAR); int m = c.get(Calendar.MONTH); int d = c.get(Calendar.DAY_OF_MONTH); c.set(y - 10, m, d); SimpleDateFormat sdfDefault = new SimpleDateFormat("yyyy-MM-dd"); selectedBirthday = sdfDefault.format(c.getTime()); SimpleDateFormat sdf2 = new SimpleDateFormat("dd MMM yyyy"); String newDate2 = sdf2.format(c.getTime()); buttonBirthday.setText(newDate2); } } private void doUpdateProfile() { new AsyncTask<Void, Integer, String>() { boolean success = false; String msg; UIDialogLoading dialog; String valueFullname, valuePassword, valueBirthdate, valueGender, valuePhone, valueDesc, valueLatitude, valueLongitude, valueLocation, valueMedia; @Override protected void onPreExecute() { super.onPreExecute(); dialog = new UIDialogLoading(activity); dialog.setCancelable(false); dialog.show(); valueFullname = editFullname.getText().toString(); valuePassword = <PASSWORD>(); valueBirthdate = selectedBirthday; valueGender = Integer.toString(selectedGender); valuePhone = editContact.getText().toString(); valueDesc = editDesc.getText().toString(); valueLatitude = Double.toString(currentLatitude); valueLongitude = Double.toString(currentLongitude); valueLocation = currentLocation; valueMedia = selectedImagePath; HelperGeneral.closeKeyboard(activity); } @Override protected String doInBackground(Void... params) { PrefAuthentication auth = new PrefAuthentication(activity); String[] field = new String[]{"token", "fullname", "password", "birthdate", "gender", "phone", "latitude", "longitude", "desc", "location", "media_file"}; String[] value = new String[]{auth.getKeyUserToken(), valueFullname, valuePassword, valueBirthdate, valueGender, valuePhone, valueLatitude, valueLongitude, valueDesc, valueLocation, valueMedia}; if(!valueMedia.equals("")) { String resultFilename = HelperGeneral.upload(HelperNative.getURL(11185), valueMedia, field, value); value[10] = HelperGeneral.convertJSONToPathImage(resultFilename); } ControllerGeneral general = new ControllerGeneral(activity); general.setPostParameter(field, value); general.executeUpdateAccount(); if(general.getSuccess()) { success = true; auth.setKeyUserFullname(valueFullname); auth.setKeyUserBirthdate(valueBirthdate); auth.setKeyUserGender(valueGender); auth.setKeyUserPhone(valuePhone); auth.setKeyUserLat(valueLatitude); auth.setKeyUserLong(valueLongitude); auth.setKeyUserDesc(valueDesc); auth.setKeyUserLocation(valueLocation); if(!value[10].equals("0")) { auth.setKeyUserAvatar(value[10]); } auth.commit(); } msg = general.getMessage(); return ""; } @Override protected void onPostExecute(String s) { super.onPostExecute(s); if(dialog != null && dialog.isShowing()) { dialog.dismiss(); } if(success) { for(int i = 0;i < fragmentUpdate.size();i++) { fragmentUpdate.get(i).onUpdate(); } activity.onBackPressed(); } new UIToast(activity, msg).show(); } }.execute(); } private void initGoogleAPI() { if (mGoogleApi == null) { mGoogleApi = new GoogleApiClient.Builder(activity) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .build(); } } private void initMap() { /*map.setMapType(GoogleMap.MAP_TYPE_NORMAL); map.setMyLocationEnabled(true); map.setOnMyLocationChangeListener(new GoogleMap.OnMyLocationChangeListener() { @Override public void onMyLocationChange(Location location) { currentLatitude = location.getLatitude(); currentLongitude = location.getLongitude(); ArrayList<String> getAddr = HelperGeneral.getAddressMaps(activity, currentLatitude, currentLongitude); if (getAddr.size() > 3) { String city = getAddr.get(0); String country = getAddr.get(3); currentLocation = city + ", " + country; editLocation.setText(currentLocation); } } });*/ } private void showNotifEnableGPS() { if(!HelperGeneral.isLocationEnabled(activity)) { new UIToast(activity, "Please turn on your GPS Location").show(); } } private void choosePicture(){ Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Complete action using"), PICK_FROM_FILE); } @Override public void onSaveInstanceState(Bundle outState) { outState.putParcelable("imageCaptureUri", mImageCaptureUri); } private void first_load(Bundle savedInstanceState) { if(savedInstanceState != null) { mImageCaptureUri = savedInstanceState.getParcelable("imageCaptureUri"); } } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == activity.RESULT_OK || resultCode != activity.RESULT_CANCELED) { switch (requestCode) { case PICK_FROM_FILE: mImageCaptureUri = null; mImageCaptureUri = data.getData(); onChoosePicture(); break; } } } private void onChoosePicture() { new AsyncTask<Void,Integer, String>(){ Bitmap bm; @Override protected String doInBackground(Void... voids) { String urls = ""; if(mImageCaptureUri != null) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.RGB_565; String fi = getPath(activity, mImageCaptureUri); Uri r = Uri.parse(fi); File f = new File(r.getPath().toString()); urls = f.getAbsolutePath(); bm = HelperGeneral.ResizeBitmap(urls, 400, 400, false); } else { urls = ""; } return urls; } @Override protected void onPostExecute(String s) { super.onPostExecute(s); if(s != null && !s.equals("") && bm != null) { selectedImagePath = s; circleImage.setImageBitmap(bm); } } }.execute(); } public String getRealPathFromURI(Uri contentUri) { String[] proj = { MediaStore.Images.Media.DATA }; Cursor cursor = activity.getContentResolver().query(contentUri, proj, null, null, null); int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); return cursor.getString(column_index); } @SuppressLint("NewApi") public static String getPath(final Context context, final Uri uri) { final boolean isKitKat = Build.VERSION.SDK_INT >= 19; // DocumentProvider if (isKitKat && android.provider.DocumentsContract.isDocumentUri(context, uri)) { // ExternalStorageProvider if (isExternalStorageDocument(uri)) { final String docId = android.provider.DocumentsContract.getDocumentId(uri); final String[] split = docId.split(":"); final String type = split[0]; if ("primary".equalsIgnoreCase(type)) { return Environment.getExternalStorageDirectory() + "/" + split[1]; } // TODO handle non-primary volumes } // DownloadsProvider else if (isDownloadsDocument(uri)) { final String id = android.provider.DocumentsContract.getDocumentId(uri); final Uri contentUri = ContentUris.withAppendedId( Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); return getDataColumn(context, contentUri, null, null); } // MediaProvider else if (isMediaDocument(uri)) { final String docId = android.provider.DocumentsContract.getDocumentId(uri); final String[] split = docId.split(":"); final String type = split[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; } else if ("audio".equals(type)) { contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; } final String selection = "_id=?"; final String[] selectionArgs = new String[] { split[1] }; return getDataColumn(context, contentUri, selection, selectionArgs); } } // MediaStore (and general) else if ("content".equalsIgnoreCase(uri.getScheme())) { // Return the remote address if (isGooglePhotosUri(uri)) return uri.getLastPathSegment(); return getDataColumn(context, uri, null, null); } // File else if ("file".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } return null; } public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; final String[] projection = { column }; try { cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); if (cursor != null && cursor.moveToFirst()) { final int index = cursor.getColumnIndexOrThrow(column); return cursor.getString(index); } } finally { if (cursor != null) cursor.close(); } return null; } /** * @param uri The Uri to check. * @return Whether the Uri authority is ExternalStorageProvider. */ public static boolean isExternalStorageDocument(Uri uri) { return "com.android.externalstorage.documents".equals(uri.getAuthority()); } /** * @param uri The Uri to check. * @return Whether the Uri authority is DownloadsProvider. */ public static boolean isDownloadsDocument(Uri uri) { return "com.android.providers.downloads.documents".equals(uri.getAuthority()); } /** * @param uri The Uri to check. * @return Whether the Uri authority is MediaProvider. */ public static boolean isMediaDocument(Uri uri) { return "com.android.providers.media.documents".equals(uri.getAuthority()); } /** * @param uri The Uri to check. * @return Whether the Uri authority is Google Photos. */ public static boolean isGooglePhotosUri(Uri uri) { return "com.google.android.apps.photos.content".equals(uri.getAuthority()); } @Override public void onConnected(@Nullable Bundle bundle) { mLastLocation = LocationServices.FusedLocationApi.getLastLocation( mGoogleApi); if(mLastLocation != null) { currentLatitude = mLastLocation.getLatitude(); currentLongitude = mLastLocation.getLongitude(); ArrayList<String> getAddr = HelperGeneral.getAddressMaps(activity, currentLatitude, currentLongitude); if (getAddr.size() > 3) { String city = getAddr.get(0); String country = getAddr.get(3); currentLocation = city + ", " + country; if(editLocation != null) { editLocation.setText(currentLocation); } } } } @Override public void onConnectionSuspended(int i) { } @Override public void onConnectionFailed(ConnectionResult connectionResult) { } } <file_sep>LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := meetdesk-library LOCAL_SRC_FILES := meetdesk-library.c include $(BUILD_SHARED_LIBRARY)<file_sep>package com.meetdesk.fragment; import android.app.Activity; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.meetdesk.BaseActivity; import com.meetdesk.BaseFragment; import com.meetdesk.R; import com.meetdesk.helper.HelperGeneral; /** * Created by ekobudiarto on 12/19/16. */ public class FragmentConfirmation extends BaseFragment { View main_view; HelperGeneral.FragmentInterface iFragment; BaseActivity activity; public static final String TAG_FRAGMENT_SETTINGS = "tag:fragment-settings"; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { main_view = inflater.inflate(R.layout.fragment_confirmation, container, false); return main_view; } @Override public void onAttach(Activity activity) { super.onAttach(activity); if(activity != null) { this.activity = (BaseActivity) activity; iFragment = (HelperGeneral.FragmentInterface) this.activity; } } @Override public void onStart() { super.onStart(); if(activity != null) { } } } <file_sep>package com.meetdesk.fragment; import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.ImageView; import com.meetdesk.BaseActivity; import com.meetdesk.BaseFragment; import com.meetdesk.R; import com.meetdesk.controller.ControllerGeneral; import com.meetdesk.helper.HelperGeneral; import com.meetdesk.model.PrefAuthentication; import com.meetdesk.util.EndlessRecyclerViewScrollListener; import com.meetdesk.view.UIText; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Map; /** * Created by ekobudiarto on 11/1/16. */ public class FragmentInbox extends BaseFragment { View main_view; HelperGeneral.FragmentInterface iFragment; BaseActivity activity; public static final String TAG_FRAGMENT_INBOX = "tag:fragment-inbox"; ImageButton imagebuttonBack; RecyclerView recycler; ArrayList<String> inboxID, inboxTitle, inboxUser, inboxDate, inboxMessage; ArrayList<Boolean> inboxNotif, inboxShowGroupDate; InboxAdapter adapter; int l = 10, o = 0; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { main_view = inflater.inflate(R.layout.fragment_inbox, container, false); return main_view; } @Override public void onAttach(Activity activity) { super.onAttach(activity); if(activity != null) { this.activity = (BaseActivity) activity; iFragment = (HelperGeneral.FragmentInterface) this.activity; } } @Override public void onStart() { super.onStart(); if(activity != null) { init(); getData(true); } } private void init() { inboxID = new ArrayList<String>(); inboxTitle = new ArrayList<String>(); inboxUser = new ArrayList<String>(); inboxDate = new ArrayList<String>(); inboxMessage = new ArrayList<String>(); inboxNotif = new ArrayList<Boolean>(); inboxShowGroupDate = new ArrayList<Boolean>(); adapter = new InboxAdapter(); imagebuttonBack = (ImageButton) activity.findViewById(R.id.inbox_imagebutton_back); recycler = (RecyclerView) activity.findViewById(R.id.inbox_recycler); final LinearLayoutManager recycleLayoutManager = new LinearLayoutManager(activity); recycler.setLayoutManager(recycleLayoutManager); recycler.setItemAnimator(new DefaultItemAnimator()); recycler.setAdapter(adapter); recycler.addOnScrollListener(new EndlessRecyclerViewScrollListener(recycleLayoutManager) { @Override public void onLoadMore(int page, int totalItemsCount) { getData(false); } }); recycler.addOnItemTouchListener(new HelperGeneral.RecyclerTouchListener(activity, recycler, new HelperGeneral.ClickListener() { @Override public void onClick(View view, int position) { launchInboxNew(inboxUser.get(position), inboxTitle.get(position), inboxID.get(position)); } @Override public void onLongClick(View view, int position) { } })); imagebuttonBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { activity.onBackPressed(); } }); } private void launchInboxNew(String user, String title, String mid) { Map<String, String> param = new HashMap<String, String>(); param.put("new", "0"); param.put("user", user); param.put("target_id", mid); param.put("title", title); FragmentInboxNew inboxNew = new FragmentInboxNew(); iFragment.onNavigate(inboxNew, param); } private void getData(final boolean firstLoad) { new AsyncTask<Void, Integer, String>() { boolean success = false; ArrayList<String> tempID, tempTitle, tempUser,tempDate, tempContent; ArrayList<Boolean> tempShowGroup, tempIsNotif; @Override protected void onPreExecute() { super.onPreExecute(); if(firstLoad) { o = 0; } tempID = new ArrayList<String>(); tempDate = new ArrayList<String>(); tempTitle = new ArrayList<String>(); tempUser = new ArrayList<String>(); tempContent = new ArrayList<String>(); tempShowGroup = new ArrayList<Boolean>(); tempIsNotif = new ArrayList<Boolean>(); } @Override protected String doInBackground(Void... params) { PrefAuthentication authentication = new PrefAuthentication(activity); ControllerGeneral general = new ControllerGeneral(activity); general.setToken(authentication.getKeyUserToken()); general.setL((l)); general.setO(o); general.executeListMessage(); if(general.getSuccess()) { success = true; tempID.addAll(general.getInboxID()); tempDate.addAll(general.getInboxDate()); tempUser.addAll(general.getInboxUser()); tempTitle.addAll(general.getInboxTitle()); tempContent.addAll(general.getInboxMessage()); tempShowGroup.addAll(general.getInboxShowGroupDate()); tempIsNotif.addAll(general.getInboxNotif()); o = general.getOffset(); } return ""; } @Override protected void onPostExecute(String s) { super.onPostExecute(s); if(success) { if(tempID.size() > 0) { for(int i = 0;i < tempID.size();i++) { inboxID.add(tempID.get(i)); inboxDate.add(tempDate.get(i)); inboxUser.add(tempUser.get(i)); inboxTitle.add(tempTitle.get(i)); inboxMessage.add(tempContent.get(i)); inboxShowGroupDate.add(tempShowGroup.get(i)); inboxNotif.add(tempIsNotif.get(i)); } adapter.notifyDataSetChanged(); } } } }.execute(); } private String getInboxDateFormat(String date) { String result = ""; try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date newDate = sdf.parse(date); SimpleDateFormat sdf2 = new SimpleDateFormat("EEEE, dd MMMM yyyy"); result = sdf2.format(newDate); } catch (ParseException e) { result = ""; } return result; } private String getInboxTimeFormat(String time) { String result = ""; try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date newDate = sdf.parse(time); SimpleDateFormat sdf2 = new SimpleDateFormat("KK a"); result = sdf2.format(newDate); } catch (ParseException e) { result = ""; } return result; } public class InboxAdapter extends RecyclerView.Adapter<InboxAdapter.InboxViewHolder>{ private static final int TYPE_HEADER = 0; private static final int TYPE_ITEM = 1; public InboxAdapter() { } @Override public int getItemViewType(int position) { return TYPE_ITEM; } @Override public InboxViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.item_fragment_inbox, parent, false); return new InboxViewHolder(itemView); } @Override public void onBindViewHolder(final InboxViewHolder holder, int position) { String desc = HelperGeneral.getLimitedWords(inboxMessage.get(position), 10); String date = getInboxDateFormat(inboxDate.get(position)); String time = getInboxTimeFormat(inboxDate.get(position)); holder.textUser.setText(inboxUser.get(position)); holder.textDesc.setText(desc); holder.textTime.setText(time); holder.textTitle.setText(inboxTitle.get(position)); holder.textDate.setText(date); if(inboxNotif.get(position)) { holder.iconNotif.setImageResource(R.drawable.icon_inbox_notif); } if(!inboxNotif.get(position)) { holder.iconNotif.setImageResource(R.drawable.icon_inbox_notif_transparent); } if(inboxShowGroupDate.get(position)) { holder.textDate.setVisibility(View.VISIBLE); } if(!inboxShowGroupDate.get(position)) { holder.textDate.setVisibility(View.GONE); } } @Override public int getItemCount() { return inboxID.size(); } public class InboxViewHolder extends RecyclerView.ViewHolder{ ImageView iconNotif; UIText textUser, textTitle, textTime, textDesc, textDate; public InboxViewHolder(View itemView) { super(itemView); iconNotif = (ImageView) itemView.findViewById(R.id.item_inbox_notif); textUser = (UIText) itemView.findViewById(R.id.item_inbox_user); textTitle = (UIText) itemView.findViewById(R.id.item_inbox_title); textTime = (UIText) itemView.findViewById(R.id.item_inbox_time); textDesc = (UIText) itemView.findViewById(R.id.item_inbox_desc); textDate = (UIText) itemView.findViewById(R.id.item_inbox_date); } } public boolean isHeader(int position) { return position == 0; } } } <file_sep>package com.meetdesk.fragment; import android.app.Activity; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.ImageView; import com.meetdesk.BaseActivity; import com.meetdesk.BaseFragment; import com.meetdesk.R; import com.meetdesk.helper.HelperGeneral; import com.meetdesk.util.RecyclerViewItemDivider; import com.meetdesk.view.UIText; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; /** * Created by ekobudiarto on 11/4/16. */ public class FragmentHelp extends BaseFragment { View main_view; HelperGeneral.FragmentInterface iFragment; BaseActivity activity; public static final String TAG_FRAGMENT_HELP = "tag:fragment-help"; ImageButton imagebuttonBack; RecyclerView recycler; ArrayList<String> dataID, dataTitle; AdapterHelp adapter; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { main_view = inflater.inflate(R.layout.fragment_help, container, false); return main_view; } @Override public void onAttach(Activity activity) { super.onAttach(activity); if(activity != null) { this.activity = (BaseActivity) activity; iFragment = (HelperGeneral.FragmentInterface) this.activity; } } @Override public void onStart() { super.onStart(); if(activity != null) { init(); getData(); } } private void init() { dataID = new ArrayList<String>(); dataTitle = new ArrayList<String>(); adapter = new AdapterHelp(); imagebuttonBack = (ImageButton) activity.findViewById(R.id.help_imagebutton_back); recycler = (RecyclerView) activity.findViewById(R.id.help_recycler); final LinearLayoutManager recycleLayoutManager = new LinearLayoutManager(activity); RecyclerViewItemDivider divider = new RecyclerViewItemDivider(activity, RecyclerViewItemDivider.VERTICAL_LIST); recycler.addItemDecoration(divider); recycler.setLayoutManager(recycleLayoutManager); recycler.setItemAnimator(new DefaultItemAnimator()); recycler.setAdapter(adapter); recycler.addOnItemTouchListener(new HelperGeneral.RecyclerTouchListener(activity, recycler, new HelperGeneral.ClickListener() { @Override public void onClick(View view, int position) { if(dataID.get(position).equals("1")) { Map<String, String> param = new HashMap<String, String>(); FragmentHelpAbout about = new FragmentHelpAbout(); iFragment.onNavigate(about, param); } if(dataID.get(position).equals("2")) { /*Map<String, String> param = new HashMap<String, String>(); FragmentHelpTerm term = new FragmentHelpTerm(); iFragment.onNavigate(term, param);*/ HelperGeneral.openAppURL(activity, "https://www.meetdesk.id/term"); } if(dataID.get(position).equals("3")) { Map<String, String> param = new HashMap<String, String>(); FragmentHelpContact contact = new FragmentHelpContact(); iFragment.onNavigate(contact, param); } } @Override public void onLongClick(View view, int position) { } })); imagebuttonBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { activity.onBackPressed(); } }); } private void getData() { dataID.add("1"); dataID.add("2"); dataID.add("3"); dataTitle.add("About"); dataTitle.add("Terms and Privacy Policy"); dataTitle.add("Contact Us"); adapter.notifyDataSetChanged(); } public class AdapterHelp extends RecyclerView.Adapter<AdapterHelp.HelpViewHolder>{ private static final int TYPE_HEADER = 0; private static final int TYPE_ITEM = 1; public AdapterHelp() { } @Override public int getItemViewType(int position) { return TYPE_ITEM; } @Override public HelpViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.item_fragment_help, parent, false); return new HelpViewHolder(itemView); } @Override public void onBindViewHolder(final HelpViewHolder holder, int position) { holder.textUser.setText(dataTitle.get(position)); } @Override public int getItemCount() { return dataID.size(); } public class HelpViewHolder extends RecyclerView.ViewHolder{ UIText textUser; public HelpViewHolder(View itemView) { super(itemView); textUser = (UIText) itemView.findViewById(R.id.item_help_title); } } public boolean isHeader(int position) { return position == 0; } } } <file_sep>package com.meetdesk.model; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import com.meetdesk.helper.HelperEntityColumn; import java.util.ArrayList; import java.util.List; /** * Created by ekobudiarto on 11/22/16. */ public class QueryRegion { SQLiteOpenHelper sqliteHelper; public QueryRegion(SQLiteOpenHelper sqliteHelper) { this.sqliteHelper = sqliteHelper; } public void setSqliteHelper(SQLiteOpenHelper helper) { this.sqliteHelper = helper; } public void AddRegion(EntityRegion region) { SQLiteDatabase db = sqliteHelper.getWritableDatabase(); ContentValues value = new ContentValues(); value.put(HelperEntityColumn.COL_REGION_ID, region.getRegionID()); value.put(HelperEntityColumn.COL_REGION_NAME, region.getRegionName()); value.put(HelperEntityColumn.COL_REGION_CODE, region.getRegionCode()); db.insert(HelperEntityColumn.TBL_REGION, null, value); db.close(); } public void UpdateRegion(EntityRegion region) { SQLiteDatabase db = sqliteHelper.getWritableDatabase(); ContentValues value = new ContentValues(); value.put(HelperEntityColumn.COL_REGION_ID, region.getRegionID()); value.put(HelperEntityColumn.COL_REGION_NAME, region.getRegionName()); value.put(HelperEntityColumn.COL_REGION_CODE, region.getRegionCode()); db.update(HelperEntityColumn.TBL_REGION, value, HelperEntityColumn.COL_REGION_ID + " = ?", new String[] {String.valueOf(region.getRegionID())}); db.close(); } public List<EntityRegion> GetAllRegion() { List<EntityRegion> listRegion = new ArrayList<EntityRegion>(); String query = "SELECT * FROM " + HelperEntityColumn.TBL_REGION +" ORDER BY " + HelperEntityColumn.COL_REGION_ID + " DESC"; SQLiteDatabase db = sqliteHelper.getWritableDatabase(); Cursor cursor = db.rawQuery(query, null); if(cursor.moveToFirst()) { do{ EntityRegion region = new EntityRegion(); region.setRegionID(Integer.parseInt(cursor.getString(0))); region.setRegionName(cursor.getString(1)); region.setRegionCode(cursor.getString(2)); listRegion.add(region); }while (cursor.moveToNext()); } return listRegion; } public EntityRegion GetDetailRegion(int id) { SQLiteDatabase db = sqliteHelper.getReadableDatabase(); Cursor cursor = db.query(HelperEntityColumn.TBL_REGION, new String[]{ HelperEntityColumn.COL_REGION_ID, HelperEntityColumn.COL_REGION_NAME, HelperEntityColumn.COL_REGION_CODE }, HelperEntityColumn.COL_REGION_ID + " = ?", new String[]{String.valueOf(id)}, null, null, null, null); if(cursor != null) cursor.moveToFirst(); EntityRegion region = new EntityRegion(); region.setRegionID(Integer.parseInt(cursor.getString(0))); region.setRegionName(cursor.getString(1)); region.setRegionCode(cursor.getString(2)); return region; } public void DeleteRegion(EntityRegion region) { SQLiteDatabase db = sqliteHelper.getWritableDatabase(); db.execSQL("DELETE FROM " + HelperEntityColumn.TBL_REGION + " WHERE " + HelperEntityColumn.COL_REGION_ID + " = " + Integer.toString(region.getRegionID())); db.close(); } public void ResetRegion() { SQLiteDatabase db = sqliteHelper.getWritableDatabase(); db.execSQL("DELETE FROM " + HelperEntityColumn.TBL_REGION); db.close(); } public boolean CheckItemRegion(int id) { String query = "SELECT * FROM " + HelperEntityColumn.TBL_REGION + " WHERE " + HelperEntityColumn.COL_REGION_ID + " = " + Integer.toString(id); SQLiteDatabase db = sqliteHelper.getReadableDatabase(); Cursor cursor = db.rawQuery(query, null); if(cursor.moveToFirst()) { return true; } else { return false; } } public void CreateDBRegion(SQLiteDatabase db) { String CREATE_REGION = "CREATE TABLE " + HelperEntityColumn.TBL_REGION + " (" + HelperEntityColumn.COL_REGION_ID + " INTEGER PRIMARY KEY, "+ HelperEntityColumn.COL_REGION_NAME + " TEXT, "+ HelperEntityColumn.COL_REGION_CODE + " TEXT) "; db.execSQL("DROP TABLE IF EXISTS " + HelperEntityColumn.TBL_REGION); db.execSQL(CREATE_REGION); } } <file_sep>package com.meetdesk.model; /** * Created by ekobudiarto on 11/22/16. */ public class EntityProductCategory { private int categoryID; private String categoryName; private String categoryDesc; private String categoryIcon; public EntityProductCategory() { this.categoryID = 0; this.categoryName = ""; this.categoryDesc = ""; this.categoryIcon = ""; } public void setCategoryID(int id) { this.categoryID = id; } public int getCategoryID() { return categoryID; } public void setCategoryName(String name) { this.categoryName = name; } public String getCategoryName() { return categoryName; } public void setCategoryDesc(String desc) { this.categoryDesc = desc; } public String getCategoryDesc() { return categoryDesc; } public void setCategoryIcon(String icon) { this.categoryIcon = icon; } public String getCategoryIcon() { return categoryIcon; } } <file_sep>package com.meetdesk.activity; import android.Manifest; import android.content.Intent; import android.content.pm.PackageManager; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.os.SystemClock; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.widget.Toast; import com.crashlytics.android.Crashlytics; import com.meetdesk.BaseActivity; import com.meetdesk.R; import com.meetdesk.controller.ControllerSetup; import com.meetdesk.helper.HelperGeneral; import com.meetdesk.model.PrefAuthentication; import io.fabric.sdk.android.Fabric; public class Intro extends BaseActivity { boolean isLoggedIn = false, showSelectType = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Fabric.with(this, new Crashlytics()); setContentView(R.layout.activity_intro); } @Override protected void onStart() { super.onStart(); getPermissionReadPhoneState(); } private void launch() { new AsyncTask<Void, Integer, String>() { boolean success = false; String msg = ""; @Override protected void onPreExecute() { // TODO Auto-generated method stub overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); super.onPreExecute(); } @Override protected String doInBackground(Void... params) { // TODO Auto-generated method stub PrefAuthentication authPreferences = new PrefAuthentication(Intro.this); showSelectType = authPreferences.getDisplayingSelectType(); isLoggedIn = authPreferences.getLoggedIn(); if(authPreferences.getKeyUserToken().equals("")) { authPreferences.setKeyUserToken(HelperGeneral.getDeviceID(Intro.this)); } ControllerSetup setup = new ControllerSetup(Intro.this); setup.setL(50); setup.setO(0); setup.setToken(HelperGeneral.getDeviceID(Intro.this)); setup.getRegion(); ControllerSetup setup2 = new ControllerSetup(Intro.this); setup2.setL(50); setup2.setO(0); setup2.setToken(HelperGeneral.getDeviceID(Intro.this)); setup2.getProcat(); if(!setup.getSuccess() && !setup2.getSuccess()) { success = false; msg = setup.getMessage(); } SystemClock.sleep(3000); return ""; } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); Intent i = null; if(isLoggedIn) { i = new Intent(Intro.this, MainActivity.class); } else { i = new Intent(Intro.this, ActivityAuth.class); i.putExtra("isLogout", false); } startActivity(i); finish(); } }.execute(); } private void getPermissionReadPhoneState() { if(Build.VERSION.SDK_INT >= 23) { if(ContextCompat.checkSelfPermission(Intro.this, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) { launch(); } else { ActivityCompat.requestPermissions(Intro.this, new String[]{Manifest.permission.READ_PHONE_STATE}, 112); } } else { launch(); } } @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); switch (requestCode) { case 112:{ if(grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { launch(); } else { Toast.makeText(Intro.this, "No Allowed Permission", Toast.LENGTH_SHORT).show(); System.exit(0); } } } } }
198d47bcacec8b24098c41ccdced3411825df2ac
[ "Makefile", "Java", "C", "Gradle" ]
25
Java
cupsmark/md-andro
12912f260bfc81f8627c17afff5b29ca29f7a42a
bd560a94ed995c93d9d4d0e39f78165d11de6d52
refs/heads/master
<repo_name>sivasatvik/Concurrent-Programming<file_sep>/Genetic Algorithm/Makefile all: g++ -std=c++14 -pthread tsp.cpp main.cpp -o main.o -DN=4 -DSEED=15 -DC=50 -DPOP=20 -DGEN=5000 ./main.o<file_sep>/brute/main.cpp #include <atomic> #include <iostream> #include <thread> #include <vector> #include <random> #include <cstdlib> #include <algorithm> #include <sys/time.h> // Nnumber of threads #define num_proc N using namespace std; // Matrix representation of graph ( graph[i][j] = cost to go from i to j [ i.e distance[i to j]]) int graph[V][V]; // global array where each thread store the minimum cost it found int mins[num_proc]; // Second vertex number ranges from [1 to V-1] ( assume init vertex = 0) std::atomic_int vert_no; // Print Generated Graph void printGraph(){ for (int i = 0; i < V; ++i){ for (int j = 0; j < V; ++j){ cout<<graph[i][j]<<" "; } cout<<endl; } } // Creates Random Graph with V number of vertex void generatesGraph() { vector<int> vec; // creates the vector for(int i = 0; i < V; i++){ vec.push_back(i); // cout<<vec[i]<<" "; } // cout<<endl; // generates a random permutation random_shuffle(vec.begin(), vec.end()); // gives random weight to vertices int i, weight; // This for loop connect all the edges for(i = 0; i <= V; i++) { weight = rand() % V + 1; // random weight in range [1,V] // cout<<vec[i]<<" "<<vec[i+1]<<" "<<weight<<endl; if(i + 1 < V){ graph[vec[i]][vec[i+1]] = weight; } else { // add last edge graph[vec[i]][vec[0]] = weight; break; } } int limit_edges = V * (V - 1); // calculates the limit of edges int size_edges = rand() % (2 * limit_edges) + limit_edges; // This for loop adds some extra edges to graph for(int i = 0; i < size_edges; i++) { int src = rand() % V; // random source int dest = rand() % V; // random destination weight = rand() % V + 1; // random weight in range [1,V] if(src != dest) { graph[vec[src]][vec[dest]] = weight; graph[vec[dest]][vec[src]] = weight; } } } // implementation of traveling Salesman Problem void travllingSalesmanProblem(int id) { int min_path = 0; do { // store all vertex apart from source vertex and initial vertex i.e 0 int sec_vert = vert_no++; vector<int> vertex; for (int i = 1; i < V; i++) if (i != sec_vert) vertex.push_back(i); // store minimum weight Hamiltonian Cycle. min_path = 999999; do { // store current Path weight(cost) int current_pathweight = graph[0][sec_vert]; // initial vertex(1) to second vertex pathlength add // compute current path weight int k = sec_vert; // Starting from second vertex, calc dist between adjacent vertices for (int i = 0; i < vertex.size(); i++) { current_pathweight += graph[k][vertex[i]]; k = vertex[i]; } // Add distance to get back to initial vertex current_pathweight += graph[k][0]; // update minimum min_path = min(min_path, current_pathweight); } while (next_permutation(vertex.begin(), vertex.end())); }while(vert_no < V); mins[id] = min_path; // Store in Global array } // Main function int main() { // Seed to make sure same random cities are generated when testing sequencial and parallel code srand(SEED); vert_no = 1; generatesGraph(); // int graph[][V] = { { 0, 10, 15, 20 }, // { 10, 0, 35, 25 }, // { 15, 35, 0, 30 }, // { 20, 25, 30, 0 } // }; printGraph(); cout << "\n\n\n\n"; struct timeval start; gettimeofday(&start, 0); vector<thread> threads; // Start num_proc threads for(int i = 0; i<num_proc; i++){ threads.push_back(std::thread(travllingSalesmanProblem, i)); } // wait for threads to finish for(auto &th : threads) th.join(); struct timeval end; gettimeofday(&end, 0); // find min of the minimum value each thread generated int cur_min = mins[0]; for(int i=1;i<num_proc;i++) { if(mins[i] < cur_min) { cur_min = mins[i]; } } cout << cur_min <<endl; long long duration = (end.tv_sec-start.tv_sec)*1000000LL + end.tv_usec-start.tv_usec; float time_val = (float)duration/1000000; cout << "\n\nTime for to run this algorithm: " << time_val << " seconds.\n\n"; // shows time in seconds cout<<"----------------------------------------------------------------------------------------------\n"; return 0; }<file_sep>/README.md # Concurrent Implementation for TSP <file_sep>/Genetic Algorithm/main.cpp #include <iostream> #include "tsp.h" using namespace std; int main() { // Seed for same random cities generated for sequence and parallel code srand(SEED); // creates random graph, parameter 3 is true is for generate the graph Graph * graph4 = new Graph(C, 0, true); // graph4->showInfoGraph(); // graph4->showGraph(); // parameters: the graph, population size, generations and mutation rate // optional parameters: show_population Genetic genetic(graph4, POP, GEN, 5, true); // gets initial my_population // genetic.initialPopulation(); struct timeval start; gettimeofday(&start, 0); // Vector of created threads vector<thread> threads; for(int i = 0; i<num_proc; i++){ threads.push_back(std::thread(&Genetic::run, &genetic, i)); } // Wait for threads to finish for(auto &th : threads) th.join(); struct timeval end; gettimeofday(&end, 0); // Get final minimum of results from each thread genetic.getResult(); long long duration = (end.tv_sec-start.tv_sec)*1000000LL + end.tv_usec-start.tv_usec; float time_val = (float)duration/1000000; cout << "\n\nTime for to run the genetic algorithm: " << time_val << " seconds.\n\n"; // shows time in seconds cout<<"----------------------------------------------------------------------------------------------\n"; ofstream file1; file1.open("Multi-threaded.csv",ios::out | ios::app); file1<<","<<time_val<<"\n"; file1.close(); return 0; } <file_sep>/Source_Code/tsp.h #ifndef TSP #define TSP #include <vector> #include <map> #include <set> #include <utility> #include <ctime> #include <cstdlib> /* Graph class to represent the graph of the city */ class Graph{ private: int vertices; // Total number of cities the Salesman should travel int tot_edges; int initial_vertex; // Starting point of the Salesman std::map<std::pair<int,int>, int> edge_map; // Mapping the edges public: /* Constructor */ Graph(int vertices, int initial_vertex); void add_edge(int v1, int v2, int weight); void show_graph(); int exists_edge(int v1, int v2); friend class Genetic; }; class Genetic{ }; <file_sep>/brute_plain/main.cpp #include <bits/stdc++.h> #include <vector> #include <random> #include <cstdlib> #include <algorithm> #include <sys/time.h> using namespace std; int graph[V][V]; void printGraph(){ for (int i = 0; i < V; ++i){ for (int j = 0; j < V; ++j){ cout<<graph[i][j]<<" "; } cout<<endl; } } void generatesGraph() { vector<int> vec; // creates the vector for(int i = 0; i < V; i++){ vec.push_back(i); // cout<<vec[i]<<" "; } cout<<endl; // generates a random permutation random_shuffle(vec.begin(), vec.end()); //initial_vertex = vec[0]; // updates initial vertex int i, weight; for(i = 0; i <= V; i++) { weight = rand() % V + 1; // random weight in range [1,V] // cout<<vec[i]<<" "<<vec[i+1]<<" "<<weight<<endl; if(i + 1 < V){ graph[vec[i]][vec[i+1]] = weight; // cost[i] = weight; // cout<<ary[vec[i]][vec[i+1]]<<endl; } // addEdge(vec[i], vec[i + 1], weight); else { // add last edge graph[vec[i]][vec[0]] = weight; // cost[i] = weight; // addEdge(vec[i], vec[0], weight); break; } } int limit_edges = V * (V - 1); // calculates the limit of edges int size_edges = rand() % (2 * limit_edges) + limit_edges; // add others edges randomly for(int i = 0; i < size_edges; i++) { int src = rand() % V; // random source int dest = rand() % V; // random destination weight = rand() % V + 1; // random weight in range [1,V] if(src != dest) { graph[vec[src]][vec[dest]] = weight; graph[vec[dest]][vec[src]] = weight; // addEdge(vec[src], vec[dest], weight); // addEdge(vec[dest], vec[src], weight); } } } // implementation of traveling Salesman Problem int travllingSalesmanProblem(int graph[][V], int s) { // store all vertex apart from source vertex vector<int> vertex; for (int i = 0; i < V; i++) if (i != s) vertex.push_back(i); // store minimum weight Hamiltonian Cycle. int min_path = 999999; do { // store current Path weight(cost) int current_pathweight = 0; // compute current path weight int k = s; for (int i = 0; i < vertex.size(); i++) { current_pathweight += graph[k][vertex[i]]; // cout<<current_pathweight<<endl; k = vertex[i]; } current_pathweight += graph[k][s]; // update minimum min_path = min(min_path, current_pathweight); } while (next_permutation(vertex.begin(), vertex.end())); return min_path; } // driver program to test above function int main() { srand(SEED); // matrix representation of graph generatesGraph(); // int graph[][V] = { { 0, 10, 15, 20 }, // { 10, 0, 35, 25 }, // { 15, 35, 0, 30 }, // { 20, 25, 30, 0 } }; printGraph(); struct timeval start; gettimeofday(&start, 0); int s = 0; cout << travllingSalesmanProblem(graph, s) << endl; struct timeval end; gettimeofday(&end, 0); long long duration = (end.tv_sec-start.tv_sec)*1000000LL + end.tv_usec-start.tv_usec; float time_val = (float)duration/1000000; cout << "\n\nTime for to run the genetic algorithm: " << time_val/*float(clock() - begin_time)/CLOCKS_PER_SEC*/ << " seconds.\n\n"; // shows time in seconds cout<<"----------------------------------------------------------------------------------------------\n"; return 0; }<file_sep>/Genetic Algorithm/script.py import subprocess import os subprocess.call('ls') num_proc = [4, 8, 2, 1] seed = [7, 11, 31] cities = [20, 50, 100, 250, 500, 750, 1000] pop = [5, 10, 20, 40] gen = [1000, 5000, 10000] subprocess.call('pwd', shell=True) for i in num_proc: for j in seed: for k in cities: for l in pop: for g in gen: command = 'g++ -g --std=c++14 -pthread tsp.cpp main.cpp -o main.o -DN='+str(i)+" -DSEED="+str(j)+" -DC="+str(k)+" -DPOP="+str(l)+" -DGEN="+str(g) print command subprocess.call(command, shell=True) subprocess.call("./main.o", shell=True) os.chdir('../plain/') subprocess.call('pwd', shell=True) for i in num_proc: for j in seed: for k in cities: for l in pop: for g in gen: command = 'g++ -g --std=c++14 -pthread tsp.cpp main.cpp -o main.o -DN='+str(i)+" -DSEED="+str(j)+" -DC="+str(k)+" -DPOP="+str(l)+" -DGEN="+str(g) print command subprocess.call(command, shell=True) subprocess.call("./main.o", shell=True) <file_sep>/plain/main.cpp #include <iostream> #include "tsp.h" using namespace std; int main() { srand(SEED); // random numbers // creates random graph, parameter true is for generate the graph Graph * graph4 = new Graph(C, 0, true); // graph4->showInfoGraph(); // graph4->showGraph(); // parameters: the graph, population size, generations and mutation rate // optional parameters: show_population Genetic genetic(graph4, POP, GEN, 5, true); // Genetic genetic1(graph4, 10, 10000, 5, true); // Genetic genetic2(graph4, 10, 10000, 5, true); struct timeval start; gettimeofday(&start, 0); // const clock_t begin_time = clock(); // gets time genetic.run(); // runs the genetic algorithm // genetic1.run(); // genetic2.run(); struct timeval end; gettimeofday(&end, 0); long long duration = (end.tv_sec-start.tv_sec)*1000000LL + end.tv_usec-start.tv_usec; float time_val = (float)duration/1000000; // float time_val = float(clock () - begin_time) / CLOCKS_PER_SEC; cout << "\n\nTime for to run the genetic algorithm: " << time_val/*float(clock () - begin_time) / CLOCKS_PER_SEC*/ << " seconds.\n"; // shows time in seconds cout<<"----------------------------------------------------------------------------------------------\n"; ofstream file1; file1.open("Plain.csv",ios::out | ios::app); file1<<","<<time_val<<"\n"; file1.close(); return 0; }<file_sep>/brute/Makefile all: g++ -std=c++14 -pthread main.cpp -o main.o -DN=4 -DSEED=15 -DC=12
53c38a43833185fcb99747005fee06fe5dd74597
[ "Markdown", "Python", "Makefile", "C++" ]
9
Makefile
sivasatvik/Concurrent-Programming
53014efaf3cd04a15f5c3db5445eac7ce14a5dda
c7d4679e4cb6a40011f600e77854f954ac7a96a8
refs/heads/master
<file_sep>export default class Transactions{ static transactions: any[] constructor(){ Transactions.transactions = [] } add(objeto: any){ Transactions.transactions.push(objeto) } } <file_sep># bank-system. Esse sistema foi criado para gerenciar movimentações bancárias. Esse projeto é só uma forma pessoal de treinar, portanto, não criarei tão cedo uma interface gráfica ou qualquer coisa parecida. <file_sep>import express, { json, Response, Request } from 'express' import router from './routes/routes' import Transaction from './models/Transaction' const app = express() app.use(express.json()) //router sempre é o ultimo app.use(router) app.get('/', (request: Request, response: Response) => { return response.json({message: 'Rota conectada'}) }) app.listen(3333, () => { console.log('🍕Door open at entrance 3333') })<file_sep>import { Router } from 'express' import { v4 } from 'uuid' import Transactions from './Transactions' export const viewrRoute = Router() export default class Transaction{ contaCorrente: number name: string id: string numDeposit: number totalDeposit: number numWithDraw: number totalWithDraw: number static quantidade = 0 constructor(clientName: string, value: number) { this.contaCorrente = value this.name = clientName this.id = v4() this.numDeposit = 0 this.totalDeposit = 0 this.numWithDraw = 0 this.totalWithDraw = 0 Transaction.quantidade += 1 const add = new Transactions() add.add(Transaction) } withdraw(value: number){ if(this.contaCorrente < value){ return } this.contaCorrente -= value this.numWithDraw += 1 this.totalWithDraw += value } deposit(value: number){ this.contaCorrente += value this.numDeposit += 1 this.totalDeposit += value } viewr(){ viewrRoute.get('/', (request, response)=>{ return response.json({ 'Nome': `${this.name}`, 'Conta corrente': `${this.contaCorrente}`, 'Data': `${new Date}`, 'Número de depósito': `R$${this.numDeposit}`, 'Valor total de depósitos': `R$${this.totalWithDraw}`, 'Número de saques': `${this.numWithDraw}`, 'Valor total de saques': `R$${this.numDeposit + this.numWithDraw}`, 'Movimentações': `${this.numDeposit }`, 'Valor movimentado': `R$${this.totalDeposit + this.totalWithDraw}`, 'Banco': `$ RichestBank $` }) } ) } }<file_sep>import { Router } from "express"; import transactionRoute from "./transationsRoutes"; import { viewrRoute } from "../models/Transaction"; const router = Router() router.use('/transaction', transactionRoute) router.use('/transactionViewr', viewrRoute) export default router <file_sep>import Transactions from "../models/Transactions"; import Transaction from "../models/Transaction"; const transactionRepository = new Transactions() transactionRepository.add('olá') export function repositoryController(nome: string, value: number){ for(var i=0;i<= Transactions.transactions.length;i++){ if(nome == Transactions.transactions[i].name || Transactions.transactions.length <= 0){ return console.log('[ERROR] Pessoa já registrada') } const data = new Transaction(nome, value) return console.log('Registrado com sucesso!') } } <file_sep>import Transactions from "../models/Transactions"; export default function analyzeId(value: string){ for(var i=0; i <= Transactions.transactions.length;i++){ var idsAnalyze = Transactions.transactions[i].id var transaction = Transactions.transactions[i] if(value = idsAnalyze){ return transaction } } }<file_sep>import { Response, Request, Router } from "express"; import { repositoryController } from "../controller/repositoryController"; const transactionRoute = Router() transactionRoute.post('/', (request: Request, response: Response) => { const {name, value} = request.body repositoryController(name, value) return response.json({'🍗message':'A rota de visualização é /transactionViewr' }); }) export default transactionRoute
87c8cd0a79d484d2f68403f86feb06f46d545e67
[ "Markdown", "TypeScript" ]
8
TypeScript
PedroAgua1/bank-system.
78b0ba2a96f5cdab7e0986af0bc2861ea7d622bf
38dc05bffb1265ce675084153df69a73fd4b5652
refs/heads/master
<file_sep>var MAX_MEMORY = 4096; var Brainfuck = function() { this.instruction_pointer = 0; this.memory_pointer = 0; this.memory = []; this.program = "+++.[.-]-."; }; Brainfuck.prototype = { clearMemory: function() { for (var index = 0; index < MAX_MEMORY; index++) { this.memory[index] = 0; } }, /************************************** Begin Opcodes ***************************************/ operatorCellShiftLeft: function() { console.log("Cock"); }, operatorCellShiftRight: function() { console.log("Cock"); }, operatorIncrementCell: function() { this.memory[this.memory_pointer]++; /* Increment Instruction Pointer */ this.instruction_pointer++; }, operatorDecrementCell: function() { this.memory[this.memory_pointer]--; /* Increment Instruction Pointer */ this.instruction_pointer++; }, operatorPrintCell: function() { console.log(this.memory[this.memory_pointer]); /* Increment Instruction Pointer */ this.instruction_pointer++; }, operatorBeginLoop: function() { //console.log(this.memory[this.pointer]); /* Increment Instruction Pointer */ this.instruction_pointer++; }, operatorEndLoop: function() { //console.log(this.memory[this.pointer]); /* Increment Instruction Pointer */ this.instruction_pointer++; }, operatorInput: function() { this.memory[this.memory_pointer] = prompt("Enter a character:").charCodeAt(0); /* Increment Instruction Pointer */ this.instruction_pointer++; }, /************************************** End Opcodes ***************************************/ executeOperator: function(operator) { switch(operator) { case "+": this.operatorIncrementCell(); break; case "-": this.operatorDecrementCell(); break; case "<": this.operatorCellShiftLeft(); break; case ".": this.operatorPrintCell(); break; case ",": break; case "[": this.operatorBeginLoop(); break; case "]": this.operatorEndLoop(); break; } }, executeFrame: function() { /* What's our current operator? */ var operator = this.program.charAt(this.instruction_pointer); /* Do it to it */ this.executeOperator(operator); }, execute: function() { this.clearMemory(); var oob = this.program.length; while (this.instruction_pointer < oob) { console.log(this.program.charAt(this.instruction_pointer)); this.executeFrame(); } } };<file_sep>jsbf ==== Javascript-based interpreter for the esoteric programming language Brainfuck.
c121c0645a531303b994ea27fd8e5299ad5e3084
[ "JavaScript", "Markdown" ]
2
JavaScript
loganwm/jsbf
8fe11ef2d58248c1915d8b1e799d631ce40e077e
63ef9d82b89c66c1e9f1372011bad2687f310acb
refs/heads/master
<repo_name>drachid/Hibernate<file_sep>/hibernate-envers/src/main/java/fr/netapsys/envers/model/package-info.java /** * Package contenant les beans métiers (entités). */ package fr.netapsys.envers.model; <file_sep>/HibernateExample/src/main/java/com/tutorial/OneToMany/Courses.java package com.tutorial.OneToMany; import java.io.Serializable; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import org.hibernate.annotations.GenericGenerator; @Entity @Table(name = "courses") public class Courses implements Serializable{ // (name = "generator", strategy = "sequence-identity") // (generator = "generator") // @GenericGenerator @GeneratedValue @Id @Column(name="COURSES_ID") private Long coursesId; @Column(name = "COURSES_NAME") private String name; @Column(name = "COURSES_DESC") private String description; @ManyToOne(fetch=FetchType.LAZY,cascade=CascadeType.ALL) @JoinColumn(name="FK_STUDENT_ID",nullable=false) private Student students; public Courses(){ } public Long getCoursesId() { return coursesId; } public void setCoursesId(Long coursesId) { this.coursesId = coursesId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Student getStudents() { return students; } public void setStudents(Student students) { this.students = students; } } <file_sep>/hibernate-envers/src/test/java/fr/netapsys/envers/model/HibernateEnversTest.java package fr.netapsys.envers.model; import java.util.List; import javax.annotation.Resource; import junit.framework.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.transaction.TransactionConfiguration; import org.springframework.transaction.annotation.Transactional; import fr.netapsys.envers.dao.GenericDao; /** * Classe en charge de tester la mise en place d'Hibernate Envers sur un exemple. * @author Netapsys * @version $Revision$ $Date$ */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath*:applicationContext.xml" }) @Transactional @TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = false) public class HibernateEnversTest { /** * Dao de gestion des livres. */ @Resource(name = "livreDao") private GenericDao<Livre> livreDao; private static final Logger LOG = LoggerFactory .getLogger(HibernateEnversTest.class); /** * Méthode en charge d'initialiser les données de test. */ @Before public void init() { // Jeton de sécurité virtuel final SecurityContext securityContext = Mockito.mock(SecurityContext.class); final Authentication authentication = Mockito.mock(Authentication.class); SecurityContextHolder.setContext(securityContext); Mockito.when(securityContext.getAuthentication()).thenReturn(authentication); Mockito.when(authentication.getName()).thenReturn("Rachid"); } /** * Méthode en charge de tester l'initialisation des données de test. */ @Test public void testInit() { Assert.assertNotNull(this.livreDao); } /** * Méthode en charge de tester la création d'un livre avec une critique. */ @Test public void createLivre() { final Livre livre = new Livre(); livre.setTitre("Hibernate Envers"); final Critique critique = new Critique(); critique.setLivre(livre); critique.setLibelle("Vraiment top"); livre.getCritiques().add(critique); final Livre result = this.livreDao.save(livre); Assert.assertNotNull(result); } /** * Méthode en charge de modifier le livre. */ @Test public void modifyLivre() { final Livre livre = this.livreDao.get(1L); livre.setTitre("Hibernate Envers - Nouvelle Version"); final Livre result = this.livreDao.save(livre); Assert.assertNotNull(result); } /** * Méthode en charge de supprimer le livre. */ @Test public void removeLivre() { final Livre livre = this.livreDao.get(1L); this.livreDao.remove(livre); } /** * Méthode en charge de récupérer une version historisée de livre. */ @Test public void retrieveLivre() { // Récupération des révisions du livre final List<Number> revisions = this.livreDao.getRevisions(1L); final Livre create = this.livreDao.retrieve(1L, revisions.get(0)); Assert.assertEquals("Hibernate Envers", create.getTitre()); Assert.assertEquals(1, create.getCritiques().size()); final Livre modify = this.livreDao.retrieve(1L, revisions.get(1)); Assert.assertEquals("Hibernate Envers - Nouvelle Version", modify.getTitre()); Assert.assertEquals(1, modify.getCritiques().size()); final Livre del = this.livreDao.retrieve(1L, revisions.get(2)); Assert.assertNull(del); } } <file_sep>/HibernateInterceptor/src/main/java/com/javacodegeeks/enterprise/hibernate/Student.java package com.javacodegeeks.enterprise.hibernate; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.SequenceGenerator; import javax.persistence.Table; @Entity @Table(name="STUDENT") public class Student implements java.io.Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.SEQUENCE , generator="USERS_SEQ") @SequenceGenerator(name="USERS_SEQ",sequenceName="DEMO_USERS_SEQ",allocationSize = 1) @Column(name="STUDENT_ID") private Integer studentId; @Column(name="STUDENT_NAME") private String studentName; @Column(name="STUDENT_AGE") private String studentAge; public Student() { } public Student(String studentName, String studentAge) { this.studentName = studentName; this.studentAge = studentAge; } public Integer getStudentId() { return this.studentId; } public void setStudentId(Integer studentId) { this.studentId = studentId; } public String getStudentName() { return this.studentName; } public void setStudentName(String studentName) { this.studentName = studentName; } public String getStudentAge() { return this.studentAge; } public void setStudentAge(String studentAge) { this.studentAge = studentAge; } @Override public String toString() { return "Student [studentId=" + studentId + ", studentName=" + studentName + ", studentAge=" + studentAge + "]"; } }<file_sep>/hibernate-envers/src/main/java/fr/netapsys/envers/model/Livre.java package fr.netapsys.envers.model; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.OneToMany; import org.hibernate.annotations.LazyCollection; import org.hibernate.annotations.LazyCollectionOption; import org.hibernate.envers.Audited; import fr.netapsys.envers.model.common.BeanObject; /** * Bean métier représentant un livre. * @author Netapsys * @version $Revision$ $Date$ */ @Entity @Audited public class Livre extends BeanObject { /** * Serial ID. */ private static final long serialVersionUID = -1406425184398414716L; /** * Titre. */ private String titre; /** * Liste de critiques. */ @OneToMany(mappedBy = "livre", cascade = CascadeType.ALL, orphanRemoval = true) @LazyCollection(LazyCollectionOption.TRUE) private Set<Critique> critiques = new HashSet<Critique>(); /** * Getter pour titre. * @return Le titre */ public String getTitre() { return this.titre; } /** * Setter pour titre. * @param titre Le titre à écrire. */ public void setTitre(final String titre) { this.titre = titre; } /** * Getter pour critiques. * @return Le critiques */ public Set<Critique> getCritiques() { return this.critiques; } /** * Setter pour critiques. * @param critiques Le critiques à écrire. */ public void setCritiques(final Set<Critique> critiques) { this.critiques = critiques; } } <file_sep>/HibernateExample/src/main/java/com/tutorial/ManyToMany/Category.java package com.tutorial.ManyToMany; import java.io.Serializable; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumns; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.Table; import org.hibernate.annotations.GenericGenerator; @Entity @Table(name="category") public class Category implements Serializable{ @Id @GenericGenerator(name = "generator", strategy = "sequence-identity") @GeneratedValue(strategy =GenerationType.SEQUENCE) @Column(name="CATEGORY_ID") private Integer categoryId; @Column(name="CATEGORY_NAME") private String name; @Column(name="CATEGORY_DESC") private String desc; @ManyToMany(fetch=FetchType.LAZY,mappedBy="categories") private Set<Stock> stocks = new HashSet<Stock>(0); public Category() { } /** * @return the categoryId */ public Integer getCategoryId() { return categoryId; } /** * @param categoryId the categoryId to set */ public void setCategoryId(Integer categoryId) { this.categoryId = categoryId; } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the desc */ public String getDesc() { return desc; } /** * @param desc the desc to set */ public void setDesc(String desc) { this.desc = desc; } /** * @return the stocks */ public Set<Stock> getStocks() { return stocks; } /** * @param stocks the stocks to set */ public void setStocks(Set<Stock> stocks) { this.stocks = stocks; } } <file_sep>/hibernate-envers/src/main/java/fr/netapsys/envers/dao/GenericDao.java package fr.netapsys.envers.dao; import java.util.List; import fr.netapsys.envers.model.common.BeanObject; /** * DAO (Data Access Object) générique pour l'utilisation standard des POJOs (CRUD). * @param <BEAN> Bean Objet Métier. * @author NETAPSYS * @version $Revision$ $Date$ */ public interface GenericDao<BEAN extends BeanObject> { /** * Méthode de récupération d'un objet à partir de son identifiant. * @param id L'identifiant de l'objet (sa clef primaire). * @return Objet recherché. */ BEAN get(final Long id); /** * Méthode générique de récupération d'un objet d'un type particulier, en fonction d'un * identifiant et d'une révision. * @param id L'identifiant de l'objet (sa clef primaire). * @param revision Révision. * @return L'objet recherché. */ BEAN retrieve(final Long id, final Number revision); /** * Méthode générique de récupération des révisions d'un objet d'un type particulier, en * fonction d'un identifiant. * @param id L'identifiant de l'objet (sa clef primaire). * @return Liste des révisions. */ List<Number> getRevisions(final Long id); /** * Méthode de sauvegarde d'un objet d'un type particulier (insert et update). * @param object Objet à sauvegarder. * @return Objet sauvegardé. */ BEAN save(final BEAN object); /** * Méthode de suppression d'un objet à partir de son identifiant. * @param object Objet à supprimer. */ void remove(final BEAN object); } <file_sep>/hibernate-envers/src/main/java/fr/netapsys/envers/model/audit/package-info.java /** * Package contenant les beans métiers spécifiques à la gestion de l'audit des entités. */ package fr.netapsys.envers.model.audit; <file_sep>/HibernateOneManyAnotationMappedBy/src/main/java/net/viralpatel/hibernate/Department.java package net.viralpatel.hibernate; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Transient; import javax.print.attribute.HashAttributeSet; @Entity @Table(name="DEPARTMENT") public class Department { @Id @GeneratedValue @Column(name="DEPARTMENT_ID") private Long departmentId; @Column(name="DEPT_NAME") private String departmentName; @OneToMany(fetch= FetchType.LAZY, cascade=CascadeType.ALL) private List<Employee> employees=new ArrayList<Employee>(0); public Long getDepartmentId() { return departmentId; } public void setDepartmentId(Long departmentId) { this.departmentId = departmentId; } public String getDepartmentName() { return departmentName; } public void setDepartmentName(String departmentName) { this.departmentName = departmentName; } public List<Employee> getEmployees() { return employees; } public void setEmployees(List<Employee> employees) { this.employees = employees; } } <file_sep>/HibernateExample/src/main/java/com/mkyong/App.java package com.mkyong; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Set; import javax.management.InstanceAlreadyExistsException; import javax.management.MBeanRegistrationException; import javax.management.MalformedObjectNameException; import javax.management.NotCompliantMBeanException; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import com.mkyong.util.HibernateUtil; import com.tutorial.ManyToMany.Category; import com.tutorial.ManyToMany.Stock; import com.tutorial.OneToMany.Courses; import com.tutorial.OneToMany.Student; import com.tutorial.OneToOne.Commune; import com.tutorial.OneToOne.Maire; import com.tutorial.singleonetomany.User; public class App { public static void main(String[] args) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException, MalformedObjectNameException { SessionFactory sf= HibernateUtil.getSessionFactory(); Session session = sf.openSession(); session.beginTransaction(); // oneToOneRelation(session ); // manyToManyRelation(session); oneToManyRelation(session); // ONeToManyQuery(session); // hibernateBatchProcessing(session); // singleOneToMany(session); session.getTransaction().commit(); session.close(); System.out.println("Done"); } private static void singleOneToMany(Session session) { System.out.println("Hibernate singleOneToMany"); User user =new User(); user.setName("rachid"); user.setGender("homme"); user.setMailingList(true); user.setCountry("France"); session.save(user); } private static void ONeToManyQuery(Session session) { Student student = (Student)session.get(Student.class, 10); Set<Courses> sets = student.getCourses(); for ( Iterator iter = sets.iterator();iter.hasNext(); ) { Courses courses = (Courses) iter.next(); System.out.println(courses.getCoursesId()); System.out.println(courses.getName()); } } private static void manyToManyRelation(Session session) { /******** Many TO Many*****/ System.out.println("Hibernate Many to Many (Annotation)"); Stock pdtStk =new Stock(); pdtStk.setStockName("pomme de terre"); pdtStk.setStockCode("123"); // Stock courgStk =new Stock(); courgStk.setStockName("courgette"); courgStk.setStockCode("656"); // // Category ctgHiver = new Category(); ctgHiver.setName("Legumes d'hiver"); ctgHiver.setDesc("Legumes d'hiver"); // // Category ctgPrintemps = new Category(); ctgPrintemps.setName("Legumes Printemps"); ctgPrintemps.setDesc("Legumes Printemps"); // // // // pdtStk.getCategories().add(ctgPrintemps); pdtStk.getCategories().add(ctgHiver); ctgHiver.getStocks().add(pdtStk); ctgPrintemps.getStocks().add(pdtStk); // courgStk.getCategories().add(ctgPrintemps); ctgPrintemps.getStocks().add(courgStk); session.save(ctgPrintemps); session.save(courgStk); session.save(ctgHiver); session.save(pdtStk); // Simple Query String hql = " select s.stockName from Stock as s left join s.categories as c where c.name like '%Legumes d hiver%' "; String hqlInverse="select c.name from Category as c left join c.stocks as s where s.stockName ='pomme de terre'"; Query query = (Query) session.createQuery(hqlInverse); query.setParameter("stockName", "Legumes Printemps"); List <String> list = query.list(); for(String cde:list) System.out.println(cde); // } private static void oneToManyRelation(Session session) { /******** One TO Many*****/ System.out.println("Hibernate one to Many (Annotation)"); // Courses maths = new Courses(); // maths.setDescription("Enseignement de mathematique"); // maths.setName("Mathematique"); // // Courses french = new Courses(); // french.setDescription("Enseignement de francais"); // french.setName("francais"); // // Student student = new Student(); // student.setName("dafali"); // student.setFirstname("rachid"); // // maths.setStudents(student); // french.setStudents(student); // student.getCourses().add(maths); // student.getCourses().add(french); // // Student student1 = new Student(); // student1.setName("dafali"); // student1.setFirstname("youssef"); // // maths.setStudents(student1); // french.setStudents(student1); // student1.getCourses().add(maths); // student1.getCourses().add(french); // // Student student2 = new Student(); // student2.setName("dafali"); // student2.setFirstname("youssef"); // // maths.setStudents(student2); // french.setStudents(student2); // student2.getCourses().add(maths); // student2.getCourses().add(french); // // // // // session.merge(maths); // session.merge(french); /*Query */ Set<Courses> courses = null; Long start=0L; start=System.currentTimeMillis(); System.out.println("start="+start); List<Student> students= session.createQuery("from Student").list(); for(Student itStudent:students){ System.out.println(itStudent.getFirstname()+""+itStudent.getName()); courses= itStudent.getCourses(); for(Courses itCourses:courses){ System.out.println(itCourses.getDescription()); } } long end= System.currentTimeMillis(); System.out.println("end="+end); Long duree=end-start; System.out.println("Le temps ecoulé"+duree); } private static void oneToOneRelation(Session session) { /************* ONe TO One ******/ System.out.println("Hibernate one to one (Annotation)"); Maire maire = new Maire(); maire.setNom("<NAME>"); SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy"); Date date=null; try { date = format.parse("08/04/2013"); } catch (ParseException e) { e.printStackTrace(); } maire.setAnneeElection(date); Commune commune =new Commune(); commune.setName("<NAME>"); commune.setMaire(maire); commune.setEtat(false); session.save(commune); } }
c157e5542b96026074b1c6fb316796ad5035f0e4
[ "Java" ]
10
Java
drachid/Hibernate
f8af53af78f3133e0590922669d2c852285e3af0
1c8006daa6f4fd07d3c755b52efc5bce1501f9c7
refs/heads/main
<file_sep>import React from 'react' import { Container, Header } from 'semantic-ui-react' import ListArticle from '../components/ListArticle' class Homepage extends React.Component { constructor(props) { super(props) this.state = {} } render () { const { articles, errorFromApi} = this.props return ( <Container> <Header as="h2" style={{ textAlign: "center", margin: 20 }}> Trending News </Header> {articles.length > 0 && <ListArticle articles={articles} />} {errorFromApi && <p>{errorFromApi}</p>} </Container> ) } } export default Homepage<file_sep>import { NEWS_API_KEY } from './config' export const getTrendingNews = async () => { const response = await fetch(`https://newsapi.org/v2/top-headlines?country=us&apiKey=${NEWS_API_KEY}`) const trendingNews = await response.json() return trendingNews } export const getSearchArticles = async searchInput => { const response = await fetch( `https://newsapi.org/v2/everything?q=${searchInput}&sortBy=publishedAt&apiKey=${NEWS_API_KEY}` ) const newsArticles = await response.json() return newsArticles }<file_sep>import React from 'react' // eslint-disable-next-line import { BrowserRouter as Router, Route, Switch } from 'react-router-dom' import { Container } from 'semantic-ui-react' import { getSearchArticles, getTrendingNews } from './api' import Navbar from './components/Navbar' import SearchBar from './components/searchBar' import Homepage from './pages/home' import Categories from './pages/categories' class App extends React.Component { constructor (props) { super(props) this.state = { articles: [], searchInput: "", totalResults: "", loading: false, errorFromApi: "", } } async componentDidMount() { try { const response = await getTrendingNews() this.setState({ articles: response.articles }) } catch (err) { this.setState({ errorFromApi: 'Ooopss!!! Could not Find Any News Article' }) } } searchForInput = async input => { try { this.setState({ loading: true }) const response = await getSearchArticles(input) this.setState({ articles: response.articles, searchInput: input, totalResults: response.totalResults, }) } catch (err) { this.setState({ errorFromApi: "Could not find any articles" }) } this.setState({ loading: false }) } render() { const { articles, errorFromApi, loading } = this.state return ( <Container> <Router> <Navbar /> <SearchBar searchForInput={this.searchForInput} /> {loading && <p style={{ textAlign: "center" }}>Searching for articles...</p> } <Switch> <Route path='/' exact component={ () => ( <Homepage articles={articles} errorFromApi={errorFromApi}/> )}/> <Route path='/categories' exact component={ () => <Categories />}/> </Switch> </Router> </Container> ) } } export default App <file_sep>import React from 'react' import { Container, Grid, Header } from 'semantic-ui-react' import { getSearchArticles } from '../api' import CardList from '../components/CardArticle' class Categories extends React.Component { constructor(props) { super(props) this.state = { technologyArticles: [], politicsArticles: [], cultureArticles: [], loading: false, errorFromApi: '' } } async componentDidMount() { this._isMounted = true this.setState({ loading: true }) try { const techNews = await getSearchArticles(`technology`) const politicsNews = await getSearchArticles(`politics`) const cultureNews = await getSearchArticles(`culture`) if (this._isMounted) { console.log(`Mount is true`) this.setState({ technologyArticles: techNews.articles, politicsArticles: politicsNews.articles, cultureArticles: cultureNews.articles }) } } catch (err) { this.setState({ errorFromApi: 'Oops! Couldn.t Find Any Related Article' }) } this.setState({ loading: false }) } componentWillUnmount() { this._isMounted = false } render() { const { technologyArticles, politicsArticles, cultureArticles, errorFromApi} = this.state // console.log(this.state) return ( <Container> <Grid columns='equal' celled='internally' padded='vertically' style={{ gridGap: '20px' }}> <Grid.Row> <Header as="h2" style={{ textAlign: "left", margin: 20, gridColumn: "1/-1" }}> Technology </Header> {technologyArticles.length > 0 && <CardList articles={technologyArticles} />} {console.log(technologyArticles.length > 0)} {errorFromApi && <p>{errorFromApi}</p>} </Grid.Row> <Grid.Row> <Header as="h2" style={{ textAlign: "left", margin: 20 }}> Politics </Header> {politicsArticles.length > 0 && <CardList articles={politicsArticles} />} {errorFromApi && <p>{errorFromApi}</p>} </Grid.Row> <Grid.Row> <Header as="h2" style={{ textAlign: "left", margin: 20 }}> Culture </Header> {cultureArticles.length > 0 && <CardList articles={cultureArticles} />} {errorFromApi && <p>{errorFromApi}</p>} </Grid.Row> </Grid> </Container> ) } } export default Categories<file_sep>import React from 'react' import { Card, Grid, Icon } from 'semantic-ui-react' const CardListItem = (props) => { const { article } = props const extra = ( // eslint-disable-next-line jsx-a11y/anchor-is-valid <a href={article.url}> <Icon name='user' /> {article.source.name} </a> ) return ( <Grid.Column width={8}> <Card image={article.urlToImage} header={article.title} meta={article.publishedAt.split("T")[0]} description={article.description} extra={extra} /> </Grid.Column> ) } const CardList = props => ( <Card.Group> {props.articles.map( (article, index) => ( <CardListItem key={article.title + index} article={article}/> ))} </Card.Group> ) export default CardList
88a9a291484953a76a5538513824497cde6880dc
[ "JavaScript" ]
5
JavaScript
Lilit0x/react-news-app
68e2e044ad0c3e94ed2ffcb1c2db7e1d4ff8a1cc
e90919b8fee3851d59b8d202b7f8e8e9855e35d3
refs/heads/master
<repo_name>e-Timofeev/TestTask<file_sep>/TestTask/Classes/LetterStats.cs using System; namespace TestTask { /// <summary> /// Статистика вхождения буквы/пары букв /// </summary> public struct LetterStats : IComparable { /// <summary> /// Буква/Пара букв для учёта статистики. /// </summary> public string Letter; /// <summary> /// Кол-во вхождений буквы/пары. /// </summary> public int Count; /// <summary> /// Переопределение для вывода на экран данных структуры. /// </summary> /// <returns></returns> public override string ToString() => string.Format($"{Letter} - {Count}\n"); /// <summary> /// Сравнивает позиции текущей и заданной структур. (для сортировки по алфавиту). /// </summary> /// <param name="obj">Структура для сравнения с текущей.</param> /// <returns>Целое число, характеризующее отношение позиции.</returns> public int CompareTo(object obj) { LetterStats? tmp = (LetterStats)obj; return Letter.CompareTo(tmp?.Letter); } /// <summary> /// Проверка на равенство текущей и заданной структур. /// </summary> /// <param name="obj">Структура для сравнения с текущей.</param> /// <returns>True если структуры равны по букве/паре букв, false в остальных случаях.</returns> public override bool Equals(object obj) { LetterStats? tmp = (LetterStats)obj; if (tmp == null) return false; else return Letter == tmp?.Letter; } /// <summary> /// Хэш-функция для для буквы/пары структуры. /// </summary> /// <returns>Хэш-код по полю Letter.</returns> public override int GetHashCode() => Letter.GetHashCode(); } } <file_sep>/TestTask/Classes/Program.cs using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace TestTask { /// <summary> /// Стандартный класс, содержащий точку входа. /// </summary> public class Program { /// <summary> /// Программа принимает на входе 2 пути до файлов. /// Анализирует в первом файле кол-во вхождений каждой буквы (регистрозависимо). Например А, б, Б, Г и т.д. /// Анализирует во втором файле кол-во вхождений парных букв (не регистрозависимо). Например АА, Оо, еЕ, тт и т.д. /// По окончанию работы - выводит данную статистику на экран. /// </summary> /// <param name="args">Первый параметр - путь до первого файла. /// Второй параметр - путь до второго файла.</param> static void Main(string[] args) { if (args.Length != 0) { IReadOnlyStream inputStream1 = GetInputStream(args[0]); IReadOnlyStream inputStream2 = GetInputStream(args[1]); IList<LetterStats> singleLetterStats = FillSingleLetterStats(inputStream1); IList<LetterStats> doubleLetterStats = FillDoubleLetterStats(inputStream2); IList<LetterStats> RemoveVowelChars = RemoveCharStatsByType(singleLetterStats, CharType.Vowel); IList<LetterStats> RemoveConsonantsChars = RemoveCharStatsByType(doubleLetterStats, CharType.Consonants); //Вывод на экрна исходных статистик и после удаления завленных типов букв. { PrintStatistic(singleLetterStats); PrintStatistic(doubleLetterStats); Console.WriteLine("Удаление гласных"); PrintStatistic(RemoveVowelChars); Console.WriteLine("Удаление согласных"); PrintStatistic(RemoveConsonantsChars); } } else Console.WriteLine("Не заданы аргументы командной строки."); // TODO : Необжодимо дождаться нажатия клавиши, прежде чем завершать выполнение программы. Console.ReadKey(); } /// <summary> /// Ф-ция возвращает экземпляр потока с уже загруженным файлом для последующего посимвольного чтения. /// </summary> /// <param name="fileFullPath">Полный путь до файла для чтения.</param> /// <returns>Поток для последующего чтения.</returns> private static IReadOnlyStream GetInputStream(string fileFullPath) => new ReadOnlyStream(fileFullPath); /// <summary> /// Ф-ция считывающая из входящего потока все буквы, и возвращающая коллекцию статистик вхождения каждой буквы. /// Статистика РЕГИСТРОЗАВИСИМАЯ! /// </summary> /// <param name="stream">Стрим для считывания символов для последующего анализа</param> /// <returns>Коллекция статистик по каждой букве, что была прочитана из стрима.</returns> private static IList<LetterStats> FillSingleLetterStats(IReadOnlyStream stream) { List<LetterStats> stats = new List<LetterStats>(); LetterStats ReadChar = new LetterStats(); while (!stream.IsEof) { char c = stream.ReadNextChar(); if (char.IsLetter(c)) { ReadChar.Letter = c.ToString(); ReadChar.Count = (stream as ReadOnlyStream).NumberOfOccurrences(c); /* TODO : заполнять статистику с использованием метода IncStatistic. Учёт букв - регистрозависимый. - IncStatistic - не задействовал. Логика подсчета инкапсулирована в классе ReadOnlyStream. - Коды символов отличаются в зависимости от регистра, доп. действий не требуется. */ stats.Add(ReadChar); } } (stream as ReadOnlyStream).FindPairLetter(); // закрываем входящий поток. stream.Dispose(); return stats; } /// <summary> /// Ф-ция считывающая из входящего потока все буквы, и возвращающая коллекцию статистик вхождения парных букв. /// В статистику должны попадать только пары из одинаковых букв, например АА, СС, УУ, ЕЕ и т.д. /// Статистика - НЕ регистрозависимая! /// </summary> /// <param name="stream">Стрим для считывания символов для последующего анализа</param> /// <returns>Коллекция статистик по каждой букве, что была прочитана из стрима.</returns> private static IList<LetterStats> FillDoubleLetterStats(IReadOnlyStream stream) { List<LetterStats> stats = new List<LetterStats>(); LetterStats ReadChar = new LetterStats(); foreach (string item in (stream as ReadOnlyStream).FindPairLetter()) { ReadChar.Letter = item; ReadChar.Count = (stream as ReadOnlyStream).NumberOfOccurrences(item); stats.Add(ReadChar); } stream.Dispose(); return stats; } /// <summary> /// Ф-ция перебирает все найденные буквы/парные буквы, содержащие в себе только гласные или согласные буквы. /// (Тип букв для перебора определяется параметром charType) /// Все найденные буквы/пары соответствующие параметру поиска - удаляются из переданной коллекции статистик. /// </summary> /// <param name="letters">Коллекция со статистиками вхождения букв/пар.</param> /// <param name="charType">Тип букв для анализа</param> private static IList<LetterStats> RemoveCharStatsByType(IList<LetterStats> letters, CharType charType) { List<LetterStats> PatStats = new List<LetterStats>(); LetterStats LetterPatStats = new LetterStats(); string PatternVowel = "[АаЕеЁёИиОоУуЫыЭэЮюЯя]"; string patternConsonants = "[БбВвГгДдЖжЗзЙйКкЛлМмНнПпРрСсТтФфХхЦцЧчШшЩщ]"; string str = string.Empty; // TODO : Удалить статистику по запрошенному типу букв. switch (charType) { case CharType.Consonants: foreach (var item in letters.ToList().Distinct()) { str = Regex.Replace(item.Letter, patternConsonants, ""); if (str.Length > 0) { LetterPatStats.Letter = str; LetterPatStats.Count = item.Count; PatStats.Add(LetterPatStats); } } break; case CharType.Vowel: foreach (var item in letters.ToList().Distinct()) { str = Regex.Replace(item.Letter, PatternVowel, ""); if (str.Length > 0) { LetterPatStats.Letter = str; LetterPatStats.Count = item.Count; PatStats.Add(LetterPatStats); } } break; } return PatStats; } /// <summary> /// Ф-ция выводит на экран полученную статистику в формате "{Буква} : {Кол-во}" /// Каждая буква - с новой строки. /// Выводить на экран необходимо предварительно отсортировав набор по алфавиту. /// В конце отдельная строчка с ИТОГО, содержащая в себе общее кол-во найденных букв/пар /// </summary> /// <param name="letters">Коллекция со статистикой</param> private static void PrintStatistic(IEnumerable<LetterStats> letters) { int count = 0; try { // TODO : Выводить на экран статистику. Выводить предварительно отсортировав по алфавиту! letters.ToList().Sort(); foreach (LetterStats item in letters.Distinct()) { Console.WriteLine(item.ToString()); count++; } } catch (ArgumentNullException ex) { throw new Exception(ex.Message); } catch (InvalidOperationException ex) { throw new Exception(ex.Message); } catch (Exception ex) { throw new Exception(ex.Message); } Console.WriteLine($"Итого найденных букв/пар - {count}\n"); } } } <file_sep>/TestTask/Classes/ReadOnlyStream.cs using System; using System.Collections.Generic; using System.IO; using System.Text; using System.Text.RegularExpressions; namespace TestTask { /// <summary> /// Класс для фактической работы с урезанным по функционалу потоком. /// </summary> public class ReadOnlyStream : IReadOnlyStream { #region Свойства /// <summary> /// Считывание символов из потока байтов. /// </summary> private StreamReader LocalStream { get; set; } /// <summary> /// Содержимое файла, прочитанного из потока. /// </summary> private string CharFromStream { get; set; } /// <summary> /// Флаг вызова Dispose. /// </summary> private bool disposed = false; /// <summary> /// Флаг конца потока. /// </summary> private bool IsEndStream; /// <summary> /// Флаг окончания файла. /// </summary> public bool IsEof { get { return IsEndStream; } // TODO : Заполнять данный флаг при достижении конца файла/стрима при чтении private set { if (LocalStream.EndOfStream) IsEndStream = value; } } #endregion #region Конструкторы /// <summary> /// Конструктор по умолчанию. /// </summary> public ReadOnlyStream() { } /// <summary> /// Конструктор класса. /// Т.к. происходит прямая работа с файлом, необходимо обеспечить ГАРАНТИРОВАННОЕ закрытие файла после окончания работы с таковым! /// </summary> /// <param name="fileFullPath">Полный путь до файла для чтения</param> public ReadOnlyStream(string fileFullPath) { // TODO : Заменить на создание реального стрима для чтения файла! if (File.Exists(fileFullPath)) { LocalStream = new StreamReader(fileFullPath, encoding: Encoding.Default); CharFromStream = LocalStream.ReadToEnd(); ResetPositionToStart(); } else { throw new FileNotFoundException("Не найден файл по указанному пути."); } } #endregion #region Методы /// <summary> /// Подсчитывает число вхождений аргумента в строке, заполненной из потока. /// </summary> /// <param name="ch">Символ, считываемый ReadNextChar.</param> /// <returns>Число вхождений (int).</returns> public int NumberOfOccurrences(char ch) { int count = 0; foreach (char i in CharFromStream) if (i == ch) count++; return count; } /// <summary> /// Перегрузка для подсчета числа вхождений пары букв в строке, заполненной из потока. /// </summary> /// <param name="ch">Строка, содержащая пару букв.</param> /// <returns>Число вхождений (int).</returns> public int NumberOfOccurrences(string ch) { int CountLetter = new Regex(ch, RegexOptions.IgnoreCase).Matches(CharFromStream).Count; return CountLetter; } /// <summary> /// Ф-ция получения из потока пар (одинаковых) регистронезависимых букв. /// </summary> /// <returns>Список строк из пар одинаковых букв.</returns> public List<string> FindPairLetter() { List<string> res = new List<string>(); string pattern = @"\w{2}"; Regex pat = new Regex(pattern, RegexOptions.IgnoreCase); if (pat.IsMatch(CharFromStream)) { MatchCollection matchcol = pat.Matches(CharFromStream); foreach (Match item in matchcol) { res.Add(item.Value.ToLower()); } } return res; } /// <summary> /// Ф-ция чтения следующего символа из потока. /// Если произведена попытка прочитать символ после достижения конца файла, метод /// должен бросать соответствующее исключение /// </summary> /// <returns>Считанный символ.</returns> public char ReadNextChar() { if (LocalStream.EndOfStream) IsEof = true; // TODO : Необходимо считать очередной символ из LocalStream. try { return (char)LocalStream.Read(); } catch (Exception ex) { throw new IOException(ex.Message); } } /// <summary> /// Сбрасывает текущую позицию потока на начало. /// </summary> public void ResetPositionToStart() { if (LocalStream == null) { IsEof = true; return; } LocalStream.BaseStream.Position = 0; IsEof = false; } /// <summary> /// Публичная реализации шаблона очистки объекта. /// </summary> public void Dispose() { Dispose(true); // подавляем финализацию GC.SuppressFinalize(this); } /// <summary> /// Защищенная реализации шаблона очистки объекта. /// </summary> /// <param name="disposing"></param> protected virtual void Dispose(bool disposing) { if (!disposed) { if (disposing) { LocalStream.Dispose(); } // освобождаем неуправляемые объекты disposed = true; } } #endregion } }
acfe035270981b92e81104d91a474a9f4772c507
[ "C#" ]
3
C#
e-Timofeev/TestTask
19b37afb31113f1cf27166eb5e96b0d833dcd8f0
5cf50eb66d72a620ff2cbb7c8332638695be6d4a
refs/heads/main
<repo_name>JianingWang43/bilibili_crawler<file_sep>/README.md # bilibili_crawler Just a toy for fun. <file_sep>/main.py import random import requests import json import re import os os.system("pip3 install you-get") my_headers = [ "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14", "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Win64; x64; Trident/6.0)", 'Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11', 'Opera/9.25 (Windows NT 5.1; U; en)', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)', 'Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko) (Kubuntu)', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.12) Gecko/20070731 Ubuntu/dapper-security Firefox/1.5.0.12', 'Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/1.2.9', "Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, like Gecko) Ubuntu/11.04 Chromium/16.0.912.77 Chrome/16.0.912.77 Safari/535.7", "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:10.0) Gecko/20100101 Firefox/10.0 " ] def downView(url,title): res = requests.get(url, headers={'User-Agent': random.choice(my_headers)}, verify=False) with open(title,"wb")as f: f.write(res.content) f.close() pagemax=int(input("please input max page\n")) page = 0 durationmax=int(input("please input max duration(second)\n")) print("getting download urls...\n") while page <= pagemax-1: page+=1 r = requests.get('https://api.bilibili.com/x/web-interface/popular?ps=20&pn='+str(page), headers={'User-Agent': random.choice(my_headers)}) if r.status_code != 200: print("http error code" + r.status_code) exit(0) else: res = json.loads(r.text) for data in res['data']['list']: if int(data['duration']) < durationmax: print(data['title']) print(data['duration']) print(data['bvid']) url = "https://www.bilibili.com/video/"+data['bvid'] os.system("you-get "+url)
a9977fc56f099e3047b66e6dac9fa2fc28af71f3
[ "Markdown", "Python" ]
2
Markdown
JianingWang43/bilibili_crawler
fcc9b5dbcc10ea76cf75cd7798e4f4cfd6a7cef3
cc53cb49cb761fb39179b4ffda505c3d104ce2c7
refs/heads/master
<repo_name>sumitt1080/Project_Euler<file_sep>/euler problem 7.java import java.util.Scanner; import java.lang.Math; public class Program { public static void main(String[] args) { Scanner k=new Scanner(System.in); int n,pc=1,i; int j; System.out.println ("Enter which prime number you want to know: "); n=k.nextInt(); for(i=3;pc!=n;i+=2) { for(j=3;j<i;j+=2) { if(i%j==0) break; } if(j==i) pc++; } System.out.println(n+" th Prime Number is "+j); } }<file_sep>/euler problem9.java public class Program { public static void main(String[] args) { int i,j,c; for(i=1;i<=500;i++){ for(j=1;j<=500;j++) { c=1000-i-j; if(i*i+j*j-c*c==0&&i<j) { System.out.println("a * b * c = "+(i*j*c)); System.exit(0); } }} } } <file_sep>/euler problem 3.java public class Program { public static void main(String[] args) { long ans=600851475143l; for (long i=3,a=ans;a!=1;i+=2) if(a%i==0) { while (a%i==0) a/=i; ans=i; } System.out.println(ans); } }<file_sep>/euler problem 2.java public class program { public static void main(String[] args) { int a=1,b=2,c,s=2; int i; for(i=3;i<=40;i++) { c=a+b; a=b; b=c; if(c%2==0) s=s+c; } System.out.println(" Sum is: "+s); }}<file_sep>/euler problem 4.java public class Program { public static void main(String[] args) { long i,j,s=0,n,rw=0,r,q; for(i=100;i<1000;i++) { for(j=100;j<1000;j++) { n=i*j; q=n; while(q>0) { r=q%10; rw=rw*10+r; q=q/10; } if(rw==n&&n>s) { s=rw; } rw=0; } } System.out.println("Largest palindrome 3 digit is : "+s); } }<file_sep>/euler problem 5.java public class euler_Problem_5 { public static void main(String[] args) { int sum = 1, pN = 0; for (int i = 1; i <= 20; i++) { pN = Prime(i); if (pN > 0) { sum *= pN; } while ( pN < 0 && !(sum%i == 0) ) { if ((sum*2)%i == 0) { sum *= 2; } else if ((sum*3)%i == 0) { sum *= 3; } } } System.out.println("Smallest Divisible Number: " + sum); } private static int Prime(int num) { int j; if (num == 2 || num == 3) {return num; } for (j = 0; (j <= num/2) && ( !((num % (j+2)) == 0 )) ; j++); return (j > num/2) ? num:-1; } }
66c2e8c4ef2cce94e1830a61ff023b2cc8ac9b32
[ "Java" ]
6
Java
sumitt1080/Project_Euler
b32806015b5ad05f2643106447da92a1b83f022e
963004a9820b2a23497e332ba6ac3d21392241f5