随笔分类 -  读书笔记

读书时,留下的记录
该文被密码保护。
posted @ 2018-08-17 23:33 风*依旧 阅读(1) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2018-04-21 20:17 风*依旧 阅读(0) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2017-10-15 17:21 风*依旧 阅读(51) 评论(0) 推荐(0)
摘要:1、System FunctionYou can use the system built-in function to execute systemcommands. Please note that there is a difference between two waycommunication and system command.In "|&", you can pass the output of any awk command as input to anexternal command, and you can receive the output 阅读全文
posted @ 2013-09-10 21:01 风*依旧 阅读(359) 评论(0) 推荐(0)
摘要:1、Bit ManipulationJust like C, awk can manipulate bits.AND andOR or XOR xorComplement complLeft Shift lshiftRight Shift rlshiftAwk Example using Bit Functions$ cat bits.awkBEGIN { number1=15 number2=25 print "AND: " and(number1,number2); print "OR: " or(number1,number2) print &qu 阅读全文
posted @ 2013-09-09 17:17 风*依旧 阅读(341) 评论(0) 推荐(0)
摘要:1、Argument Processing (ARGC, ARGV, ARGIND)The built-in variables we discussed earlier, FS, NFS, RS, NR,FILENAME, OFS, and ORS, are all available on all versions of awk(including nawk, and gawk).• The environment variables discussed in this hack are availableonly on nawk and gawk.• Use ARGC and ARGV 阅读全文
posted @ 2013-09-09 17:03 风*依旧 阅读(424) 评论(0) 推荐(0)
摘要:4、Generic String FunctionsIndex FunctionThe index function can be used to get the index (location) of thegiven string (or character) in an input string.You can also use index to check whether a given string (or character)is present in an input string. If the given string is not present, it willretur 阅读全文
posted @ 2013-09-06 15:56 风*依旧 阅读(344) 评论(0) 推荐(0)
摘要:1、Simple If Statement语法:if (conditional-expression)action如果是多个action,则语法如下:if (conditional-expression){action1;action2;}Print all the items with quantity <=5:$ awk -F "," '{ if ($5 <= 5) \print "Only",$5,"qty of",$2, "is available"; }' \items.txt 阅读全文
posted @ 2013-06-28 18:53 风*依旧 阅读(416) 评论(0) 推荐(0)
摘要:1、VariablesYou don't need to declare anvariable to use it. If you wish to initialize an awk variable, it is betterto do it in the BEGIN section, which will be executed only once.There are no data types in Awk. Whether an awk variable is a numberor a string depends on the context in which the var 阅读全文
posted @ 2013-06-19 18:42 风*依旧 阅读(475) 评论(0) 推荐(0)
摘要:知识上的投资总能得到最好的回报。 ——本杰明·富兰克林 噢,好样的老富兰克林——从不会想不出精练的说教。为什么,如果我们能够早睡早起,我们就是了不起的程序员——对吗?早起的鸟儿有虫吃,但早起的虫子呢? 然而在这种情况下,Ben确实命中了要害。你的知识和经验是你最重要的职业财富。 遗憾的是,它们是有时效的资产(expiring asset)。随着新技术、语言及环境的出现,你的知识会变得过时。不断变化的市场驱动力也许会使你的经验变得陈旧或无关紧要。考虑到“网年”飞逝的速度,这样的事情可能会非常快地发生。 随着你的知识的价值降低,对你的公司或客户来说,你的价值也在降低。我们想要阻止这样的事 阅读全文
posted @ 2013-01-16 22:35 风*依旧 阅读(256) 评论(0) 推荐(0)
摘要:7.1 instanceof运算符的陷阱instanceof运算符的前一个操作数通常是一个引用类型的变量,后一个 操作数通常是一个类(也可以是接口,可以把接口当成一种特殊的类),它用于判断前面的对象是否是后面的类或其子类、实现类的实例。如果是,返回true,否则返回false。根据java语言规范,使用instanceof运算符有一个限制:instanceof运算符前面操作数的编译时类型必须是如下3种情况:要么与后面的类相同;要么是后面的类的父类;要么是后面类型的子类如果前面操作数的编译时类型与后面的类型没有任何关系,程序将无法通过编译。观察下面程序:public class Instance 阅读全文
posted @ 2012-11-25 19:13 风*依旧 阅读(212) 评论(0) 推荐(0)
摘要:6.4.2 省略花括号的危险下面代码中的循环题只有一行代码,所以尝试省略该循环体的或括号package com.qunar.bigInteger;class Cat { private static long instancecCount = 0; public Cat() { System.out.println("执行无参的构造器"); instancecCount++; } public static long getInstanceCount() { return instancecCount; }}public ... 阅读全文
posted @ 2012-11-24 23:53 风*依旧 阅读(171) 评论(0) 推荐(0)
摘要:5.1 关于字符串的陷阱5.1.1 jvm对于字符串的处理对于java中的字符直接量,jvm会使用一个字符串池来保存它们:第一次使用某个字符串时,jvm会将其放入字符串池进行缓存。在一般情况下,字符串池中的字符串对象不会被回收,当程序再次使用该字符串时,无需重新创建该对象,而是直接将引用变量指向字符串池中已有的该字符串对象。如果将一个字符串表连接表达式赋给一个字符串变量,并且该字符串连接表达式的值在编译时就可确定下来,那么jvm就会在编译时计算该表达式的值,并让它指向字符串池中对应的字符串。参看以下程序:public class StringJoinTest{ public static v. 阅读全文
posted @ 2012-11-18 23:07 风*依旧 阅读(237) 评论(0) 推荐(0)
摘要:4.1 Java引用的种类Java语言对对象的引用有如下四种:强引用、软引用、弱引用、虚引用4.2 Java的内存泄露程序运行过程中会不断的分配内存,那些不再使用的内存应该即时回收它们,从而保证系统可以再次使用这些内存,如果存在无用的内存无法被回收回来,那就是内存泄漏。4.3 垃圾回收机制垃圾回收机制主要完成以下两方面的事情:跟踪并监控每个对象,当某个对象处于不可达状态时,回收该对象占用的内存;清理内存分配、回收过程中产生的内存碎片4.3的余下部分都很重要,查看原书 阅读全文
posted @ 2012-11-17 23:48 风*依旧 阅读(162) 评论(0) 推荐(0)
摘要:3.1Set和Map3.1.1HashSet和HashMapHashMap底层将key-value当做一个整体来处理,这个整体就是一个Entry对象。HashMap底层采用一个Entry[]数组来保存所有的key-value对。当需要存储一个Entry对象时,首先会根据其key的hashCode()返回值决定该Entry的存储位置:如果两个Entry的key的hashCode()返回值相同,那它们的存储位置相同;如果两个Entry的key通过equals比较返回true,新添加的Entry的value将覆盖原有的Entry的value,但key不会被覆盖;如果这两个Entry的key通过equ 阅读全文
posted @ 2012-11-05 19:03 风*依旧 阅读(269) 评论(0) 推荐(0)
摘要:MethodParametersTheJavaprogramminglanguagealwaysusescallbyvalue.Thatmeansthatthemethodgetsacopyofallparametervalues.Inparticular,themethodcannotmodifythecon-tentsofanyparametervariablesthatarepassedtoit.Thereare,however,twokindsofmethodparameters:•Primitivetypes(numbers,booleanvalues)•Objectreferenc 阅读全文
posted @ 2012-10-21 21:49 风*依旧 阅读(146) 评论(0) 推荐(0)
摘要:2.1.2实例变量的初始化时机JDK里面提供了一个叫做javap的工具,主要用于帮助开发者深入了解Java编译器的机制,其语法格式如下:javap<options><classes>...该工具支持如下的常用选项:-c:分解方法代码,也就是显示每个方法的具体的字节码。-l:用于指定显示行号和局部变量列表-public|protected|package|private:用于指定显示哪种级别的类成员,分别对应Java的4中访问控制权限。-verbose:用于指定显示更进一步的详细信息。定 义实例变量时指定的初始值、初始化块中为实例变量指定的初始值、构造器中为实例变量指定的 阅读全文
posted @ 2012-10-18 17:26 风*依旧 阅读(189) 评论(0) 推荐(0)