自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(5)
  • 资源 (7)
  • 问答 (2)
  • 收藏
  • 关注

转载 复杂格式不规范excel 文件解析

import java.io.File;  import java.text.DecimalFormat;  import java.text.SimpleDateFormat;import java.util.ArrayList;  import java.util.List;    import org.apache.commons.lang.StringUtils;import org.ap...

2018-05-30 15:32:47 2688 1

原创 Permission denied: user=root, access=WRITE, inode="/user":hdfs:supergroup:drwxr-xr-x解决办法

学习hive时,往数据库insert一条数据,报Permission denied:            user=root,access=WRITE,inode="/user":hdfs:supergroup:drwxr-xr-x错误,查阅相关资料明白/user文件的所有者是HDFS  权限为755  也就是只有HDFS才能对这个文件进行操作,而root去访问hdfs上面的/user目录没

2017-10-16 16:54:50 2847

转载 零基础学习hadoop到上手工作线路指导初级篇:hive及mapreduce

转自http://www.cnblogs.com/snowbook/p/5660572.html这篇文章总结的很好,一步一步来,简单很多hadoop 1.x分为mapreduce与hdfs其中mapreduce是很多人都需要迈过去的槛,它比较难以理解,我们有时候即使写出了mapreduce程序,但是还是摸不着头脑。我们不知道key代表什么意思,我们不知道为什么会处理这个

2017-10-12 14:14:59 836

原创 android选择本地相册或拍照更换软件背景图片

最近做了一个小软件,想实现动态替换背景图片的效果,查找资料半天才实现哭,下面是代码:随便给了一个ImageView,通过点击图片来更换背景<ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="

2017-06-27 14:16:23 2442

原创 android增删改查以及通知栏和定时任务简单的实现

最近在学android,看着网上的例子,模仿写了一个,简单的实现了android的增删改查以及通知栏和定时任务

2017-06-23 08:35:58 598

hadoop-eclipse-plugin-2.6.0.jar

hadoop-eclipse-plugin-2.6.0.jar,下载后放到eclipse的plugins下,然后重启eclipse,打开window→preferences看到有Hadoop Map/Reduce就说明成功

2017-10-12

PLSQL.Developer绿色汉化破解版

PLSQL.Developer绿色汉化破解版,先安装plsqldev905.exe,再安装chinese_package.exe,然后进入plsql打开帮助-注册,将sn.txt里的内容填进去就ok了

2017-09-30

读取xls、xlsx文件所需poi.jar包

package com.cepri.framework.utils; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Date; import java.util.HashMap; import java.util.Map; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; 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; public class ReadMain { private Workbook wb; private Sheet sheet; private Row row; public ReadMain(String filepath) { if(filepath==null){ return; } String ext = filepath.substring(filepath.lastIndexOf(".")); try { InputStream is = new FileInputStream(filepath); if(".xls".equals(ext)){ wb = new HSSFWorkbook(is); }else if(".xlsx".equals(ext)){ wb = new XSSFWorkbook(is); }else{ wb=null; } } catch (FileNotFoundException e) { System.out.println("FileNotFoundException"); } catch (IOException e) { System.out.println("IOException"); } } /** * 读取Excel表格表头的内容 * * @param InputStream * @return String 表头内容的数组 * @author zengwendong */ public String[] readExcelTitle() throws Exception{ if(wb==null){ throw new Exception("Workbook对象为空!"); } sheet = wb.getSheetAt(0); row = sheet.getRow(0); // 标题总列数 int colNum = row.getPhysicalNumberOfCells(); System.out.println("colNum:" + colNum); String[] title = new String[colNum]; for (int i = 0; i < colNum; i++) { // title[i] = getStringCellValue(row.getCell((short) i)); title[i] = row.getCell(i).getCellFormula(); } return title; } /** * 读取Excel数据内容 * * @param InputStream * @return Map 包含单元格数据内容的Map对象 * @author zengwendong */ public Map<Integer, Map<Integer,Object>> readExcelContent() throws Exception{ if(wb==null){ throw new Exception("Workbook对象为空!"); } Map<Integer, Map<Integer,Object>> content = new HashMap<Integer, Map<Integer,Object>>(); sheet = wb.getSheetAt(0); // 得到总行数 int rowNum = sheet.getLastRowNum(); row = sheet.getRow(0); int colNum = row.getPhysicalNumberOfCells(); // 正文内容应该从第二行开始,第一行为表头的标题 for (int i = 1; i <= rowNum; i++) { row = sheet.getRow(i); int j = 0; Map<Integer,Object> cellValue = new HashMap<Integer, Object>(); while (j < colNum) { Object obj = getCellFormatValue(row.getCell(j)); cellValue.put(j, obj); j++; } content.put(i, cellValue); } return content; } /** * * 根据Cell类型设置数据 * * @param cell * @return * @author zengwendong */ private Object getCellFormatValue(Cell cell) { Object cellvalue = ""; if (cell != null) { // 判断当前Cell的Type switch (cell.getCellType()) { case Cell.CELL_TYPE_NUMERIC:// 如果当前Cell的Type为NUMERIC case Cell.CELL_TYPE_FORMULA: { // 判断当前的cell是否为Date if (DateUtil.isCellDateFormatted(cell)) { // 如果是Date类型则,转化为Data格式 // data格式是带时分秒的:2013-7-10 0:00:00 // cellvalue = cell.getDateCellValue().toLocaleString(); // data格式是不带带时分秒的:2013-7-10 Date date = cell.getDateCellValue(); cellvalue = date; } else {// 如果是纯数字 // 取得当前Cell的数值 cellvalue = String.valueOf(cell.getNumericCellValue()); } break; } case Cell.CELL_TYPE_STRING:// 如果当前Cell的Type为STRING // 取得当前的Cell字符串 cellvalue = cell.getRichStringCellValue().getString(); break; default:// 默认的Cell值 cellvalue = ""; } } else { cellvalue = ""; } return cellvalue; } public static void main(String[] args) { try { String filepath = "C:\\Users\\adminiatrotor\\Desktop\\111.xlsx"; ReadMain excelReader = new ReadMain(filepath); // 对读取Excel表格内容测试 Map<Integer, Map<Integer,Object>> map = excelReader.readExcelContent(); System.out.println("获得Excel表格的内容:"); for (int i = 1; i <= map.size(); i++) { Map a = map.get(i); System.out.println(a); } } catch (FileNotFoundException e) { System.out.println("未找到指定路径的文件!"); e.printStackTrace(); }catch (Exception e) { e.printStackTrace(); } } }

2017-09-30

Everything

Everything,一个搜索本地文件非常快的工具

2017-08-18

IKAnalyzer

IKAnalyzer 2012,献给有需要的人

2017-08-18

jdk1.6 64位

jdk1.6 64位

2017-08-15

阿里巴巴java开发手册

阿里巴巴java开发手册

2017-08-15

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除