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 工具类的更多相关文章

  1. TestNG参数化测试Spring应用Dubbo接口

    一.配置dubbo的Bean文件: 配置spring-dubbo.xml文件: <dubbo:reference interface="com.datatrees.basisdata. ...

  2. Maven基础&&Spring框架阶段常用工具类整理

    常用工具类 1.密码加密工具类: package com.itheima.utils; import java.security.MessageDigest; import sun.misc.BASE ...

  3. Java基础 @org.junit.Test-单元测试方法 + 操纵Collection和Map的工具类 : Collections 的sort/binarySearch/max/min等静态方法

      单元测试代码:  ( 在IDEA中先输入'@Test '然后根据提示进行自动修订即可!!运行时直接运行即可! 若有多个单元测试块的时候,直接把鼠标放在哪里就自动在哪里运行那个单元块) import ...

  4. Junit参数化测试Spring应用Dubbo接口

    一.创建基础类. package com.tree.autotest; import org.junit.Before;import org.springframework.context.annot ...

  5. spring.net +dapper 打造简易的DataAccess 工具类.

    public class DBUtil { /// <summary> /// 数据库连接字符串 /// </summary> private static string Da ...

  6. ssh框架中,工具类调用service层方法(参考https://www.cnblogs.com/l412382979/p/8526945.html)

    代码如下: package common.dataService; import javax.annotation.PostConstruct; import org.springframework. ...

  7. spring 中 PO与DTO相互转换的工具类

    public class BeanMapper { /** * 持有Dozer单例, 避免重复创建DozerMapper消耗资源. */ private static DozerBeanMapper ...

  8. Java集合框架:Collections工具类

    java.util.Collections工具类提供非常多实用的方法.使得程序员操作集合类的时候更加的方便easy,这些方法都是静态的. 整个Collections工具类源代码几乎相同有4000行.我 ...

  9. Java集合框架:Arrays工具类

    java.util.Arrays类能方便地操作数组,它提供的方法都是静态的.整个Arrays工具类的实现有3000+行.可是归纳总结一下可知它有下面功能(9个): 1. asList 定义: @Saf ...

随机推荐

  1. 验收测试与UI

    CRS 如果功能复杂的情况下,是不是先写验收测试,然后写单元测试,最后写代码? STST 是的 从高往低走,无论是分析,还是测试,还是开发 从高往低走,带来的是干净无累赘的,底层依赖高层的优雅的结果 ...

  2. 在浏览器中输入url地址 -> 显示主页的过程

    -来自<图解HTTP> 最近在进行前端面试方面的一些准备,看了网上许多相关的文章,发现有一个问题始终绕不开: 在浏览器中输入URL到整个页面显示在用户面前时这个过程中到底发生了什么.仔细思 ...

  3. 基于BeanNameViewResolver解析器,自定义视图

    概述 基于spring-mvc自定义视图,以BeanNameViewResolver作为解析器,以满足特殊需求. 本文以输出多个pdf文件的压缩文件,供前台下载的需求为例:但是不提供服务层实现. 实现 ...

  4. 洛谷——P2799 国王的魔镜

    P2799 国王的魔镜 题目描述 国王有一个魔镜,可以把任何接触镜面的东西变成原来的两倍——只是,因为是镜子嘛,增加的那部分是反的.比如一条项链,我们用AB来表示,不同的字母表示不同颜色的珍珠.如果把 ...

  5. Sqli-labs less 8

    Less-8 经过简单的测试,我们发现 'or 1=1--+返回正常,那么我们就基本知道应该怎么使用了,参考less5.这里简单的进行一个示例: http://127.0.0.1/sqllib/Les ...

  6. Linux命令之head

    head [选项] [文件] head命令输出文件开头部分,默认情况下显示文件的头10行.如果指定多个文件,每个文件前都有一个标题,给出文件名.如果没有指定文件,或当文件为-时,读取标准输入. (1) ...

  7. 【BZOJ 4104】【THUSC 2015】解密运算

    http://www.lydsy.com/JudgeOnline/problem.php?id=4104 网上题解满天飞,我也懒得写了 #include<cstdio> #include& ...

  8. [BZOJ5011][JXOI2017]颜色

    5011: [Jx2017]颜色 Time Limit: 30 Sec  Memory Limit: 512 MBSubmit: 84  Solved: 46[Submit][Status][Disc ...

  9. [HDU1542]Atlantis(扫描线+线段树)

    Atlantis Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Su ...

  10. Activity(活动)生命周期(1)--返回栈

    Android是使用任务(task)来管理活动的,一个任务就是一组存放在栈里的活动的集合,这个栈也被称为返回栈(Back stack).栈是一种后进先出的数据结构,在默认情况下,每当我们启动了一个新的 ...