Junit测试Spring应用Dubbo测试框架之-Excel 工具类
- package com.tree.autotest.demo;
- import com.alibaba.fastjson.JSON;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Test;- import java.io.*;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;- /**
* 规则包:
* 规则编码:
* 规则名称:
* 规则条件:
* <p/>
*/
public class ExcelHandle {- /**
* 将时间毫秒数转换成:yyyy-MM-dd HH:mm:ss 格式的字符串
* @param longtime
* @return
*/
public static String getTimeByLongTime(long longtime){
Date dat=new Date(longtime);
GregorianCalendar gc = new GregorianCalendar();
gc.setTime(dat);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String sb=format.format(gc.getTime());
return sb;
}- /**
*
* @param timeStr 类似于:Tue Mar 03 00:00:00 CST 2015 这样的时间字符串
* @return
*/
public static String getTimeByLongTime(String timeStr){
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
Date time = null;
try {
time = sdf.parse (timeStr);
} catch (ParseException e) {
e.printStackTrace();
}
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String sb=format.format(time);
return sb;
}
/**
* 通过map转成
* @param testcaselist 所有TC
* @param componentName
* @param excelIndex
* @return
*/
public static String requestJsonStrByMap(Map<String, ArrayList<String>> testcaselist,String componentName,int excelIndex){
String requestJsonStr = null;
try{
Map<String, String> paramMap= getTestCaseMap(testcaselist,excelIndex);
Map<String, Object> reqMap = new HashMap<String, Object>();- reqMap.put("name", componentName);
reqMap.put("session", paramMap);
requestJsonStr = JSON.toJSONString(reqMap, true);
}catch(Exception e){
}
return requestJsonStr;
}- /**
* 通过map转成
* @param componentName
* @param excelPath
* @param excelIndex
* @return
*/
public static String requestJsonStrByMap(String excelPath,String componentName,int excelIndex){
String requestJsonStr = null;
try{
Map<String, String> paramMap= getTestCaseMap(excelPath,excelIndex);- Map<String, Object> reqMap = new HashMap<String, Object>();
- reqMap.put("name", componentName);
reqMap.put("session", paramMap);
requestJsonStr = JSON.toJSONString(reqMap, true);
}catch(Exception e){
}
return requestJsonStr;
}- /**
* 通过字符串拼接的方式组合成json
* @param componentName
* @param excelPath
* @param excelIndex
* @return
*/
public static String requestJsonStrByStr(String excelPath,String componentName,int excelIndex){
StringBuilder sb = new StringBuilder("{\"name\":\""+componentName+"\",");
String tcJsonStr = getTestCaseJsonStr(excelPath,excelIndex);
sb.append("\"session\":");
sb.append(tcJsonStr);
return sb.append("}").toString();
}- /**
* 将TC的入参以Map形式返回(不包含预期值)
* @param testcaselist 所有TC
* @param excelIndex
* @return
*/
private static Map<String, String> getTestCaseMap(Map<String, ArrayList<String>> testcaselist,int excelIndex){
try{
if(excelIndex <= 1) throw new Exception("输入的excel行号必须大于1");
ArrayList<String> clNames = testcaselist.get("1");// 列名
ArrayList<String> paramValues = new ArrayList<String>();
paramValues = testcaselist.get(excelIndex + "");
Map<String, String> paramMap= new HashMap<String, String>();
for (int i = 1; i < clNames.size(); i++) {//除去首例:用例名称
paramMap.put(clNames.get(i), paramValues.get(i));
}
paramMap.remove("预期值");//除去最后一列:预期值
paramMap.remove("实际值");//除去最后一列:实际值
return paramMap;
}catch(Exception e){
return null;
}
}- /**
* 将TC的入参以Map形式返回(不包含预期值)
* @param excelPath
* @param excelIndex
* @return
*/
private static Map<String, String> getTestCaseMap(String excelPath,int excelIndex){
try{
if(excelIndex <= 1) throw new Exception("输入的excel行号必须大于1");
Map<String, ArrayList<String>> testcaselist = ReadXlsx_2(excelPath);
ArrayList<String> clNames = testcaselist.get("1");// 列名
ArrayList<String> paramValues = new ArrayList<String>();
paramValues = testcaselist.get(excelIndex + "");
Map<String, String> paramMap= new HashMap<String, String>();
for (int i = 1; i < clNames.size(); i++) {//除去首例:用例名称
paramMap.put(clNames.get(i), paramValues.get(i));
}
paramMap.remove("预期值");//除去最后一列:预期值
return paramMap;
}catch(Exception e){
return null;
}
}
/**
* 将TC的入参以JsonStr形式返回(不包含预期值)
* @param excelPath excelpath文件路径
* @param excelIndex excel行号 PS:要大于1,因为1是列名
* @return
*/
public static String getTestCaseJsonStr(String excelPath,int excelIndex){
String jsonText = null;
try {
Map<String, String> paramMap= getTestCaseMap(excelPath, excelIndex);
jsonText = JSON.toJSONString(paramMap, true);
} catch (Exception e) {
e.printStackTrace();
}
return jsonText;
}- /**
* 获取某个TC的预期值,默认预期值的列名是:预期值
* @param testcaselist 所有TC
* @param excelIndex
* @return
*/
public static String getExpectedValue(Map<String, ArrayList<String>> testcaselist,int excelIndex){
String expectedValue = null;
try {
if(excelIndex <= 1) throw new Exception("输入的excel行号必须大于1");
ArrayList<String> clNames = testcaselist.get("1");// 列名
ArrayList<String> paramValues = new ArrayList<String>();
paramValues = testcaselist.get(excelIndex + "");
Map<String, String> paramMap= new HashMap<String, String>();
for (int i = 1; i < clNames.size(); i++) {//除去用例名称
paramMap.put(clNames.get(i), paramValues.get(i));
}
expectedValue = paramMap.get("预期值");
} catch (Exception e) {
e.printStackTrace();
}
return expectedValue;
}- /**
* 获取某个TC的预期值,默认预期值的列名是:预期值
* @param excelPath
* @param excelIndex
* @return
*/
public static String getExpectedValue(String excelPath,int excelIndex){
String expectedValue = null;
try {
if(excelIndex <= 1) throw new Exception("输入的excel行号必须大于1");
Map<String, ArrayList<String>> testcaselist = ReadXlsx_2(excelPath);
ArrayList<String> clNames = testcaselist.get("1");// 列名
ArrayList<String> paramValues = new ArrayList<String>();
paramValues = testcaselist.get(excelIndex + "");
Map<String, String> paramMap= new HashMap<String, String>();
for (int i = 1; i < clNames.size(); i++) {//除去用例名称
paramMap.put(clNames.get(i), paramValues.get(i));
}
expectedValue = paramMap.get("预期值");
} catch (Exception e) {
e.printStackTrace();
}
return expectedValue;
}
/**
* 获取某个TC的预期值,默认预期值的列名是:预期值
* @param excelPath
* @param excelIndex
* @param expectedValueColName 预期值的列名
* @return
*/
public static String getExpectedValue(String excelPath,int excelIndex,String expectedValueColName){
String expectedValue = null;
try {
if(excelIndex <= 1) throw new Exception("输入的excel行号必须大于1");
Map<String, ArrayList<String>> testcaselist = ReadXlsx_2(excelPath);
ArrayList<String> clNames = testcaselist.get("1");// 列名
ArrayList<String> paramValues = new ArrayList<String>();
paramValues = testcaselist.get(excelIndex + "");
Map<String, String> paramMap= new HashMap<String, String>();
for (int i = 1; i < clNames.size(); i++) {//除去用例名称
paramMap.put(clNames.get(i), paramValues.get(i));
}
expectedValue = paramMap.get(expectedValueColName);
} catch (Exception e) {
e.printStackTrace();
}
return expectedValue;
}- /**
* 获取第一个Sheet
*
* @param filePath
* @return
*/
private static XSSFSheet getSheet(String filePath) {
File file = new File(filePath);
XSSFSheet xssfSheet = null;
try {
OPCPackage opcPackage = OPCPackage.open(file);
XSSFWorkbook xssfWorkbook = new XSSFWorkbook(opcPackage);
xssfSheet = xssfWorkbook.getSheetAt(0);
} catch (Exception e) {
e.printStackTrace();
}
return xssfSheet;
}- /**
* 获每列的列名(即sheet的第一列)
*
* @param xssfSheet
* @return
*/
private static ArrayList<String> getColumnName(XSSFSheet xssfSheet) {
XSSFRow row_1 = xssfSheet.getRow(0);
ArrayList<String> colsName = new ArrayList<String>();
int lieNum = row_1.getPhysicalNumberOfCells();- for (int t = 0; t < lieNum; t++) {
colsName.add(row_1.getCell(t).getStringCellValue());
}
return colsName;
}- /**
* 读取测试用例excel文件,将所有的case保存在map中,以行号为key,从1开始包括第一行
* @param filePath
* @return
* @throws InvalidFormatException
* @throws IOException
*/
public static Map<String, ArrayList<String>> ReadXlsx_2(String filePath)
throws InvalidFormatException, IOException {
// XSSFSheet xssfSheet = getSheet(filePath);
//
// int totalRows = xssfSheet.getPhysicalNumberOfRows();// 得到总行数
// int rowstart = xssfSheet.getFirstRowNum();
// int rowEnd = xssfSheet.getLastRowNum();
// ////////////// 获取每列名称//////////////
// ArrayList<String> lieName = getColumnName(xssfSheet);
// int lieNum = lieName.size();
// ////////////////////////////
// Map<String, ArrayList<String>> testcaselist = new HashMap<String, ArrayList<String>>();
// for (int i = rowstart; i <= rowEnd; i++)// 获取每一行即一个TC(包括第一行)
// {
// XSSFRow row = xssfSheet.getRow(i);
// if (null == row)
// continue;
// ArrayList<String> paramValues = new ArrayList<String>();
// for (int t = 0; t < lieNum; t++) { // 获取每一列的值
//// String cellValue = "";
//// try {
//// cellValue = row.getCell(t).getStringCellValue();
//// } catch (Exception e) {
//// if ("Cannot get a text value from a numeric cell".equals(e.getMessage())) {
//// cellValue = (int)row.getCell(t).getNumericCellValue() + "";
//// }
//// }
//// paramValues.add(cellValue);
//
// String cellValue = "";
// XSSFCell cell = row.getCell(t);
// if (null == cell){
// paramValues.add("");
// continue;
// }
// switch (cell.getCellType()) {
// case HSSFCell.CELL_TYPE_NUMERIC: // 数字
//
// if (HSSFDateUtil.isCellDateFormatted(cell)) {
// long longtime = Math.round(cell.getNumericCellValue());
// cellValue = getTimeByLongTime(longtime);//将时间毫秒数转换成:yyyy-MM-dd HH:mm:ss 格式的字符串
// } else {
// double tempValue = cell.getNumericCellValue();
// long longVal = Math.round(tempValue);
// if (Double.parseDouble(longVal + ".0") == tempValue)
// cellValue = longVal + ""; //整数
// else
// cellValue = tempValue + "";//小数
// }
// paramValues.add(cellValue);
// break;
// case HSSFCell.CELL_TYPE_STRING: // 字符串
// cellValue = cell.getStringCellValue();
// paramValues.add(cellValue);
// break;
// case HSSFCell.CELL_TYPE_BOOLEAN: // Boolean
// cellValue = cell.getBooleanCellValue()+"";
// paramValues.add(cellValue);
// break;
// case HSSFCell.CELL_TYPE_FORMULA: // 公式
// cellValue = cell.getCellFormula()+"";
// paramValues.add(cellValue);
// break;
// case HSSFCell.CELL_TYPE_BLANK: // 空值
// cellValue = cell.getCellFormula()+"";
// paramValues.add(cellValue);
// break;
// case HSSFCell.CELL_TYPE_ERROR: // 故障
// cellValue = "";
// paramValues.add(cellValue);
// break;
// default:
// System.out.print("未知类型 ");
// cellValue = "";
// paramValues.add(cellValue);
// break;
// }// switch结束
// }
// String key = (i + 1) + "";// 以行号为key,从0开始
// testcaselist.put(key, paramValues);
// }
// return testcaselist;- Map<String, ArrayList<String>> testcaselist = new HashMap<String, ArrayList<String>>();
File file = new File(filePath);
try {
OPCPackage opcPackage = OPCPackage.open(file);
XSSFWorkbook xssfWorkbook = new XSSFWorkbook(opcPackage);
testcaselist = ReadXlsx_2(xssfWorkbook);
} catch (Exception e) {
e.printStackTrace();
}
return testcaselist;
}- /**
* 读取测试用例excel文件,将所有的case保存在map中,以行号为key,从1开始包括第一行
* @param wb excel工作簿
* @return
* @throws InvalidFormatException
* @throws IOException
*/
public static Map<String, ArrayList<String>> ReadXlsx_2(XSSFWorkbook wb)
throws InvalidFormatException, IOException {
XSSFSheet xssfSheet = wb.getSheetAt(0);//getSheet(filePath);- int totalRows = xssfSheet.getPhysicalNumberOfRows();// 得到总行数
int rowstart = xssfSheet.getFirstRowNum();
int rowEnd = xssfSheet.getLastRowNum();
////////////// 获取每列名称//////////////
ArrayList<String> lieName = getColumnName(xssfSheet);
int lieNum = lieName.size();
////////////////////////////
Map<String, ArrayList<String>> testcaselist = new HashMap<String, ArrayList<String>>();
for (int i = rowstart; i <= rowEnd; i++)// 获取每一行即一个TC(包括第一行)
{
XSSFRow row = xssfSheet.getRow(i);
if (null == row)
continue;
ArrayList<String> paramValues = new ArrayList<String>();
for (int t = 0; t < lieNum; t++) { // 获取每一列的值
// String cellValue = "";
// try {
// cellValue = row.getCell(t).getStringCellValue();
// } catch (Exception e) {
// if ("Cannot get a text value from a numeric cell".equals(e.getMessage())) {
// cellValue = (int)row.getCell(t).getNumericCellValue() + "";
// }
// }
// paramValues.add(cellValue);- String cellValue = "";
XSSFCell cell = row.getCell(t);
if (null == cell){
paramValues.add("");
continue;
}
switch (cell.getCellType()) {
case HSSFCell.CELL_TYPE_NUMERIC: // 数字- if (HSSFDateUtil.isCellDateFormatted(cell)) {
- String timeStr =cell.getDateCellValue().toString();
- long longtime = Math.round(cell.getNumericCellValue());
cellValue = getTimeByLongTime(timeStr);//将时间毫秒数转换成:yyyy-MM-dd HH:mm:ss 格式的字符串
} else {
double tempValue = cell.getNumericCellValue();
long longVal = Math.round(tempValue);
if (Double.parseDouble(longVal + ".0") == tempValue)
cellValue = longVal + ""; //整数
else
cellValue = tempValue + "";//小数
}
paramValues.add(cellValue);
break;
case HSSFCell.CELL_TYPE_STRING: // 字符串
cellValue = cell.getStringCellValue();
paramValues.add(cellValue);
break;
case HSSFCell.CELL_TYPE_BOOLEAN: // Boolean
cellValue = cell.getBooleanCellValue()+"";
paramValues.add(cellValue);
break;
case HSSFCell.CELL_TYPE_FORMULA: // 公式
cellValue = cell.getCellFormula()+"";
paramValues.add(cellValue);
break;
case HSSFCell.CELL_TYPE_BLANK: // 空值
// cellValue = cell.getCellFormula()+"";
cell.setCellValue("");
// cellValue = cell.getCellFormula()+"";
paramValues.add("");
break;
case HSSFCell.CELL_TYPE_ERROR: // 故障
cellValue = "";
paramValues.add(cellValue);
break;
default:
System.out.print("未知类型 ");
cellValue = "";
paramValues.add(cellValue);
break;
}// switch结束
}
String key = (i + 1) + "";// 以行号为key,从0开始
testcaselist.put(key, paramValues);
}
return testcaselist;
}- public static InputStream loadExcel(String filePath){
InputStream myxlsx = null;
try {
myxlsx = new FileInputStream(filePath);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return myxlsx;
}- public static XSSFWorkbook getWorkBook(String myxlsName){
XSSFWorkbook wb = null;
try {
wb = new XSSFWorkbook(loadExcel(myxlsName));
} catch (IOException e) {
e.printStackTrace();
}
return wb;
}- /**
* 修改指定单元格的内容
* @param myxls 以流的形式,先读excel的内容
* @param rowNum 单元格的行号,从0开始
* @param colNum 单元格的列号,从0开始
* @param cellContext 向指定单元格写入的内容
* @return
*/
public static boolean writeExcel(String myxls,int rowNum,int colNum,String cellContext){
XSSFWorkbook wb = getWorkBook(myxls);
XSSFSheet xssfSheet = null;
if(xssfSheet == null) xssfSheet = wb.getSheetAt(0);
try {
XSSFRow row = xssfSheet.getRow(rowNum);
if(row == null) throw new Exception("该sheet中不存在"+rowNum+"行");
XSSFCell cell = row.getCell(colNum);
if(cell == null) cell = row.createCell(colNum);//throw new Exception("该sheet中不存在"+rowNum+"行,"+colNum+"列");
cell.setCellValue("");
cell.setCellValue(cellContext);
FileOutputStream fileOut = null;
try{
fileOut = new FileOutputStream(myxls);
wb.write(fileOut);
}finally {
try {
fileOut.close();
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}
/*
++++++++++++++++++++++++++++++++++++++++++++数据驱动模块相关+++++++++++++++++++++++++++++++
*/
/**
* TestNG 参数化方法,
* @param fileName excel文件路径
* @param sheetName sheet名称
* @return:返回二维数组对象,HashMap类型,列名(参数名称)为Key值,每行参数值为value。
*/- public static Object[][] readXlsx(String fileName, String sheetName) throws IOException {
XSSFWorkbook xssfWorkbook = new XSSFWorkbook(fileName);
XSSFSheet xssfSheet = xssfWorkbook.getSheet(sheetName);- int totalRow = xssfSheet.getLastRowNum(); //文件最大行数
int totalColumn = xssfSheet.getRow(0).getLastCellNum(); //表头最大列数- // 为了返回值是Object[][],定义一个多行单列的二维数组
HashMap<String, String>[][] arr = new HashMap[totalRow][1];- // 对数组中所有元素hashmap进行初始化,除去header那行
if (totalRow > 1) {
for (int i = 0; i < totalRow; i++) {
arr[i][0] = new HashMap<String, String>();
}
} else {
System.out.println("excel中没有数据");
}- //获取表头内容
ArrayList<String> header = new ArrayList<String>();
for (int c = 0; c < totalColumn; c++) {
String cellValue = ExcelHandle.getCellValue(xssfSheet.getRow(0).getCell(c));
header.add(cellValue);
// System.out.println("###" + cellValue);
}- // 循环行Row
for (int rowNum = 1; rowNum <=totalRow; rowNum++) {
XSSFRow xssfRow = xssfSheet.getRow(rowNum);
if (xssfRow == null) {
continue;
}
// 循环列Column
for (int columnNum = 0; columnNum < totalColumn; columnNum++) {
XSSFCell xssfCell = xssfRow.getCell(columnNum);
if (xssfCell != null) {
String cellValue = ExcelHandle.getCellValue(xssfSheet.getRow(rowNum).getCell(columnNum));
arr[rowNum - 1][0].put(header.get(columnNum), cellValue);
System.out.print(" " + getCellValue(xssfSheet.getRow(rowNum).getCell(columnNum)));
continue;
}
}
}
return arr;
}- /**
* 取表格值
* @param xssfCell XSSFCell类型对象,表示单元格。
* @return:返回单元格数值
*/- public static String getCellValue(XSSFCell xssfCell) {
if (xssfCell.getCellType() == xssfCell.CELL_TYPE_BOOLEAN) {
return String.valueOf(xssfCell.getBooleanCellValue());
} else if (xssfCell.getCellType() == xssfCell.CELL_TYPE_NUMERIC) {
return new BigDecimal(xssfCell.getNumericCellValue()).toPlainString();
// return String.valueOf(xssfCell.getNumericCellValue());
} else {
return String.valueOf(xssfCell.getStringCellValue());
}
}- @Test
public void testExcelReader() throws IOException {
String file = "src/main/resources/case/UserEmailService/TestSelectEmailBillCountByUserId.xlsx";;
Object a[][]=readXlsx(file, "工作表1");- }
- }
Junit测试Spring应用Dubbo测试框架之-Excel 工具类的更多相关文章
- TestNG参数化测试Spring应用Dubbo接口
一.配置dubbo的Bean文件: 配置spring-dubbo.xml文件: <dubbo:reference interface="com.datatrees.basisdata. ...
- Maven基础&&Spring框架阶段常用工具类整理
常用工具类 1.密码加密工具类: package com.itheima.utils; import java.security.MessageDigest; import sun.misc.BASE ...
- Java基础 @org.junit.Test-单元测试方法 + 操纵Collection和Map的工具类 : Collections 的sort/binarySearch/max/min等静态方法
单元测试代码: ( 在IDEA中先输入'@Test '然后根据提示进行自动修订即可!!运行时直接运行即可! 若有多个单元测试块的时候,直接把鼠标放在哪里就自动在哪里运行那个单元块) import ...
- Junit参数化测试Spring应用Dubbo接口
一.创建基础类. package com.tree.autotest; import org.junit.Before;import org.springframework.context.annot ...
- spring.net +dapper 打造简易的DataAccess 工具类.
public class DBUtil { /// <summary> /// 数据库连接字符串 /// </summary> private static string Da ...
- ssh框架中,工具类调用service层方法(参考https://www.cnblogs.com/l412382979/p/8526945.html)
代码如下: package common.dataService; import javax.annotation.PostConstruct; import org.springframework. ...
- spring 中 PO与DTO相互转换的工具类
public class BeanMapper { /** * 持有Dozer单例, 避免重复创建DozerMapper消耗资源. */ private static DozerBeanMapper ...
- Java集合框架:Collections工具类
java.util.Collections工具类提供非常多实用的方法.使得程序员操作集合类的时候更加的方便easy,这些方法都是静态的. 整个Collections工具类源代码几乎相同有4000行.我 ...
- Java集合框架:Arrays工具类
java.util.Arrays类能方便地操作数组,它提供的方法都是静态的.整个Arrays工具类的实现有3000+行.可是归纳总结一下可知它有下面功能(9个): 1. asList 定义: @Saf ...
随机推荐
- 最短路-Floyd
简介: 算法的特点: 弗洛伊德算法是解决任意两点间的最短路径的一种算法,可以正确处理有向图或有向图或负权(但不可存在负权回路)的最短路径问题,同时也被用于计算有向图的传递闭 包. 算法思想: 通过F ...
- python模块之HTMLParser
HTMLParser是python用来解析html的模块.它可以分析出html里面的标签.数据等等,是一种处理html的简便途径. HTMLParser采用的是一种事件驱动的模式,当HTMLParse ...
- 洛谷P3941入阵曲
题目传送门 这道题也是今年湖南集训队Day8的第一题,昨天洛谷的公开赛上又考了一遍,来发个记录(其实是因为五月天,另外两道题分别是将军令和星空,出这次题目的人肯定同为五迷(✪㉨✪)) 话不多说.先理解 ...
- 关于sql查询语句中的别名
sql语句中给子查询或其他查询类型加别名的时候可能会报错 java.sql.SQLException: 无法转换为内部表示 原因是select返回类型的实体类中没有写该别名 原来的实体类 更改后的实体 ...
- Python开发基础-Day21多态与多态性、绑定方法和非绑定方法
多态与多态性 多态 多态并不是一个新的知识 多态是指一类事物有多种形态,在类里就是指一个抽象类有多个子类,因而多态的概念依赖于继承 举个栗子:动物有多种形态,人.狗.猫.猪等,python的序列数据类 ...
- CSS3选择器、低版本解决方案及各浏览器私有前缀
一.基本选择器 通配选择器:* 元素选择器:div.p… ID选择器:#id 类选择器:.className 群组选择器:选择器1,选择器2 主流浏览器全部支持 二.层次选择器 后代选择器: div ...
- [HDU1532]Drainage Ditches
最大流模板题 今天补最大流,先写道模板题,顺便写点对它的理解 最大流问题就是给一个幽香有向图,每一条边有容量,问若从$s$点放水,最多会有多少水流到$t$ 为了解决整个问题,第一步我们当然要找到一条路 ...
- [Luogu2656]采蘑菇
题目大意: 给你一个有向图,每条边有一个边权w以及恢复系数k, 你从s点出发乱走,经过某条边时会获得相应的收益w,而当第二次经过这条边时相应的收益为w*k下取整. 问你最大能获得的收益为多少? 思路: ...
- 微信小程序 Session 失效
微信小程序 Session 失效 微信小程序,前端请求后端,中间多了个微信服务器,所以请求的流程就是 页面--微信服务器--目标服务器 这就导致了一个问题 session 每次请求都是一个新的会话 解 ...
- Android Broadcast Security(转)
原文地址:http://drops.wooyun.org/tips/4393 0x00 科普 Broadcast Recevier 广播接收器是一个专注于接收广播通知信息,并做出对应处理的组件.很多广 ...