20150105

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>数据表格</title>

<%

String pid = request.getParameter("parentid");

if (pid == null || pid.trim().length() == 0)
{
    pid = "0";
}

%>

<script type="text/javascript" src="js/jquery-easyui-1.4.4/jquery.min.js"></script>
 <link rel="stylesheet" type="text/css"  href="js/jquery-easyui-1.4.4/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"  href="js/jquery-easyui-1.4.4/themes/icon.css">
<script type="text/javascript" src="js/jquery-easyui-1.4.4/jquery.easyui.min.js"></script>

<script type="text/javascript" src="js/jquery-easyui-1.4.4/locale/easyui-lang-zh_CN.js"></script>

<script >

$(function()
        {

    $("#mydg").datagrid({
        title:‘地区列表‘,
        collapsible:true,
        width:500,
        url:‘MembersList?parentid=<%=pid%>‘,
        fitColumns:true,
        striped:true,
        idField:‘id‘,            //跨页选取,不会受到 翻页的影响
        pagination:true,
        rownumbers:true,
        pageList:[5,10,50],
        pageSize:5,
        sortName:‘id‘,            //排序依据  id
        sortOrder:‘desc‘,        //排序方式 倒序排列
        remoteSort:false,        //客户端排序方式
        frozenColumns:[[
                        {field:‘‘,checkbox:true},
                  {field:‘id‘,width:80,title:‘ID‘}]],
        columns:[[
                  {field:‘parentId‘,width:80,title:‘父ID‘},
                  {field:‘name‘,width:80,title:‘地区名‘,
                      formatter: function(value,row,index){

                          return ‘<a href=datagrid.jsp?parentid=‘ + row.id + ‘>‘+ value + ‘</a>‘;

                      }
                  },
                  {field:‘postCode‘,width:180,title:‘邮编‘}
                  ]],
                  toolbar: [{
                      text:‘增加地区‘,
                          iconCls: ‘icon-add‘,
                          handler: function(){

                              $("#addform").form(‘reset‘);

                              $("#add").dialog({
                                  title:‘增加地区‘
                              });

                              $("#add").dialog(‘open‘);

                          }
                      },‘-‘,{
                          text:‘编辑地区‘,
                      iconCls: ‘icon-edit‘,
                      handler: function(){

                          var s = $("#mydg").datagrid(‘getSelected‘);

                          if(s != null)
                              {
                              //编辑数据

                              $("#addform").form(‘reset‘);

                              //清理ID
                              $("#id").val(null);

                              $("#add").dialog({
                                  title:‘编辑地区‘
                              });

                              //绑定数据
                              $("#addform").form(‘load‘, s);

                              $("#add").dialog(‘open‘);

                              }
                          else
                              {
                              alert(‘请选择一条数据‘);
                              }

                      }
                  },‘-‘,{
                      text:‘删除地区‘,
                      iconCls: ‘icon-remove‘,
                      handler: function(){

                          var s = $("#mydg").datagrid(‘getSelections‘);

                          if(s.length > 0)
                          {
                              $.messager.confirm(‘确认‘,‘您确认要删除吗?‘,function(r){
                                  if (r)
                                  {    

                              var ids = ‘‘;
                              for(var i = 0;i < s.length;i++)
                              {
                                  ids += s[i].id;
                                  if(i != (s.length - 1))
                                  {
                                      ids += ‘,‘;
                                  }
                              }

                          //    alert(‘ids = ‘ + ids);
                              $.get("DeleteMembers?ids="+ids,
                              function(data,status)
                              {
                                     // alert("Data: " + data + "\nStatus: " + status);
                                    var mes = eval(‘(‘ + data + ‘)‘);
                                    $.messager.show({title:‘提交信息‘, msg:mes.message});
                                    $("#mydg").datagrid(‘reload‘);
                                  //清除选择项
                                    $("#mydg").datagrid(‘clearSelections‘);
                              })
                              }
                              });
                          }
                          else
                          {
                          alert(‘请选择一条数据‘);
                          }
                      }
                  }]

    });

    $("#addform").form({
        novalidate:false,
        url:‘TestSubmit‘,
        onSubmit:function()
        {

            var isValid = $(this).form(‘validate‘);

            if (!isValid)
                {
            $.messager.show({title:‘表单验证‘, msg:‘验证未通过‘});
                }            

            return isValid;
        },success:function(data){    

            //解析接收到的数据
            var mes = eval(‘(‘ + data + ‘)‘);
            $.messager.show({title:‘提交信息‘, msg:mes.message});

            if (mes.success)
                {
                    $("#add").dialog(‘close‘);

                    $("#mydg").datagrid(‘reload‘);
                }
            else
                {

                }
        }
    })

    $("#subbutton").click(function(){

        $("#addform").form(‘submit‘);

    });

        });

</script>
</head>
<body>

<!-- <table id="mydatagrid"  title="地区列表" class="easyui-datagrid" style="width:500px;height:200px"
data-options="collapsible:true,singleSelect:false,url:‘MembersList?parentid=0‘,method:‘post‘"
>
<thead>
<tr>
<th data-options="field:‘id‘,width:80" >ID</th>
<th data-options="field:‘parentId‘,width:80" >父ID</th>
<th data-options="field:‘name‘,width:80" >地区名</th>
<th data-options="field:‘postCode‘,width:180" >邮编</th>
</tr>
</thead>

</table> -->

<table id="mydg"></table>

<div id="add" class="easyui-dialog" data-options="closed:true" title="增加地区" style="width:300px;">

<form id="addform" method="post" >

<table >
<tr>
<td>地区名称:</td>
<td><input id="name"  name="name" class="easyui-textbox" data-options="required:true,
validType:‘length[2,10]‘,missingMessage:‘这是地区名称,为必填项‘" width="30" ></td>
</tr>
<tr>
<td>邮政编码:</td>
<td><input id="postCode"  name="postCode" class="easyui-numberbox" data-options="required:false,
validType:‘length[6,6]‘" width="30" ></td>
</tr>
<input name="parentid" type="hidden" value="<%=pid%>" />
<input name="id" id="id" type="hidden" value="" />
<tr>
<td colspan=2 align="center">
<a id="subbutton" class="easyui-linkbutton" style="width:80px" >提交</a>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>

1

package com.hanqi;

import java.io.IOException;
import java.util.ArrayList;

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

import com.hanqi.dao.Members;
import com.hanqi.dao.MembersDAL;

import com.alibaba.fastjson.*;

/**
 * Servlet implementation class JsonMembers
 */
@WebServlet("/JsonMembers")
public class JsonMembers extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
     * @see HttpServlet#HttpServlet()
     */
    public JsonMembers() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        request.setCharacterEncoding("UTF-8");

        response.setContentType("text/html;charset=UTF-8");

        response.setCharacterEncoding("UTF-8");

        String rtn = "";

String pid = request.getParameter("parentid");

if (pid == null || pid.trim().length() == 0 )
{
    pid = "-1";
}

int iPid = Integer.parseInt(pid);

MembersDAL md = new MembersDAL();

ArrayList<Members> al;

try {
    al = md.getList(iPid);

Members m = new Members();

m.setName("未选择");
m.setId(-1);
m.setParentId(0);
m.setPostCode("12345");

if (al == null)
{
    al = new ArrayList<Members>();
}

al.add(0,m);

    rtn = JSON.toJSONString(al);

} catch (Exception e) {

    e.printStackTrace();
}

response.getWriter().print(rtn);

    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
        doGet(request, response);
    }

}

json

package com.hanqi;

import java.io.IOException;
import java.util.ArrayList;

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

import com.alibaba.fastjson.JSON;
import com.hanqi.dao.Members;
import com.hanqi.dao.MembersDAL;

/**
 * Servlet implementation class MembersList
 */
@WebServlet("/MembersList")
public class MembersList extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
     * @see HttpServlet#HttpServlet()
     */
    public MembersList() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        request.setCharacterEncoding("UTF-8");

        response.setContentType("text/html;charset=UTF-8");

        response.setCharacterEncoding("UTF-8");

        String rtn = "";

String pid = request.getParameter("parentid");

String pagenum = request.getParameter("page");
String pagerows = request.getParameter("rows");

if (pid == null || pid.trim().length() == 0 )
{
    pid = "-1";
}

int iPid = Integer.parseInt(pid);

int iPagenum = Integer.parseInt(pagenum);//页码
int iPagerows = Integer.parseInt(pagerows);//每页记录条数

MembersDAL md = new MembersDAL();

ArrayList<Members> al;

try {
    al = md.getList(iPid, iPagenum, iPagerows);

if (al != null)
{
    int count = md.getCount(iPid);

    rtn = "{\"total\":" + count + ",\"rows\":" + JSON.toJSONString(al) + "}";
}

} catch (Exception e) {

    e.printStackTrace();
}

response.getWriter().print(rtn);

    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
        doGet(request, response);
    }

}

list

package com.hanqi;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hanqi.dao.Members;
import com.hanqi.dao.MembersDAL;

/**
 * Servlet implementation class TestSubmit
 */
@WebServlet("/TestSubmit")
public class TestSubmit extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
     * @see HttpServlet#HttpServlet()
     */
    public TestSubmit() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub

        request.setCharacterEncoding("UTF-8");

        response.setContentType("text/html;charset=UTF-8");

        response.setCharacterEncoding("UTF-8");

        String json = "{\"success\":true,\"message\":\"数据提交成功\"}";

        String name = request.getParameter("name");

        String postcode = request.getParameter("postCode");

        String parentid = request.getParameter("parentid");

        String id = request.getParameter("id");

        if (name != null && name.trim().length() > 0)
        {
            //get方式
            //name = new String(name.getBytes("ISO-8859-1"), "UTF-8");

            if (parentid != null && parentid.trim().length() > 0)
            {
                Members m = new Members();

                if (id != null && id.trim().length() > 0)
                {
                m.setId(Integer.parseInt(id));
                }

                m.setName(name);
                m.setParentId(Integer.parseInt(parentid));
                m.setPostCode(postcode);

                MembersDAL md = new MembersDAL();

                try {

                    //执行修改
                    if (id != null && id.trim().length() > 0)
                    {

                        if (md.update(m) > 0)
                        {
                        json = "{\"success\":true,\"message\":\"数据修改成功\"}";
                        }
                        else
                        {

                            json = "{\"success\":false,\"message\":\"数据修改失败\"}";
                        }
                    }
                    else
                    {
                    if (md.insert(m) > 0)
                    {
                    json = "{\"success\":true,\"message\":\"数据新增成功\"}";
                    }
                    else
                    {

                        json = "{\"success\":false,\"message\":\"数据新增失败\"}";
                    }
                    }

                } catch (Exception e) {

                    json = "{\"success\":false,\"message\":\"发生错误:" + e.getMessage() + "\"}";

                    e.printStackTrace();
                }
            }
            else
            {

                json = "{\"success\":false,\"message\":\"parentid不能为空\"}";
            }

        }
        else
        {
            json = "{\"success\":false,\"message\":\"请正确填写地区名称\"}";
        }

        response.getWriter().append(json);
    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
        doGet(request, response);
    }

}

test

package com.hanqi.dao;

import java.sql.*;

public class DBHelper {

    public static Connection getConnection() throws Exception
    {
        Class.forName("oracle.jdbc.driver.OracleDriver");                

        String url = "jdbc:oracle:thin:@localhost:1521:orcl";

        Connection conn = DriverManager.getConnection(url,"MemberDB", "123654789");

        return conn;

    }

}

DB

package com.hanqi.dao;

public class Members {

    private int id;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getParentId() {
        return parentId;
    }

    public void setParentId(int parentId) {
        this.parentId = parentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPostCode() {
        return postCode;
    }

    public void setPostCode(String postCode) {
        this.postCode = postCode;
    }

    private int parentId;

    private String name;

    private String postCode;

}

Members

package com.hanqi.dao;

import java.sql.*;
import java.util.*;

import com.hanqi.dao.DBHelper;

public class MembersDAL {

    public int insert(Members m) throws Exception
    {
        int rtn = -1;

        Connection conn = DBHelper.getConnection();
        PreparedStatement pst = null;

        if (conn != null)
        {
            try
            {
            String sql = "insert into Members (id, parentid, name, postcode) values (sq_members_id.nextval,?,?,?) ";

            pst = conn.prepareStatement(sql);

            pst.setInt(1, m.getParentId());
            pst.setString(2, m.getName());
            pst.setString(3, m.getPostCode());

            rtn = pst.executeUpdate();
            }
            catch(Exception ex)
            {
                throw ex;
            }
            finally
            {
            try
            {
            pst.close();
            }
            catch(Exception ex){}

            conn.close();
            }
        }

        return rtn;

    }

    public int update(Members m) throws Exception
    {
        int rtn = -1;

        Connection conn = DBHelper.getConnection();
        PreparedStatement pst = null;

        if (conn != null)
        {
            try
            {
            String sql = "update Members set name = ?, postcode = ? where id = ? ";

            pst = conn.prepareStatement(sql);

            pst.setString(1, m.getName());
            pst.setString(2, m.getPostCode());
            pst.setInt(3, m.getId());

            rtn = pst.executeUpdate();
            }
            catch(Exception ex)
            {
                throw ex;
            }
            finally
            {
            try
            {
            pst.close();
            }
            catch(Exception ex){}

            conn.close();
            }
        }

        return rtn;

    }

    //删
    public int delete(int id) throws Exception
    {
        int rtn = -1;

        Connection conn = DBHelper.getConnection();

        PreparedStatement pst = null;

        if (conn != null)
        {
            try
            {
            String sql = "delete Members where id = ? or parentid = ? ";

            pst = conn.prepareStatement(sql);

            pst.setInt(1, id);
            pst.setInt(2, id);

            rtn = pst.executeUpdate();
            }
            catch(Exception ex)
            {
                throw ex;
            }
            finally
            {
                try
                {
            pst.close();
                }
                catch(Exception ex)
                {

                }
            conn.close();
            }
        }

        return rtn;
    }

    private void dgDel(Connection conn, int id) throws SQLException
    {
        PreparedStatement pst = null;
        ResultSet rs = null;
        Statement st = null;

        try
        {

            //删除
            String sql = "delete Members where id = ? ";

            pst = conn.prepareStatement(sql);

            pst.setInt(1, id);

            pst.executeUpdate();

        sql = "select * from Members where parentid = " + id;

        //遍历子节点
        st = conn.createStatement();

        rs = st.executeQuery(sql);

        if (rs != null)
        {
            while(rs.next())
            {
                dgDel(conn, rs.getInt("id"));//递归调用
            }
        }

        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }
        finally
        {

            try
            {
            rs.close();
            }
            catch(Exception ex)
            {

            }

            try
            {
            pst.close();
            }
            catch(Exception ex)
            {

            }

            try
            {
            st.close();
            }
            catch(Exception ex)
            {

            }
        }

    }

    //删
    public int deleteDG(int id) throws Exception
    {
        int rtn = -1;

        Connection conn = DBHelper.getConnection();

        PreparedStatement pst = null;

        if (conn != null)
        {
            try
            {
                conn.setAutoCommit(false);//手动提交

            //递归级联删除
                dgDel(conn, id);

            conn.commit();
            }
            catch(Exception ex)
            {
                conn.rollback();

                throw ex;
            }
            finally
            {
                try
                {
            pst.close();
                }
                catch(Exception ex)
                {

                }
            conn.close();
            }
        }

        return rtn;
    }

    public ArrayList<Members> getList(int parentid) throws Exception
    {
        ArrayList<Members> rtn = null;

        Connection conn = DBHelper.getConnection();
        PreparedStatement pst = null;
        ResultSet rs = null;

        if (conn != null)
        {
            try
            {
            String sql = "select * from members  ";

            pst = conn.prepareStatement(sql);

            //pst.setInt(1, parentid);

            rs = pst.executeQuery();

            if (rs != null)
            {
                rtn = new ArrayList<Members>();

                while(rs.next())
                {
                    Members u = new Members();

                    u.setId(rs.getInt("id"));
                    u.setParentId(rs.getInt("parentid"));
                    u.setName(rs.getString("name"));
                    u.setPostCode(rs.getString("postcode"));

                    rtn.add(u);
                }
            }
            }
            catch(Exception ex)
            {
                throw ex;
            }
            finally
            {
                try
                {
                rs.close();
                }
                catch(Exception ex){}
            try
            {
            pst.close();
            }
            catch(Exception ex){}

            conn.close();
            }
        }

        return rtn;
    }

    public ArrayList<Members> getList(int parentid, int pagenum, int pagerows) throws Exception
    {
        ArrayList<Members> rtn = null;

        Connection conn = DBHelper.getConnection();
        PreparedStatement pst = null;
        ResultSet rs = null;

        if (conn != null)
        {
            try
            {
                int maxrows = pagenum * pagerows;

            String sql = "select * from (select t.*, rownum as rnum from (select * from MEMBERS where parentid = ? order by id desc) t where rownum <= ?) where rnum > ?";

            pst = conn.prepareStatement(sql);

            pst.setInt(1, parentid);
            pst.setInt(2, maxrows);
            pst.setInt(3, maxrows - pagerows);

            rs = pst.executeQuery();

            if (rs != null)
            {
                rtn = new ArrayList<Members>();

                while(rs.next())
                {
                    Members u = new Members();

                    u.setId(rs.getInt("id"));
                    u.setParentId(rs.getInt("parentid"));
                    u.setName(rs.getString("name"));
                    u.setPostCode(rs.getString("postcode"));

                    rtn.add(u);
                }
            }
            }
            catch(Exception ex)
            {
                throw ex;
            }
            finally
            {
                try
                {
                rs.close();
                }
                catch(Exception ex){}
            try
            {
            pst.close();
            }
            catch(Exception ex){}

            conn.close();
            }
        }

        return rtn;
    }

    //单条查询
    public Members getMembers(int id) throws Exception
    {
        Members rtn = null;

        //获取

        Connection conn = DBHelper.getConnection();
        PreparedStatement pst = null;
        ResultSet rs = null;

        if (conn != null)
        {
            try
            {
            String sql = "select * from Members where id = ?";

            pst = conn.prepareStatement(sql);

            pst.setInt(1, id);

            rs = pst.executeQuery();

            if (rs != null && rs.next())
            {

                    rtn = new Members();

                    rtn.setId(rs.getInt("id"));
                    rtn.setParentId(rs.getInt("parentid"));
                    rtn.setName(rs.getString("name"));
                    rtn.setPostCode(rs.getString("postcode"));

            }
            }
            catch(Exception ex)
            {
                throw ex;
            }
            finally
            {
                try
                {
                rs.close();
                }
                catch(Exception ex){}

            try
            {
            pst.close();
            }
            catch(Exception ex){}

            conn.close();
            }
        }

        return rtn;
    }

    //记录条数查询
    public int getCount(int parentid) throws Exception
    {
        int rtn = 0;

        //获取

        Connection conn = DBHelper.getConnection();
        PreparedStatement pst = null;
        ResultSet rs = null;

        if (conn != null)
        {
            try
            {
            String sql = "select count(1) as c from Members where parentid = ?";

            pst = conn.prepareStatement(sql);

            pst.setInt(1, parentid);

            rs = pst.executeQuery();

            if (rs != null && rs.next())
            {
                rtn = rs.getInt("c");
            }
            }
            catch(Exception ex)
            {
                throw ex;
            }
            finally
            {
                try
                {
                rs.close();
                }
                catch(Exception ex){}

            try
            {
            pst.close();
            }
            catch(Exception ex){}

            conn.close();
            }
        }

        return rtn;
    }

}

DAL

package com.haoqi;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hanqi.dao.MembersDAL;

/**
 * Servlet implementation class DeleteMembers
 */
@WebServlet("/DeleteMembers")
public class DeleteMembers extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
     * @see HttpServlet#HttpServlet()
     */
    public DeleteMembers() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        request.setCharacterEncoding("UTF-8");

        response.setContentType("text/html;charset=UTF-8");

        response.setCharacterEncoding("UTF-8");

        String json = "";

        String ids = request.getParameter("ids");

        if (ids != null && ids.trim().length() > 0)
        {

            String[] sid =  ids.split(",");

            MembersDAL md = new MembersDAL();

            try
            {
                for(String id : sid)        //遍历ID ,每遍历一个id就执行一次删除
                {
                    //执行删除
                    int iID = Integer.parseInt(id);            //转换类型

                    md.deleteDG(iID);        //执行删除

                }

                json = "{\"success\":true,\"message\":\"删除数据成功\"}";
            }
            catch (Exception e)
            {
                e.printStackTrace();

                json = "{\"success\":false,\"message\":\"删除数据失败\"}";
            }
        }
        else
        {
            json = "{\"success\":false,\"message\":\"请正确填写ID\"}";
        }

        response.getWriter().append(json);

    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
        doGet(request, response);
    }

}

Delete

时间: 2024-10-29 03:45:39

20150105的相关文章

无题20150105

我好累 累得颤抖 夕阳也倦了 打发晚风出来 温柔的从窗前吹过 我的眼神紧闭 只听见风在轻唱 云霞正美

[Everyday Mathematics]20150105

设 $f\in C^1(a,b)$ 适合 $$\bex \lim_{x\to a^+}f(x)=+\infty,\quad \lim_{x\to b^-}f(x)=-\infty, \eex$$ 并且 $$\bex f'(x)+f^2(x)\geq -1,\quad \forall\ x\in (a,b). \eex$$ 试证: $b-a\geq \pi$.

高效同步数据的方法及效率测试--边打包边压缩边传输边解压20150105

有些时候在备份或者同步有很多文件的大目录时(比如几个GB或者几十个GB的数据库目录.log目录),直接scp的话花费的时间较长,虽然可以采用先压缩再传输再解压的方法,传输的数据量确实减少了,但压缩和解压也会耗费很多的时间,总体效果也不令人满意,昨天晚上突发奇想,由于之前做过流媒体视频点播的项目的经验,如果能像看高清视频一样只需要下载完视频文件的metadata头就可以实现边下载边播放,即渐进式下载(http://baike.baidu.com/link?url=fTWQYBTqQr1BisysC

oracle delete 后的还原数据 靠谱

 一,查找大致时间点的SCN select timestamp_to_scn(to_timestamp('2015-01-05 21:20:00','yyyy-mm-dd hh24:mi:ss')) from dual; 二,查询被删除的数据,并还原 insert into ERP_FACILITY_MAP  select * from ERP_FACILITY_MAP as of scn 1603128909 select * from ERP_FACILITY_MAP

Robomongo简介

作者:zhanhailiang 日期:2015-01-05 简介 Robomongo是基于Shell的跨平台MongoDB管理工具.Robomongo与MongoDB之间的关系就相当于PHPMyAdmin与MySQL之间的关系. 特性 对MongoDB Shell的完美支持 Robomongo内置V8引擎来驱动mongo命令行工具,所以你通过mongo命令行工具的所有操作都可以通Robomongo来完成.其本身提供语法高亮,自动完成,并且支持不同的结果查询模式(文本,树,或表格),如下图: 注:

csdn发的好过分的和分

http://cli.im/vas/MQ507280uw0pr/20150105 http://cli.im/vas/FU507239ho2vf/20150105 http://cli.im/vas/DR507219kd2lb/20150105 http://cli.im/vas/IT507192td0xp/20150105 http://cli.im/vas/HM507166nt8ws/20150105 http://cli.im/vas/CU507137lp8yz/20150105 http

Pandas学习笔记,如何用列的值过滤行

通过tushare引入DataFrame d = ts.get_hist_data('600848', start='2015-01-05', end='2015-01-09') data = pd.DataFrame(d) print(data) print(data.ma5 > data.ma20) open high close low volume price_change p_change date 2015-01-09 11.68 11.71 11.23 11.19 44851.56

python自然语言处理1——从网络抓取数据

python自然语言处理1--从网络抓取数据 写在前面 本节学习python2.7 BeautifulSoup库从网络抽取数据的技术,检验之简而言之就是爬虫技术.网络编程是一门复杂的技术,在需要基础的地方,文中给出的链接地址,都是很好的教程,可以参考,我在这里不在重复发明轮子.本节的主旨在于: 帮助快速掌握基本爬虫技术,形成一条主线,能为自己的实验构造基础数据.掌握爬虫技术后,可以从网络抓取符合特定需求的数据供分析,这里学习的爬虫技术适用于数据挖掘.自然语言处理等需要从外部挖掘数据的学科. 1.

Strus2学习Exception处理集锦(一)

2015-01-05 同学用dom4j写的一个更改节点文本的方法爆出这样一个错误: 代码: for(Iterator itr=root.elementIterator();itr.hasNext();){ Element ele=(Element)itr.next(); System.out.println((Element)ele.element("name")==null); if(ele.element("name").getText().equals(nam