1.Linux Centos7.8.2003系统离线GCC源码编译升级
2.å¦ä½ç¨Apache POI读åExcel
Linux Centos7.8.2003系统离线GCC源码编译升级
要进行Linux Centos7.8.的源码GCC离线源码编译升级,首先需要准备一个干净的源码Centos7.8.虚拟机,并可以使用本地镜像源,源码具体步骤可在相关文章中找到。源码php密码登录源码
在GCC的源码ftp站点下载所需版本,例如gcc-.1.0。源码新安装的源码机器可能缺少编译依赖,但镜像源内通常包含这些,源码无需在线下载。源码
编译依赖库一般包括gcc-c++、源码autoconf、源码zblog游戏源码automake、源码libtools和m4,源码但具体可能因机器环境而异。源码简便的源码方法是使用yum group install Development Tools,这个组合包含了大部分开发所需的减税系统源码依赖。
离线编译时,先解压gcc源码,然后进入目录,由于是离线,需要手动下载所有依赖,海豚调度源码如gmp-6.1.0、isl、mpfr和mpc。确保按依赖顺序编译,例如先gmp-6.1.0,源码收藏 网然后mpc-1.0.3。
创建编译目录,设置编译参数后,开始编译过程。可能遇到找不到库的错误,此时需要将库添加到环境变量。编译时间根据机器性能不同,通常十几分钟内完成。
编译成功后,升级GCC的过程是删除或备份原有GCC软链接,然后指向新编译的GCC目录。升级脚本可以简化这一过程,但如有问题,务必及时调整。
å¦ä½ç¨Apache POI读åExcel
ããé¦å POIæ¯å¼æºç»ç»Apacheåºåçä¸ä¸ªå¼æºjarå ï¼æä¾äºæ¹ä¾¿è§£æExcelçAPIï¼æ们å¯ä»¥é常æ¹ä¾¿ç使ç¨å®æ¥è¯»åExcelãè¿éä»ç»3.5Finalçæ¬ãããæéç¨å°çjarå å¦ä¸:
ãã说å°Excelï¼æåï¼æ ¼å¼æ¯ä¸ä¸æ ·çï¼ç¨POI解æçæ¹æ³ä¹å°±ä¸ä¸æ ·ï¼Excel主è¦æ¯ä½¿ç¨org.apache.poi.hssf.usermodelå ä¸çç±»æ¥è§£æï¼èExcelå°±æ¯ä½¿ç¨org.apache.poi.xssf.usermodelæ¥è§£æã
ãã解æExcelæºç
说å°Excelï¼æåï¼æ ¼å¼æ¯ä¸ä¸æ ·çï¼ç¨POI解æçæ¹æ³ä¹å°±ä¸ä¸æ ·ï¼Excel主è¦æ¯ä½¿ç¨org.apache.poi.hssf.usermodelå ä¸çç±»æ¥è§£æï¼èExcelå°±æ¯ä½¿ç¨org.apache.poi.xssf.usermodelæ¥è§£æã
解æExcelæºç
StringBuffer content = new StringBuffer();
HSSFWorkbook workbook = new HSSFWorkbook(is); // å建对Excelå·¥ä½ç°¿æ件çå¼ç¨
for (int numSheets = 0; numSheets < workbook.getNumberOfSheets(); numSheets++) {
if (null != workbook.getSheetAt(numSheets)) {
HSSFSheet aSheet = workbook.getSheetAt(numSheets); // è·å¾ä¸ä¸ªsheet
for (int rowNumOfSheet = 0; rowNumOfSheet <= aSheet.getLastRowNum(); rowNumOfSheet++) {
if (null != aSheet.getRow(rowNumOfSheet)) {
HSSFRow aRow = aSheet.getRow(rowNumOfSheet); // è·å¾ä¸è¡
for (int cellNumOfRow = 0; cellNumOfRow <= aRow.getLastCellNum(); cellNumOfRow++) {
if (null != aRow.getCell(cellNumOfRow)) {
HSSFCell aCell = aRow.getCell(cellNumOfRow); // è·å¾åå¼
if (aCell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC) {
content.append(aCell.getNumericCellValue() + "\t");
} else if (aCell.getCellType() == HSSFCell.CELL_TYPE_BOOLEAN) {
content.append(aCell.getBooleanCellValue() + "\t");
} else if (aCell.getCellType() == HSSFCell.CELL_TYPE_STRING) {
content.append(aCell.getStringCellValue() + "\t");
} else if (aCell.getCellType() == HSSFCell.CELL_TYPE_FORMULA){
content.append(aCell.getCellFormula() + "\t");
} else {
continue;
}
}
if(cellNumOfRow == aRow.getLastCellNum()) {
content.append("\n");
}
}
}
}
}
}
return content.toString().trim();
解æExcelååºæ¬ä¸æ ·ï¼åªæ¯å°HSSFSheet,HSSFCellçé½æ¹æXSSFSheet,XSSFCellå³å¯ã
å¦å¤è¦æé大家çæ¯Excelçæ ·å¼é½æ¯åºäºä¸ä¸ªåå æ ¼çï¼æ以ç¨HSSFRow.getRowStyle()æ¿æ ·å¼ä¼åºé®é¢çï¼ä¸ä¸å®ä¼æ¿å°ä½ æ³è¦çæ ·å¼ãå¤çå并åå æ ¼æ¯POIçä¸ä¸ªé¾ç¹ï¼åªè½éè¿å¤æå½ååå æ ¼æ¯å¦å¨å并åå æ ¼ä¹ä¸ï¼å¦ææ¯ï¼é£æ¤åå æ ¼çå¼ä¾¿æ¯è¿ä¸ªå并åå æ ¼çé¦ä½ç½®åå æ ¼çå¼ï¼åªæéè¿è¿æ ·æè½æ¥å¤çå并åå æ ¼ã
å¤çå并åå æ ¼ç代ç ï¼
public static boolean isMergedRegion(HSSFSheet sheet, HSSFCell cell) {
//å¾å°ä¸ä¸ªsheetä¸æå¤å°ä¸ªå并åå æ ¼
int sheetmergerCount = sheet.getNumMergedRegions();
for(int i = 0; i < sheetmergerCount; i++) {
//å¾åºå ·ä½çå并åå æ ¼
CellRangeAddress ca = sheet.getMergedRegion(i);
//å¾å°å并åå æ ¼çèµ·å§è¡, ç»æè¡, èµ·å§å, ç»æå
int firstC = ca.getFirstColumn();
int lastC = ca.getLastColumn();
int firstR = ca.getFirstRow();
int lastR = ca.getLastRow();
//å¤æ该åå æ ¼æ¯å¦å¨å并åå æ ¼èå´ä¹å , å¦ææ¯, åè¿å true
if(cell.getColumnIndex() <= lastC && cell.getColumnIndex() >= firstC) {
if(cell.getRowIndex() <= lastR && cell.getRowIndex() >= firstR) {
return true;
}
}
}
return false;
}
public static String getMergedRegionValue(HSSFSheet sheet, HSSFCell cell) {
//è·å¾ä¸ä¸ª sheet ä¸å并åå æ ¼çæ°é
int sheetmergerCount = sheet.getNumMergedRegions();
//便å©å并åå æ ¼
for(int i = 0; i < sheetmergerCount; i++) {
//è·å¾å并åå æ ¼
CellRangeAddress ca = sheet.getMergedRegion(i);
//è·å¾å并åå æ ¼çèµ·å§è¡, ç»æè¡, èµ·å§å, ç»æå
int firstC = ca.getFirstColumn();
int lastC = ca.getLastColumn();
int firstR = ca.getFirstRow();
int lastR = ca.getLastRow();
//å¤æ该åå æ ¼æ¯å¦æ¯å¨å并åå æ ¼ä¸, å¦ææ¯, åè¿åæå¨å并åå æ ¼çé¦åå æ ¼çå¼
if(cell.getColumnIndex() <= lastC && cell.getColumnIndex() >= firstC) {
if(cell.getRowIndex() <= lastR && cell.getRowIndex() >= firstR) {
HSSFRow fRow = sheet.getRow(firstR);
HSSFCell fCell = fRow.getCell(firstC);
//é¤äºå并åå æ ¼é¦åå æ ¼çå¼, å ¶ä½çç¨(*)æ¥åºå
if (fCell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC && hasBorder(cell)) {
return String.valueOf(fCell.getNumericCellValue());
} else if (fCell.getCellType() == HSSFCell.CELL_TYPE_BOOLEAN && hasBorder(cell)) {
return String.valueOf(fCell.getBooleanCellValue());
} else if (fCell.getCellType() == HSSFCell.CELL_TYPE_STRING && hasBorder(cell)) {
return fCell.getStringCellValue();
} else if (fCell.getCellType() == HSSFCell.CELL_TYPE_FORMULA && hasBorder(cell)){
return String.valueOf(fCell.getCellFormula());
}
}
}
}
return "";
}