text:
package Rex::Virtualization;

use strict;
use warnings;

our $VERSION = '0.56.1'; # VERSION

use Rex::Logger;
use Rex::Config;

my %VM_PROVIDER;

Rex::Config->register_config_handler(
  virtualization => sub {
    my ($param) = @_;

    if ( ref($param) eq '' ) {

#support 'set virtualization => 'LibVirt', but leave the way open for using a hash in future
#other virtualisation drivers may need more settings...
      $param = { type => $param };
    }

    if ( exists $param->{type} ) {
      Rex::Config->set( virtualization => $param->{type} );
    }
  }
);

sub register_vm_provider {
  my ( $class, $service_name, $service_class ) = @_;
  $VM_PROVIDER{"\L$service_name"} = $service_class;
  return 1;
}

sub create {
  my ( $class, $wanted_provider ) = @_;

  $wanted_provider ||= Rex::Config->get("virtualization");
  if ( ref($wanted_provider) ) {
    $wanted_provider = $wanted_provider->{type} || "LibVirt";
  }

  my $klass = "Rex::Virtualization::$wanted_provider";

  if ( exists $VM_PROVIDER{$wanted_provider} ) {
    $klass = $VM_PROVIDER{$wanted_provider};
  }

  eval "use $klass";

  if ($@) {
    Rex::Logger::info("Virtualization Class $klass not found.");
    die("Virtualization Class $klass not found.");
  }

  Rex::Logger::debug("Using $klass for virtualization");

  my $mod = $klass->new;
  return $mod;
}

1;


text:
using System;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http;

namespace Ap.Common.WebApi.HttpResults
{
    public class OkTextPlainResult : IHttpActionResult
    {
        private readonly ApiController _controller;

        public OkTextPlainResult(string content, Encoding encoding, ApiController controller)
        {
            if (content == null)
            {
                throw new ArgumentNullException("content");
            }

            if (encoding == null)
            {
                throw new ArgumentNullException("encoding");
            }

            if (controller == null)
            {
                throw new ArgumentNullException("controller");
            }

            Content = content;
            Encoding = encoding;
            _controller = controller;
        }

        public string Content { get; private set; }

        public Encoding Encoding { get; private set; }

        public HttpRequestMessage Request
        {
            get { return _controller.Request; }
        }

        public Task<HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
        {
            return Task.FromResult(Execute());
        }

        private HttpResponseMessage Execute()
        {
            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
            response.RequestMessage = Request;
            response.Content = new StringContent(Content, Encoding);
            return response;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.spongepowered.common.mixin.core.world.storage;

import net.minecraft.world.storage.ISaveHandler;
import net.minecraft.world.storage.MapStorage;
import net.minecraft.world.storage.WorldSavedData;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.common.SpongeImpl;

@Mixin(MapStorage.class)
public abstract class MapStorageMixin {

    @Shadow @Final private ISaveHandler saveHandler;

    // When we have a null saveHandler, we're not in the 'real' Overworld
    // MapStorage

    @Inject(method = "getOrLoadData", at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z", remap = false))
    private void impl$ValidateCallingOnMainThread(CallbackInfoReturnable<WorldSavedData> ci) {
        if (this.saveHandler != null && !SpongeImpl.getServer().isCallingFromMinecraftThread()) {
            SpongeImpl.getLogger().error("Attempted to call MapStorage#getOrLoadData from off the main thread!", new Exception("Dummy exception"));
        }
    }

    @Inject(method = "setData", at = @At(value = "HEAD"))
    private void impl$ValidateCallingOnMainThread(CallbackInfo ci) {
        if (this.saveHandler != null && !SpongeImpl.getServer().isCallingFromMinecraftThread()) {
            SpongeImpl.getLogger().error("Attempted to call MapStorage#setData from off the main thread!", new Exception("Dummy exception"));
        }
    }

}


text:
// Title:
//
// Description:
//
// Author:black
//
// Createtime:2013-11-12 09:25
//
// Version:1.0
//
// 修改历史:版本号 修改日期 修改人 修改说明
//
// 1.0 2013-11-12 09:25 black 创建文档
package server

import (
	"github.com/hjqhezgh/commonlib"
	"github.com/hjqhezgh/lessgo"
	"net/http"
	"strconv"
	"strings"
	"time"
)

type RoomOrTime struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
}

type Weekdate struct {
	Date string `json:"date"`
	Week string `json:"week"`
}

type Schedule struct {
	Id                  int    `json:"id"`
	Name                string `json:"name"`
	PersonNum           int    `json:"personNum"`
	CurrentTMKPersonNum int    `json:"currentTMKPersonNum"`
	SignNum             int    `json:"signNum"`
	Teacher             string `json:"teacher"`
	Assistant           string `json:"assistant"`
	IsNormal            int    `json:"isNormal"`
	RoomId              int    `json:"roomId"`
	TimeId              int    `json:"timeId"`
	Week                int    `json:"week"`
	ClassId             int    `json:"classId"`
	CenterId            int    `json:"centerId"`
	Code                string `json:"code"`
}

/*
课表查询sql
select csd.id,csd.room_id,csd.time_id,csd.course_id,teacher.really_name teaName,assistant.really_name assName,personNum.num perNum,signNum.num sigNum,wc.name,cour.name from class_schedule_detail csd
left join employee teacher on teacher.user_id=csd.teacher_id
left join employee assistant on assistant.user_id=csd.assistant_id
left join (select count(1) num,schedule_detail_id from schedule_detail_child group by schedule_detail_id) personNum on personNum.schedule_detail_id = csd.id
left join time_section ts on ts.id=csd.time_id
left join (select count(1) num,schedule_detail_id from sign_in group by schedule_detail_id) signNum on signNum.schedule_detail_id = csd.id
left join wyclass wc on wc.class_id=csd.class_id
left join course cour on cour.cid=csd.course_id
*/
func ClassScheduleDetailListAction(w http.ResponseWriter, r *http.Request) {

	m := make(map[string]interface{})

	employee := lessgo.GetCurrentEmployee(r)

	if employee.UserId == "" {
		lessgo.Log.Warn("用户未登陆")
		m["success"] = false
		m["code"] = 100
		m["msg"] = "用户未登陆"
		commonlib.OutputJson(w, m, " ")
		return
	}

	err := r.ParseForm()

	if err != nil {
		lessgo.Log.Error(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
		commonlib.OutputJson(w, m, " ")
		return
	}

	date := r.FormValue("date")
	dateType := r.FormValue("type")

	searchDate := time.Now()

	if date != "" {
		searchDate, _ = time.ParseInLocation("20060102150405", date, time.Local)
	}

	if dateType == "pre" {
		searchDate = searchDate.Add(time.Duration(-7*24) * time.Hour)
	} else if dateType == "next" {
		searchDate = searchDate.Add(time.Duration(7*24) * time.Hour)
	}

	week := 0

	if searchDate.Weekday() == time.Monday {
		week = 1
	} else if searchDate.Weekday() == time.Tuesday {
		week = 2
	} else if searchDate.Weekday() == time.Wednesday {
		week = 3
	} else if searchDate.Weekday() == time.Thursday {
		week = 4
	} else if searchDate.Weekday() == time.Friday {
		week = 5
	} else if searchDate.Weekday() == time.Saturday {
		week = 6
	} else if searchDate.Weekday() == time.Sunday {
		week = 7
	}

	monday := searchDate.Add(-1 * time.Duration(week-1) * 24 * time.Hour)
	sunday := searchDate.Add(time.Duration(7-week) * 24 * time.Hour)
	st := monday.Format("20060102") + "000000"
	et := sunday.Format("20060102") + "235959"

	userId, _ := strconv.Atoi(employee.UserId)
	_employee, err := FindEmployeeById(userId)
	if err != nil {
		m["success"] = false
		m["code"] = 100
		m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
		commonlib.OutputJson(w, m, " ")
		return
	}

	db := lessgo.GetMySQL()
	defer db.Close()
	rooms := []RoomOrTime{}
	times := []RoomOrTime{}
	weekdates := []Weekdate{}
	schedules := []Schedule{}

	getRoomInfoSql := "select rid,name from room where cid=? "
	lessgo.Log.Debug(getRoomInfoSql)

	rows, err := db.Query(getRoomInfoSql, _employee.CenterId)

	if err != nil {
		lessgo.Log.Error(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "系统发生错误,请联系IT部门"
		commonlib.OutputJson(w, m, " ")
		return
	}

	for rows.Next() {
		room := RoomOrTime{}
		err = commonlib.PutRecord(rows, &room.Id, &room.Name)

		if err != nil {
			lessgo.Log.Error(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "系统发生错误,请联系IT部门"
			commonlib.OutputJson(w, m, " ")
			return
		}

		rooms = append(rooms, room)
	}

	getTimeSql := "select id,start_time,end_time from time_section where center_id=? order by start_time,end_time"
	lessgo.Log.Debug(getRoomInfoSql)

	rows, err = db.Query(getTimeSql, _employee.CenterId)

	if err != nil {
		lessgo.Log.Error(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "系统发生错误,请联系IT部门"
		commonlib.OutputJson(w, m, " ")
		return
	}

	for rows.Next() {
		timeObject := RoomOrTime{}
		startTime := ""
		endTime := ""
		err = commonlib.PutRecord(rows, &timeObject.Id, &startTime, &endTime)
		timeObject.Name = startTime + "~" + endTime

		if err != nil {
			lessgo.Log.Error(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "系统发生错误,请联系IT部门"
			commonlib.OutputJson(w, m, " ")
			return
		}

		times = append(times, timeObject)
	}

	for i := 0; i < 7; i++ {
		var weekdate = Weekdate{}
		if i == 0 {
			weekdate.Week = "星期一"
		} else if i == 1 {
			weekdate.Week = "星期二"
		} else if i == 2 {
			weekdate.Week = "星期三"
		} else if i == 3 {
			weekdate.Week = "星期四"
		} else if i == 4 {
			weekdate.Week = "星期五"
		} else if i == 5 {
			weekdate.Week = "星期六"
		} else if i == 6 {
			weekdate.Week = "星期日"
		}

		theday := monday.Add(time.Duration(i*24) * time.Hour)
		weekdate.Date = theday.Format("2006-01-02")

		weekdates = append(weekdates, weekdate)
	}

	getScheduleInfoSql := "select csd.id,csd.room_id,csd.time_id,csd.course_id,teacher.really_name teaName,assistant.really_name assName,personNum.num perNum,signNum.num sigNum,wc.name,cour.name,csd.week,csd.class_id,csd.center_id,wc.code from class_schedule_detail csd "
	getScheduleInfoSql += " left join employee teacher on teacher.user_id=csd.teacher_id  "
	getScheduleInfoSql += " left join employee assistant on assistant.user_id=csd.assistant_id "
	getScheduleInfoSql += " left join (select count(1) num,schedule_detail_id from schedule_detail_child group by schedule_detail_id) personNum on personNum.schedule_detail_id = csd.id "
	getScheduleInfoSql += " left join time_section ts on ts.id=csd.time_id "
	getScheduleInfoSql += " left join (select count(1) num,schedule_detail_id from sign_in group by schedule_detail_id) signNum on signNum.schedule_detail_id = csd.id "
	getScheduleInfoSql += " left join wyclass wc on wc.class_id=csd.class_id "
	getScheduleInfoSql += " left join course cour on cour.cid=csd.course_id "
	getScheduleInfoSql += " where csd.start_time>=? and csd.start_time<=? and csd.center_id=? "
	lessgo.Log.Debug(getScheduleInfoSql)

	rows, err = db.Query(getScheduleInfoSql, st, et, _employee.CenterId)

	if err != nil {
		lessgo.Log.Error(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "系统发生错误,请联系IT部门"
		commonlib.OutputJson(w, m, " ")
		return
	}

	for rows.Next() {
		schedule := Schedule{}
		courseId := 0
		className := ""
		courseName := ""

		err = commonlib.PutRecord(rows, &schedule.Id, &schedule.RoomId, &schedule.TimeId, &courseId, &schedule.Teacher, &schedule.Assistant, &schedule.PersonNum, &schedule.SignNum, &className, &courseName, &schedule.Week, &schedule.ClassId, &schedule.CenterId, &schedule.Code)

		if err != nil {
			lessgo.Log.Error(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "系统发生错误,请联系IT部门"
			commonlib.OutputJson(w, m, " ")
			return
		}

		if courseId != 0 {
			schedule.IsNormal = 1
			schedule.Name = courseName
		} else {
			schedule.IsNormal = 2
			schedule.Name = className
		}

		schedules = append(schedules, schedule)
	}

	m["success"] = true
	m["code"] = 200
	m["msg"] = "成功"
	m["times"] = times
	m["rooms"] = rooms
	m["weekdates"] = weekdates
	m["schedules"] = schedules
	m["firstDayOfWeek"] = st

	commonlib.OutputJson(w, m, "")
}

func ClassScheduleDetailListQuickAction(w http.ResponseWriter, r *http.Request) {

	m := make(map[string]interface{})

	employee := lessgo.GetCurrentEmployee(r)

	if employee.UserId == "" {
		lessgo.Log.Warn("用户未登陆")
		m["success"] = false
		m["code"] = 100
		m["msg"] = "用户未登陆"
		commonlib.OutputJson(w, m, " ")
		return
	}

	err := r.ParseForm()

	if err != nil {
		lessgo.Log.Error(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
		commonlib.OutputJson(w, m, " ")
		return
	}

	date := r.FormValue("date")
	centerId := r.FormValue("centerId")
	oldClassId := r.FormValue("oldClassId")
	dateType := r.FormValue("type")

	searchDate := time.Now()

	if date != "" {
		searchDate, _ = time.ParseInLocation("20060102150405", date, time.Local)
	}

	if dateType == "pre" {
		searchDate = searchDate.Add(time.Duration(-7*24) * time.Hour)
	} else if dateType == "next" {
		searchDate = searchDate.Add(time.Duration(7*24) * time.Hour)
	}

	week := 0

	if searchDate.Weekday() == time.Monday {
		week = 1
	} else if searchDate.Weekday() == time.Tuesday {
		week = 2
	} else if searchDate.Weekday() == time.Wednesday {
		week = 3
	} else if searchDate.Weekday() == time.Thursday {
		week = 4
	} else if searchDate.Weekday() == time.Friday {
		week = 5
	} else if searchDate.Weekday() == time.Saturday {
		week = 6
	} else if searchDate.Weekday() == time.Sunday {
		week = 7
	}

	monday := searchDate.Add(-1 * time.Duration(week-1) * 24 * time.Hour)
	sunday := searchDate.Add(time.Duration(7-week) * 24 * time.Hour)
	st := monday.Format("20060102") + "000000"
	et := sunday.Format("20060102") + "235959"

	db := lessgo.GetMySQL()
	defer db.Close()
	rooms := []RoomOrTime{}
	times := []RoomOrTime{}
	weekdates := []Weekdate{}
	schedules := []Schedule{}

	getRoomInfoSql := "select rid,name from room where cid=? "
	lessgo.Log.Debug(getRoomInfoSql)

	rows, err := db.Query(getRoomInfoSql, centerId)

	if err != nil {
		lessgo.Log.Error(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "系统发生错误,请联系IT部门"
		commonlib.OutputJson(w, m, " ")
		return
	}

	for rows.Next() {
		room := RoomOrTime{}
		err = commonlib.PutRecord(rows, &room.Id, &room.Name)

		if err != nil {
			lessgo.Log.Error(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "系统发生错误,请联系IT部门"
			commonlib.OutputJson(w, m, " ")
			return
		}

		rooms = append(rooms, room)
	}

	getTimeSql := "select id,start_time,end_time from time_section where center_id=? order by start_time,end_time"
	lessgo.Log.Debug(getRoomInfoSql)

	rows, err = db.Query(getTimeSql, centerId)

	if err != nil {
		lessgo.Log.Error(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "系统发生错误,请联系IT部门"
		commonlib.OutputJson(w, m, " ")
		return
	}

	for rows.Next() {
		timeObject := RoomOrTime{}
		startTime := ""
		endTime := ""
		err = commonlib.PutRecord(rows, &timeObject.Id, &startTime, &endTime)
		timeObject.Name = startTime + "~" + endTime

		if err != nil {
			lessgo.Log.Error(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "系统发生错误,请联系IT部门"
			commonlib.OutputJson(w, m, " ")
			return
		}

		times = append(times, timeObject)
	}

	for i := 0; i < 7; i++ {
		var weekdate = Weekdate{}
		if i == 0 {
			weekdate.Week = "星期一"
		} else if i == 1 {
			weekdate.Week = "星期二"
		} else if i == 2 {
			weekdate.Week = "星期三"
		} else if i == 3 {
			weekdate.Week = "星期四"
		} else if i == 4 {
			weekdate.Week = "星期五"
		} else if i == 5 {
			weekdate.Week = "星期六"
		} else if i == 6 {
			weekdate.Week = "星期日"
		}

		theday := monday.Add(time.Duration(i*24) * time.Hour)
		weekdate.Date = theday.Format("2006-01-02")

		weekdates = append(weekdates, weekdate)
	}

	getScheduleInfoSql := "select csd.id,csd.room_id,csd.time_id,csd.course_id,teacher.really_name teaName,assistant.really_name assName,personNum.num perNum,signNum.num sigNum,wc.name,cour.name,csd.week,csd.class_id,csd.center_id,wc.code,currTMKPersonNum.num from class_schedule_detail csd "
	getScheduleInfoSql += " left join employee teacher on teacher.user_id=csd.teacher_id  "
	getScheduleInfoSql += " left join employee assistant on assistant.user_id=csd.assistant_id "
	getScheduleInfoSql += " left join (select count(1) num,schedule_detail_id from schedule_detail_child group by schedule_detail_id) personNum on personNum.schedule_detail_id = csd.id "
	getScheduleInfoSql += " left join (select count(1) num,schedule_detail_id from schedule_detail_child where create_user=? group by schedule_detail_id) currTMKPersonNum on currTMKPersonNum.schedule_detail_id = csd.id "
	getScheduleInfoSql += " left join time_section ts on ts.id=csd.time_id "
	getScheduleInfoSql += " left join (select count(1) num,schedule_detail_id from sign_in group by schedule_detail_id) signNum on signNum.schedule_detail_id = csd.id "
	getScheduleInfoSql += " left join wyclass wc on wc.class_id=csd.class_id "
	getScheduleInfoSql += " left join course cour on cour.cid=csd.course_id "
	getScheduleInfoSql += " where csd.start_time>=? and csd.start_time<=? and csd.center_id=?"

	params := []interface{}{}

	params = append(params, employee.UserId)
	params = append(params, st)
	params = append(params, et)
	params = append(params, centerId)

	if oldClassId != "" {
		getScheduleInfoSql += " and wc.class_id!= ? "
		params = append(params, oldClassId)
	}

	lessgo.Log.Debug(getScheduleInfoSql)

	rows, err = db.Query(getScheduleInfoSql, params...)

	if err != nil {
		lessgo.Log.Error(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "系统发生错误,请联系IT部门"
		commonlib.OutputJson(w, m, " ")
		return
	}

	for rows.Next() {
		schedule := Schedule{}
		courseId := 0
		className := ""
		courseName := ""

		err = commonlib.PutRecord(rows, &schedule.Id, &schedule.RoomId, &schedule.TimeId, &courseId, &schedule.Teacher, &schedule.Assistant, &schedule.PersonNum, &schedule.SignNum, &className, &courseName, &schedule.Week, &schedule.ClassId, &schedule.CenterId, &schedule.Code, &schedule.CurrentTMKPersonNum)

		if err != nil {
			lessgo.Log.Error(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "系统发生错误,请联系IT部门"
			commonlib.OutputJson(w, m, " ")
			return
		}

		if courseId != 0 {
			schedule.IsNormal = 1
			schedule.Name = courseName
		} else {
			schedule.IsNormal = 2
			schedule.Name = className
		}

		schedules = append(schedules, schedule)
	}

	m["success"] = true
	m["code"] = 200
	m["msg"] = "成功"
	m["times"] = times
	m["rooms"] = rooms
	m["weekdates"] = weekdates
	m["schedules"] = schedules
	m["firstDayOfWeek"] = st

	commonlib.OutputJson(w, m, "")
}

func ClassScheduleDetailListTempAction(w http.ResponseWriter, r *http.Request) {

	m := make(map[string]interface{})

	employee := lessgo.GetCurrentEmployee(r)

	if employee.UserId == "" {
		lessgo.Log.Warn("用户未登陆")
		m["success"] = false
		m["code"] = 100
		m["msg"] = "用户未登陆"
		commonlib.OutputJson(w, m, " ")
		return
	}

	err := r.ParseForm()

	if err != nil {
		lessgo.Log.Error(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
		commonlib.OutputJson(w, m, " ")
		return
	}

	date := r.FormValue("date")
	centerId := r.FormValue("centerId")
	dateType := r.FormValue("type")

	roleType := ""

	roleCodes := strings.Split(employee.RoleCode, ",")

	for _, roleCode := range roleCodes {
		if roleCode == "admin" || roleCode == "yyzj" || roleCode == "zjl" || roleCode == "yyzy" || roleCode == "tmk" {
			roleType = "all"
			break
		} else {
			roleType = "center"
			break
		}
	}

	if roleType == "center" {
		userId, _ := strconv.Atoi(employee.UserId)
		_employee, err := FindEmployeeById(userId)
		if err != nil {
			m["success"] = false
			m["code"] = 100
			m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
			commonlib.OutputJson(w, m, " ")
			return
		}
		centerId = _employee.CenterId
	}

	searchDate := time.Now()

	if date != "" {
		searchDate, _ = time.ParseInLocation("20060102150405", date, time.Local)
	}

	if dateType == "pre" {
		searchDate = searchDate.Add(time.Duration(-7*24) * time.Hour)
	} else if dateType == "next" {
		searchDate = searchDate.Add(time.Duration(7*24) * time.Hour)
	}

	week := 0

	if searchDate.Weekday() == time.Monday {
		week = 1
	} else if searchDate.Weekday() == time.Tuesday {
		week = 2
	} else if searchDate.Weekday() == time.Wednesday {
		week = 3
	} else if searchDate.Weekday() == time.Thursday {
		week = 4
	} else if searchDate.Weekday() == time.Friday {
		week = 5
	} else if searchDate.Weekday() == time.Saturday {
		week = 6
	} else if searchDate.Weekday() == time.Sunday {
		week = 7
	}

	monday := searchDate.Add(-1 * time.Duration(week-1) * 24 * time.Hour)
	sunday := searchDate.Add(time.Duration(7-week) * 24 * time.Hour)
	st := monday.Format("20060102") + "000000"
	et := sunday.Format("20060102") + "235959"

	db := lessgo.GetMySQL()
	defer db.Close()
	rooms := []RoomOrTime{}
	times := []RoomOrTime{}
	weekdates := []Weekdate{}
	schedules := []Schedule{}

	getRoomInfoSql := "select rid,name from room where cid=? "
	lessgo.Log.Debug(getRoomInfoSql)

	rows, err := db.Query(getRoomInfoSql, centerId)

	if err != nil {
		lessgo.Log.Error(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "系统发生错误,请联系IT部门"
		commonlib.OutputJson(w, m, " ")
		return
	}

	for rows.Next() {
		room := RoomOrTime{}
		err = commonlib.PutRecord(rows, &room.Id, &room.Name)

		if err != nil {
			lessgo.Log.Error(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "系统发生错误,请联系IT部门"
			commonlib.OutputJson(w, m, " ")
			return
		}

		rooms = append(rooms, room)
	}

	getTimeSql := "select id,start_time,end_time from time_section where center_id=? order by start_time,end_time"
	lessgo.Log.Debug(getRoomInfoSql)

	rows, err = db.Query(getTimeSql, centerId)

	if err != nil {
		lessgo.Log.Error(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "系统发生错误,请联系IT部门"
		commonlib.OutputJson(w, m, " ")
		return
	}

	for rows.Next() {
		timeObject := RoomOrTime{}
		startTime := ""
		endTime := ""
		err = commonlib.PutRecord(rows, &timeObject.Id, &startTime, &endTime)
		timeObject.Name = startTime + "~" + endTime

		if err != nil {
			lessgo.Log.Error(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "系统发生错误,请联系IT部门"
			commonlib.OutputJson(w, m, " ")
			return
		}

		times = append(times, timeObject)
	}

	for i := 0; i < 7; i++ {
		var weekdate = Weekdate{}
		if i == 0 {
			weekdate.Week = "星期一"
		} else if i == 1 {
			weekdate.Week = "星期二"
		} else if i == 2 {
			weekdate.Week = "星期三"
		} else if i == 3 {
			weekdate.Week = "星期四"
		} else if i == 4 {
			weekdate.Week = "星期五"
		} else if i == 5 {
			weekdate.Week = "星期六"
		} else if i == 6 {
			weekdate.Week = "星期日"
		}

		theday := monday.Add(time.Duration(i*24) * time.Hour)
		weekdate.Date = theday.Format("2006-01-02")

		weekdates = append(weekdates, weekdate)
	}

	getScheduleInfoSql := "select csd.id,csd.room_id,csd.time_id,csd.course_id,teacher.really_name teaName,assistant.really_name assName,personNum.num perNum,signNum.num sigNum,wc.name,cour.name,csd.week,csd.class_id,csd.center_id,wc.code,currTMKPersonNum.num from class_schedule_detail csd "
	getScheduleInfoSql += " left join employee teacher on teacher.user_id=csd.teacher_id  "
	getScheduleInfoSql += " left join employee assistant on assistant.user_id=csd.assistant_id "
	getScheduleInfoSql += " left join (select count(1) num,schedule_detail_id from schedule_detail_child group by schedule_detail_id) personNum on personNum.schedule_detail_id = csd.id "
	getScheduleInfoSql += " left join (select count(1) num,schedule_detail_id from schedule_detail_child where create_user=? group by schedule_detail_id) currTMKPersonNum on currTMKPersonNum.schedule_detail_id = csd.id "
	getScheduleInfoSql += " left join time_section ts on ts.id=csd.time_id "
	getScheduleInfoSql += " left join (select count(1) num,schedule_detail_id from sign_in group by schedule_detail_id) signNum on signNum.schedule_detail_id = csd.id "
	getScheduleInfoSql += " left join wyclass wc on wc.class_id=csd.class_id "
	getScheduleInfoSql += " left join course cour on cour.cid=csd.course_id "
	getScheduleInfoSql += " where csd.start_time>=? and csd.start_time<=? and csd.center_id=? and  csd.course_id is null"

	params := []interface{}{}

	params = append(params, employee.UserId)
	params = append(params, st)
	params = append(params, et)
	params = append(params, centerId)

	lessgo.Log.Debug(getScheduleInfoSql)

	rows, err = db.Query(getScheduleInfoSql, params...)

	if err != nil {
		lessgo.Log.Error(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "系统发生错误,请联系IT部门"
		commonlib.OutputJson(w, m, " ")
		return
	}

	for rows.Next() {
		schedule := Schedule{}
		courseId := 0
		className := ""
		courseName := ""

		err = commonlib.PutRecord(rows, &schedule.Id, &schedule.RoomId, &schedule.TimeId, &courseId, &schedule.Teacher, &schedule.Assistant, &schedule.PersonNum, &schedule.SignNum, &className, &courseName, &schedule.Week, &schedule.ClassId, &schedule.CenterId, &schedule.Code, &schedule.CurrentTMKPersonNum)

		if err != nil {
			lessgo.Log.Error(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "系统发生错误,请联系IT部门"
			commonlib.OutputJson(w, m, " ")
			return
		}

		if courseId != 0 {
			schedule.IsNormal = 1
			schedule.Name = courseName
		} else {
			schedule.IsNormal = 2
			schedule.Name = className
		}

		schedules = append(schedules, schedule)
	}

	m["success"] = true
	m["code"] = 200
	m["msg"] = "成功"
	m["times"] = times
	m["rooms"] = rooms
	m["weekdates"] = weekdates
	m["schedules"] = schedules
	m["firstDayOfWeek"] = st

	commonlib.OutputJson(w, m, "")
}

func ClassScheduleDetailAddAction(w http.ResponseWriter, r *http.Request) {

	m := make(map[string]interface{})

	employee := lessgo.GetCurrentEmployee(r)

	if employee.UserId == "" {
		lessgo.Log.Warn("用户未登陆")
		m["success"] = false
		m["code"] = 100
		m["msg"] = "用户未登陆"
		commonlib.OutputJson(w, m, " ")
		return
	}

	err := r.ParseForm()

	if err != nil {
		lessgo.Log.Error(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
		commonlib.OutputJson(w, m, " ")
		return
	}

	userId, _ := strconv.Atoi(employee.UserId)
	_employee, err := FindEmployeeById(userId)
	if err != nil {
		m["success"] = false
		m["code"] = 100
		m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
		commonlib.OutputJson(w, m, " ")
		return
	}

	roomId := r.FormValue("roomId")
	timeId := r.FormValue("timeId")
	courseId := r.FormValue("courseId")
	teacherId := r.FormValue("teacherId")
	assistantId := r.FormValue("assistantId")
	week := r.FormValue("week")
	date := r.FormValue("date")
	scheduleType := r.FormValue("type")
	isTmp := r.FormValue("isTmp")
	capacity := r.FormValue("capacity")
	name := r.FormValue("name")
	code := r.FormValue("code")

	date = strings.Replace(date, "-", "", -1)

	timeSection, err := FindTimeSectionById(timeId)

	if err != nil {
		lessgo.Log.Error(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
		commonlib.OutputJson(w, m, " ")
		return
	}

	startTime := date + strings.Replace(timeSection.StartTime, ":", "", -1) + "00"
	endTime := date + strings.Replace(timeSection.EndTime, ":", "", -1) + "00"

	db := lessgo.GetMySQL()
	defer db.Close()

	tx, err := db.Begin()
	if err != nil {
		lessgo.Log.Warn(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "系统发生错误,请联系IT部门"
		commonlib.OutputJson(w, m, " ")
		return
	}

	if scheduleType == "normal" {

		insertScheduleSql := "insert into class_schedule_detail(teacher_id,assistant_id,course_id,center_id,time_id,room_id,day_date,week,start_time,end_time,status,capacity) values(?,?,?,?,?,?,?,?,?,?,?,?)"
		lessgo.Log.Debug(insertScheduleSql)

		stmt, err := tx.Prepare(insertScheduleSql)

		if err != nil {
			lessgo.Log.Warn(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
			commonlib.OutputJson(w, m, " ")
			return
		}

		_, err = stmt.Exec(teacherId, assistantId, courseId, _employee.CenterId, timeId, roomId, date, week, startTime, endTime, 1, capacity)

		if err != nil {
			lessgo.Log.Warn(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
			commonlib.OutputJson(w, m, " ")
			return
		}

		if isTmp == "1" {
			selectTmpSql := "select id from schedule_template where center_id=? and room_id=? and time_id=? and week=? "
			lessgo.Log.Debug(selectTmpSql)

			rows, err := db.Query(selectTmpSql, _employee.CenterId, roomId, timeId, week)

			scheduleTemplateId := 0

			if rows.Next() {
				err := commonlib.PutRecord(rows, &scheduleTemplateId)

				if err != nil {
					lessgo.Log.Warn(err.Error())
					m["success"] = false
					m["code"] = 100
					m["msg"] = "系统发生错误,请联系IT部门"
					commonlib.OutputJson(w, m, " ")
					return
				}
			}

			if scheduleTemplateId == 0 {
				insertScheduleTmpSql := "insert into schedule_template(center_id,room_id,teacher_id,assistant_id,time_id,week,course_id) values(?,?,?,?,?,?,?)"
				lessgo.Log.Debug(insertScheduleTmpSql)

				stmt, err = tx.Prepare(insertScheduleTmpSql)

				if err != nil {
					lessgo.Log.Warn(err.Error())
					m["success"] = false
					m["code"] = 100
					m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
					commonlib.OutputJson(w, m, " ")
					return
				}

				_, err = stmt.Exec(_employee.CenterId, roomId, teacherId, assistantId, timeId, week, courseId)

				if err != nil {
					lessgo.Log.Warn(err.Error())
					m["success"] = false
					m["code"] = 100
					m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
					commonlib.OutputJson(w, m, " ")
					return
				}
			} else {
				updateScheduleTmpSql := "update schedule_template set teacher_id=?, assistant_id=?,course_id=? where id=? "
				lessgo.Log.Debug(updateScheduleTmpSql)

				stmt, err = tx.Prepare(updateScheduleTmpSql)
				if err != nil {
					lessgo.Log.Warn(err.Error())
					m["success"] = false
					m["code"] = 100
					m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
					commonlib.OutputJson(w, m, " ")
					return
				}
				_, err = stmt.Exec(teacherId, assistantId, courseId, scheduleTemplateId)

				if err != nil {
					lessgo.Log.Warn(err.Error())
					m["success"] = false
					m["code"] = 100
					m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
					commonlib.OutputJson(w, m, " ")
					return
				}
			}

		}

		tx.Commit()

		m["success"] = true
		commonlib.OutputJson(w, m, " ")
	} else {
		insertClassSql := "insert into wyclass(name,create_time,center_id,start_time,code) values(?,?,?,?,?)"
		lessgo.Log.Debug(insertClassSql)

		stmt, err := tx.Prepare(insertClassSql)

		if err != nil {
			lessgo.Log.Warn(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
			commonlib.OutputJson(w, m, " ")
			return
		}

		res, err := stmt.Exec(name, time.Now().Format("20060102150405"), _employee.CenterId, startTime, code)

		if err != nil {
			lessgo.Log.Warn(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
			commonlib.OutputJson(w, m, " ")
			return
		}

		classId, err := res.LastInsertId()

		if err != nil {
			lessgo.Log.Warn(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
			commonlib.OutputJson(w, m, " ")
			return
		}

		insertScheduleSql := "insert into class_schedule_detail(class_id,center_id,time_id,room_id,day_date,week,start_time,end_time,status,capacity) values(?,?,?,?,?,?,?,?,?,?)"
		lessgo.Log.Debug(insertScheduleSql)

		stmt, err = tx.Prepare(insertScheduleSql)

		if err != nil {
			lessgo.Log.Error(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
			commonlib.OutputJson(w, m, " ")
			return
		}

		_, err = stmt.Exec(classId, _employee.CenterId, timeId, roomId, date, week, startTime, endTime, 1, capacity)

		if err != nil {
			lessgo.Log.Warn(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
			commonlib.OutputJson(w, m, " ")
			return
		}

		tx.Commit()

		m["success"] = true
		commonlib.OutputJson(w, m, " ")
	}
}

func ClassScheduleDetailModifyAction(w http.ResponseWriter, r *http.Request) {

	m := make(map[string]interface{})

	employee := lessgo.GetCurrentEmployee(r)

	if employee.UserId == "" {
		lessgo.Log.Warn("用户未登陆")
		m["success"] = false
		m["code"] = 100
		m["msg"] = "用户未登陆"
		commonlib.OutputJson(w, m, " ")
		return
	}

	err := r.ParseForm()

	if err != nil {
		lessgo.Log.Error(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
		commonlib.OutputJson(w, m, " ")
		return
	}

	scheduleId := r.FormValue("scheduleId")
	name := r.FormValue("name")
	code := r.FormValue("code")
	teacherId := r.FormValue("teacherId")
	assistantId := r.FormValue("assistantId")
	scheduleType := r.FormValue("type")
	classId := r.FormValue("classId")

	db := lessgo.GetMySQL()
	defer db.Close()

	tx, err := db.Begin()
	if err != nil {
		lessgo.Log.Warn(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "系统发生错误,请联系IT部门"
		commonlib.OutputJson(w, m, " ")
		return
	}

	if scheduleType == "normal" {

		updateSql := "update class_schedule_detail set teacher_id=?,assistant_id=? where id=?"
		lessgo.Log.Debug(updateSql)

		stmt, err := tx.Prepare(updateSql)

		if err != nil {
			lessgo.Log.Warn(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
			commonlib.OutputJson(w, m, " ")
			return
		}

		_, err = stmt.Exec(teacherId, assistantId, scheduleId)

		if err != nil {
			lessgo.Log.Warn(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
			commonlib.OutputJson(w, m, " ")
			return
		}

		tx.Commit()

		m["success"] = true
		commonlib.OutputJson(w, m, " ")
	} else {
		updateSql := "update wyclass set name=? , code=? where class_id=?"
		lessgo.Log.Debug(updateSql)

		stmt, err := tx.Prepare(updateSql)

		if err != nil {
			lessgo.Log.Warn(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
			commonlib.OutputJson(w, m, " ")
			return
		}

		_, err = stmt.Exec(name, code, classId)

		if err != nil {
			lessgo.Log.Warn(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
			commonlib.OutputJson(w, m, " ")
			return
		}

		tx.Commit()

		m["success"] = true
		commonlib.OutputJson(w, m, " ")
	}
}

//课表读取
func ClassScheduleDetailLoadAction(w http.ResponseWriter, r *http.Request) {

	m := make(map[string]interface{})

	employee := lessgo.GetCurrentEmployee(r)

	if employee.UserId == "" {
		lessgo.Log.Warn("用户未登陆")
		m["success"] = false
		m["code"] = 100
		m["msg"] = "用户未登陆"
		commonlib.OutputJson(w, m, " ")
		return
	}

	err := r.ParseForm()

	if err != nil {
		m["success"] = false
		m["code"] = 100
		m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
		commonlib.OutputJson(w, m, " ")
		return
	}

	id := r.FormValue("scheduleId")
	roomId := r.FormValue("roomId")
	timeId := r.FormValue("timeId")
	week := r.FormValue("week")
	date := r.FormValue("date")
	//	schedule := r.FormValue("type")

	db := lessgo.GetMySQL()
	defer db.Close()

	loadFormObjects := []lessgo.LoadFormObject{}

	if id != "" {
		getScheduleDetailSql := "select csd.teacher_id,csd.assistant_id,wc.name,wc.code,wc.class_id from class_schedule_detail csd left join wyclass wc on wc.class_id=csd.class_id where csd.id=?"
		lessgo.Log.Debug(getScheduleDetailSql)

		rows, err := db.Query(getScheduleDetailSql, id)

		if err != nil {
			m["success"] = false
			m["code"] = 100
			m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
			commonlib.OutputJson(w, m, " ")
			return
		}

		var teacherId, assistantId, className, classCode, classId string

		if rows.Next() {
			err = commonlib.PutRecord(rows, &teacherId, &assistantId, &className, &classCode, &classId)

			if err != nil {
				m["success"] = false
				m["code"] = 100
				m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
				commonlib.OutputJson(w, m, " ")
				return
			}
		}

		m["success"] = true

		h1 := lessgo.LoadFormObject{"scheduleId", id}
		h2 := lessgo.LoadFormObject{"name", className}
		h3 := lessgo.LoadFormObject{"code", classCode}
		h4 := lessgo.LoadFormObject{"teacherId", teacherId}
		h5 := lessgo.LoadFormObject{"assistantId", assistantId}
		h6 := lessgo.LoadFormObject{"classId", classId}

		loadFormObjects = append(loadFormObjects, h1)
		loadFormObjects = append(loadFormObjects, h2)
		loadFormObjects = append(loadFormObjects, h3)
		loadFormObjects = append(loadFormObjects, h4)
		loadFormObjects = append(loadFormObjects, h5)
		loadFormObjects = append(loadFormObjects, h6)
	} else {
		roomInfoSql := "select name from room where rid=? "
		lessgo.Log.Debug(roomInfoSql)

		rows, err := db.Query(roomInfoSql, roomId)

		if err != nil {
			m["success"] = false
			m["code"] = 100
			m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
			commonlib.OutputJson(w, m, " ")
			return
		}

		var roomName string

		if rows.Next() {
			err = commonlib.PutRecord(rows, &roomName)

			if err != nil {
				m["success"] = false
				m["code"] = 100
				m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
				commonlib.OutputJson(w, m, " ")
				return
			}
		}

		timeInfoSql := "select start_time,end_time from time_section where id=?"
		lessgo.Log.Debug(timeInfoSql)

		rows, err = db.Query(timeInfoSql, timeId)

		if err != nil {
			m["success"] = false
			m["code"] = 100
			m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
			commonlib.OutputJson(w, m, " ")
			return
		}

		var startTime, endTime string

		if rows.Next() {
			err = commonlib.PutRecord(rows, &startTime, &endTime)

			if err != nil {
				m["success"] = false
				m["code"] = 100
				m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
				commonlib.OutputJson(w, m, " ")
				return
			}
		}

		weekDesc := ""
		if week == "1" {
			weekDesc = "星期一"
		} else if week == "2" {
			weekDesc = "星期二"
		} else if week == "3" {
			weekDesc = "星期三"
		} else if week == "4" {
			weekDesc = "星期四"
		} else if week == "5" {
			weekDesc = "星期五"
		} else if week == "6" {
			weekDesc = "星期六"
		} else if week == "7" {
			weekDesc = "星期日"
		}

		m["success"] = true

		h1 := lessgo.LoadFormObject{"id", id}
		h2 := lessgo.LoadFormObject{"roomId", roomId}
		h3 := lessgo.LoadFormObject{"timeId", timeId}
		h4 := lessgo.LoadFormObject{"roomName", roomName}
		h5 := lessgo.LoadFormObject{"timeDesc", startTime + "~" + endTime}
		h6 := lessgo.LoadFormObject{"weekDesc", date + "(" + weekDesc + ")"}
		h7 := lessgo.LoadFormObject{"week", week}
		h8 := lessgo.LoadFormObject{"date", date}
		h9 := lessgo.LoadFormObject{"capacity", "10"}

		loadFormObjects = append(loadFormObjects, h1)
		loadFormObjects = append(loadFormObjects, h2)
		loadFormObjects = append(loadFormObjects, h3)
		loadFormObjects = append(loadFormObjects, h4)
		loadFormObjects = append(loadFormObjects, h5)
		loadFormObjects = append(loadFormObjects, h6)
		loadFormObjects = append(loadFormObjects, h7)
		loadFormObjects = append(loadFormObjects, h8)
		loadFormObjects = append(loadFormObjects, h9)
	}

	m["datas"] = loadFormObjects
	commonlib.OutputJson(w, m, " ")
}

//仅删除课表,不删除模板
func DeleteSingleScheduleAction(w http.ResponseWriter, r *http.Request) {

	m := make(map[string]interface{})

	employee := lessgo.GetCurrentEmployee(r)

	if employee.UserId == "" {
		lessgo.Log.Warn("用户未登陆")
		m["success"] = false
		m["code"] = 100
		m["msg"] = "用户未登陆"
		commonlib.OutputJson(w, m, " ")
		return
	}

	err := r.ParseForm()

	if err != nil {
		m["success"] = false
		m["code"] = 100
		m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
		commonlib.OutputJson(w, m, " ")
		return
	}

	scheduleId := r.FormValue("scheduleId")

	db := lessgo.GetMySQL()
	defer db.Close()

	checkExistSql := "select count(1) from schedule_detail_child where schedule_detail_id=?"

	lessgo.Log.Debug(checkExistSql)

	rows, err := db.Query(checkExistSql, scheduleId)

	if err != nil {
		lessgo.Log.Warn(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "系统发生错误,请联系IT部门"
		commonlib.OutputJson(w, m, " ")
		return
	}

	num := 0

	if rows.Next() {

		err = commonlib.PutRecord(rows, &num)

		if err != nil {
			lessgo.Log.Warn(err.Error())
			m["success"] = false
			m["code"] = 100
			m["msg"] = "系统发生错误,请联系IT部门"
			commonlib.OutputJson(w, m, " ")
			return
		}
	}

	if num > 0 {
		m["success"] = false
		m["code"] = 100
		m["msg"] = "有人上课,不能删除"
		commonlib.OutputJson(w, m, " ")
		return
	}

	tx, err := db.Begin()
	if err != nil {
		lessgo.Log.Warn(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "系统发生错误,请联系IT部门"
		commonlib.OutputJson(w, m, " ")
		return
	}

	deteleSql := "delete from class_schedule_detail where id=?"

	lessgo.Log.Debug(deteleSql)

	stmt, err := tx.Prepare(deteleSql)

	if err != nil {
		tx.Rollback()
		lessgo.Log.Warn(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
		commonlib.OutputJson(w, m, " ")
		return
	}

	_, err = stmt.Exec(scheduleId)

	if err != nil {
		tx.Rollback()
		lessgo.Log.Warn(err.Error())
		m["success"] = false
		m["code"] = 100
		m["msg"] = "出现错误,请联系IT部门,错误信息:" + err.Error()
		commonlib.OutputJson(w, m, " ")
		return
	}

	tx.Commit()

	m["success"] = true
	m["code"] = 200
	m["msg"] = "操作成功"
	commonlib.OutputJson(w, m, " ")
	return
}


text:
FILE_EXTENSION=".sgf"
SEARCH_DIR="Games"
DESTINATION_PATH="/home/david/Documents/GitHub/tensorGo/TrainingData/"

# Create a list of all files in SEARCH_DIR with extension FILE_EXTENSION
FILES=$(find $SEARCH_DIR -type f -name "*$FILE_EXTENSION")
count=0

# For each of the files found copy it to DESTINATION_PATH with a new name
for f in $FILES;
do mv -fv "$f" "${DESTINATION_PATH}game${count}${FILE_EXTENSION}"
((count++))
done


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- From: file:/Users/sandeepkaranth/hadoop/git-leaderamp-vnext/leaderamp-vnext-mobile/LeaderAmp/node_modules/react-native-xmpp/android/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/res/values-w500dp/values-w500dp.xml -->
    <eat-comment/>
    <integer name="abc_max_action_buttons">4</integer>
</resources>


text:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <stroke
                android:width="1dp"
                android:color="#FF000000" />
            <solid android:color="#FFDDDDDD" />

        </shape>
    </item>

    <item
        android:bottom="1dp"
        android:top="1dp">
        <shape android:shape="rectangle">
            <solid android:color="#FFFFFF" />
        </shape>
    </item>
</layer-list>


text:
package com.codamasters.screens;

import static com.badlogic.gdx.scenes.scene2d.actions.Actions.moveTo;
import static com.badlogic.gdx.scenes.scene2d.actions.Actions.run;
import static com.badlogic.gdx.scenes.scene2d.actions.Actions.sequence;

import com.codamasters.LittleNibolas;
import com.codamasters.LNHelpers.AssetLoaderSpace;
import com.codamasters.LNHelpers.AssetsLoaderActual;
import com.codamasters.LNHelpers.AssetsLoaderRome;
import com.codamasters.tween.ActorAccessor;

import aurelienribon.tweenengine.Timeline;
import aurelienribon.tweenengine.Tween;
import aurelienribon.tweenengine.TweenManager;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.viewport.FitViewport;

public class CongratsRome implements Screen {

	private Stage stage;
	private Skin skin;
	private Table table;
	private TweenManager tweenManager;
	private Label puntos, lHighscore;
	private LittleNibolas game;

	public CongratsRome(LittleNibolas game){
		this.game = game;
	}

	@Override
	public void render(float delta) {
		Gdx.gl.glClearColor(0, 0, 0, 0);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		stage.act(delta);
		stage.draw();

		tweenManager.update(delta);
	}

	@Override
	public void resize(int width, int height) {
	    stage.getViewport().update(width, height, false);

		table.invalidateHierarchy();
	}

	@Override
	public void show() {
		stage = new Stage(new FitViewport(1280,720));
		Gdx.input.setInputProcessor(stage);

		skin = new Skin(Gdx.files.internal("ui/menuSkin.json"), new TextureAtlas("ui/atlas.pack"));

		table = new Table(skin);
		table.setFillParent(true);

		// creating heading
		Label heading = new Label("Enhorabuena", skin, "big");
		heading.setFontScale(2);

		int score = AssetsLoaderRome.getScore();
		int highscore = AssetsLoaderRome.getHighScore();

		puntos = new Label("Puntuacion obtenida:" + score,skin);
		puntos.setFontScale(1);

		if(AssetsLoaderActual.getHighScore() < 10000 && AssetsLoaderRome.getHighScore()>=150
				&& AssetLoaderSpace.getHighScore() >= 150){
			game.actionResolver.unlockAchievement(LittleNibolas.ACHIEVEMENT7);
		}

		if(score > highscore){
			lHighscore = new Label("Nuevo record !!!",skin);
			lHighscore.setFontScale(1);
			AssetsLoaderRome.setHighScore(score);
			game.actionResolver.submitScore(LittleNibolas.LEADERBOARD_NV2, score);

		}else{
			lHighscore = new Label("Puntuacion maxima:" + highscore,skin);
			lHighscore.setFontScale(1);
		}

		// creating buttons
		TextButton buttonPlay = new TextButton("Continuar", skin,"big");
		buttonPlay.addListener(new ClickListener() {

			@Override
			public void clicked(InputEvent event, float x, float y) {
				stage.addAction(sequence(moveTo(0, -stage.getHeight(), .5f), run(new Runnable() {

					@Override
					public void run() {
						((Game) Gdx.app.getApplicationListener()).setScreen(new FinSegundoNivel1(game));
					}
				})));
			}
		});
		buttonPlay.pad(10, 60, 10, 60);

		TextButton buttonRetry = new TextButton("Reintentar", skin,"big");
		buttonRetry.addListener(new ClickListener() {

			@Override
			public void clicked(InputEvent event, float x, float y) {
				stage.addAction(sequence(moveTo(0, -stage.getHeight(), .5f), run(new Runnable() {

					@Override
					public void run() {
						AssetsLoaderRome.reloadNibolas();
						((Game) Gdx.app.getApplicationListener()).setScreen(new ScreenRome(game));
					}
				})));
			}
		});
		buttonRetry.pad(10);

		// putting stuff together
		table.add(heading).spaceBottom(50).row();
		table.add(puntos).spaceBottom(10).row();
		table.add(lHighscore).spaceBottom(20).row();
		table.add(buttonPlay).spaceBottom(15).row();
		table.add(buttonRetry).spaceBottom(15).row();

		stage.addActor(table);

		// creating animations
		tweenManager = new TweenManager();
		Tween.registerAccessor(Actor.class, new ActorAccessor());

		// heading color animation
		Timeline.createSequence().beginSequence()
				.push(Tween.to(heading, ActorAccessor.RGB, .5f).target(1, 0, 0))

				.end().repeat(Tween.INFINITY, 0).start(tweenManager);

		// heading and buttons fade-in
		Timeline.createSequence().beginSequence()
				.push(Tween.set(buttonPlay, ActorAccessor.ALPHA).target(0))
				.push(Tween.set(buttonRetry, ActorAccessor.ALPHA).target(0))
				.push(Tween.from(heading, ActorAccessor.ALPHA, .25f).target(0))
				.push(Tween.to(buttonPlay, ActorAccessor.ALPHA, .25f).target(1))
				.push(Tween.to(buttonRetry, ActorAccessor.ALPHA, .25f).target(1))
				.end().start(tweenManager);

		// table fade-in
		Tween.from(table, ActorAccessor.ALPHA, .75f).target(0).start(tweenManager);
		Tween.from(table, ActorAccessor.Y, .75f).target(Gdx.graphics.getHeight() / 8).start(tweenManager);

		tweenManager.update(Gdx.graphics.getDeltaTime());
	}

	@Override
	public void hide() {
		dispose();
	}

	@Override
	public void pause() {

	}

	@Override
	public void resume() {

	}

	@Override
	public void dispose() {
		stage.dispose();
		skin.dispose();

	}
}


text:
package org.apache.tomcat.util.net.openssl.panama;

import static org.apache.tomcat.util.openssl.openssl_h.*;

import jdk.incubator.foreign.MemoryAddress;

/**
 * Stats exposed by an OpenSSL session context.
 *
 * @see SSL_CTX_sess_number
 */
public final class OpenSSLSessionStats {

    private final MemoryAddress ctx;

    OpenSSLSessionStats(MemoryAddress ctx) {
        this.ctx = ctx;
    }

    /**
     * @return The current number of sessions in the internal session cache.
     */
    public long number() {
        return SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_NUMBER(), 0, null);
    }

    /**
     * @return The number of started SSL/TLS handshakes in client mode.
     */
    public long connect() {
        return SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_CONNECT() ,0, null);
    }

    /**
     * @return The number of successfully established SSL/TLS sessions in client mode.
     */
    public long connectGood() {
        return SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_CONNECT_GOOD() , 0, null);
    }

    /**
     * @return The number of start renegotiations in client mode.
     */
    public long connectRenegotiate() {
        return SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_CONNECT_RENEGOTIATE() , 0, null);
    }

    /**
     * @return The number of started SSL/TLS handshakes in server mode.
     */
    public long accept() {
        return SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_ACCEPT(), 0, null);
    }

    /**
     * @return The number of successfully established SSL/TLS sessions in server mode.
     */
    public long acceptGood() {
        return SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_ACCEPT_GOOD(), 0, null);
    }

    /**
     * @return The number of start renegotiations in server mode.
     */
    public long acceptRenegotiate() {
        return SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_ACCEPT_RENEGOTIATE(), 0, null);
    }

    /**
     * @return The number of successfully reused sessions. In client mode, a
     *         session set with {@code SSL_set_session} successfully reused is
     *         counted as a hit. In server mode, a session successfully
     *         retrieved from internal or external cache is counted as a hit.
     */
    public long hits() {
        return SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_HIT(), 0, null);
    }

    /**
     * @return The number of successfully retrieved sessions from the external
     *         session cache in server mode.
     */
    public long cbHits() {
        return SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_CB_HIT(), 0, null);
    }

    /**
     * @return The number of sessions proposed by clients that were not found in
     *         the internal session cache in server mode.
     */
    public long misses() {
        return SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_MISSES(), 0, null);
    }

    /**
     * @return The number of sessions proposed by clients and either found in
     *         the internal or external session cache in server mode, but that
     *         were invalid due to timeout. These sessions are not included in
     *         the {@link #hits()} count.
     */
    public long timeouts() {
        return SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_TIMEOUTS(), 0, null);
    }

    /**
     * @return The number of sessions that were removed because the maximum
     *         session cache size was exceeded.
     */
    public long cacheFull() {
        return SSL_CTX_ctrl(ctx, SSL_CTRL_SESS_CACHE_FULL(), 0, null);
    }
}


text:
package com.azure.resourcemanager;

import com.azure.resourcemanager.compute.models.Disk;
import com.azure.resourcemanager.compute.models.KnownWindowsVirtualMachineImage;
import com.azure.resourcemanager.compute.models.VirtualMachine;
import com.azure.resourcemanager.compute.models.VirtualMachineDataDisk;
import com.azure.resourcemanager.compute.models.VirtualMachineSizeTypes;
import com.azure.resourcemanager.compute.models.VirtualMachines;
import com.azure.core.management.Region;
import com.azure.resourcemanager.test.ResourceManagerTestBase;
import org.junit.jupiter.api.Assertions;
import reactor.core.publisher.Mono;

public class TestVirtualMachine extends TestTemplate<VirtualMachine, VirtualMachines> {
    @Override
    public VirtualMachine createResource(VirtualMachines virtualMachines) throws Exception {
        final String vmName = virtualMachines.manager().resourceManager().internalContext().randomResourceName("vm", 10);

        final VirtualMachine[] vms = new VirtualMachine[1];

        Mono<VirtualMachine> resourceStream =
            virtualMachines
                .define(vmName)
                .withRegion(ResourceManagerTestBase.locationOrDefault(Region.US_EAST))
                .withNewResourceGroup()
                .withNewPrimaryNetwork("10.0.0.0/28")
                .withPrimaryPrivateIPAddressDynamic()
                .withoutPrimaryPublicIPAddress()
                .withPopularWindowsImage(KnownWindowsVirtualMachineImage.WINDOWS_SERVER_2012_R2_DATACENTER)
                .withAdminUsername("testuser")
                .withAdminPassword(ResourceManagerTestBase.password())
                .withNewDataDisk(150)
                .withSize(VirtualMachineSizeTypes.fromString("Standard_D2a_v4"))
                .createAsync();

        vms[0] = resourceStream.block();

        Assertions.assertEquals(1, vms[0].dataDisks().size());
        VirtualMachineDataDisk dataDisk = vms[0].dataDisks().values().iterator().next();
        Assertions.assertEquals(150, dataDisk.size());
        Assertions.assertEquals(128, vms[0].osDiskSize());
        Disk osDisk = virtualMachines.manager().disks().getById(vms[0].osDiskId());
        Assertions.assertNotNull(osDisk);
        Assertions.assertEquals(128, osDisk.sizeInGB());

        return vms[0];
    }

    @Override
    public VirtualMachine updateResource(VirtualMachine resource) throws Exception {
        resource = resource.update().withSize(VirtualMachineSizeTypes.fromString("Standard_D2a_v4")).withNewDataDisk(100).apply();
        return resource;
    }

    @Override
    public void print(VirtualMachine virtualMachine) {
        TestUtils.print(virtualMachine);
    }
}


text:
class Profile;

namespace user_prefs {
class PrefRegistrySyncable;
}

namespace gcm {

class GCMProfileService;
class PushMessagingApplicationId;

class PushMessagingServiceImpl : public content::PushMessagingService,
                                 public GCMAppHandler,
                                 public content_settings::Observer {
 public:
  // Register profile-specific prefs for GCM.
  static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);

  // If any Service Workers are using push, starts GCM and adds an app handler.
  static void InitializeForProfile(Profile* profile);

  PushMessagingServiceImpl(GCMProfileService* gcm_profile_service,
                           Profile* profile);
  ~PushMessagingServiceImpl() override;

  // GCMAppHandler implementation.
  void ShutdownHandler() override;
  void OnMessage(const std::string& app_id,
                 const GCMClient::IncomingMessage& message) override;
  void OnMessagesDeleted(const std::string& app_id) override;
  void OnSendError(
      const std::string& app_id,
      const GCMClient::SendErrorDetails& send_error_details) override;
  void OnSendAcknowledged(const std::string& app_id,
                          const std::string& message_id) override;
  bool CanHandle(const std::string& app_id) const override;

  // content::PushMessagingService implementation:
  GURL GetPushEndpoint() override;
  void RegisterFromDocument(
      const GURL& requesting_origin,
      int64 service_worker_registration_id,
      const std::string& sender_id,
      int renderer_id,
      int render_frame_id,
      bool user_visible_only,
      const content::PushMessagingService::RegisterCallback& callback) override;
  void RegisterFromWorker(
      const GURL& requesting_origin,
      int64 service_worker_registration_id,
      const std::string& sender_id,
      const content::PushMessagingService::RegisterCallback& callback) override;
  void Unregister(
      const GURL& requesting_origin,
      int64 service_worker_registration_id,
      const std::string& sender_id,
      bool retry_on_failure,
      const content::PushMessagingService::UnregisterCallback&) override;
  blink::WebPushPermissionStatus GetPermissionStatus(
      const GURL& requesting_origin,
      const GURL& embedding_origin) override;

  // content_settings::Observer implementation.
  void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern,
                               const ContentSettingsPattern& secondary_pattern,
                               ContentSettingsType content_type,
                               std::string resource_identifier) override;

  void SetProfileForTesting(Profile* profile);

 private:
  // A registration is pending until it has succeeded or failed.
  void IncreasePushRegistrationCount(int add, bool is_pending);
  void DecreasePushRegistrationCount(int subtract, bool was_pending);

  // OnMessage methods ---------------------------------------------------------

  void DeliverMessageCallback(const std::string& app_id_guid,
                              const GURL& requesting_origin,
                              int64 service_worker_registration_id,
                              const GCMClient::IncomingMessage& message,
                              content::PushDeliveryStatus status);

  // Developers are required to display a Web Notification in response to an
  // incoming push message in order to clarify to the user that something has
  // happened in the background. When they forget to do so, display a default
  // notification on their behalf.
  void RequireUserVisibleUX(const GURL& requesting_origin,
                            int64 service_worker_registration_id);
  void DidGetNotificationsShown(
      const GURL& requesting_origin,
      int64 service_worker_registration_id,
      bool notification_shown,
      bool notification_needed,
      const std::string& data,
      bool success,
      bool not_found);

  // Register methods ----------------------------------------------------------

  void RegisterEnd(
      const content::PushMessagingService::RegisterCallback& callback,
      const std::string& registration_id,
      content::PushRegistrationStatus status);

  void DidRegister(
      const PushMessagingApplicationId& application_id,
      const content::PushMessagingService::RegisterCallback& callback,
      const std::string& registration_id,
      GCMClient::Result result);

  void DidRequestPermission(
      const PushMessagingApplicationId& application_id,
      const std::string& sender_id,
      const content::PushMessagingService::RegisterCallback& callback,
      bool allow);

  // Unregister methods --------------------------------------------------------

  void Unregister(const std::string& app_id_guid,
                  const std::string& sender_id,
                  bool retry_on_failure,
                  const content::PushMessagingService::UnregisterCallback&);

  void DidUnregister(const std::string& app_id_guid,
                     bool retry_on_failure,
                     const content::PushMessagingService::UnregisterCallback&,
                     GCMClient::Result result);

  // OnContentSettingChanged methods -------------------------------------------

  void UnregisterBecausePermissionRevoked(const PushMessagingApplicationId& id,
                                          const std::string& sender_id,
                                          bool success, bool not_found);

  // Helper methods ------------------------------------------------------------

  // Checks if a given origin is allowed to use Push.
  bool HasPermission(const GURL& origin);

  GCMProfileService* gcm_profile_service_;  // It owns us.

  Profile* profile_;  // It owns our owner.

  int push_registration_count_;
  int pending_push_registration_count_;

  base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_;

  DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl);
};

}  // namespace gcm

#endif  // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_


text:
NS_ASSUME_NONNULL_BEGIN

@class DWConfirmUsernameViewController;

@protocol DWConfirmUsernameViewControllerDelegate <NSObject>

- (void)confirmUsernameViewControllerDidConfirm:(DWConfirmUsernameViewController *)controller;

@end

@interface DWConfirmUsernameViewController : DWBaseModalViewController

@property (readonly, nonatomic, copy) NSString *username;

@property (nullable, nonatomic, weak) id<DWConfirmUsernameViewControllerDelegate> delegate;

- (instancetype)initWithUsername:(NSString *)username;

@end

NS_ASSUME_NONNULL_END


text:
/**
 * @fileoverview Implementation of Counter mode.
 *
 * @author rcc@google.com (Ryan Chan)
 */

goog.provide('e2e.ciphermode.Ctr');

goog.require('e2e');
goog.require('e2e.async.Result');
goog.require('e2e.ciphermode.CipherMode');
goog.require('e2e.error.InvalidArgumentsError');
goog.require('e2e.error.UnsupportedError');
goog.require('goog.array');
goog.require('goog.crypt');

/**
 * Implements the Counter mode.
 *
 * @param {!e2e.cipher.SymmetricCipher} cipher The block cipher to use.
 * @constructor
 * @extends {e2e.ciphermode.CipherMode}
 * @final
 */
e2e.ciphermode.Ctr = function(cipher) {
  goog.base(this, cipher);
};
goog.inherits(e2e.ciphermode.Ctr, e2e.ciphermode.CipherMode);

/** @inheritDoc */
e2e.ciphermode.Ctr.prototype.encryptSync = function(data, iv) {
  if (iv.length != this.cipher.blockSize) {
    throw new e2e.error.InvalidArgumentsError('IV does not match block size.');
  }

  /** @type {!e2e.cipher.ciphertext.Symmetric} */
  var ciphertext = [];
  var encKey = [];
  var block = [];
  var ctr = goog.array.clone(iv);

  for (var i = 0; i < data.length; i += this.cipher.blockSize) {
    encKey = e2e.async.Result.getValue(this.cipher.encrypt(ctr));
    e2e.incrementByteArray(ctr);
    if (e2e.compareByteArray(iv, ctr)) {
      throw new e2e.error.UnsupportedError('CTR overflow: Too many blocks.');
    }
    block = data.slice(i, i + this.cipher.blockSize);
    Array.prototype.push.apply(ciphertext, goog.crypt.xorByteArray(
        block,
        encKey.slice(0, block.length)));
  }
  return ciphertext;
};

/** @inheritDoc */
e2e.ciphermode.Ctr.prototype.decryptSync =
    e2e.ciphermode.Ctr.prototype.encryptSync;

/** @inheritDoc */
e2e.ciphermode.Ctr.prototype.encrypt = function(data, iv) {
  return e2e.async.Result.toResult(this.encryptSync(data, iv));
};

/** @inheritDoc */
e2e.ciphermode.Ctr.prototype.decrypt = e2e.ciphermode.Ctr.prototype.encrypt;


text:
/*
 * DO NOT EDIT THIS CODE BY HAND! It has been generated with jsvcgen.
 */
package com.solidfire.element.api;

import com.solidfire.gson.Gson;
import com.solidfire.core.client.Attributes;
import com.solidfire.gson.annotations.SerializedName;
import com.solidfire.core.annotation.Since;
import com.solidfire.core.javautil.Optional;
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Objects;

/**
 * ResetNodeDetails
 **/

public class ResetNodeDetails implements Serializable {

    public static final long serialVersionUID = -1915588983327371212L;
    @SerializedName("rtfiInfo") private RtfiInfo rtfiInfo;
    // empty constructor
    @Since("7.0")
    public ResetNodeDetails() {}

    // parameterized constructor
    @Since("7.0")
    public ResetNodeDetails(
        RtfiInfo rtfiInfo
    )
    {
        this.rtfiInfo = rtfiInfo;
    }

    /**
     *
     **/
    public RtfiInfo getRtfiInfo() { return this.rtfiInfo; }

    public void setRtfiInfo(RtfiInfo rtfiInfo) {
        this.rtfiInfo = rtfiInfo;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ResetNodeDetails that = (ResetNodeDetails) o;

        return
            Objects.equals(rtfiInfo, that.rtfiInfo);
    }

    @Override
    public int hashCode() {
        return Objects.hash( rtfiInfo );
    }

    public java.util.Map<String, Object> toMap() {
        java.util.Map<String, Object> map = new HashMap<>();
        map.put("rtfiInfo", rtfiInfo);
        return map;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        Gson gson = new Gson();
        sb.append( "{ " );

        sb.append(" rtfiInfo : ").append(gson.toJson(rtfiInfo)).append(",");
        sb.append( " }" );

        if(sb.lastIndexOf(", }") != -1)
            sb.deleteCharAt(sb.lastIndexOf(", }"));

        return sb.toString();
    }

    public static Builder builder() {
        return new Builder();
    }

    public final Builder asBuilder() {
        return new Builder().buildFrom(this);
    }

    public static class Builder {
        private RtfiInfo rtfiInfo;

        private Builder() { }

        public ResetNodeDetails build() {
            return new ResetNodeDetails (
                         this.rtfiInfo);
        }

        private ResetNodeDetails.Builder buildFrom(final ResetNodeDetails req) {
            this.rtfiInfo = req.rtfiInfo;

            return this;
        }

        public ResetNodeDetails.Builder rtfiInfo(final RtfiInfo rtfiInfo) {
            this.rtfiInfo = rtfiInfo;
            return this;
        }

    }
}


text:
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;

namespace RxSoft
{
	[CustomEditor(typeof(rxCustomPolygon), true)]
	public class rxCustomPolygonEditor : Editor
	{
		public void OnSceneGUI()
		{
			rxCustomPolygon targetPolygon = target as rxCustomPolygon;

			// Get the mouse position.
			Ray ray = HandleUtility.GUIPointToWorldRay( Event.current.mousePosition );
			Vector3 mousePosition = ray.GetPoint( ( targetPolygon.transform.position - Camera.current.transform.position ).magnitude );

			switch ( Event.current.type )
			{
				case EventType.mouseDrag:
				{
					targetPolygon.OnMouseDrag( mousePosition );

					EditorUtility.SetDirty( targetPolygon );
				}
				break;

				case EventType.mouseMove:
				{
					targetPolygon.OnMouseMove( mousePosition );

					EditorUtility.SetDirty( targetPolygon );
				}
				break;

				case EventType.mouseDown:
				{
					targetPolygon.OnMouseDown( mousePosition );

					EditorUtility.SetDirty( targetPolygon );
				}
				break;

				case EventType.layout:
				{
					// This blocks mouse clicks from deselecting the target while editing.
					int controlID = GUIUtility.GetControlID( FocusType.Passive );
					HandleUtility.AddDefaultControl( controlID );
				}
				break;
			}
		}

		public override void OnInspectorGUI()
		{
			base.OnInspectorGUI();

			rxCustomPolygon targetPolygon = target as rxCustomPolygon;

			List<Vector2> targetVertices = targetPolygon.GetWorldVertices();

			GUILayout.BeginVertical();

			bool insertVertex = GUILayout.Button( "Insert Vertex" );
			bool deleteVertex = GUILayout.Button( "Delete Vertex" );

			bool reverseWinding = GUILayout.Button( "Reverse Winding" );
			bool centerGizmo = GUILayout.Button( "Center Gizmo" );

			GUILayout.Label( "Type: " + ( rxGeometry.IsPolygonConvex( targetVertices ) ? "Convex" : "Concave" ) );
			GUILayout.Label( "Winding: " + ( rxGeometry.IsPolygonCCW( targetVertices ) ? "CCW" : "CW" ) );

			GUILayout.EndVertical();

			if ( insertVertex )
			{
				targetPolygon.InsertVertex();
				EditorUtility.SetDirty( targetPolygon );
			}

			if ( deleteVertex )
			{
				targetPolygon.DeleteVertex();
				EditorUtility.SetDirty( targetPolygon );
			}

			if ( reverseWinding )
			{
				targetPolygon.ReverseWinding();
				EditorUtility.SetDirty( targetPolygon );
			}

			if ( centerGizmo )
			{
				targetPolygon.CenterGizmo();
				EditorUtility.SetDirty( targetPolygon );
			}
		}
	}
}


text:
/*
	This file is part of cpp-ethereum.

	cpp-ethereum is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 2 of the License, or
	(at your option) any later version.

	Foobar is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
*/
/** @file Client.h
 * @author Gav Wood <i@gavwood.com>
 * @date 2014
 */

#pragma once

#include <thread>
#include <mutex>
#include "Common.h"
#include "BlockChain.h"
#include "TransactionQueue.h"
#include "State.h"
#include "Dagger.h"
#include "PeerNetwork.h"

namespace eth
{

struct MineProgress
{
	uint requirement;
	uint best;
	uint current;
};

class Client
{
public:
	Client(std::string const& _clientVersion, Address _us = Address(), std::string const& _dbPath = std::string());
	~Client();

	void transact(Secret _secret, Address _dest, u256 _amount, u256 _fee, u256s _data = u256s());

	void lock();
	void unlock();

	bool changed() const { auto ret = m_changed; m_changed = false; return ret; }

	State const& state() const { return m_s; }
	BlockChain const& blockChain() const { return m_bc; }
	TransactionQueue const& transactionQueue() const { return m_tq; }

	std::vector<PeerInfo> peers() { return m_net ? m_net->peers() : std::vector<PeerInfo>(); }
	unsigned peerCount() const { return m_net ? m_net->peerCount() : 0; }

	void startNetwork(short _listenPort = 30303, std::string const& _seedHost = std::string(), short _port = 30303, unsigned _verbosity = 4, NodeMode _mode = NodeMode::Full, unsigned _peers = 5, std::string const& _publicIP = std::string());
	void connect(std::string const& _seedHost, short _port = 30303);
	void stopNetwork();

	void setAddress(Address _us) { m_s.setAddress(_us); }
	Address address() const { return m_s.address(); }
	void startMining();
	void stopMining();
	MineProgress miningProgress() const { return m_mineProgress; }

private:
	void work();

	std::string m_clientVersion;		///< Our end-application client's name/version.
	BlockChain m_bc;					///< Maintains block database.
	TransactionQueue m_tq;				///< Maintains list of incoming transactions not yet on the block chain.
	Overlay m_stateDB;					///< Acts as the central point for the state database, so multiple States can share it.
	State m_s;							///< The present state of the client.
	PeerServer* m_net = nullptr;		///< Should run in background and send us events when blocks found and allow us to send blocks as required.
	std::thread* m_work;				///< The work thread.
	std::mutex m_lock;
	enum { Active = 0, Deleting, Deleted } m_workState = Active;
	bool m_doMine = false;				///< Are we supposed to be mining?
	MineProgress m_mineProgress;

	mutable bool m_changed;
};

}


text:
package me.invkrh.raft.exception

import me.invkrh.raft.message.ClientMessage._
import me.invkrh.raft.message.RPCMessage._

final case class HeartbeatIntervalException()
  extends RuntimeException("Heartbeat interval should be smaller than the election time")

final case class MultiLeaderException(local: Int, received: Int, term: Int)
  extends RuntimeException(
    s"Two leader detected at term $term: local -> $local, received -> $received")

final case class CandidateHasLeaderException(leaderID: Int)
  extends RuntimeException(s"Leader should be empty, but $leaderID found")

final case class RaftConfigFileNotFoundException(path: String)
  extends RuntimeException(s"Can not find config file under $path")

final case class RaftConfigDirectoryNotFoundException()
  extends RuntimeException(s"Can not retrieve config directory location from System Env")

final case class UnexpectedSenderException(msg: String, senderAddr: String)
  extends RuntimeException(s"Receive message [$msg] from unexpected sender [$senderAddr]")

final case class MalformedAddressException(address: String, reason: String)
  extends RuntimeException(s"Address $address is not valid: $reason")

final case class UnreachableAddressException(address: String)
  extends RuntimeException(s"Address [$address] can not be reached")

final case class InvalidArgumentsException(argsStr: String)
  extends RuntimeException(s"Invalid arguments: $argsStr")

final case class EmptyMembershipException()
  extends RuntimeException(s"No members are given during initialization")

final case class InvalidResponseException(response: RPCResponse, curTerm: Int)
  extends RuntimeException(s"Response $response is not valid at term $curTerm")

final case class LogMatchingPropertyException(cmd1: Command, cmd2: Command)
  extends RuntimeException(s"Different commands [$cmd1, $cmd2] on the same index with same term")

final case class UnknownDataStoreTypeException(dst: String)
  extends RuntimeException(s"Data store type $dst does not exist")

final case class UnknownCommandException(cmd: Command)
  extends RuntimeException(s"Command $cmd is not valid")


text:
<?php

namespace Orchestra\Foundation\Http\Handlers;

use Orchestra\Contracts\Authorization\Authorization;
use Orchestra\Foundation\Support\MenuHandler;

class UserMenuHandler extends MenuHandler
{
    /**
     * Menu configuration.
     *
     * @var array
     */
    protected $menu = [
        'id' => 'users',
        'position' => '*',
        'title' => 'orchestra/foundation::title.users.list',
        'link' => 'orchestra::users',
        'icon' => 'users',
    ];

    /**
     * Get the title.
     *
     * @param  string  $value
     *
     * @return string
     */
    public function getTitleAttribute($value)
    {
        return \trans($value);
    }

    /**
     * Check authorization to display the menu.
     *
     * @param  \Orchestra\Contracts\Authorization\Authorization  $acl
     *
     * @return bool
     */
    public function authorize(Authorization $acl)
    {
        return $acl->canIf('manage-users');
    }
}


text:
<?php

namespace Frontend\CorresponsaliaBundle\Form\Tecnologia;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class AsignacionType extends AbstractType
{
        /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('responsable')
            ->add('fechaAsignacion', 'date', array('widget' => 'single_text', 'format' => 'dd-MM-y'))
            ->add('fechaEstimadaRetorno', 'date', array('widget' => 'single_text', 'format' => 'dd-MM-y'))
            ->add('fechaRetorno', 'date', array('widget' => 'single_text', 'format' => 'dd-MM-y'))
            ->add('id','hidden')
            ->add('corresponsalia', null, array('empty_value' => 'Seleccione'))
            ->add('status', null, array('empty_value' => 'Seleccione'))
        ;
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Frontend\CorresponsaliaBundle\Entity\Tecnologia\Asignacion'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'tecnologia_asignacion';
    }
}


text:
<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "goods_images".
 *
 * @property integer $id
 * @property integer $good_id
 * @property integer $variation_id
 * @property string $hash
 * @property string $date
 * @property integer $position
 * @property integer $status
 */
class GoodsImages extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'goods_images';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['good_id', 'variation_id', 'position', 'status'], 'integer'],
            [['date'], 'safe'],
            [['hash'], 'string', 'max' => 32]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'good_id' => 'Good ID',
            'variation_id' => 'Variation ID',
            'hash' => 'Hash',
            'date' => 'Date',
            'position' => 'Position',
            'status' => 'Status',
        ];
    }
}


text:
'use strict';

module.exports = require('./makeMakeHot');


text:
<!doctype html>

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">

    <link href="app.css" rel="stylesheet">

Auth0 Passwordless Example

Login with SMS

Don't forget to add your page's origin  to your App's Allowed Origins (CORS) in the Auth0 dashboard, unless it is already in the list of Allowed Callback URLs.

            Enter your mobile number:
            <input class="phone-number"/>

            <button onclick="sendSMS()" class="btn btn-primary send-sms">Send SMS</button>

            Enter the code you received:
            <input class="code"/>

            <button onclick="login()" class="btn btn-primary">Submit Code</button>

Welcome


text:
// Copyright 2022 Google LLC
//
// 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.

// Tests of various domains that don't fit naturally into the other test files
// in this directory: BitFlagCombinationOf and OneOf.

#include <bitset>
#include <cctype>
#include <deque>
#include <iterator>
#include <list>
#include <optional>
#include <set>
#include <string>
#include <unordered_set>
#include <utility>
#include <variant>
#include <vector>

#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/container/flat_hash_set.h"
#include "absl/numeric/int128.h"
#include "absl/random/random.h"
#include "./fuzztest/domain.h"
#include "./domain_tests/domain_testing.h"
#include "./fuzztest/internal/meta.h"

namespace fuzztest {
namespace {

using ::testing::UnorderedElementsAre;
using ::testing::UnorderedElementsAreArray;

TEST(BitFlagCombinationOf, Ints) {
  auto domain = BitFlagCombinationOf({1, 4, 16, 32});
  auto seen = MutateUntilFoundN(domain, 16);
  EXPECT_THAT(seen, UnorderedElementsAre(0, 1, 4, 5, 16, 17, 20, 21, 32, 33, 36,
                                         37, 48, 49, 52, 53));

  absl::BitGen bitgen;
  int val = 1 | 4 | 16 | 32;
  while (val != 0) {
    int prev = val;
    domain.Mutate(val, bitgen, true);
    // val can't have new bits set.
    EXPECT_EQ(prev & val, val);
    EXPECT_EQ(prev | val, prev);
  }
}

TEST(BitFlagCombinationOf, Enum) {
  enum class E { A = 1, B = 8 };
  auto domain = BitFlagCombinationOf({E::A, E::B});

  auto seen = MutateUntilFoundN(domain, 4);
  EXPECT_THAT(seen, UnorderedElementsAre(E{0}, E{1}, E{8}, E{9}));
}

TEST(BitFlagCombinationOf, UserDefined) {
  EXPECT_THAT(
      MutateUntilFoundN(
          BitFlagCombinationOf({absl::uint128(1), absl::uint128(4)}), 4),
      UnorderedElementsAre(absl::uint128(0), absl::uint128(1), absl::uint128(4),
                           absl::uint128(5)));

  EXPECT_THAT(
      MutateUntilFoundN(
          BitFlagCombinationOf({std::bitset<10>(2), std::bitset<10>(16)}), 4),
      UnorderedElementsAre(std::bitset<10>(0), std::bitset<10>(2),
                           std::bitset<10>(16), std::bitset<10>(18)));
}

TEST(BitFlagCombinationOf, InvalidInputReportsErrors) {
  EXPECT_DEATH_IF_SUPPORTED(
      BitFlagCombinationOf<int>({}),
      "domain.h:.*Failed precondition .!flags.empty...: BitFlagCombinationOf "
      "requires a non empty list.");

  EXPECT_DEATH_IF_SUPPORTED(BitFlagCombinationOf({0, 1, 2}),
                            "BitFlagCombinationOf requires non zero flags.");

  EXPECT_DEATH_IF_SUPPORTED(
      BitFlagCombinationOf({1, 2, 3}),
      "BitFlagCombinationOf requires flags to be mutually exclusive.");
}

TEST(OneOf, AllSubDomainsArePickedEventually) {
  absl::BitGen bitgen;
  std::vector<int> vals;
  for (int i = 1; i <= 5; ++i) {
    vals.push_back(i);
  }
  auto domain = OneOf(Just(1), Just(2), Just(3), Just(4), Just(5));

  absl::flat_hash_set<int> elems;
  while (elems.size() < 5) {
    Value inited(domain, bitgen);
    elems.insert(inited.user_value);
  }
  ASSERT_THAT(elems, UnorderedElementsAreArray(vals));

  elems.clear();
  Value mutated(domain, bitgen);
  while (elems.size() < 5) {
    mutated.Mutate(domain, bitgen, false);
    elems.insert(mutated.user_value);

    VerifyRoundTripThroughConversion(mutated, domain);
  }
  ASSERT_THAT(elems, UnorderedElementsAreArray(vals));
}

TEST(OneOf, Mutate) {
  absl::BitGen bitgen;
  constexpr int kRuns = 100;
  constexpr int kMax = 1000;
  auto domain = OneOf(InRange(-kMax, -1), InRange(0, kMax));
  for (int i = 0; i < kRuns; ++i) {
    int k = absl::Uniform(bitgen, -kMax, kMax);
    Value v(domain, bitgen);
    // Construct the internal corpus_type representation from the integer.
    if (k < 0) {
      v.corpus_value = std::variant<int, int>(std::in_place_index_t<0>{}, k);
    } else {
      v.corpus_value = std::variant<int, int>(std::in_place_index_t<1>{}, k);
    }
    v.Mutate(domain, bitgen, /*only_shrink=*/false);
    ASSERT_NE(k, v.user_value);
  }
  for (int i = 0; i < kRuns; ++i) {
    Value v(domain, bitgen);
    int old_k = v.user_value;
    v.Mutate(domain, bitgen, /*only_shrink=*/true);
    int new_k = v.user_value;
    if ((new_k >= 0) == (old_k >= 0)) {
      EXPECT_LE(std::abs(new_k), std::abs(old_k))
          << "Values (run " << i << "): " << new_k << " <= " << old_k;
    }
  }
}

enum class Color : int { Red, Green, Blue, Yellow };

TEST(OneOf, SwitchesDomains) {
  absl::BitGen bitgen;
  std::vector<Color> all_colors{Color::Red, Color::Green, Color::Blue,
                                Color::Yellow};
  auto domain = OneOf(ElementOf({Color::Red, Color::Green}),
                      ElementOf({Color::Blue, Color::Yellow}));
  absl::flat_hash_set<Color> found;
  Value v(domain, bitgen);
  while (found.size() < all_colors.size()) {
    v.Mutate(domain, bitgen, /*only_shrink=*/false);
    found.insert(v.user_value);
  }
  ASSERT_THAT(found, UnorderedElementsAreArray(all_colors));
}

}  // namespace
}  // namespace fuzztest

// This is outside the fuzztest namespace on purpose to avoid the lexical scope.
namespace {

TEST(Domain, DoesNotTriggerADL) {
  // If ADL triggered the expression `StringOf(x)` will be valid.
  // We expect that it is not valid.
  EXPECT_FALSE(fuzztest::internal::Requires<fuzztest::Domain<char>>(
      [](auto x) -> decltype(StringOf(x)) {}));

  // Qualified is ok.
  EXPECT_TRUE(fuzztest::internal::Requires<fuzztest::Domain<char>>(
      [](auto x) -> decltype(fuzztest::StringOf(x)) {}));

  // And importing the name is ok too.
  using fuzztest::StringOf;
  EXPECT_TRUE(fuzztest::internal::Requires<fuzztest::Domain<char>>(
      [](auto x) -> decltype(StringOf(x)) {}));
}

}  // namespace


text:
int mount_handle_close(
     mount_handle_t *mount_handle,
     libcerror_error_t **error );