text:
package org.smartloli.kafka.eagle.web.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.smartloli.kafka.eagle.api.util.AlertUtils;
import org.smartloli.kafka.eagle.common.protocol.alarm.AlarmClusterInfo;
import org.smartloli.kafka.eagle.common.protocol.alarm.AlarmConfigInfo;
import org.smartloli.kafka.eagle.common.protocol.alarm.AlarmConsumerInfo;
import org.smartloli.kafka.eagle.common.protocol.alarm.AlarmEmailMockInfo;
import org.smartloli.kafka.eagle.common.util.CalendarUtils;
import org.smartloli.kafka.eagle.common.util.KConstants;
import org.smartloli.kafka.eagle.common.util.KConstants.AlarmType;
import org.smartloli.kafka.eagle.common.util.StrUtils;
import org.smartloli.kafka.eagle.common.util.SystemConfigUtils;
import org.smartloli.kafka.eagle.web.service.AlertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Alarm controller to viewer data.
 *
 * @author smartloli.
 *

 * Created by Sep 6, 2016.
 *

 * Update by hexiang 20170216
 */
@Controller
public class AlarmController {

    /**
     * Alert Service interface to operate this method.
     */
    @Autowired
    private AlertService alertService;

    /**
     * Add alarmer viewer.
     */
    @RequiresPermissions("/alarm/add")
    @RequestMapping(value = "/alarm/add", method = RequestMethod.GET)
    public ModelAndView addView(HttpSession session) {
        ModelAndView mav = new ModelAndView();
        mav.setViewName("/alarm/add");
        return mav;
    }

    /**
     * Add alarmer config group.
     */
    @RequiresPermissions("/alarm/config")
    @RequestMapping(value = "/alarm/config", method = RequestMethod.GET)
    public ModelAndView configView(HttpSession session) {
        ModelAndView mav = new ModelAndView();
        mav.setViewName("/alarm/config");
        return mav;
    }

    /**
     * Add alarmer config group.
     */
    @RequiresPermissions("/alarm/list")
    @RequestMapping(value = "/alarm/list", method = RequestMethod.GET)
    public ModelAndView listView(HttpSession session) {
        ModelAndView mav = new ModelAndView();
        mav.setViewName("/alarm/list");
        return mav;
    }

    /**
     * Create cluster alarmer viewer.
     */
    @RequiresPermissions("/alarm/create")
    @RequestMapping(value = "/alarm/create", method = RequestMethod.GET)
    public ModelAndView createView(HttpSession session) {
        ModelAndView mav = new ModelAndView();
        mav.setViewName("/alarm/create");
        return mav;
    }

    /**
     * Modify alarmer viewer.
     */
    @RequiresPermissions("/alarm/modify")
    @RequestMapping(value = "/alarm/modify", method = RequestMethod.GET)
    public ModelAndView modifyView(HttpSession session) {
        ModelAndView mav = new ModelAndView();
        mav.setViewName("/alarm/modify");
        return mav;
    }

    /**
     * Modify alarmer viewer.
     */
    @RequiresPermissions("/alarm/history")
    @RequestMapping(value = "/alarm/history", method = RequestMethod.GET)
    public ModelAndView historyView(HttpSession session) {
        ModelAndView mav = new ModelAndView();
        mav.setViewName("/alarm/history");
        return mav;
    }

    /**
     * Create alarmer success viewer.
     */
    @RequestMapping(value = "/alarm/add/success", method = RequestMethod.GET)
    public ModelAndView addSuccessView(HttpSession session) {
        ModelAndView mav = new ModelAndView();
        mav.setViewName("/alarm/add_success");
        return mav;
    }

    /**
     * Create alarmer failed viewer.
     */
    @RequestMapping(value = "/alarm/add/failed", method = RequestMethod.GET)
    public ModelAndView addFailedView(HttpSession session) {
        ModelAndView mav = new ModelAndView();
        mav.setViewName("/alarm/add_failed");
        return mav;
    }

    /**
     * Config alarmer success viewer.
     */
    @RequestMapping(value = "/alarm/config/success", method = RequestMethod.GET)
    public ModelAndView configSuccessView(HttpSession session) {
        ModelAndView mav = new ModelAndView();
        mav.setViewName("/alarm/config_success");
        return mav;
    }

    /**
     * Config alarmer failed viewer.
     */
    @RequestMapping(value = "/alarm/config/failed", method = RequestMethod.GET)
    public ModelAndView configFailedView(HttpSession session) {
        ModelAndView mav = new ModelAndView();
        mav.setViewName("/alarm/config_failed");
        return mav;
    }

    /**
     * Create alarmer success viewer.
     */
    @RequestMapping(value = "/alarm/create/success", method = RequestMethod.GET)
    public ModelAndView createSuccessView(HttpSession session) {
        ModelAndView mav = new ModelAndView();
        mav.setViewName("/alarm/create_success");
        return mav;
    }

    /**
     * Create alarmer failed viewer.
     */
    @RequestMapping(value = "/alarm/create/failed", method = RequestMethod.GET)
    public ModelAndView createFailedView(HttpSession session) {
        ModelAndView mav = new ModelAndView();
        mav.setViewName("/alarm/create_failed");
        return mav;
    }

    /**
     * Get alarmer consumer group by ajax.
     */
    @RequestMapping(value = "/alarm/consumer/group/ajax", method = RequestMethod.GET)
    public void alarmConsumerGroupAjax(HttpServletResponse response, HttpServletRequest request) {
        HttpSession session = request.getSession();
        String clusterAlias = session.getAttribute(KConstants.SessionAlias.CLUSTER_ALIAS).toString();
        String search = StrUtils.convertNull(request.getParameter("name"));

        String formatter = SystemConfigUtils.getProperty(clusterAlias + ".kafka.eagle.offset.storage");
        try {
            JSONObject object = new JSONObject();
            object.put("items", JSON.parseArray(alertService.getAlarmConsumerGroup(clusterAlias, formatter, search)));
            byte[] output = object.toJSONString().getBytes();
            BaseController.response(output, response);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /**
     * Get alarmer consumer group by ajax.
     */
    @RequestMapping(value = "/alarm/consumer/{group}/topic/ajax", method = RequestMethod.GET)
    public void alarmConsumerTopicAjax(@PathVariable("group") String group, HttpServletResponse response, HttpServletRequest request) {

        HttpSession session = request.getSession();
        String clusterAlias = session.getAttribute(KConstants.SessionAlias.CLUSTER_ALIAS).toString();
        String search = StrUtils.convertNull(request.getParameter("name"));

        String formatter = SystemConfigUtils.getProperty(clusterAlias + ".kafka.eagle.offset.storage");
        try {
            JSONObject object = new JSONObject();
            object.put("items", JSON.parseArray(alertService.getAlarmConsumerTopic(clusterAlias, formatter, group, search)));
            byte[] output = object.toJSONString().getBytes();
            BaseController.response(output, response);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /**
     * Add alarmer form.
     */
    @RequestMapping(value = "/alarm/add/form", method = RequestMethod.POST)
    public ModelAndView alarmAddForm(HttpSession session, HttpServletResponse response, HttpServletRequest request) {
        String clusterAlias = session.getAttribute(KConstants.SessionAlias.CLUSTER_ALIAS).toString();

        ModelAndView mav = new ModelAndView();
        String group = request.getParameter("ke_alarm_consumer_group");
        String topic = request.getParameter("ke_alarm_consumer_topic");
        String lag = request.getParameter("ke_topic_lag");
        String alarmLevel = request.getParameter("ke_alarm_cluster_level");
        String alarmMaxTimes = request.getParameter("ke_alarm_cluster_maxtimes");
        String alarmGroup = request.getParameter("ke_alarm_cluster_group");
        AlarmConsumerInfo alarmConsumer = new AlarmConsumerInfo();
        alarmConsumer.setGroup(group);
        alarmConsumer.setAlarmGroup(alarmGroup);
        alarmConsumer.setAlarmLevel(alarmLevel);
        alarmConsumer.setAlarmMaxTimes(Integer.parseInt(alarmMaxTimes));
        alarmConsumer.setAlarmTimes(0);
        alarmConsumer.setCluster(clusterAlias);
        alarmConsumer.setCreated(CalendarUtils.getDate());
        alarmConsumer.setIsEnable("Y");
        alarmConsumer.setIsNormal("Y");
        alarmConsumer.setLag(Long.parseLong(lag));
        alarmConsumer.setModify(CalendarUtils.getDate());
        alarmConsumer.setTopic(topic);

        int code = alertService.insertAlarmConsumer(alarmConsumer);

        if (code > 0) {
            session.removeAttribute("Alarm_Submit_Status");
            session.setAttribute("Alarm_Submit_Status", "Insert success.");
            mav.setViewName("redirect:/alarm/add/success");
        } else {
            session.removeAttribute("Alarm_Submit_Status");
            session.setAttribute("Alarm_Submit_Status", "Insert failed.");
            mav.setViewName("redirect:/alarm/add/failed");
        }

        return mav;
    }

    /**
     * Get alarmer datasets by ajax.
     */
    @RequestMapping(value = "/alarm/list/table/ajax", method = RequestMethod.GET)
    public void alarmConsumerListAjax(HttpServletResponse response, HttpServletRequest request) {
        String aoData = request.getParameter("aoData");
        JSONArray params = JSON.parseArray(aoData);
        int sEcho = 0, iDisplayStart = 0, iDisplayLength = 0;
        String search = "";
        for (Object object : params) {
            JSONObject param = (JSONObject) object;
            if ("sEcho".equals(param.getString("name"))) {
                sEcho = param.getIntValue("value");
            } else if ("iDisplayStart".equals(param.getString("name"))) {
                iDisplayStart = param.getIntValue("value");
            } else if ("iDisplayLength".equals(param.getString("name"))) {
                iDisplayLength = param.getIntValue("value");
            } else if ("sSearch".equals(param.getString("name"))) {
                search = param.getString("value");
            }
        }

        HttpSession session = request.getSession();
        String clusterAlias = session.getAttribute(KConstants.SessionAlias.CLUSTER_ALIAS).toString();

        Map<String, Object> map = new HashMap<String, Object>();
        map.put("cluster", clusterAlias);
        map.put("search", search);
        map.put("start", iDisplayStart);
        map.put("size", iDisplayLength);

        List<AlarmConsumerInfo> alarmConsumers = alertService.getAlarmConsumerAppList(map);
        JSONArray aaDatas = new JSONArray();
        for (AlarmConsumerInfo alertConsumer : alarmConsumers) {
            JSONObject obj = new JSONObject();
            int id = alertConsumer.getId();
            String group = alertConsumer.getGroup();
            String topic = alertConsumer.getTopic();
            String alarmGroup = alertConsumer.getAlarmGroup();
            obj.put("id", id);
            obj.put("group", "" + (group.length() > 8 ? group.substring(0, 8) + "..." : group) + "");
            obj.put("topic", "" + (topic.length() > 8 ? topic.substring(0, 8) + "..." : topic) + "");
            obj.put("lag", alertConsumer.getLag());
            obj.put("alarmGroup", "" + (alarmGroup.length() > 8 ? alarmGroup.substring(0, 8) + "..." : alarmGroup) + "");
            obj.put("alarmTimes", alertConsumer.getAlarmTimes());
            obj.put("alarmMaxTimes", alertConsumer.getAlarmMaxTimes());
            if (alertConsumer.getAlarmLevel().equals("P0")) {
                obj.put("alarmLevel", "" + alertConsumer.getAlarmLevel() + "");
            } else if (alertConsumer.getAlarmLevel().equals("P1")) {
                obj.put("alarmLevel", "" + alertConsumer.getAlarmLevel() + "");
            } else if (alertConsumer.getAlarmLevel().equals("P2")) {
                obj.put("alarmLevel", "" + alertConsumer.getAlarmLevel() + "");
            } else {
                obj.put("alarmLevel", "" + alertConsumer.getAlarmLevel() + "");
            }
            if (alertConsumer.getIsNormal().equals("Y")) {
                obj.put("alarmIsNormal", "Y");
            } else {
                obj.put("alarmIsNormal", "N");
            }
            if (alertConsumer.getIsEnable().equals("Y")) {
                obj.put("alarmIsEnable", "<input type='checkbox' name='is_enable_chk' id='alarm_config_is_enable_" + id + "' checked class='chooseBtn' />");
            } else {
                obj.put("alarmIsEnable", "<input type='checkbox' name='is_enable_chk' id='alarm_config_is_enable_" + id + "' class='chooseBtn' />");
            }
            obj.put("created", alertConsumer.getCreated());
            obj.put("modify", alertConsumer.getModify());
            obj.put("operate",
                    "
<button id='ke_btn_action' class='btn btn-primary dropdown-toggle' type='button' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>Action </button>
ModifyDelete
");
            aaDatas.add(obj);
        }

        JSONObject target = new JSONObject();
        target.put("sEcho", sEcho);
        target.put("iTotalRecords", alertService.alertConsumerAppCount(map));
        target.put("iTotalDisplayRecords", alertService.alertConsumerAppCount(map));
        target.put("aaData", aaDatas);
        try {
            byte[] output = target.toJSONString().getBytes();
            BaseController.response(output, response);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /**
     * Switch cluster alert info.
     */
    @RequestMapping(value = "/alarm/list/modify/switch/{id}/ajax", method = RequestMethod.GET)
    public void modifyConsumerAlertSwitchByIdAjax(@PathVariable("id") int id, HttpServletResponse response, HttpServletRequest request) {
        try {
            AlarmConsumerInfo alarmConsumer = alertService.findAlarmConsumerAlertById(id);
            if (alarmConsumer.getIsEnable().equals("Y")) {
                alarmConsumer.setIsEnable("N");
            } else {
                alarmConsumer.setIsEnable("Y");
            }
            alarmConsumer.setModify(CalendarUtils.getDate());
            int code = alertService.modifyConsumerAlertSwitchById(alarmConsumer);
            JSONObject object = new JSONObject();
            if (code > 0) {
                object.put("code", code);
                object.put("status", "Success");
            } else {
                object.put("code", code);
                object.put("status", "Failed");
            }
            byte[] output = object.toJSONString().getBytes();
            BaseController.response(output, response);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /**
     * Get alarm consumer detail, such consumer group(cgroup) or topic, and
     * alarm group(agroup).
     */
    @RequestMapping(value = "/alarm/consumer/detail/{type}/{id}/ajax", method = RequestMethod.GET)
    public void getAlarmConsumerDetailByIdAjax(@PathVariable("id") int id, @PathVariable("type") String type, HttpServletResponse response, HttpServletRequest request) {
        try {
            JSONObject object = new JSONObject();
            if ("cgroup".equals(type)) {
                object.put("result", alertService.findAlarmConsumerAlertById(id).getGroup());
            } else if ("topic".equals(type)) {
                object.put("result", alertService.findAlarmConsumerAlertById(id).getTopic());
            } else if ("agroup".equals(type)) {
                object.put("result", alertService.findAlarmConsumerAlertById(id).getAlarmGroup());
            }
            byte[] output = object.toJSONString().getBytes();
            BaseController.response(output, response);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /**
     * Delete alarm consumer application.
     */
    @RequestMapping(value = "/alarm/consumer/{id}/del", method = RequestMethod.GET)
    public ModelAndView alarmConsumerDelete(@PathVariable("id") int id, HttpServletRequest request) {
        int code = alertService.deleteAlarmConsumerById(id);
        if (code > 0) {
            return new ModelAndView("redirect:/alarm/modify");
        } else {
            return new ModelAndView("redirect:/errors/500");
        }
    }

    /**
     * Get alert info.
     */
    @RequestMapping(value = "/alarm/consumer/modify/{id}/ajax", method = RequestMethod.GET)
    public void findAlarmConsumerByIdAjax(@PathVariable("id") int id, HttpServletResponse response, HttpServletRequest request) {
        try {
            byte[] output = alertService.findAlarmConsumerAlertById(id).toString().getBytes();
            BaseController.response(output, response);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /**
     * Modify consumer topic alert info.
     */
    @RequestMapping(value = "/alarm/consumer/modify/", method = RequestMethod.POST)
    public String modifyAlarmConsumerInfo(HttpSession session, HttpServletRequest request) {
        String id = request.getParameter("ke_consumer_id_lag");
        String lag = request.getParameter("ke_consumer_name_lag");
        String agroup = request.getParameter("ke_alarm_consumer_group");
        String maxtimes = request.getParameter("ke_alarm_consumer_maxtimes");
        String level = request.getParameter("ke_alarm_consumer_level");

        AlarmConsumerInfo alertConsumer = new AlarmConsumerInfo();
        // JavaScript has already judged.
        alertConsumer.setId(Integer.parseInt(id));
        alertConsumer.setLag(Long.parseLong(lag));
        alertConsumer.setAlarmGroup(agroup);
        alertConsumer.setAlarmMaxTimes(Integer.parseInt(maxtimes));
        alertConsumer.setAlarmLevel(level);
        alertConsumer.setModify(CalendarUtils.getDate());

        if (alertService.modifyAlarmConsumerById(alertConsumer) > 0) {
            return "redirect:/alarm/modify";
        } else {
            return "redirect:/errors/500";
        }
    }

    /**
     * Create alarmer form.
     */
    @RequestMapping(value = "/alarm/create/form", method = RequestMethod.POST)
    public ModelAndView alarmCreateForm(HttpSession session, HttpServletResponse response, HttpServletRequest request) {
        ModelAndView mav = new ModelAndView();
        String type = request.getParameter("ke_alarm_cluster_type");
        String value = "";
        if (AlarmType.TOPIC.equals(type)) {
            value = request.getParameter("ke_topic_alarm");
        } else {
            if (AlarmType.PRODUCER.equals(type)) {
                value = request.getParameter("ke_producer_alarm");
            } else {
                value = request.getParameter("ke_server_alarm");
            }
        }
        String level = request.getParameter("ke_alarm_cluster_level");
        String alarmGroup = request.getParameter("ke_alarm_cluster_group");
        int maxTimes = 10;
        try {
            maxTimes = Integer.parseInt(request.getParameter("ke_alarm_cluster_maxtimes"));
        } catch (Exception e) {
            e.printStackTrace();
        }
        String clusterAlias = session.getAttribute(KConstants.SessionAlias.CLUSTER_ALIAS).toString();
        AlarmClusterInfo alarmClusterInfo = new AlarmClusterInfo();
        alarmClusterInfo.setAlarmGroup(alarmGroup);
        alarmClusterInfo.setAlarmLevel(level);
        alarmClusterInfo.setAlarmMaxTimes(maxTimes);
        alarmClusterInfo.setAlarmTimes(0);
        alarmClusterInfo.setCluster(clusterAlias);
        alarmClusterInfo.setCreated(CalendarUtils.getDate());
        alarmClusterInfo.setIsEnable("Y");
        alarmClusterInfo.setIsNormal("Y");
        alarmClusterInfo.setModify(CalendarUtils.getDate());
        alarmClusterInfo.setServer(value);
        alarmClusterInfo.setType(type);

        int code = alertService.create(alarmClusterInfo);
        if (code > 0) {
            session.removeAttribute("Alarm_Submit_Status");
            session.setAttribute("Alarm_Submit_Status", "Insert success.");
            mav.setViewName("redirect:/alarm/create/success");
        } else {
            session.removeAttribute("Alarm_Submit_Status");
            session.setAttribute("Alarm_Submit_Status", "Insert failed.");
            mav.setViewName("redirect:/alarm/create/failed");
        }

        return mav;
    }

    /**
     * Get alarmer cluster history datasets by ajax.
     */
    @RequestMapping(value = "/alarm/history/table/ajax", method = RequestMethod.GET)
    public void alarmClusterHistoryAjax(HttpServletResponse response, HttpServletRequest request) {
        String aoData = request.getParameter("aoData");
        JSONArray params = JSON.parseArray(aoData);
        int sEcho = 0, iDisplayStart = 0, iDisplayLength = 0;
        String search = "";
        for (Object object : params) {
            JSONObject param = (JSONObject) object;
            if ("sEcho".equals(param.getString("name"))) {
                sEcho = param.getIntValue("value");
            } else if ("iDisplayStart".equals(param.getString("name"))) {
                iDisplayStart = param.getIntValue("value");
            } else if ("iDisplayLength".equals(param.getString("name"))) {
                iDisplayLength = param.getIntValue("value");
            } else if ("sSearch".equals(param.getString("name"))) {
                search = param.getString("value");
            }
        }

        HttpSession session = request.getSession();
        String clusterAlias = session.getAttribute(KConstants.SessionAlias.CLUSTER_ALIAS).toString();

        Map<String, Object> map = new HashMap<String, Object>();
        map.put("cluster", clusterAlias);
        map.put("search", search);
        map.put("start", iDisplayStart);
        map.put("size", iDisplayLength);

        List<AlarmClusterInfo> alarmClusters = alertService.getAlarmClusterList(map);
        JSONArray aaDatas = new JSONArray();
        for (AlarmClusterInfo clustersInfo : alarmClusters) {
            JSONObject obj = new JSONObject();
            int id = clustersInfo.getId();
            String server = StrUtils.convertNull(clustersInfo.getServer());
            String group = StrUtils.convertNull(clustersInfo.getAlarmGroup());
            obj.put("id", id);
            obj.put("type", clustersInfo.getType());
            obj.put("value", "" + (server.length() > 8 ? server.substring(0, 8) + "..." : server) + "");
            obj.put("alarmGroup", "" + (group.length() > 8 ? group.substring(0, 8) + "..." : group) + "");
            obj.put("alarmTimes", clustersInfo.getAlarmTimes());
            obj.put("alarmMaxTimes", clustersInfo.getAlarmMaxTimes());
            if (clustersInfo.getAlarmLevel().equals("P0")) {
                obj.put("alarmLevel", "" + clustersInfo.getAlarmLevel() + "");
            } else if (clustersInfo.getAlarmLevel().equals("P1")) {
                obj.put("alarmLevel", "" + clustersInfo.getAlarmLevel() + "");
            } else if (clustersInfo.getAlarmLevel().equals("P2")) {
                obj.put("alarmLevel", "" + clustersInfo.getAlarmLevel() + "");
            } else {
                obj.put("alarmLevel", "" + clustersInfo.getAlarmLevel() + "");
            }
            if (clustersInfo.getIsNormal().equals("Y")) {
                obj.put("alarmIsNormal", "Y");
            } else {
                obj.put("alarmIsNormal", "N");
            }
            if (clustersInfo.getIsEnable().equals("Y")) {
                obj.put("alarmIsEnable", "<input type='checkbox' name='is_enable_chk' id='alarm_config_is_enable_" + id + "' checked class='chooseBtn' />");
            } else {
                obj.put("alarmIsEnable", "<input type='checkbox' name='is_enable_chk' id='alarm_config_is_enable_" + id + "' class='chooseBtn' />");
            }
            obj.put("created", clustersInfo.getCreated());
            obj.put("modify", clustersInfo.getModify());
            obj.put("operate",
                    "
<button id='ke_btn_action' class='btn btn-primary dropdown-toggle' type='button' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>Action </button>
AlterDelete
");
            aaDatas.add(obj);
        }

        JSONObject target = new JSONObject();
        target.put("sEcho", sEcho);
        target.put("iTotalRecords", alertService.getAlarmClusterCount(map));
        target.put("iTotalDisplayRecords", alertService.getAlarmClusterCount(map));
        target.put("aaData", aaDatas);
        try {
            byte[] output = target.toJSONString().getBytes();
            BaseController.response(output, response);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /**
     * Get alarm cluster detail, such server or alarm group.
     */
    @RequestMapping(value = "/alarm/cluster/detail/{type}/{id}/ajax", method = RequestMethod.GET)
    public void getAlarmClusterDetailByIdAjax(@PathVariable("id") int id, @PathVariable("type") String type, HttpServletResponse response, HttpServletRequest request) {
        try {
            JSONObject object = new JSONObject();
            if ("server".equals(type)) {
                object.put("result", alertService.findAlarmClusterAlertById(id).getServer());
            } else if ("group".equals(type)) {
                object.put("result", alertService.findAlarmClusterAlertById(id).getAlarmGroup());
            }
            byte[] output = object.toJSONString().getBytes();
            BaseController.response(output, response);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /**
     * Delete history alarmer.
     */
    @RequestMapping(value = "/alarm/history/{id}/del", method = RequestMethod.GET)
    public ModelAndView alarmHistoryClusterDelete(@PathVariable("id") int id, HttpServletRequest request) {
        int code = alertService.deleteAlarmClusterAlertById(id);
        if (code > 0) {
            return new ModelAndView("redirect:/alarm/history");
        } else {
            return new ModelAndView("redirect:/errors/500");
        }
    }

    /**
     * Get alert info.
     */
    @RequestMapping(value = "/alarm/history/modify/{id}/ajax", method = RequestMethod.GET)
    public void findClusterAlertByIdAjax(@PathVariable("id") int id, HttpServletResponse response, HttpServletRequest request) {
        try {
            byte[] output = alertService.findAlarmClusterAlertById(id).toString().getBytes();
            BaseController.response(output, response);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /**
     * Switch cluster alert info.
     */
    @RequestMapping(value = "/alarm/history/modify/switch/{id}/ajax", method = RequestMethod.GET)
    public void modifyClusterAlertSwitchByIdAjax(@PathVariable("id") int id, HttpServletResponse response, HttpServletRequest request) {
        try {
            AlarmClusterInfo alarmCluster = alertService.findAlarmClusterAlertById(id);
            if (alarmCluster.getIsEnable().equals("Y")) {
                alarmCluster.setIsEnable("N");
            } else {
                alarmCluster.setIsEnable("Y");
            }
            alarmCluster.setModify(CalendarUtils.getDate());
            int code = alertService.modifyClusterAlertSwitchById(alarmCluster);
            JSONObject object = new JSONObject();
            if (code > 0) {
                object.put("code", code);
                object.put("status", "Success");
            } else {
                object.put("code", code);
                object.put("status", "Failed");
            }
            byte[] output = object.toJSONString().getBytes();
            BaseController.response(output, response);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /**
     * Modify consumer topic alert info.
     */
    @RequestMapping(value = "/alarm/history/modify/", method = RequestMethod.POST)
    public String modifyClusterAlertInfo(HttpSession session, HttpServletRequest request) {
        String id = request.getParameter("ke_alarm_cluster_id_server");
        String server = request.getParameter("ke_alarm_cluster_name_server");
        String group = request.getParameter("ke_alarm_cluster_group");
        String maxtimes = request.getParameter("ke_alarm_cluster_maxtimes");
        String level = request.getParameter("ke_alarm_cluster_level");

        AlarmClusterInfo cluster = new AlarmClusterInfo();
        cluster.setId(Integer.parseInt(id));
        cluster.setServer(server);
        cluster.setAlarmGroup(group);
        cluster.setAlarmMaxTimes(Integer.parseInt(maxtimes));
        cluster.setAlarmLevel(level);
        cluster.setModify(CalendarUtils.getDate());
        if (alertService.modifyClusterAlertById(cluster) > 0) {
            return "redirect:/alarm/history";
        } else {
            return "redirect:/errors/500";
        }
    }

    /**
     * Get alarm type list, such as email, dingding, wechat and so on.
     */
    @RequestMapping(value = "/alarm/type/list/ajax", method = RequestMethod.GET)
    public void alarmTypeListAjax(HttpServletResponse response, HttpServletRequest request) {
        try {
            JSONObject object = new JSONObject();
            object.put("items", JSON.parseArray(alertService.getAlertTypeList()));
            byte[] output = object.toJSONString().getBytes();
            BaseController.response(output, response);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /**
     * Get alarm cluster type list, such as kafka, zookeeper and so on.
     */
    @RequestMapping(value = "/alarm/cluster/{type}/list/ajax", method = RequestMethod.GET)
    public void alarmClusterTypeListAjax(@PathVariable("type") String type, HttpServletResponse response, HttpServletRequest request) {
        try {
            JSONObject object = new JSONObject();
            String search = "";
            Map<String, Object> map = new HashMap<>();
            if ("group".equals(type)) {
                HttpSession session = request.getSession();
                String clusterAlias = session.getAttribute(KConstants.SessionAlias.CLUSTER_ALIAS).toString();
                search = StrUtils.convertNull(request.getParameter("name"));
                map.put("search", "%" + search + "%");
                map.put("start", 0);
                map.put("size", 10);
                map.put("cluster", clusterAlias);
            } else {
                search = StrUtils.convertNull(request.getParameter("name"));
                map.put("search", search);
            }
            object.put("items", JSON.parseArray(alertService.getAlertClusterTypeList(type, map)));
            byte[] output = object.toJSONString().getBytes();
            BaseController.response(output, response);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /**
     * Check alarm group name.
     */
    @RequestMapping(value = "/alarm/check/{group}/ajax", method = RequestMethod.GET)
    public void alarmGroupCheckAjax(@PathVariable("group") String group, HttpServletResponse response, HttpServletRequest request) {
        try {
            HttpSession session = request.getSession();
            String clusterAlias = session.getAttribute(KConstants.SessionAlias.CLUSTER_ALIAS).toString();
            Map<String, Object> params = new HashMap<>();
            params.put("cluster", clusterAlias);
            params.put("alarmGroup", group);
            JSONObject object = new JSONObject();
            object.put("result", alertService.findAlarmConfigByGroupName(params));
            byte[] output = object.toJSONString().getBytes();
            BaseController.response(output, response);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /**
     * Add alarm config .
     */
    @RequestMapping(value = "/alarm/config/storage/form", method = RequestMethod.POST)
    public ModelAndView alarmAddConfigForm(HttpSession session, HttpServletResponse response, HttpServletRequest request) {
        ModelAndView mav = new ModelAndView();
        String group = request.getParameter("ke_alarm_group_name");
        String type = request.getParameter("ke_alarm_type");
        String url = request.getParameter("ke_alarm_url");
        String http = request.getParameter("ke_alarm_http");
        String address = request.getParameter("ke_alarm_address");
        String clusterAlias = session.getAttribute(KConstants.SessionAlias.CLUSTER_ALIAS).toString();

        AlarmConfigInfo alarmConfig = new AlarmConfigInfo();
        alarmConfig.setCluster(clusterAlias);
        alarmConfig.setAlarmGroup(group);
        alarmConfig.setAlarmType(type);
        alarmConfig.setAlarmUrl(url);
        alarmConfig.setHttpMethod(http);
        alarmConfig.setAlarmAddress(address);
        alarmConfig.setCreated(CalendarUtils.getDate());
        alarmConfig.setModify(CalendarUtils.getDate());

        Map<String, Object> params = new HashMap<>();
        params.put("cluster", clusterAlias);
        params.put("alarmGroup", group);
        boolean findCode = alertService.findAlarmConfigByGroupName(params);

        if (findCode) {
            session.removeAttribute("Alarm_Config_Status");
            session.setAttribute("Alarm_Config_Status", "Insert failed alarm group[" + alarmConfig.getAlarmGroup() + "] has exist.");
            mav.setViewName("redirect:/alarm/config/failed");
        } else {
            int resultCode = alertService.insertOrUpdateAlarmConfig(alarmConfig);
            if (resultCode > 0) {
                session.removeAttribute("Alarm_Config_Status");
                session.setAttribute("Alarm_Config_Status", "Insert success.");
                mav.setViewName("redirect:/alarm/config/success");
            } else {
                session.removeAttribute("Alarm_Config_Status");
                session.setAttribute("Alarm_Config_Status", "Insert failed.");
                mav.setViewName("redirect:/alarm/config/failed");
            }
        }

        return mav;
    }

    /**
     * Get alarm config list.
     */
    @RequestMapping(value = "/alarm/config/table/ajax", method = RequestMethod.GET)
    public void getAlarmConfigTableAjax(HttpServletResponse response, HttpServletRequest request) {
        String aoData = request.getParameter("aoData");
        JSONArray params = JSON.parseArray(aoData);
        int sEcho = 0, iDisplayStart = 0, iDisplayLength = 0;
        String search = "";
        for (Object object : params) {
            JSONObject param = (JSONObject) object;
            if ("sEcho".equals(param.getString("name"))) {
                sEcho = param.getIntValue("value");
            } else if ("iDisplayStart".equals(param.getString("name"))) {
                iDisplayStart = param.getIntValue("value");
            } else if ("iDisplayLength".equals(param.getString("name"))) {
                iDisplayLength = param.getIntValue("value");
            } else if ("sSearch".equals(param.getString("name"))) {
                search = param.getString("value");
            }
        }

        HttpSession session = request.getSession();
        String clusterAlias = session.getAttribute(KConstants.SessionAlias.CLUSTER_ALIAS).toString();

        Map<String, Object> map = new HashMap<>();
        map.put("search", "%" + search + "%");
        map.put("start", iDisplayStart);
        map.put("size", iDisplayLength);
        map.put("cluster", clusterAlias);

        JSONArray configList = JSON.parseArray(alertService.getAlarmConfigList(map).toString());
        JSONArray aaDatas = new JSONArray();

        for (Object object : configList) {
            JSONObject config = (JSONObject) object;
            JSONObject obj = new JSONObject();
            String alarmGroup = StrUtils.convertNull(config.getString("alarmGroup"));
            String url = StrUtils.convertNull(config.getString("alarmUrl"));
            String address = StrUtils.convertNull(config.getString("alarmAddress"));
            obj.put("cluster", config.getString("cluster"));
            obj.put("alarmGroup", alarmGroup.length() > 16 ? alarmGroup.substring(0, 16) + "..." : alarmGroup);
            obj.put("alarmType", config.getString("alarmType"));
            obj.put("alarmUrl", "" + (url.length() > 16 ? url.substring(0, 16) + "..." : url) + "");
            obj.put("httpMethod", config.getString("httpMethod"));
            obj.put("alarmAddress", "" + (address.length() > 16 ? address.substring(0, 16) + "..." : address) + "");
            obj.put("created", config.getString("created"));
            obj.put("modify", config.getString("modify"));
            obj.put("operate",
                    "
<button id='ke_btn_action' class='btn btn-primary dropdown-toggle' type='button' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>Action </button>
ModifyDelete
");
            aaDatas.add(obj);
        }

        int count = alertService.alarmConfigCount(map); // only need cluster
        JSONObject target = new JSONObject();
        target.put("sEcho", sEcho);
        target.put("iTotalRecords", count);
        target.put("iTotalDisplayRecords", count);
        target.put("aaData", aaDatas);
        try {
            byte[] output = target.toJSONString().getBytes();
            BaseController.response(output, response);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /**
     * Delete alarm config.
     */
    @RequestMapping(value = "/alarm/config/{group}/del", method = RequestMethod.GET)
    public ModelAndView alarmConfigDelete(@PathVariable("group") String group, HttpServletRequest request) {
        HttpSession session = request.getSession();
        String clusterAlias = session.getAttribute(KConstants.SessionAlias.CLUSTER_ALIAS).toString();
        Map<String, Object> map = new HashMap<>();
        map.put("cluster", clusterAlias);
        map.put("alarmGroup", group);

        int code = alertService.deleteAlertByGroupName(map);
        if (code > 0) {
            return new ModelAndView("redirect:/alarm/list");
        } else {
            return new ModelAndView("redirect:/errors/500");
        }
    }

    /**
     * Get alarm config by group name.
     */
    @RequestMapping(value = "/alarm/config/get/{type}/{group}/ajax", method = RequestMethod.GET)
    public void getAlarmConfigDetailByGroupAjax(@PathVariable("type") String type, @PathVariable("group") String group, HttpServletResponse response, HttpServletRequest request) {
        try {
            HttpSession session = request.getSession();
            String clusterAlias = session.getAttribute(KConstants.SessionAlias.CLUSTER_ALIAS).toString();
            Map<String, Object> params = new HashMap<>();
            params.put("cluster", clusterAlias);
            params.put("alarmGroup", group);
            JSONObject object = new JSONObject();
            if ("url".equals(type)) {
                object.put("result", alertService.getAlarmConfigByGroupName(params).getAlarmUrl());
            } else if ("address".equals(type)) {
                object.put("result", alertService.getAlarmConfigByGroupName(params).getAlarmAddress());
            } else if ("modify".equals(type)) {
                object.put("url", alertService.getAlarmConfigByGroupName(params).getAlarmUrl());
                object.put("address", alertService.getAlarmConfigByGroupName(params).getAlarmAddress());
            }
            byte[] output = object.toJSONString().getBytes();
            BaseController.response(output, response);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /**
     * Modify alarm config.
     */
    @RequestMapping(value = "/alarm/config/modify/form/", method = RequestMethod.POST)
    public ModelAndView alarmModifyConfigForm(HttpSession session, HttpServletResponse response, HttpServletRequest request) {
        ModelAndView mav = new ModelAndView();
        String group = request.getParameter("ke_alarm_group_m_name");
        String url = request.getParameter("ke_alarm_config_m_url");
        String address = request.getParameter("ke_alarm_config_m_address");
        String clusterAlias = session.getAttribute(KConstants.SessionAlias.CLUSTER_ALIAS).toString();

        Map<String, Object> params = new HashMap<>();
        params.put("cluster", clusterAlias);
        params.put("alarmGroup", group);

        AlarmConfigInfo alarmConfig = alertService.getAlarmConfigByGroupName(params);

        alarmConfig.setAlarmUrl(url);
        alarmConfig.setAlarmAddress(address);
        alarmConfig.setModify(CalendarUtils.getDate());

        int resultCode = alertService.insertOrUpdateAlarmConfig(alarmConfig);
        if (resultCode > 0) {
            mav.setViewName("redirect:/alarm/list");
        } else {
            mav.setViewName("redirect:/errors/500");
        }
        return mav;
    }

    /**
     * Send test message by alarm config .
     */
    @RequestMapping(value = "/alarm/config/test/send/ajax", method = RequestMethod.POST)
    public void sendTestMsgAlarmConfig(@RequestBody AlarmEmailMockInfo emailMock, HttpServletResponse response, HttpServletRequest request) {
        try {
            String type = emailMock.getType();
            String url = emailMock.getUrl();
            String msg = emailMock.getMsg();
            String result = "";
            if (AlarmType.EMAIL.equals(type)) {
                String address = emailMock.getAddress();
                JSONObject data = new JSONObject();
                data.put("address", address);
                data.put("msg", msg);
                data.put("title", AlarmType.EMAIL_TEST_TITLE);
                result = AlertUtils.sendTestMsgByEmail(url, data);
            } else if (AlarmType.DingDing.equals(type)) {
                result = AlertUtils.sendTestMsgByDingDing(url, msg);
            } else if (AlarmType.WeChat.equals(type)) {
                result = AlertUtils.sendTestMsgByWeChat(url, msg);
            }
            byte[] output = result.getBytes();
            BaseController.response(output, response);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}


text:
Pride Month 2021
Pride Month may be drawing to a close but it is never too late to celebrate, especially with the wealth of LGBTQIA content being published today. This is my favorite month to write recommendations for so please come by to any of our six Houston area locations to browse our selections of these but so much more!
By Alice Osman
This Webtoon started back in 2016, with the first volume published physically in 2019. Heartstopper follows tenth grader Charlie Spring who had been outed last year and bullied throughout his ninth grade year. Tenth grade hasn't been too great but Charlie sees it as it couldn't be worse than the previous year. (We all know how that feels with the past year we've had) He then makes a new friend (soon to be more), Nick Nelson, an eleventh grader and rugby player. Nick is aware of Charlie and heard about him being bullied the year before, but never had the opportunity to talk to him but when friendship blooms quickly between the two, soon Charlie finds himself falling hard for Nick, but he doesn't think he has a chance. Heart Stoppers is a heartwarming coming of age story that explores friendship, love and the joys and hardships coming out. It's a gentle reminder that no matter what is going on in life there is someone around that can be there for you. Showcasing a warm comforting story with love's gut punches with help from stunning artwork lends itself to help more the story along. It is a must read as well as having been recently optioned by Netflix, will be a must watch as well!
Check Please!
By Ngozi Ukazu
This title is a favorite of us Bedrock Citizens, it also had it's start as a webcomic but has become a graphic novel YA romance staple. The story follows Eric "Bitty" Bittle starting university and coming into his own with a sweeter than the sweets he bakes romance. Hockey, baked goods, on and off the rink romance, this story of friendship and self discovery is the perfect title to read this pride month. Volume one and two are currently in print with volume three on the way, do yourself a favor and read this series!!
Laura Dean Keeps Breaking Up With Me by Mariko Tamaki
I know I have written about this title many times but this is honestly one of my favorite graphic novels of all time. This is a sapphic tale of finding your own self worth and the beauty of friendship while trying to overcome toxic relationships, both platonic and romantic. Frederica "Freddy" Riley is dating the most popular girl in school Laura Dean, though they tend to break up every major holiday, they always find their way back to each other (much to the chagrin of Freddy's friends.) Freddy comes into her own and realizes what she has to do after a whirlwind of high school drama, but it had such a heartwarming message I can't count the amount of times I've reread it. The artwork is absolutely stunning and the writing is so relatable, this story will stay with you long after you've put it down. I cannot recommend this book enough!!
This is only a tiny sample of all the comic/graphic novel offerings we have at our stores to celebrate not only for pride month but for all year round. Thank you all so much for shopping with us and we can't wait to see you in store! Stay cool out there!
Written by Bedrock City Contributor: Victoria
Related blog posts:
AAPI Heritage Month in Comics
Comics to Read for Earth Day
Small Press Highlight
Go Go Godzilla!
April Fools Day with Comics Greatest Pranksters
US Presidency in Comic Book History
WandaVision: Why you should read Vision by Tom King
What to Read Before Wonder Woman 1984
Star Wars: the High Republic
Native American Heritage Month in Comics
US History in Comics for 'Hamilton' Fans
Celebrate Pride Month With These Titles!
Honoring Essential Workers in Comics
Comics and Hope
Loki Essential Reading
Nexus: Unsung Hero
asian and pacific islander heritage month

redpajama_set_name: RedPajamaCommonCrawl


text:
Q: How to calculate number of selected in SQL Server stored procedure I want to get no of records also with the following SQL Server stored procedure. Can someone please let me know how I rewrite the following procedure?
    @PapCod AS VARCHAR(3)
AS
BEGIN
    SET NOCOUNT OFF;

    SELECT
        RTRIM(SA_ArticalCode) AS SupCode,
        RTRIM(SA_ArticalName) AS SupName
    FROM
        Correspondent_Staff_Atricals
    WHERE
        SA_PapCode = RTRIM(@PapCod)
END

A: You can use COUNT function.
SELECT
    COUNT(*)
FROM
    Correspondent_Staff_Atricals
WHERE
    SA_PapCode = RTRIM(@PapCod)

A: use count(*) over()
SELECT
  RTRIM(SA_ArticalCode) AS SupCode,
  RTRIM(SA_ArticalName) AS SupName,
  count(*) over() [count]
FROM
  Correspondent_Staff_Atricals
WHERE
  SA_PapCode = @PapCod -- no need to rtrim, the rows will be found anyway

A: You can use Union ALL to append a row where you calculate number of rows:
SELECT RTRIM(SA_ArticalCode) as SupCode,
   RTRIM(SA_ArticalName) as SupName
   FROM Correspondent_Staff_Atricals
        WHERE SA_PapCode = RTRIM(@PapCod)
UNION ALL
SELECT 'RowsCount', COUNT(1)
FROM Correspondent_Staff_Atricals
        WHERE SA_PapCode = RTRIM(@PapCod)

redpajama_set_name: RedPajamaStackExchange


It's an itty bitty story, generally under 1,000 words or 3 printed pages. You might be thinking 'How on earth can I cram a full story into less than three pages?' Very easily, actually!
I was terrified of writing short fiction before I decided to give it a shot. As fantasy writers, sometimes comfortably writing books as long—or longer—than 500 printed pages, thinking of cramming a full story into 3 pages is daunting. However, I believe all forms of writing strengthen you as a writer. Flash fiction, especially, makes you par down your words and forces you to get to the core of your story. But just because flash fiction is itty bitty doesn't mean it can't have meat. All the basics of good story telling still apply to micro fiction; you still need engaging, lively characters, a big problem, emotional depth, good pacing, and so on.
Want to try your hand at micro fiction? Here are some tips to help you get started.
Pick one character and stick with their POV. You won't have much room for character development, so pick the most intriguing character and write the entire story from their perspective.
Pick a single problem. You won't have room for subplots, so place your character in an interesting situation, with a "big" problem, and run with that for your entire story. Noticing a pattern here? 1 character; 1 problem.
Skip character names unless they have significance. It's okay to keep things simple in flash fiction. "The girl" or "the bear" will do just fine in micro fiction, unless there is a reason to name a character.
Think of it like a scene. Scenes are like micro stories—they have a beginning, a middle, and an end. The inciting incident will have to be a lot closer to the beginning of the story, if not the start of the story, but it may help to think of your micro story as having three distinct parts. George R. R. Martin does the "story within a scene" tactic quite well.
Limit to one supporting character (for stories under 500 words) or two supporting characters (for stories closer to 1k). The shorter the story, the less room for multiple characters. Otherwise, if you try to cram three or more characters into an itty bitty story, the main character will become diluted and the story will start to seem crowded. Save your elaborate plots and huge cast for your super novels!
I don't do any plotting when I write micro fiction.
I just start with an idea, usually a place, a person, or a thing, and just run with it, letting my imagination pull me in whatever direction it wants. Try it! I was surprised at how much I enjoyed writing micro fiction once I started.
Micro fiction can become an important part of your content marketing campaign, but that's a post for another time.
As an example, I've included one of my flash fictions below. Feel free to post your own in the comments! I look forward to reading them.
*In case you're wondering, the itty bitty story below weighs in around 400 words.
The merchant had never been a rich man by any means, but that didn't stop him from trying to acquire nice things. Things far above his earnings from hauling his weekly catches into the bustling, stinking market of the little seaside town of Aspire.
Saying Aspire didn't have much to offer or that it didn't look like much was like saying the sky is blue and fish lived in the sea. Those things were simply facts begrudgingly recognized—or ignored—by the Aspirians. Shiny, unique things of great value were hard to come by.
Which is why when the merchant caught a beautiful mermaid in his net one day, his face lit up in surprise and wonder.
She stared at him. "Mermaids keep schedules, too," she said matter-of-factly, as if he should already know this.
Beneath the waves, her long, graceful tail shimmered. Sunlight glinted along hundreds of tiny scales.
"That's because I made it when I was a boy." Shrugging, he slipped it over his hand and tossed it to her.
"Depends on the perspective." She produced a knife—from where, he did not know—slashed herself free and dove beneath the waves.
K. D. Jones is the epic fantasy pseudonym for young adult author Krystle Jones. Krystle was born and raised in the small, southern town of Tullahoma, Tennessee. Reading and writing have been lifelong passions of hers. In addition to writing, she is passionate about information technology, Etsy, painting, and exercising. She believes you can be whatever you want to be if you're willing to work hard. She currently lives in the Midwest with her husband and adopted fur babies.
Learn more about K. D. Jones at kdjonesepicfantasy.com.
Next ›Discover The Tree of Ages Series!
This is so fun! How often do you get carried away with a character and want to write their full story?
First of all, thanks so much for sharing this with us K.D.! Love love your writing insight, and these flash pieces have been so fun to read each week. So glad you're letting us share the lovliness here!
That was WONDEFUL, Jen! I'd say you nailed it. You always write something beautiful and deep. ❤ Would love to see more.
Oh wow thanks! I wasn't sure what I was doing, but it was a super fun challenge! I live in a 100 year old farmhouse in the middle of the woods so it wasn't a big imagination stretch with the tree 😉 I'll try to think of another fun idea sometime soon!
Nice advice and am gonna try it out. And your story piece was so intriguing.


There is going to be Bundesbank Beermann Speech in Germany and the US will publish Retail Sales MoM.
The support rests at 1.15440 with resistance at 1.15830 which both lines are above the weekly pivot point at 1.15340. The EMA of 10 is moving horizontally in the ascendant channel and it is below the EMA of 200 and the EMA of 100. The RSI is rising towards the overbought area, the Stochastic is moving in low ranges and the MACD line is below the signal line in the negative territory. The ADX is not showing any clear signals.
While considering pullbacks, EURUSD may continue its growth towards the 1.162.


At the start of the day PE teacher A decided to use the whiteboard in the first lesson and I asked why he had decided to do so. He explained that sometimes having a visual aid can help students to understand what is expected of them, and can help them to engage in the task. He had drawn a frying pan full of eggs and bacon, with a tennis racket next to it. This was to explain to the students that a tennis racket is different from a frying pan and so we hold them differently; this example was an effective use of visual aids and implemented some humour to engage with the class. Visual aids is something I aim to incorporate into my project as I have previously looked at essays and journals on the subject that illustrated their potential uses in an educational situation. Hearing this from my PE mentor reassured me about my plans to utilize visual aids during my training sessions to help the students understand and enjoy the tasks I give them. This made me realise that the whiteboard could be a useful resource for me when I come to creating lesson plans, even if it's just to stick pictures on.
My PE mentor explained that in this lesson the class would be moving on from the previous lesson onto some slightly more difficult skills. He also mentioned two key words in the PE national curriculum: progression and differentiation. He told me that each student should be expressing some form of progress throughout the terms, and that the activities they are challenged with should therefore progressively grow harder and/or more complex. The differentiation element alludes to the fact that every pupil's needs will be different, and therefore each activity should posses a way of being altered to individual needs. These concepts were not unfamiliar to me as I have practiced similar objectives in my personal training course, and fully appreciate the individualisation of one's progression and achievements.
The PE teacher reminded the class of what they did last time, and mentioned how impressed he was with their work. He went on to explain that the skills they did in the previous lesson would be too easy for them and that they were now going to progress, which palpably enthused the class before activities even started. The class started the session with the last skill they had learned, which was bouncing the ball off the wall and returning it as many times as they could. The teacher stopped the class at one point to watch one of their fellow students who was doing something particularly well. This student was asked to carry on while the rest of the class stood by trying to identify what they were doing more effectively than others. After a few hints from the teacher they realised it was the students footwork that was proving effective, which was then emphasised in the teacher's following demo.
The class were then put into pairs to practice rallying together. This seemed like a great test of skill as each student would have to control the ball so that they could have the longest rally. At the end of class the pairs took turns in showing the class how long they could keep their rally as a small competition to finish. All members were motivated by this competitive element and worked well in their pairs, but unfortunately time ran out quickly and each pair had to head to the changing rooms before they could see who held the longest rally. This detriment to the classes expectations is something I will want to avoid in the future and highlighted the importance of time management in a session, particularly in a PE session for children with special needs who need time to change their clothes.
This was a primary group of ASD cases, there were twelve of them with about five teaching assistants. Me and the PE teacher had set up benches in a "V" formation to create a bowling lane with pins at the end of it - there were three lanes. Two lanes were used for practice, but the end lane was used to score points, which was kept in a table on the whiteboard; this could be another example of progression and use of visual aids implementation. Basketballs were used with these students, as they were large and not too heavy, making them easy to roll. Some students were allowed to kick the ball down the lanes instead of rolling them, which could be an example of differentiation.
The difficulties of this class was slightly more severe than most of the others I had seen so far, as none of the class members could articulate sentences well, express themselves or explain emotions appropriately, and struggled to remain on task. I was asked to assist this class and to stick with the same group of students throughout the lesson. I noticed the TA's I was working with used some Makaton and big gestures, and were extremely enthusiastic when encouraging the students. I asked what the signs were they were using and they told me that when employing Makaton you sign the first letter of the person's name when addressing them. One of the TA's explained to me that the children in this class struggled to cognitively process information and often struggled to understand what was being asked of them which is why they required so much assistance, and why Makaton can sometimes be helpful with these students. One pupil in my group, Pupil 3, was incredibly quiet and appeared almost fascinated by anyone they were looking at. When I spoke to her, I spoke clearly and slowly, using big gestures to help them understand what I was saying to them, but unfortunately I don't think it had much effect. The TA's in the class had used some physical direction with the students, particularly with this one, so I decided to have a go and prompted them gently along with my hand on their back when they were kicking the ball instead of rolling it. I tried to help this pupil to hold the ball and encouraged them to roll it, but again this appeared to be a futile effort as they failed to even glance at the ball I was giving them, let alone get their fingers to grip it.
Another student got quite distressed during the session, Pupil 2, for reasons unclear, though I did notice him expressing some hypersensitivity to sound as he was covering his ears and isolating himself from the group occasionally. When this happened, a TA stuck with him and tried to get him to perform similar tasks on his own, like rolling a small red ball to her; differentiation. This was another clear demonstration of the remarkable effort put in by the TA's of this school, and as Pupil 2 seemed quite undisturbed by her presence when in the corner, again it was obvious that this TA often spent time with this student and had formed a close bond with him. This student also struggled to take turns, at one point they knocked over the pins with their hands during a pier's turn. As the TA's knew how sensitive Pupil 2 was feeling during this session, they made no effort to discourage him from performing the task inaccurately. Instead they said it was good that he was at least participating in parts of the lesson and actually made effort to encourage him when he did so. When it was Pupil 2's go, they displayed enormous frustration when failing to knock over all of the pins, which progressively grew throughout the session and resulted in this student having a time-out in the corner by themselves on a bench. It was clear that Pupil 2 was aware that he was having a time-out session as he did not move from the spot in which he had been sat.
This was definitely one of the more challenging classes in terms of behaviour and understanding, but physically most students could potentially perform well if they were able to focus on the tasks given to them.
Before lesson 3 began I was introduced to another PE teacher whom I was going to be spending that session outside on the playground with. This occurred every week with Class D so I knew it would be interesting to see one of the same classes in a different setting. On arrival to the playground I was greeted by a friendly TA who kindly delivered a brief overview of the needs of the class, stating most of them were behavioural, some were slightly autistic, and a couple of students had forms of cerebral palsy. This instantly aroused my curiosity as I have no experience with children with cerebral palsy but I had read about it during research for this project. I knew PE must be particularly challenging for them so I was going to pay close attention to the attitudes of the teacher and TA's when it came to helping these individuals, Pupil 1 and Pupil 2.
PE teacher B started off in a chatty way and took the time to ask the students how their christmas breaks had been, which the children were delighted to respond to. This seemed like a great way of engaging the class before activities as it was a lovely effort to get to know the children on a friendly basis and helped the children to feel calmer in their environment before PE. This PE teacher also challenged the class to remember what their usual warm up was. Some students raised their hands and had a go at remembering the warm up, between them they eventually recalled the whole task. PE teacher B had clearly stated that he would be "so impressed if they can remember everything" and when they did he gave positive enforcement and gave his overview of the warm up task to clarify.
The warm up was for the pupils to run around the playground, jumping and touching a basketball hoop as they went, run around the field to the wooden chimes by where they started, and touch them before returning - they did this as fast as they could but some students needed lots encouragement, particularly when heading back.
The next chunk of the lesson was throwing and catching tennis balls, using coloured cones to indicate where each pupil should be standing. The teacher chose a pair of students to help give a demonstration of the task who were happy to do so. As an easier option PE teacher B said the students could bounce the ball to each other so it is easier for their partner to catch, or as a more difficult option he said they could try catching the ball with one hand; it was their choice to differentiate the given task. PE teacher B also gave students the privilege of choosing their own partners to work with as a demonstration of trust he has in the group. As the task went on, PE teacher B encouraged students to increase the complexity of their performance, so if they had not had a go at catching with one hand they should do so. Students responded well to this and each pair made an effort to perform at the next level of the catching task. Then the PE teacher B asked pairs to show the rest of the class how they had been performing and emphasised encouraging and applauding each other when performing. This helped to give a very friendly and wholesome atmosphere amongst the class and helped to reduce the amount of pressure on the pair performing; this was particularly important for Pupil 1 and Pupil 2 as they struggled to catch, pick up, and throw the ball, but the teacher and the rest of the class remained very patient and were very enthusiastic when these pupils did manage. The kind response from the rest of the class I assumed was a result of the emphasis PE teacher B and the TA's had placed on encouraging each other and being mindful of individual abilities in the past, and was lovely to see.
Two wheelchair uses were in this class, Pupil 2 and Pupil 3, along with one hemiplegic student, Pupil 1. PE teacher A wrote down the lesson on the whiteboard for this lesson, completed with a couple of diagrams demonstrating what they were doing. The teacher wanted them working up to a sport called goal-ball, and today they were going to be doing some target practice, much like bowling. PE teacher A had got the students excited by this by saying he was going to teach them a game they had never done before, and that most other people haven't even heard of it. When he explained the rules the class gasped and expressed enthusiasm to get going. This palpable urge to try a new task made me think about my project ideas, as I knew I was striving for something creative, innovative, and fun. The simple fact that my ideas would be new to these students made me believe that they would get just as excited by the lessons I want to give them as this one.
First of all the students were put into partners and they had to roll the ball through each others legs. After each time they managed to roll the ball through their partners legs they would both move back two steps to progressively increase the distance between them. I was partnered with one of the students who, like the rest of the class, seemed excited by the activity and concentrated reasonably well. My partner missed my legs occasionally as we started to get further apart and I noticed this was because he was letting go of the ball too early and the ball was bouncing rather than rolling. I reassured him his power was good but told him to get lower when launching the ball to ensure he rolled rather than bounced. A couple of times he managed to take on my advice, but he still seemed quite excitable and distracted by the other activity in the room. I continued to feed instructions and encouragement in the attempt to reacquire his attention. It was slightly difficult and occasionally I had to stop what I was doing and using the students name to grab their attention before instructing. This method worked better.
A bowling lane was then set up for the whole class to take turns to knock over skittles. The wheelchairs users had the assistance of ramps. The teacher gave individual feedback throughout the target practice, such as good speed, good aim but more power, and once all students had their turn he decided that the class would take their shot from further away; progression. It was clear as this progression took place the students were becoming more daunted by the task as they were more reluctant to try than they were in their previous attempts. Nonetheless each student tried and still received individual feedback from PE teacher a before heading back to the changing rooms.
This was one of the youngest classes I have been with and they played on the climbing frame for a treat. A bench was set as a slide which some students needed help to go down. One student particularly enjoyed this session, showing a huge amount of enthusiasm and inquisitiveness. Every challenge set by the teacher, i.e. climb to the top, slide down by yourself, now bounce on the trampoline by yourself, the student did without hesitation and proved that he was very able by completing these challenges.
Now that my observation period has begun, and I intend to continue it for yet another week, I was reassured by a meeting with my tutor to talk and discuss more ideas with my PE mentor; I should ask him more about the observations I'm making and how that affects my plans. I plan to note down some questions before meeting with the PE teacher so that I can plan more effectively for the training period where I will be coordinating lessons and activities.


Steve took me to the Canadian Open in Hamilton this weekend. It was the first time I went to a golf tournament.
When we got there, Steve said we could buy new golf hats. I picked a red one and Steve got a blue one just like it. I was hungry so we went to find something to eat. When we got to the food tent all they had were some sandwiches, hot dogs and hamburgers. I wanted pizza but they didn`t have that so I had a hot dog and a Pepsi (I really wanted a Dr. Pepper).
After we ate, we went to the practice green to see Å"Spiderman. He`s my favourite super hero. Steve says that he`s his too. Next we went out onto the course to watch the players. It was a lot of fun because they were really great. They hit the ball really far and straight and when they hit the ball onto the green, they can get it really close.
When we went down the fairway on the second hole there were some people giving out Extra gum. We could take as much as we wanted so I took two big handfuls and stuffed them into Steve`s back pockets to eat them later.
The second hole, ninth tee and eighth green are all really close to each other. One of the players (Aaron Baddeley) on the eighth missed the green with his shot and we were able to stand right behind him when he hit his next shot to the hole. It was really neat to watch because he hit the ball way up in the air and it landed a couple of feet away from the hole.
We went back over to the second and watch the players putt. They had to walk right past us as they went to the third hole and the guy from England (Justin Rose) stared at me when he walked by. Then we went back to get more gum and it started to rain but Steve brought his umbrella so we didn`t get wet.
After we got the gum we went to the fairway at eighteen and watched a few players hit their ball to the green. I kept saying Å"wouldn`t it be great to hit a hole in 2 and then it happened! This one guy (Bo Van Pelt) hit his shot right at the flag. We were down in the valley and couldn`t see the green but we watch as the crowd got more and more excited as the ball moved towards the hole. It was easy to tell that it had gone in because everyone around the green lifted up their arms and started jumping around. The guy who hit the shot took a bow and the two guys playing with him came over and gave him a high-five. It was really cool.
I was hungry again so we went back to the food tent. I really wanted brownies but they had sold out. I would have had a chocolate bar but they only had Coffee Crisp and Crunchy. I`ve never had a Crunchy bar and I didn`t want a Coffee Crisp so I didn`t have anything. Why don`t they have more food to choose from?
We did find another food tent though and Steve waited in line for almost 30 minutes so that I could have some brownies. After he got them we went and sat in the stands on the thirteenth hole. We watched Vijay Singh (I remember his name) and a bunch of other players hit balls to the hole but no one got a hole in one.
We had been at the golf course for almost five hours now and we had to go home for dinner. Before we left we got to try putting like the pros. I didn`t get my putts in but neither did Steve.
I had a great time at my first Canadian Open. I hope Steve takes me again next year.


text:
Home News Channels Business & Finance Hands on Miami and Inter-American Development Bank Join Hands in Aftercare Facility...
Hands on Miami and Inter-American Development Bank Join Hands in Aftercare Facility Makeover Project
Building to be unveiled during IDB Annual Meeting in Miami on April 3
MIAMI, March 19 /PRNewswire-HISPANIC PR WIRE/ — The Inter-American Development Bank and local nonprofit organization Hands On Miami will join hands this month in renovating a community education facility. The makeover project will constitute the first official event of the 49th Annual Meeting of the IDB, which will be held in Greater Miami from April 4-8.
"We chose Hands On Miami to organize our direct service program given their proven track record and accomplishments," Jorge L. Arrizurieta, Chairman of the IDB Miami 2008 Host Committee, said. "Hands on Miami President Pat Morris has been instrumental in coordinating the entire volunteer effort for the Annual Meeting. Given South Florida's commitment to social and economic development, we will undoubtedly see a high volunteer turnout on April 3."
Located in the Allapattah neighborhood of Miami, the Latinos United in Action Center provides free after-school classes and programs to hundreds of neighborhood children and adults. Microsoft, Winmar Construction, and DirecTV are sponsoring the makeover project, which will commence on March 17th with the gutting and complete redesign of the interior of the building. On April 3, volunteers will complete the building with a mural painting and landscaping of the exterior.
"This is a great collaboration of the non-profit sector, the City of Miami and great corporate citizens that will make a lasting impact on Latinos United In Action and the entire Allapattah neighborhood for years to come," said Hands on Miami President Pat Morris. "And it is a wonderful gift for the IDB Annual Meeting."
"Sponsoring the Annual Meeting is a unique opportunity for companies and institutions to express their commitment to social and economic development in the Americas and participate in this historic event," Arrizurieta said. "At the same time, sponsorship entails extensive branding and exhibition opportunities which allow participating companies to elevate their stature among the business and government leaders who will attend this historic event."
On April 4, Bill Gates will deliver a keynote address about the role of philanthropy in development. Mexican media company Televisa and Spanish telecommunications company Telefónica are also supporting the Annual Meeting; Chairmen Emilio Azcárraga and César Alierta will participate in the CEO panel on private philanthropy.
IDB President Luis Alberto Moreno will moderate the panel, and he will be present for the unveiling of the Latinos United in Action Center building.
Hands On Miami is recruiting volunteers for this project and for other activities during the Annual Meeting. For more information, visit: www.handsonmiami.org.
For more information about the IDB Annual Meeting sponsorship program, visit: www.idbmiami08.org.
About Hands On Miami
Since 1993, Hands On Miami (HOM), in partnership with United Way of Miami-Dade, has developed into Miami-Dade's premier resource for volunteering. HOM provides flexibly scheduled, meaningful, direct service volunteer opportunities. In partnership with schools, social service and environmental organizations, HOM organizes more than 85 service projects each month, engaging caring residents throughout Miami-Dade County. For more information visit www.handsonmiami.org.
Previous articleRetention Education, Inc. Closes Series B Funding
Next articleCoca-Cola Announces Names of Six U.S. Torchbearers for Beijing 2008 Olympic Torch Relay
Tidal Basin Group Chief of Staff Appointed to The Institute for Diversity and Inclusion in Emergency Management Advisory Board
Inflation Worries Hurt Consumer Confidence Among Hispanics
Environmental Science Associates Acquires Sitka Technology Group
HITEC Announces Four Corporate Advisory Board Members and Names New Advisory Board Leadership
FORMER MAJOR LEAGUE BASEBALL EXECUTIVE MICHELE C. MEYER-SHIPP TO BECOME CEO OF LEADING GLOBAL NONPROFIT EMPLOYMENT RESOURCE ORGANIZATION, DRESS FOR SUCCESS WORLDWIDE


text:
Tchibo calls on government to regulate garment industry
06 April 2019 | 1:58 pm
German company Tchibo doesn't just sell coffee — it's also a leading garment retailer. The firm has turned to Berlin for help in making sure that its suppliers overseas pay higher wages to workers.
European Super League would have multi-billion euro business model
Offering a shared pot of €3.5 billion to start with, the newly-proposed football competition known as the European Super League would divvy up revenue among a smaller group of elite clubs. We tell you more. Also, we take a look at the French government's plan to aid farmers reeling from this month's cold spell.
Biafra Day anniversary paralyse social and business activities in southeast Nigeria and more
Here are a few reasons to pick up a copy of The Guardian on Tuesday. Find these stories and much more when you grab a copy of The Guardian on Tuesday.
DW Business - Africa
Nigeria has largest number of startups in Africa - Report: Richest Americans pay little in income taxes - European tableware makers take on China
US issues Hong Kong business warning and further sanctions
The US sanctions target officials from China's Hong Kong liaison office, which seeks to promote Chinese influence in the partly autonomous city.
German business confidence drops over supply shortfalls, virus fears
Managers in Germany are not feeling overly optimistic about the coming months, a major business confidence barometer shows. Two major concerns are clouding their outlook.
Imperatives for business sustainability conference
In an effort to stem incidences of business failures in the corporate polity, H. Michael & Co. founder Dr. Adeyinka Hassan in commemoration of its 10th anniversary put together a conference tagged: Corporate Governance and Enterprise Development Conference. The well-attended conference examined the imperatives of corporate governance for the success of business enterprises in Nigeria, creating economic stability and business sustainability.
German business leaders react to election result
The Social Democrats' narrow victory in Germany's federal elections suggests the country could be heading into a more progressive future. As coalition talks get started, business leaders want their priorities heard.
Belarusian border crisis hits local Polish business
The standoff over migrants entering the EU between Minsk and Warsaw has hit local Polish businesses near the border, many reliant on tourism. With the winter coming and no end in sight to the crisis, DW visited the area.
DW Business – Africa
Report: Africa to see less funding for fossil fuels - Nigeria introduces eNaira digital currency - Solar powered vehicles made in Germany?
Google's parent company reports jump in quarterly profits, driven by ad business
Benefitting from soaring demand for online ads, Google's parent company Alphabet reported nearly $19 billion in profits between July and September, up 68 percent from the same period last year. Microsoft's earnings also beat expectations, while French consumers are gearing up for some price hikes at the bakery.
Business owner loses his livelihood after tank explosion kills scores in Freetown
Bar owner Mohamed Lamin Mansaray told everyone to run away from his bar just before a fuel tanker exploded following a traffic collision, killing at least 99 people and injuring hundreds more on Friday (November 5) in Sierra Leone. The explosion destroyed Mansaray's business killing a staff member and destroying his home, which he had built for himself and his 10 family members. "We are getting into festive season....I have just purchased a brand new musical set, lots of drinks from the Sierra Leone brewery and chairs that worth about Le 270,000,000 (24,700 USD). Property that I have lost and one of my staff died", said Mansaray while pointing at what is left of his business.
Inflation, energy and the 'quitdemic': A look back at business in 2021
2021 brought big changes to households and businesses around the world. In the last show of the season, Stephen Carroll and Kate Moody take a look at some of the biggest business and economic stories of the year and how they might evolve in 2022.
Iran court jails dancing pair for 10 years
A court in Iran gave a jail sentence of more than 10 years to a young couple that appeared in a viral video. In violation of the laws of the Islamic Republic, they danced near one of Tehran's most famous landmarks.
A tax scandal, an antibiotic breakthrough and 'Are French people just lazy?'
We take a look at why only 11.3 percent of voters turned out in Tunisia's second round of parliamentary elections. We then discuss a tax scandal in the UK that's hurting the ruling Conservative Party. We also see how the Australian and Serbian press are covering Novak Djokovic's historic win at the Australian Open. Finally, an opinion writer for The New York Times argues that the French are – and are not – lazy.
Why fungi might actually be magic when it comes to climate change
An eminent scientist is calling for urgent new work to protect and even enhance underground fungal networks that could provide part of the solution to climate change.


Need a Quick Meal? We've Got It!
One of the misconceptions I sometimes hear regarding eating a healthier diet is that it's too time consuming. Or that food that's quick to make can't be good for you, too. That's what I always thought -which is why on the days I was getting home from work at 8 o'clock in the evening, I was picking up a pizza instead of making something health-promoting.
While getting in the kitchen and cooking can be time-intensive, it doesn't have to be. If I didn't have some quick and easy go-to dinners I could whip up, then I'd be back to take out and plenty of processed food, instead of getting cancer-fighting, energy-sustaining, strengthening, uplifting whole foods.
I have a few staple dinners that I throw together on the nights I need something really quick. (They also worked really well for my hubby or a friend to make when I needed the help during cancer treatment.) They take less than 30 minutes, taste soooo good and support my health and that of my family. I often make extra to reheat the next day for lunch or dinner.
One of my favorites is Simple Green Stir Fry. It's very flavorful, full of veggies and quick to throw together. Give it a try!
Cook pasta according to package instructions. Meanwhile, heat the oil in a large skillet or pan. Add the onion, stir and cook for 2 minutes. Add the broccoli, stir and cook for 2 minutes. Add the boy choy, mushroom, garlic and ginger. Stir and cook for 2 minutes. Add the tamari and a splash of water, stir, cover and steam for 1 minute. Remove from heat. Drain pasta. Serve sautéed veggies over pasta, topped with sesame seeds.


Rick Wilmer is the General Manager of Arista's WiFi Business after leading the acquisition of Mojo Networks by Arista. Rick had served as the CEO of Mojo Networks since 2015. Prior to Mojo, Rick served as the CEO of Leyden Energy and as the CEO of Pliant Technology. Rick's 30+ year career in Silicon Valley has been focused in storage and networking. He has held executive positions at Santur Corporation and Aruba Wireless Networks as an early employee through their IPO. He has also held VP Engineering or VP Operations roles at 2Wire, Procket Networks, Maxtor, and Seagate. Rick has extensive international experience, especially in Asia, where he resided for two years. Rick received his BS in Chemistry from UC Berkeley and has a Patent in storage technology.