java log add function
#dd_traces.pl (C) Marko Kivij?rvi 2006
# Dummy checks
die "Specify an input file!\n" if $ARGV[0] eq "";
die "File not found!\n" unless -e $ARGV[0];
die "Incorrect file extension for a C/C++ file!\n"
if ( $ARGV[0] !~ /(.*)\.(java)$/ );
# Constants
my $IMPORT_LOG_PACKAG = "\nimport android.util.Log;";
my $TAG;
if( $ARGV[0] !~ /BaseAdapter\.java/ && $ARGV[0] !~ /View\.java/) {
$TAG="SWIFTTAG";
}
else {
$TAG="SWIFTBASETAG";
}
# Parse output filename from the input filename
my $file = $ARGV[0];
my $origFile = $1."-orig.".$2;
#system( "cp $file $origFile" );
# Reset the input record separator (newline) so the entire file is read at once
undef $/;
# Read the input file
$_ = <>; # All there
# Adds a tracer macro after each function definition
s/
package #package
\s+
[^{;\/(\s]*\.[^{;\/(\s]* # package name
;
/
AddLogImport(tiny_mce_markeramp;) # Print the match and add the macro
/gxe; # g = repeat, x = split regex to multiple lines, e = evaluate substitution
s/
(public|private|protected)? #api property type
(\s+)?
(abstract)?
(\s+)?
class # Possible function return type
\s+ # One or more empty spaces
(\b\w+?) &n
相关文档:
package tao.hai.bing;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
public class LoadJar {
public static void main(String[] args)
{
Syst ......
package script;
import java.io.File;
import java.io.IOException;
public class Realname {
public static void main(String[] args) throws IOException
{
File oldFile = new File("d:/PMS");
if(!oldFile.exists())
{
oldFile. ......
package script;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
public class Change {
public static void main(String[] args) throws Exception {
Change c = new Change();
c.utf8toLocaleCode();
&n ......
Java把内存划分成两种:一种是栈内存,一种是堆内存。
在函数中定义的一些基本类型的变量和对象的引用变量都在函数的栈内存中分配。
当在一段代码块定义一个变量时,Java就在栈中为这个变量分配内存空间,当超过变量的作用域后,Java会自动释放掉为该变量 ......
处理乱码问题
1、规范数据库和页面所有编码统一为一种例如utf-8
2、hibernate连接数据库设置连接编码
<session-factory>
<property name="connection.url">
jdbc:mysql://127.0.0.1:3306/leaveword?useUnicode=true&characterEncoding=utf-8
& ......