beans.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <!-- 读取jdbc.properties里的配置信息 -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:jdbc.properties</value>
</property>
</bean> <bean id="dataSource" destroy-method="close"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean> <!-- xml方式配置sessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingResources">
<list>
<value>com/anllin/usermgr/model/User.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
</props>
</property>
</bean> <!-- 开启事务管理 -->
<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean> <!-- spring事务的xml配置 ,建议使用-->
<aop:config>
<aop:pointcut id="bussinessService"
expression="execution(* com.anllin.usermgr.service..*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="bussinessService" />
</aop:config> <!-- 对不同的方法进行不同的事务管理 -->
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="get*" read-only="true"/>
<tx:method name="isExists*" read-only="true"/>
<tx:method name="*" propagation="REQUIRED" read-only="false" />
</tx:attributes>
</tx:advice> <!-- UserDaoImpl继承 HibernateDaoSupport,即可使用hibernateTemplate-->
<bean id="userDao" class="com.anllin.usermgr.dao.impl.UserDaoImpl">
<property name="sessionFactory" ref="sessionFactory"/>
</bean> <bean id="userService" class="com.anllin.usermgr.service.impl.UserServiceImpl">
<property name="userDao" ref="userDao"/>
</bean> <bean id="listUsersAction" class="com.anllin.usermgr.action.ListUserAction">
<property name="userService" ref="userService"/>
</bean> <bean id="addUserAction" class="com.anllin.usermgr.action.AddUserAction">
<property name="userService" ref="userService"/>
</bean> <bean id="deleteUserAction" class="com.anllin.usermgr.action.DeleteUserAction">
<property name="userService" ref="userService"></property>
</bean> <bean id="getUserAction" class="com.anllin.usermgr.action.GetUserAction">
<property name="userService" ref="userService"></property>
</bean> <bean id="updateUserAction" class="com.anllin.usermgr.action.UpdateUserAction">
<property name="userService" ref="userService"></property>
</bean>
</beans>

  

struts.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="registration" namespace="/" extends="struts-default">
<action name="listUser" class="listUsersAction">
<result name="success">/listUsers.jsp</result>
</action> <action name="addUser" class="addUserAction">
<result name="success" type="redirect">listUser.action</result>
</action> <action name="deleteUser" class="deleteUserAction">
<result name="success" type="redirect">listUser.action</result>
</action> <action name="getUser" class="getUserAction">
<result name="success">updateUser.jsp</result>
</action> <action name="updateUser" class="updateUserAction">
<result name="success" type="redirect">listUser.action</result>
</action>
</package> </struts>

  

jdbc.properties

jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc\:mysql\://localhost\:3306/usermgr
jdbc.username=root
jdbc.password=123

  

log4j.properties

#
# Hibernate, Relational Persistence for Idiomatic Java
#
# Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
# indicated by the @author tags or express copyright attribution
# statements applied by the authors. All third-party contributions are
# distributed under license by Red Hat Middleware LLC.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# Lesser General Public License, as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
# for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this distribution; if not, write to:
# Free Software Foundation, Inc.
# 51 Franklin Street, Fifth Floor
# Boston, MA 02110-1301 USA
# #log4j.rootLogger=info, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=warn, stdout #log4j.logger.org.hibernate=debug
#log4j.logger.org.hibernate.test=info
### log schema export/update ###
log4j.logger.org.hibernate.tool.hbm2ddl=debug
#log4j.logger.org.hibernate.sql.ordering.antlr.OrderByFragmentTranslator=trace
#log4j.logger.org.hibernate.ejb=debug
#log4j.logger.org.hibernate.ejb.packaging=debug
#log4j.logger.org.hibernate.reflection=debug #log4j.logger.org.hibernate.hql.ast.QueryTranslatorImpl=trace
#log4j.logger.org.hibernate.hql.ast.HqlSqlWalker=trace
#log4j.logger.org.hibernate.hql.ast.SqlGenerator=trace
#log4j.logger.org.hibernate.hql.ast.AST=trace
#log4j.logger.org.hibernate.type.descriptor.sql.BasicBinder=trace
#log4j.logger.org.hibernate.type.BasicTypeRegistry=trace #log4j.logger.org.hibernate.engine.Cascades=debug
#log4j.logger.org.hibernate.hql=debug ### log just the SQL
#log4j.logger.org.hibernate.SQL=debug ### log JDBC bind parameters ###
#log4j.logger.org.hibernate.type=info
#log4j.logger.org.hibernate.type=trace ### log HQL parse trees
#log4j.logger.org.hibernate.hql=debug ### log cache activity ###
#log4j.logger.org.hibernate.cache=debug ### log JDBC resource acquisition
#log4j.logger.org.hibernate.jdbc=debug ### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace #log4j.logger.org.jgroups=info
#log4j.logger.org.jboss.cache=trace
#log4j.logger.org.jboss.cache.RegionManager=info
#log4j.logger.org.jboss.cache.lock=info
#log4j.logger.org.jboss.cache.interceptors.PessimisticLockInterceptor=info
#log4j.logger.org.jboss.cache.interceptors.UnlockInterceptor=info

  

AddUserAction.java

package com.anllin.usermgr.action;

import com.anllin.usermgr.model.User;
import com.anllin.usermgr.service.UserService;
import com.opensymphony.xwork2.ActionSupport; public class AddUserAction extends ActionSupport
{
private User user;
private UserService userService; public User getUser()
{
return user;
} public void setUser(User user)
{
this.user = user;
} public UserService getUserService()
{
return userService;
} public void setUserService(UserService userService)
{
this.userService = userService;
} @Override
public String execute() throws Exception
{
if(user != null)
{
this.userService.add(user);
}
return SUCCESS;
}
}

  

DeleteUserAction.java

package com.anllin.usermgr.action;

import org.apache.struts2.ServletActionContext;

import com.anllin.usermgr.service.UserService;
import com.opensymphony.xwork2.ActionSupport; public class DeleteUserAction extends ActionSupport
{
private int id; private UserService userService; public UserService getUserService()
{
return userService;
} public void setUserService(UserService userService)
{
this.userService = userService;
} @Override
public String execute() throws Exception
{
id = Integer.parseInt(ServletActionContext.getRequest().getParameter("id").trim());
if (id > 0)
{
userService.deleteById(id);
}
return SUCCESS;
}
}

  

GetUserAction.java

package com.anllin.usermgr.action;

import org.apache.struts2.ServletActionContext;

import com.anllin.usermgr.model.User;
import com.anllin.usermgr.service.UserService;
import com.opensymphony.xwork2.ActionSupport; public class GetUserAction extends ActionSupport
{
private User user;
private UserService userService;
public User getUser()
{
return user;
}
public void setUser(User user)
{
this.user = user;
}
public UserService getUserService()
{
return userService;
}
public void setUserService(UserService userService)
{
this.userService = userService;
} @Override
public String execute() throws Exception
{
int id = Integer.valueOf(ServletActionContext.getRequest().getParameter("id").trim());
if(id >= 0)
{
this.user = userService.getById(id);
} ServletActionContext.getRequest().setAttribute("user",user); return SUCCESS;
}
}

  

ListUserAction.java

package com.anllin.usermgr.action;

import java.util.List;

import org.apache.struts2.ServletActionContext;

import com.anllin.usermgr.model.User;
import com.anllin.usermgr.service.UserService;
import com.opensymphony.xwork2.ActionSupport; public class ListUserAction extends ActionSupport
{
private List<User> users;
private UserService userService; public List<User> getUsers()
{
return users;
} public void setUsers(List<User> users)
{
this.users = users;
} public UserService getUserService()
{
return userService;
} public void setUserService(UserService userService)
{
this.userService = userService;
} @Override
public String execute() throws Exception
{
users = userService.getAll();
ServletActionContext.getContext().getSession().put("users",users);
return SUCCESS;
}
}

  

UpdateUserAction.java

package com.anllin.usermgr.action;

import com.anllin.usermgr.model.User;
import com.anllin.usermgr.service.UserService;
import com.opensymphony.xwork2.ActionSupport; public class UpdateUserAction extends ActionSupport
{
private User user;
private UserService userService;
public User getUser()
{
return user;
}
public void setUser(User user)
{
this.user = user;
}
public UserService getUserService()
{
return userService;
}
public void setUserService(UserService userService)
{
this.userService = userService;
} @Override
public String execute() throws Exception
{
if(user != null)
{
userService.update(user);
}
return super.execute();
}
}

  

UserDao.java

package com.anllin.usermgr.dao;

import java.util.List;

import com.anllin.usermgr.model.User;

public interface UserDao
{
void add(User user);
void update(User user);
void delete(User user);
void deleteById(int id);
User getById(int id);
List<User> getByName(String username);
List<User> getAll();
}

  

UserDaoImpl.java

package com.anllin.usermgr.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.anllin.usermgr.dao.UserDao;
import com.anllin.usermgr.model.User; public class UserDaoImpl extends HibernateDaoSupport implements UserDao
{
@Override
public void add(User user)
{
this.getHibernateTemplate().save(user);
} @Override
public void delete(User user)
{
this.getHibernateTemplate().delete(user);
} @Override
public void deleteById(int id)
{
User user = (User)this.getHibernateTemplate().get(User.class,id);
delete(user);
} @SuppressWarnings("unchecked")
@Override
public List<User> getAll()
{
return (List<User>)this.getHibernateTemplate().find("from User");
} @Override
public User getById(int id)
{
return (User)this.getHibernateTemplate().get(User.class,id);
} @SuppressWarnings("unchecked")
@Override
public List<User> getByName(String username)
{
List<User> users = (List<User>)this.getHibernateTemplate().find("from User as u where u.username=?",username); return users;
} @Override
public void update(User user)
{
this.getHibernateTemplate().update(user);
} }

  

User.java

package com.anllin.usermgr.model;

import java.sql.Date;

public class User
{
private int id;
private String username;
private String password;
private int age;
private Date birthday; public int getId()
{
return id;
} public void setId(int id)
{
this.id = id;
} public String getUsername()
{
return username;
} public void setUsername(String username)
{
this.username = username;
} public String getPassword()
{
return password;
} public void setPassword(String password)
{
this.password = password;
} public int getAge()
{
return age;
} public void setAge(int age)
{
this.age = age;
} public Date getBirthday()
{
return birthday;
} public void setBirthday(Date birthday)
{
this.birthday = birthday;
} }

  

User.hbm.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping>
<class name="com.anllin.usermgr.model.User" dynamic-update="true" dynamic-insert="true">
<id name="id" column="id" type="integer">
<generator class="native"/>
</id>
<property name="username" type="string">
<column name="username" length="20"/>
</property>
<property name="password" type="string">
<column name="password" length="20"/>
</property>
<property name="age" type="integer">
<column name="age"/>
</property>
<property name="birthday" type="date">
<column name="birthday"/>
</property>
</class>
</hibernate-mapping>

  

UserService.java

package com.anllin.usermgr.service;

import java.util.List;

import com.anllin.usermgr.model.User;

public interface UserService
{
void add(User user);
void update(User user);
void delete(User user);
void deleteById(int id);
User getById(int id);
List<User> getByName(String username);
List<User> getAll();
boolean isExistsUser(String username);
}

  

UserServiceImpl.java

package com.anllin.usermgr.service.impl;

import java.util.List;

import com.anllin.usermgr.dao.UserDao;
import com.anllin.usermgr.model.User;
import com.anllin.usermgr.service.UserService; public class UserServiceImpl implements UserService
{
private UserDao userDao; public UserDao getUserDao()
{
return userDao;
} public void setUserDao(UserDao userDao)
{
this.userDao = userDao;
} @Override
public void add(User user)
{
this.userDao.add(user);
} @Override
public void delete(User user)
{
this.userDao.delete(user);
} @Override
public void deleteById(int id)
{
this.userDao.deleteById(id);
} @Override
public List<User> getAll()
{
return this.userDao.getAll();
} @Override
public User getById(int id)
{
return this.userDao.getById(id);
} @Override
public List<User> getByName(String username)
{
return this.userDao.getByName(username);
} @Override
public boolean isExistsUser(String username)
{
List<User> users = getByName(username);
if(users != null && users.size() > 0)
{
return true;
}
return false;
} @Override
public void update(User user)
{
this.userDao.update(user);
} }

  

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list> <filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter> <filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:beans.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener> </web-app>

  

addUser.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>Add User</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<style type="text/css">
h1
{
color:blue;
}
</style>"
</head> <body>
<h1>Add User</h1>
<s:form action="addUser.action" theme="simple">
username: <s:textfield name="user.username"/><br/>
password: <s:password name="user.password"/><br/>
age: <s:textfield name="user.age"/><br/>
birthday: <s:textfield name="user.birthday"/><br/>
<s:submit value="submit"/>
</s:form>
</body>
</html>

  

index.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>"> <title>User Manager</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache"> <style type="text/css">
body
{
font-family:Courial new,sans-serif;
font-size: 16px;
}
div
{
margin:0 auto;
text-align: center;
background: window;
}
div h1
{
color:Blue;
}
div a:link
{
color:blue;
}
div a:hover
{
color:red;
font-size:18px;
font-weight: bold;
font-style: italic;
} </style>
</head> <body>
<div>
<h1>User Manager</h1><br/><br/><br/>
<s:a href="listUser.action">Show All Users</s:a><br/><br/><br/>
<s:a href="addUser.jsp">Add a New User</s:a><br/>
</div>
</body>
</html>

  

listUsers.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>List All Users</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<style type="text/css">
table
{
border-collapse: collapse;
}
table tr th
{
background: MediumSlateBlue;
color: white;
}
table tr td
{
border:1px solid black;
background: AliceBlue;
}
h1
{
color:blue;
}
</style>
</head> <body>
<h1 align="center">List All Users</h1>
<table align="center" width="80%">
<tr>
<th>username</th>
<th>password</th>
<th>age</th>
<th>birthday</th>
<th>update</th>
<th>delete</th>
</tr>
<s:iterator value="%{#session.users}">
<tr>
<td>
<s:property value="username"/>
</td>
<td>
<s:property value="password"/>
</td>
<td>
<s:property value="age"/>
</td>
<td>
<s:property value="birthday"/>
</td>
<td>
<s:a href="getUser.action?id=%{#this.id}">update</s:a>
</td>
<td>
<s:a href="deleteUser.action?id=%{#this.id}">delete</s:a>
</td>
</tr>
</s:iterator>
</table>
</body>
</html>

  

updateUser.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>Update User</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache"> <STYLE type="text/css">
h1
{
color: blue;
}
</STYLE>
</head> <body>
<h1>Update User</h1>
<s:form action="updateUser.action" theme="simple">
<s:hidden name="user.id" value="%{#request.user.id}"></s:hidden>
username: <s:textfield name="user.username" value="%{#request.user.username}"/><br/>
password: <s:textfield name="user.password" value="%{#request.user.password}"/><br/>
age: <s:textfield name="user.age" value="%{#request.user.age}"/><br/>
birthday: <s:textfield name="user.birthday" value="%{#request.user.birthday}"/><br/>
<s:submit value="sumbit changed"></s:submit>
</s:form>
<s:debug></s:debug>
</body>
</html>

SSH使用总结(xml配置)的更多相关文章

  1. SSH框架,xml配置实现动态定时器

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-// ...

  2. SSH项目web.xml文件的常用配置【struts2的过滤器、spring监听器、解决Hibernate延迟加载问题的过滤器、解决中文乱码的过滤器】

    配置web.xml(struts2的过滤器.spring监听器.解决Hibernate延迟加载问题的过滤器.解决中文乱码的过滤器) <!-- 解决中文乱码问题 --> <filter ...

  3. java web.xml配置详解(转)

    源出处:java web.xml配置详解 1.常规配置:每一个站的WEB-INF下都有一个web.xml的设定文件,它提供了我们站台的配置设定. web.xml定义: .站台的名称和说明 .针对环境参 ...

  4. 转:web.xml 配置中classpath: 与classpath*:的区别

    原文链接:web.xml 配置中classpath: 与classpath*:的区别 引用自:http://blog.csdn.net/wxwzy738/article/details/1698393 ...

  5. Spring 入门 web.xml配置详解

    Spring 入门 web.xml配置详解 https://www.cnblogs.com/cczz_11/p/4363314.html https://blog.csdn.net/hellolove ...

  6. Maven settings.xml配置详解

    首先:Maven中央仓库的搜索全部公共jar包的地址是,http://search.maven.org/ ===Maven基础-默认中央仓库============================== ...

  7. Mybatis XML配置

    Mybatis常用带有禁用缓存的XML配置 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE ...

  8. SpringMvc的xml配置与annotation配置的例子的区别

    1.导入jar包时,要在xml配置基础上加 spring-aop-4.2.2.RELEASE.jar (注解的时候需要) 2.编写controller的时候要annotation需要做相关配置即红色部 ...

  9. Hibernate实现有两种配置,xml配置与注释配置

    hibernate实现有两种配置,xml配置与注释配置. (1):xml配置:hibernate.cfg.xml (放到src目录下)和实体配置类:xxx.hbm.xml(与实体为同一目录中) < ...

随机推荐

  1. CSS 3 中的多列属性

    .column-count <!DOCTYPE html> <html> <head> <meta charset="utf-8"> ...

  2. FAQ | 是什么导致MySQL数据库服务器磁盘I/O高(本文章来自知数堂)

    FAQ | 是什么导致MySQL数据库服务器磁盘I/O高 2016-12-26 叶金荣 老叶茶馆 0.导读 有个MySQL服务器的磁盘I/O总有过高报警,怎么回事? 本文约1500字,阅读时间约10分 ...

  3. [POI2009]Lyz

    Description 初始时滑冰俱乐部有1到n号的溜冰鞋各k双.已知x号脚的人可以穿x到x+d的溜冰鞋. 有m次操作,每次包含两个数ri,xi代表来了xi个ri号脚的人.xi为负,则代表走了这么多人 ...

  4. truncate delete 与 drop的区别

    一张表几亿条数据.根据task_id删除几千万. delete删除后查询,发现查询速度还是没有变快.explain查看 rows并没有发生变化.查询速度肯定也不会变化.原因? truncate del ...

  5. windows系统下载地址大全&大白菜下载和教程

    win10的 Windows10 64位纯净系统下载(不建议,后面的有原版) http://cjxt.sysdaa.com/down.php?post=win10-64&action=bend ...

  6. 统计mysql数据库中数据表/字段等数量的sql

    1.查询一个表中有多少个字段: SELECT COUNT(*) FROM information_schema. COLUMNSWHERE table_schema = '数据库名'AND table ...

  7. javascript onclick 函数不执行

    今天被这个问题搞伤了. 原本是要给table中的元素添加onclick事件处理函数,刚开始还可以,后来就不行了,百试不得其解,反复检查,程序也没问题,耗了一个多小时,偏偏我就不信电脑会扯拐,就要看看还 ...

  8. NumPy来自现有数据的数组

    NumPy - 来自现有数据的数组 这一章中,我们会讨论如何从现有数据创建数组. numpy.asarray 此函数类似于numpy.array,除了它有较少的参数. 这个例程对于将 Python 序 ...

  9. elsevier 与 springer 投稿区别

    http://emuch.net/bbs/viewthread.php?tid=5369913

  10. 如何用VC编写供PB调用的DLL

    和编写一般的DLL方法相同,需要注意以下两点: (1)调用约定 c函数有_stdcall._cdecl._fastcall等多种调用约定,调用约定用来说明函数参数的压栈顺序和由谁(函数自身还是调用者) ...