当前位置: 编程技术>移动开发
本页文章导读:
▪彻底开释程序中所有内存 彻底释放程序中所有内存
Activity没有完全退出的问题,finish之后窗口是消失了内存中依然存在Activity这个静态全局变量,销毁他是有虚拟机完成的,如果想用直接销毁就在onDestroy里写android..........
▪ 重要章节1:makefile怎么读取的 重要章节1:makefile如何读取的
3.7 How make Reads a Makefile
GNU make does its work in two distinct phases. During the first phase it reads all the makefiles, included makefiles, etc. and internalizes all the variables and their values, impl.........
▪ java各处csv java到处csv
import java.io.BufferedWriter;import java.io.File;import java.io.FileOutputStream;import java.io.IOException;import java.io.OutputStreamWriter;import java.util.ArrayList;import java.util.Iterator;import java.util.LinkedHashMap;import.........
[1]彻底开释程序中所有内存
来源: 互联网 发布时间: 2014-02-18
彻底释放程序中所有内存
Activity没有完全退出的问题,finish之后窗口是
消失了内存中依然存在Activity这个静态全局变量,销毁他是有虚拟机完成的,如果想
用直接销毁就在onDestroy里写
Activity没有完全退出的问题,finish之后窗口是
消失了内存中依然存在Activity这个静态全局变量,销毁他是有虚拟机完成的,如果想
用直接销毁就在onDestroy里写
android.os.Process.killProcess (android.os.Process.myPid());
[2] 重要章节1:makefile怎么读取的
来源: 互联网 发布时间: 2014-02-18
重要章节1:makefile如何读取的
3.7 How make Reads a Makefile GNU make does its work in two distinct phases. During the first phase it reads all the makefiles, included makefiles, etc. and internalizes all the variables and their values, implicit and explicit rules, and constructs a dependency graph of all the targets and their prerequisites. During the second phase, make uses these internal structures to determine what targets will need to be rebuilt and to invoke the rules necessary to do so. It's important to understand this two-phase approach because it has a direct impact on how variable and function expansion happens; this is often a source of some confusion when writing makefiles. Here we will present a summary of the phases in which expansion happens for different constructs within the makefile. We say that expansion is immediate if it happens during the first phase: in this case make will expand any variables or functions in that section of a construct as the makefile is parsed. We say that expansion is deferred if expansion is not performed immediately. Expansion of a deferred construct is not performed until either the construct appears later in an immediate context, or until the second phase. You may not be familiar with some of these constructs yet. You can reference this section as you become familiar with them, in later chapters. Variable Assignment Variable definitions are parsed as follows: immediate = deferred immediate ?= deferred immediate := immediate immediate += deferred or immediate define immediate deferred endef define immediate = deferred endef define immediate ?= deferred endef define immediate := immediate endef define immediate += deferred or immediate endef For the append operator, ‘+=’, the right-hand side is considered immediate if the variable was previously set as a simple variable (‘:=’), and deferred otherwise. Conditional Directives Conditional directives are parsed immediately. This means, for example, that automatic variables cannot be used in conditional directives, as automatic variables are not set until the recipe for that rule is invoked. If you need to use automatic variables in a conditional directive you must move the condition into the recipe and use shell conditional syntax instead. Rule Definition A rule is always expanded the same way, regardless of the form: immediate : immediate ; deferred deferred That is, the target and prerequisite sections are expanded immediately, and the recipe used to construct the target is always deferred. This general rule is true for explicit rules, pattern rules, suffix rules, static pattern rules, and simple prerequisite definitions.
[3] java各处csv
来源: 互联网 发布时间: 2014-02-18
java到处csv
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.beanutils.BeanUtils;
public class CsvJava {
public static void main(String[] args) {
List exportData = new ArrayList<Map>();
Map row1 = new LinkedHashMap<String, String>();
row1.put("1", "11");
row1.put("2", "12");
row1.put("3", "13");
row1.put("4", "14");
exportData.add(row1);
row1 = new LinkedHashMap<String, String>();
row1.put("1", "21");
row1.put("2", "22");
row1.put("3", "23");
row1.put("4", "24");
exportData.add(row1);
List propertyNames = new ArrayList();
LinkedHashMap map = new LinkedHashMap();
map.put("1", "第一列");
map.put("2", "第二列");
map.put("3", "第三列");
map.put("4", "第四列");
createCSVFile(exportData, map, "d:/aaaaaa/mmm/", "活动目录");
}
public static File createCSVFile(List exportData, LinkedHashMap rowMapper,
String outPutPath, String filename) {
File csvFile = null;
BufferedWriter csvFileOutputStream = null;
try {
csvFile = new File(outPutPath + filename + ".csv");
// csvFile.getParentFile().mkdir();
File parent = csvFile.getParentFile();
if (parent != null && !parent.exists()) {
parent.mkdirs();
}
csvFile.createNewFile();
// GB2312使正确读取分隔符","
csvFileOutputStream = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(csvFile), "GB2312"), 1024);
// 写入文件头部
for (Iterator propertyIterator = rowMapper.entrySet().iterator(); propertyIterator
.hasNext();) {
java.util.Map.Entry propertyEntry = (java.util.Map.Entry) propertyIterator
.next();
csvFileOutputStream.write("\""
+ propertyEntry.getValue().toString() + "\"");
if (propertyIterator.hasNext()) {
csvFileOutputStream.write(",");
}
}
csvFileOutputStream.newLine();
// 写入文件内容
for (Iterator iterator = exportData.iterator(); iterator.hasNext();) {
Object row = (Object) iterator.next();
for (Iterator propertyIterator = rowMapper.entrySet()
.iterator(); propertyIterator.hasNext();) {
java.util.Map.Entry propertyEntry = (java.util.Map.Entry) propertyIterator
.next();
csvFileOutputStream.write("\""
+ BeanUtils.getProperty(row,
propertyEntry.getKey().toString())
.toString() + "\"");
if (propertyIterator.hasNext()) {
csvFileOutputStream.write(",");
}
}
if (iterator.hasNext()) {
csvFileOutputStream.newLine();
}
}
csvFileOutputStream.flush();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
csvFileOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return csvFile;
}
}
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.beanutils.BeanUtils;
public class CsvJava {
public static void main(String[] args) {
List exportData = new ArrayList<Map>();
Map row1 = new LinkedHashMap<String, String>();
row1.put("1", "11");
row1.put("2", "12");
row1.put("3", "13");
row1.put("4", "14");
exportData.add(row1);
row1 = new LinkedHashMap<String, String>();
row1.put("1", "21");
row1.put("2", "22");
row1.put("3", "23");
row1.put("4", "24");
exportData.add(row1);
List propertyNames = new ArrayList();
LinkedHashMap map = new LinkedHashMap();
map.put("1", "第一列");
map.put("2", "第二列");
map.put("3", "第三列");
map.put("4", "第四列");
createCSVFile(exportData, map, "d:/aaaaaa/mmm/", "活动目录");
}
public static File createCSVFile(List exportData, LinkedHashMap rowMapper,
String outPutPath, String filename) {
File csvFile = null;
BufferedWriter csvFileOutputStream = null;
try {
csvFile = new File(outPutPath + filename + ".csv");
// csvFile.getParentFile().mkdir();
File parent = csvFile.getParentFile();
if (parent != null && !parent.exists()) {
parent.mkdirs();
}
csvFile.createNewFile();
// GB2312使正确读取分隔符","
csvFileOutputStream = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(csvFile), "GB2312"), 1024);
// 写入文件头部
for (Iterator propertyIterator = rowMapper.entrySet().iterator(); propertyIterator
.hasNext();) {
java.util.Map.Entry propertyEntry = (java.util.Map.Entry) propertyIterator
.next();
csvFileOutputStream.write("\""
+ propertyEntry.getValue().toString() + "\"");
if (propertyIterator.hasNext()) {
csvFileOutputStream.write(",");
}
}
csvFileOutputStream.newLine();
// 写入文件内容
for (Iterator iterator = exportData.iterator(); iterator.hasNext();) {
Object row = (Object) iterator.next();
for (Iterator propertyIterator = rowMapper.entrySet()
.iterator(); propertyIterator.hasNext();) {
java.util.Map.Entry propertyEntry = (java.util.Map.Entry) propertyIterator
.next();
csvFileOutputStream.write("\""
+ BeanUtils.getProperty(row,
propertyEntry.getKey().toString())
.toString() + "\"");
if (propertyIterator.hasNext()) {
csvFileOutputStream.write(",");
}
}
if (iterator.hasNext()) {
csvFileOutputStream.newLine();
}
}
csvFileOutputStream.flush();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
csvFileOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return csvFile;
}
}
最新技术文章: