python核心编程第二版笔记由网友提供:open168 python核心编程--笔记(很详细,建议收藏) 解释器options:1.1 –d   提供调试输出1.2 –O   生成优化的字节码(生成.pyo文件)1.3 –S   不导入site模块以在启动时查找python路径1.4 –v   冗余输出(导入语句详细追踪)1.5 –m mod 将一个模块以脚本形式运行1.6 –Q opt 除法选项(参阅文档)1.7 –c cmd 运行以命令行字符串心事提交的python脚本1.8 file  …
C++标准库第二版笔记 3 和异常的理解 1 差错和异常(error and exception)的处理 标准异常类(exception class) 定义于 分为: 1.语言本身支持的异常 2.标准库发出的异常 3.程序作用域(scope of a program)之外发出的异常 程序作用域内的错误通常可以被避免(代码的逻辑错误,俗称bug).程序外的错误,例如资源不足等列为第三种. 栈解旋(stack unwinding) 异常被抛出后,从进入try块起,到异常被抛掷前,这期间在栈上的构造的…
C++标准库第二版笔记 2.1 1 Range-Based for 循环 for ( decl : coll ) { statements; } // collaborate 类似C# foreach? 2 新式的字符串字面常量(String Literal) 常用于正则表达式(regular expression) R"(\\n)" // 相当于 R"\\\\n" 当你想在字符串中写出一个右括号“)”,则使用定义符(delimiter) 换而言之,如果你想在字符串…
C++标准库第二版笔记 2 微小但重要的语法提升 template表达式内的空格: vector< list<int> >; // OK in each C++ version vector<list<int>>; // OK since C++11 取消二异性的nullptr std::nullptr_t void f(int); void f(void*); f(0) // calls f(int) f(NULL) //calls f(int) if N…
C++标准库第二版笔记 1 C++ std历史 第一份标准化文档: C++98 & C++03 & TR1 TR1 Information Technology- Programming Languages - Technical Report on C++ Library Extensions 内涵大幅度的标准库扩充,在 namespace std::tr1中. 第二份标准化文档: C++11 标准库在做不断的同质化(homogeneous),他并不是要发明新的东西,而是让既有的东西和谐…
一.简介 1.You now have three methods for distinguishing references:  Objects are identical if they occupy the same memory location in the JVM . This can be checked with the a == b operator. This concept is known as object identity. Objects are equal i…
一.结构 二.model层 1. package org.jpwh.model.helloworld; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; /* Every persistent entity class must have at least th…
前言:感觉这本书只有第二章 第三章有点看头 基本类型和引用类型 基本类型:字符串 数字 布尔值 null(待确定) undifined 引用类型:对象 数组 引用传递 保存的只是对象的地址 var obj = {}; var obj1 = obj; obj.name="hey"; obj.name === obj1.name 自修改对象 var items = [1,2,3]; var items1 = items; items.push(4); items.length === it…
一. 引用 <blockquote>ago aog aogag </blockquote> 则是引用一大段文字并独立显示 二. <a> 创建目的地 <h2><a id="chai">Chai Tea</a></h2>//创建了一个目标锚 <a href="index.html#chai">See Chai Tea</a>//链接到的位置 使用id属性在页面中创…
一.代码 1. package org.jpwh.model.inheritance.tableperclass; import org.jpwh.model.Constants; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Inheritance; import javax.persi…
一.结构 二.代码 1. package org.jpwh.model.inheritance.mappedsuperclass; import javax.persistence.MappedSuperclass; import javax.validation.constraints.NotNull; @MappedSuperclass public abstract class BillingDetails { @NotNull protected String owner; // ...…
There are four different strategies for representing an inheritance hierarchy: Use one table per concrete class and default runtime polymorphic behavior. Use one table per concrete class but discard polymorphism and inheritance relationships comple…
一.结构 二.Hibernate支持的UserTypes接口  UserType —You can transform values by interacting with the plain JDBC PreparedStatement (when storing data) and ResultSet (when loading data).By implementing this interface, you can also control how Hibernate caches a…
一.结构 二.代码 1. package org.jpwh.model.advanced; import java.io.Serializable; import java.math.BigDecimal; import java.util.Currency; /* This value-typed class should be <code>java.io.Serializable</code>: When Hibernate stores entity instance dat…
一.简介 1. 2. 3. 4. to override this default mapping. The JPA specification has a convenient shortcut annotation for this purpose, @Lob @Entity public class Item { @Lob protected byte[] image; @Lob protected String description; // ... } This maps the by…
一.数据库 二.代码 1. package org.jpwh.model.advanced; import javax.persistence.AttributeOverride; import javax.persistence.AttributeOverrides; import javax.persistence.Column; import javax.persistence.Embeddable; import javax.validation.constraints.NotNull;…
Each @AttributeOverride for a component property is “complete”: any JPA or Hibernate annotation on the overridden property is ignored. This means the @Column annotations on the Address class are ignored—all BILLING_* columns are NULL able!(Bean Valid…
一.数据库 二.代码 1. package org.jpwh.model.simple; import javax.persistence.Column; import javax.persistence.Embeddable; import javax.validation.constraints.NotNull; /** * * Instead of <code>@Entity</code>, this component POJO is marked with <cod…
一.简介 在JPA中,默认所有属性都会persist,属性要属于以下3种情况,Hibernate在启动时会报错 1.java基本类型或包装类 2.有注解 @Embedded 3.有实现java.io.Serializable 二.Overriding basic property defaults 1.@javax.persistence.Transient 如果不想属性被持久化,则注解 @javax.persistence.Transient 2.@Basic(optional = false…
一.自定义映射的表名 1. @Entity @Table(name = "USERS") public class User implements Serializable { // ... } 2.用定界符 //@Table(name = "`USER`")的标准 @Table(name = "`USER`") //JPA的标准 @Table(name = "\"USER\"") 若全部SQL都加定界符,…
一.介绍 1.这种引用方式不对,但删除时不能级联 要这种引用方式 2.The Bid class could be a problem. In object-oriented modeling, this is marked as a composition (the association between Item and Bid with the diamond). Thus, an Item is the owner of its Bid instances and holds a col…
一.结构 二.配置文件约定 The JPA provider automatically picks up this descriptor if you place it in a META-INF /orm.xml file on the classpath of the persistence unit. If you prefer to use a different name or several files, you’ll have to change the configuratio…
基础知识 委托 如果代码想要执行操作,但不知道操作细节,一般可以使用委托.例如:Thread类之所以知道要在一个新线程里运行什么,唯一的原因就是在启动新线程时,向它提供了一个ThreadStart委托实例. 委托的构成 声明委托类型 创建一个要执行代码的方法 创建一个委托实例 调用(invoke)委托实例 数据类型 匿名类型 var John = new { Name = "John" , Age = 23 }; 动态类型 将变量声明为dynamic,编译器会对变量的几乎所有处理都区别…
[root@nhserver1 02]# cat listJohn Daggett, 341 King Road, Plymouth MAAlice Ford, 22 East Broadday, Richmond VAOrville Thomas, 11345 Oak Brideg Road, Tulsa OKTerry Kalkas, 402 Lans Road, Beaver Falls PAEric Adams, 20 Post Raod, Sudbury MAHubert Sims,…
一.结构 二.代码 1. package org.jpwh.model.collections.mapofstrings; import org.jpwh.model.Constants; import javax.persistence.CollectionTable; import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Entity; imp…
一.结构 二.代码 1. package org.jpwh.model.collections.listofstrings; import org.jpwh.model.Constants; import javax.persistence.CollectionTable; import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Entity; im…
一.结构 A bag is an unordered collection that allows duplicate elements, like the java.util.Collection interface. Curiously, the Java Collections framework doesn’t include a bag implementation. You initialize the property with an ArrayList , andHibernat…
一.结构 二.代码 1. package org.jpwh.model.collections.setofstrings; import org.jpwh.model.Constants; import javax.persistence.CollectionTable; import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Entity; imp…
一.代码 1. package org.jpwh.model.inheritance.associations.onetomany; import org.jpwh.model.Constants; import javax.persistence.*; import javax.validation.constraints.NotNull; // Can not be @MappedSuperclass when it's a target class in associations! @En…
一.结构 二.代码 1. package org.jpwh.model.inheritance.associations.manytoone; import org.jpwh.model.Constants; import javax.persistence.*; import javax.validation.constraints.NotNull; // Can not be @MappedSuperclass when it's a target class in associations…