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
Ïà¹ØÎĵµ£º
String newStr = new String(oldStr.getBytes(), "UTF-8");
javaÖеÄStringÀàÊǰ´ÕÕunicode½øÐбàÂëµÄ£¬µ±Ê¹ÓÃString(byte[] bytes, String encoding)¹¹Ôì×Ö·û´®Ê±£¬encodingËùÖ¸µÄÊÇbytesÖеÄÊý¾ÝÊǰ´ÕÕÄÇÖÖ·½Ê½±àÂëµÄ£¬¶ø²»ÊÇ×îºó²úÉúµÄStringÊÇʲô±àÂ뷽ʽ£¬»»¾ä»°Ëµ£¬ÊÇÈÃϵͳ°ÑbytesÖеÄÊý¾ÝÓÉencoding±à ......
¡¡¡¡ÔõôÈóÌÐòÀûÓÃËÑË÷ÒýÇæÀ´ËѼ¯ÍøÖ·£¬ÕâÓÐʲôÓÃ?ºÜÓÐÓÃ!ÍøÉ϶¯éüÓÐÈ˽ÐÂôÍøÖ·Êý¾Ý¿â£¬Èç·¢²¼Èí¼þÍøÖ·¡¢ÓʼþµØÖ·¡¢ÂÛÌ³ÍøÖ·¡¢ÐÐÒµÍøÖ·£¬ÕâÐ©ÍøÖ·ÊÇÔõôÀ´µÄÄØ?²»¿ÉÄÜÊÇÈËÊÖ¹¤ÊÕ¼¯¶øÀ´µÄ£¬¶¼ÊÇÈóÌÐòÀûÓÃËÑË÷ÒýÇæÈ¡µ½µÄ£¬Èç¹ûÄúÐèҪijÀàÍøÖ·ÐÅÏ¢Êý¾Ý£¬¾Í¸ú³É¶¼ÀÊÎÖ½ÌÓýÀ´Ò»ÆðÑо¿Ò»Ï£¬·Ç³£¼òµ¥¡£
¡¡¡¡±¾ÎIJÉÓÃJavaÓïÑÔÐ ......
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×ÔѧµÄÌÖÂÛÖУ¬×î¾³£¿´µ½µÄ¾ÍÊÇ×êÑС¶Thinking in java¡·(TIJ)µÄ¾Ñ飬µ«ÊÇ£¬¾¡¹ÜʹÓÃTIJ×÷Ϊ½Ìѧ²ÄÁϵĽÌѧÐÐΪҲºÜ¶à£¬ÎÒÈ´ÉÐδ·¢ÏÖÓдӽÌʦ¹ØÓÚÈçºÎ½«TIJÓÃÓÚ½ÌѧµÄÂÛÊö¡£Îª´Ë£¬ÎÒȨ×÷Å×שÒýÓñ¡£
Ê×ÏÈ£¬ÎªÊ²Ã´ÒªÑ§Ï°java£¿°´ÕÕEckelµÄ»°Ëµ£¬ ......
´¦ÀíÂÒÂëÎÊÌâ
1¡¢¹æ·¶Êý¾Ý¿âºÍÒ³ÃæËùÓбàÂëͳһΪһÖÖÀýÈçutf-8
2¡¢hibernateÁ¬½ÓÊý¾Ý¿âÉèÖÃÁ¬½Ó±àÂë
<session-factory>
<property name="connection.url">
jdbc:mysql://127.0.0.1:3306/leaveword?useUnicode=true&characterEncoding=utf-8
& ......