今日概要:

  1. 结构体和方法

  2. 接口

一、go中的struct

  1. 用来自定义复杂数据结构

  2. struct里面可以包含多个字段(属性)

  3. struct类型可以定义方法,注意和函数的区分

  4. struct类型是值类型

  5. struct类型可以嵌套

  6. Go语言没有class类型,只有struct类型

1.struct声明  

  type 标识符 struct {

  field1 type

  field2 type

  }

例子: 

  1.   type Student struct {
  2.  
  3.   Name string
  4.  
  5.   Age int
  6.  
  7.   Score int
  8.  
  9.   }

2. struct 中字段访问:和其他语言一样,使用点

  1. var stu Student
  2.  
  3. stu.Name = tony
  4. stu.Age = 18
  5. stu.Score=20
  6.  
  7. fmt.Printf(“name=%s age=%d score=%d”,
  8. stu.Name, stu.Age, stu.Score

3.  struct定义的三种形式

  1. //第一种
  2. var stu Student
  3. //第二种
  4. var stu *Student = new (Student)
  5. //第三种
  6. var stu *Student = &Student{}

  其中b和c返回的都是指向结构体的指针,访问形式如下:   

    stu.Name、stu.Age和stu.Score或者 (*stu).Name、(*stu).Age

4. struct的内存布局:struct中的所有字段在内存是连续的

  struct当传入的为值的时候,传入值对应的内存地址是连续的,当传入指针的时候,指针对应的内存地址是连续的,指针原数据对应的地址是不连续的.

例子: 

  1. package main
  2.  
  3. import (
  4. "fmt"
  5. )
  6. //结构体所有字段的内存布局都是连续的
  7. type Student struct {
  8. name string
  9. age int //int占用8字节
  10. score float32
  11. }
  12.  
  13. func main() {
  14. var stu Student
  15. stu.age = 18
  16. stu.name = "alex"
  17. stu.score = 100
  18. fmt.Printf("name:%s,age:%d,score:%d\n",stu.name,stu.age,stu.score)
  19. //在内存中的布局
  20. fmt.Printf("Name:%p\n",&stu.name)
  21. fmt.Printf("Age:%p\n",&stu.age)
  22. fmt.Printf("Score:%p\n",&stu.score)
  23.  
  24. // 初始化,可以初始化部分字段
  25. var stu1 *Student = &Student{
  26. name:"xiaogang",
  27. age:29,
  28. score:1000,
  29. }
  30. fmt.Println(stu1)
  31.  
  32. var stu2 = Student{
  33. name:"test",
  34. age:111,
  35. }
  36.  
  37. fmt.Println(stu2)
  38. var stu3 *Student = new(Student)//创建了个内存地址
  39. fmt.Println(stu3)
  40.  
  41. }

5.链表定义

  1. type Student struct {
  2. Name string
  3. Next* Student
  4. }

  每个节点包含下一个节点的地址,这样把所有的节点串起来了,通常把链表中的第一个节点叫做链表头

  1. package main
  2.  
  3. import "fmt"
  4.  
  5. type Student struct {
  6. Name string
  7. Age int
  8. Score int
  9. next *Student
  10. }
  11.  
  12. //函数化,循环链表
  13. func trans (p *Student){
  14. for p != nil {
  15. fmt.Println(*p)
  16. p = p.next
  17. }
  18. fmt.Println()
  19. }
  20.  
  21. func main() {
  22.  
  23. var head Student
  24. head.Name = "alex"
  25. head.Age = 18
  26. head.Score = 100
  27.  
  28. var stu2 Student
  29. stu2.Name = "xiaogang"
  30.  
  31. head.next = &stu2
  32. trans(&head)
  33.  
  34. var stu3 Student
  35. stu3.Name = "xiaoming"
  36.  
  37. stu2.next = &stu3
  38. trans(&head)
  39.  
  40. //p := &head // var p *Student = &head
  41.  
  42. }

链表头部插入:

  1. package main
  2.  
  3. import (
  4. "fmt"
  5. "math/rand"
  6. )
  7.  
  8. type Student struct {
  9. Name string
  10. Age int
  11. Score float32
  12. up *Student
  13. }
  14.  
  15. //函数化
  16. func trans (p *Student){
  17. for p != nil {
  18. fmt.Println(*p)
  19. p = p.up
  20. }
  21. fmt.Println()
  22. }
  23.  
  24. func HeadChain(head **Student){
  25. for i :=0 ; i < 11; i ++ {
  26. var stu = Student{
  27. Name:fmt.Sprintf("student%d",i),
  28. Age:rand.Intn(100),
  29. Score:rand.Float32() * 100,
  30. }
  31. stu.up = *head
  32. *head = &stu //head相当于副本
  33. }
  34.  
  35. }
  36.  
  37. func DelNode(node *Student){
  38. //删除节点
  39. var prev_node *Student = node //临时变量保留上一个节点
  40. for node != nil{
  41. if (node.Name == "student6"){
  42. prev_node.up = node.up //被删除节点上一个节点的的up 指向被删除节点的up
  43. break
  44. }
  45. prev_node = node //prev是node的上一个节点
  46. node = node.up
  47. }
  48. }
  49.  
  50. func AddNode(node *Student,new_node *Student){
  51. //插入节点
  52. for node != nil{
  53. if (node.Name == "student6"){
  54. new_node.up = node.up
  55. node.up = new_node
  56. break
  57. }
  58. node = node.up
  59. }
  60. }
  61.  
  62. func main() {
  63. //生成链表表头
  64. var head *Student = new(Student) //head是指针 //改变一个变量的地址,传变量的变量的内存地址,要是改变一个指针的地址,将指针的内存地址传入进去
  65. head.Name = "alex"
  66. head.Age = 18
  67. head.Score = 100
  68. //链表头部插入法
  69. HeadChain(&head) //传入指针的内存地址
  70. trans(head)
  71.  
  72. //DelNode(head)
  73. //trans(head)
  74.  
  75. var newNode *Student = new(Student)
  76. newNode.Name = "xiaogang"
  77. newNode.Age = 20
  78. newNode.Score = 300
  79. AddNode(head,newNode)
  80. trans(head)
  81.  
  82. //p := &head // var p *Student = &head
  83. }
  84.  
  85. /*
  86. {student10 95 36.08714 0xc420072390}
  87. {student9 37 21.855305 0xc420072360}
  88. {student8 11 29.310184 0xc420072330}
  89. {student7 28 46.888985 0xc420072300}
  90. {student6 62 38.06572 0xc4200722d0}
  91. {student5 94 81.36399 0xc4200722a0}
  92. {student4 56 30.091187 0xc420072270}
  93. {student3 25 15.651925 0xc420072240}
  94. {student2 81 68.682304 0xc420072210}
  95. {student1 47 43.77142 0xc4200721e0}
  96. {student0 81 94.05091 0xc4200721b0}
  97. {alex 18 100 <nil>}
  98.  
  99. {student10 95 36.08714 0xc420072390}
  100. {student9 37 21.855305 0xc420072360}
  101. {student8 11 29.310184 0xc420072330}
  102. {student7 28 46.888985 0xc420072300}
  103. {student6 62 38.06572 0xc420072630}
  104. {xiaogang 20 300 0xc4200722d0}
  105. {student5 94 81.36399 0xc4200722a0}
  106. {student4 56 30.091187 0xc420072270}
  107. {student3 25 15.651925 0xc420072240}
  108. {student2 81 68.682304 0xc420072210}
  109. {student1 47 43.77142 0xc4200721e0}
  110. {student0 81 94.05091 0xc4200721b0}
  111. {alex 18 100 <nil>}
  112.  
  113. */

图解链表插入过程

链表从尾部插入:

  1. package main
  2.  
  3. import (
  4. "fmt"
  5. "math/rand"
  6. )
  7.  
  8. type Student struct {
  9. Name string
  10. Age int
  11. Score float32
  12. next *Student
  13. }
  14.  
  15. //函数化
  16. func trans (p *Student){
  17. for p != nil {
  18. fmt.Println(*p)
  19. p = p.next
  20. }
  21. fmt.Println()
  22. }
  23. func tailInsertChain(p *Student){
  24.  
  25. for i := 0 ; i < 11 ; i++ {
  26. var stu = Student{
  27. Name:fmt.Sprintf("student%d",i),
  28. Age:rand.Intn(100),
  29. Score:rand.Float32() * 100,
  30. }
  31. p.next = &stu
  32. p = &stu
  33. }
  34. }
  35.  
  36. func main() {
  37. //生成链表表头
  38. var head Student
  39. head.Name = "alex"
  40. head.Age = 18
  41. head.Score = 100
  42.  
  43. //链表尾部插入法
  44. tailInsertChain(&head)
  45. trans(&head)
  46.  
  47. //p := &head // var p *Student = &head
  48. }
  49.  
  50. /*
  51.  
  52. {alex 18 100 0xc4200721b0}
  53. {student0 81 94.05091 0xc4200721e0}
  54. {student1 47 43.77142 0xc420072210}
  55. {student2 81 68.682304 0xc420072240}
  56. {student3 25 15.651925 0xc420072270}
  57. {student4 56 30.091187 0xc4200722a0}
  58. {student5 94 81.36399 0xc4200722d0}
  59. {student6 62 38.06572 0xc420072300}
  60. {student7 28 46.888985 0xc420072330}
  61. {student8 11 29.310184 0xc420072360}
  62. {student9 37 21.855305 0xc420072390}
  63. {student10 95 36.08714 <nil>}
  64.  
  65. */

6.双链表定义

  如果有两个指针分别指向前一个节点和后一个节点,我们叫做双链表

例子: 二叉树(通过递归实现)

  如果每个节点有两个指针分别用来指向左子树和右子树,我们把这样的结构叫做二叉树

  1. package main
  2.  
  3. import "fmt"
  4. type Student struct {
  5. Name string
  6. Age int
  7. Score float32
  8. left *Student
  9. right *Student
  10. }
  11.  
  12. func trans(p *Student){
  13. if (p == nil){ //如果为空就终止
  14. return
  15. }
  16.  
  17. //前序遍历
  18. //fmt.Println(p)
  19. //trans(p.left)
  20. //trans(p.right)
  21. //中序遍历
  22. //trans(p.left)
  23. //fmt.Println(p)
  24. //trans(p.right)
  25. //后续遍历
  26. trans(p.left)
  27. trans(p.right)
  28. fmt.Println(p)
  29.  
  30. }
  31.  
  32. func main() {
  33. var root *Student = &Student{
  34. Name:"alex",
  35. Age:18,
  36. Score:100,
  37. }
  38.  
  39. var left *Student = &Student{
  40. Name:"alex_left",
  41. Age:19,
  42. Score:200,
  43. }
  44.  
  45. var left1 *Student = &Student{
  46. Name:"alex_left1",
  47. Age:19,
  48. Score:200,
  49. }
  50.  
  51. var right *Student = &Student{
  52. Name:"alex_right",
  53. Age:19,
  54. Score:200,
  55. }
  56.  
  57. var right1 *Student = &Student{
  58. Name:"alex_right1",
  59. Age:19,
  60. Score:200,
  61. }
  62.  
  63. root.left = left
  64. root.right = right
  65.  
  66. left.left = left1
  67. right.right = right1
  68.  
  69. trans(root)
  70. }
  71. /*
  72. &{alex_left1 19 200 <nil> <nil>}
  73. &{alex_left 19 200 0xc4200721e0 <nil>}
  74. &{alex_right1 19 200 <nil> <nil>}
  75. &{alex_right 19 200 <nil> 0xc420072240}
  76. &{alex 18 100 0xc4200721b0 0xc420072210}
  77.  
  78. */

7.结构体是用户单独定义的类型,不能和其他类型进行强制转换

  1. type Student struct {
  2. Number int
  3. }
  4.  
  5. type Stu Student //alias
  6.  
  7. var a Student
  8. a = Student(30)
  9.  
  10. var b Stu
  11. a = b
  12.  
  13. //错误示范

8.golang中的struct没有构造函数,一般可以使用工厂模式来解决这个问题

  类似于python的__init__构造方法

  1. package main
  2.  
  3. import "fmt"
  4. //go中没构造函数,可以通过工厂函数实现
  5.  
  6. type Student struct {
  7. Name string
  8. Age int
  9. }
  10.  
  11. func NewStudent(name string,age int) *Student{
  12. res := new(Student)
  13. res.Name = name
  14. res.Age = age
  15. return res
  16. //return &Student{Name:name,Age:age}
  17. }
  18.  
  19. func main() {
  20. S := NewStudent("alex",18)
  21. fmt.Println(S.Name,S.Age)
  22. }

****前方高能:

  1. make 用来创建map、slice、channel(引用类型)
  2. new用来创建值类型

例子:

  我们可以为struct中的每个字段,写上一个tag。这个tag可以通过反射的机制获取到,最常用的场景就是json序列化和反序列化

  1. package main
  2.  
  3. import (
  4. "fmt"
  5. "encoding/json"
  6. )
  7.  
  8. //结构体Student必须大写,不然json包无法使用结构体里的字段
  9. type Student struct {
  10. Name string `json:"name"`
  11. Age int `json:"age"`
  12. Score int `json:"score"`
  13.  
  14. }
  15.  
  16. func main() {
  17. var stu1 Student
  18. stu1.Name = "alex"
  19. stu1.Age = 18
  20. stu1.Score = 200
  21.  
  22. data, err := json.Marshal(stu1) //默认json序列化为byte数组
  23. if err != nil{
  24. fmt.Println("json error",err)
  25. return
  26. }
  27. fmt.Println(string(data))
  28.  
  29. }
  30.  
  31. /*
  32. {"name":"alex","age":18,"score":200}
  33. */

9.结构体中字段可以没有名字,即匿名字段

  1. package main
  2.  
  3. import "fmt"
  4.  
  5. type Human struct {
  6. name string
  7. age int
  8. weight int
  9. }
  10. //匿名字段类似python里的继承
  11. type Student struct {
  12. Human // 匿名字段,那么默认Student就包含了Human的所有字段
  13. speciality string
  14. }
  15.  
  16. func main() {
  17. //初始化一个学生
  18. mark := Student{Human{"alex",18,180},"python"}
  19. fmt.Println(mark)
  20. //打印
  21. fmt.Println("His name is ", mark.name)
  22. fmt.Println("His age is ", mark.age)
  23. fmt.Println("His weight is ", mark.weight)
  24. fmt.Println("His speciality is ", mark.speciality)
  25.  
  26. //修改这个学生的爱好
  27. mark.speciality = "golang"
  28. fmt.Println(mark)
  29.  
  30. mark.age += 2
  31. fmt.Println(mark)
  32. mark.Human = Human{"dragon",33,190} //student可以.Human 直接修改
  33. fmt.Println(mark)
  34. }
  35.  
  36. /*
  37. 我们看到Student访问属性age和name的时候,就像访问自己所有用的字段一样,对,匿名字段就是这样,能够实现字段的继承。是不是很酷啊?
  38. 还有比这个更酷的呢,那就是student还能访问Human这个字段作为字段名。请看下面的代码,是不是更酷了。
  39. */

匿名字段和自定义字段

  1. package main
  2.  
  3. import "fmt"
  4.  
  5. //通过匿名访问和修改字段相当的有用,但是不仅仅是struct字段哦,所有的内置类型和自定义类型都是可以作为匿名字段的
  6. type Skills []string
  7.  
  8. type Human struct {
  9. name string
  10. age int
  11. weight int
  12. }
  13.  
  14. type Student struct {
  15. Human // 匿名字段,struct
  16. Skills // 匿名字段,自定义的类型string slice
  17. int // 内置类型作为匿名字段
  18. speciality string
  19. }
  20.  
  21. func main() {
  22. // 初始化学生Jane
  23. jane := Student{Human:Human{"Jane", 35, 100}, speciality:"Biology"}
  24. // 现在我们来访问相应的字段
  25. fmt.Println("Her name is ", jane.name)
  26. fmt.Println("Her age is ", jane.age)
  27. fmt.Println("Her weight is ", jane.weight)
  28. fmt.Println("Her speciality is ", jane.speciality)
  29. // 我们来修改他的skill技能字段
  30. jane.Skills = []string{"anatomy"} //传一个切片进去
  31. fmt.Println("Her skills are ", jane.Skills)
  32. fmt.Println("She acquired two new ones ")
  33. jane.Skills = append(jane.Skills, "physics", "golang")
  34. fmt.Println("Her skills now are ", jane.Skills)
  35. // 修改匿名内置类型字段
  36. jane.int = 3
  37. fmt.Println("Her preferred number is", jane.int)
  38. }
  39. /*
  40. Her name is Jane
  41. Her age is 35
  42. Her weight is 100
  43. Her speciality is Biology
  44. Her skills are [anatomy]
  45. She acquired two new ones
  46. Her skills now are [anatomy physics golang]
  47. Her preferred number is 3
  48. */

匿名字段冲突问题:

  1. package main
  2.  
  3. import "fmt"
  4.  
  5. type Cart1 struct {
  6. name string
  7. age int
  8. }
  9.  
  10. type Cart2 struct {
  11. name string
  12. }
  13.  
  14. type Train struct {
  15. Cart1
  16. Cart2
  17. }
  18.  
  19. func main() {
  20. //cart1,cart2都包含name字段,需要精确选择
  21. var tra1 Train
  22. tra1.Cart1.name = "alex"
  23. fmt.Println(tra1)
  24.  
  25. }

10.Go中的方法是作用在特定类型的变量上,因此自定义类型,都可以有方法,而不仅仅是struct

  定义:func (recevier type) methodName(参数列表)(返回值列表){}

  1. package main
  2.  
  3. import "fmt"
  4.  
  5. type interger int
  6.  
  7. func (p interger) print(){
  8. fmt.Println("number is ",p)
  9. }
  10.  
  11. func (p *interger) set(b interger){
  12. *p = b
  13. }
  14.  
  15. type Student struct {
  16. name string
  17. age int
  18. }
  19.  
  20. func (self *Student) init(name string,age int){
  21. self.name = name
  22. self.age = age
  23. fmt.Println(self)
  24. }
  25.  
  26. func (self Student) get() Student{
  27. return self
  28. }
  29.  
  30. func main() {
  31.  
  32. var stu1 Student
  33. //go中自动变成指针,当赋值或者初始化的时候
  34. stu1.init("alex",18)
  35. res := stu1.get()
  36. fmt.Println(res)
  37.  
  38. var myint interger
  39. myint = 100
  40. myint.print()
  41. myint.set(1000)
  42. myint.print()
  43.  
  44. }
  45. /*
  46. &{alex 18}
  47. {alex 18}
  48. number is 100
  49. number is 1000
  50.  
  51. */

方法和函数的区别:

  1. 函数调用: function(variable, 参数列表)
  2. 方法:variable.function(参数列表)

指针receiver vs 值receiver的区别

  本质上和函数的值传递和地址传递是一样的

方法的访问控制,通过大小写控制

11.struct继承和组合

  如果一个struct嵌套了另一个匿名结构体,那么这个结构可以直接访问匿名结构体的方法,从而实现了继承

  如果一个struct嵌套了另一个有名结构体,那么这个模式就叫组合

例子:

  如果一个变量实现了String()这个方法,那么fmt.Printf默认会调用这个变量的String()进行输出。

  1. package main
  2.  
  3. import "fmt"
  4.  
  5. type Cart struct {
  6. weight int
  7. length int
  8. }
  9.  
  10. func (p *Cart) run(speed int) {
  11. fmt.Println("running speed is ",speed)
  12. }
  13.  
  14. //struct实现String,类调用方法都时候将变量转为指针,通过接口实现不会
  15.  
  16. func (p *Cart) String() string{
  17. str := fmt.Sprintf("[%d]-[%d]",p.length,p.weight)
  18. return str
  19. }
  20.  
  21. type Bike struct {
  22. Cart
  23. speed int
  24.  
  25. }
  26.  
  27. //组合
  28. type Train struct {
  29. c Cart
  30. }
  31.  
  32. func main() {
  33. var a Bike
  34. a.speed = 100
  35. a.weight = 200
  36. a.length = 20000
  37. fmt.Println(a)
  38.  
  39. a.run(100)
  40.  
  41. var b Train
  42. //带着组合的别名
  43. b.c.run(1000)
  44.  
  45.      //触发了String的方法
  46. fmt.Printf("%s",&a)
  47. }
  48. /*
  49. {{200 20000} 100}
  50. running speed is 100
  51. running speed is 1000
  52. [20000]-[200]
  53. */

多重继承

  如果一个struct嵌套了多个匿名结构体,那么这个结构可以直接访问多个匿名结构体的方法,从而实现了多重继承。

  多个匿名结构体含有相同字段,需要     变量.结构体.字段 精确指向

12.interface接口

  Interface类型可以定义一组方法,但是这些不需要实现。并且interface不能包含任何变量。  

  interface类型默认是一个指针

接口实现:

  Golang中的接口,不需要显示的实现。只要一个变量,含有接口类型中的所有方法,那么这个变量就实现这个接口。因此,golang中没有implement类似的关键字

  如果一个变量含有了多个interface类型的方法,那么这个变量就实现了多个接口

  如果一个变量只含有了1个interface的方部分方法,那么这个变量没有实现这个接口

  1. package main
  2.  
  3. import "fmt"
  4.  
  5. //接口是方法都集合,不能设置变量 用途类似于python的抽象类
  6. type Test interface {
  7. print()
  8. }
  9.  
  10. type Cart struct {
  11. name string
  12. speed int
  13. }
  14.  
  15. //cart实现了print方法,可以通过接口直接调用
  16. func (self *Cart) print() {
  17. fmt.Println(self.speed)
  18. fmt.Println(self.name)
  19. }
  20.  
  21. func main() {
  22. var t Test //接口是一个地址
  23. var a Cart = Cart{
  24. name:"baoshijie",
  25. speed:100,
  26. }
  27.  
  28. t = &a //接口代表了具体都类型
  29. t.print()
  30.  
  31. }
  32. /*
  33. 100
  34. baoshijie
  35.  
  36. */

接口嵌套

  一个接口可以嵌套在另外的接口

  1. type ReadWrite interface {
  2. Read(b Buffer) bool
  3. Write(b Buffer) bool
  4. }
  5. type Lock interface {
  6. Lock()
  7. Unlock()
  8. }
  9. type File interface {
  10. ReadWrite
  11. Lock
  12. Close()
  13. }

类型断言,由于接口是一般类型,不知道具体类型,如果要转成具体类型

  1. var t int
  2. var x interface{}
  3. x = t
  4. y = x.(int) //转成int
  5.  
  6. var t int
  7. var x interface{}
  8. x = t
  9. y, ok = x.(int) //转成int,带检查

练习:传入参数判断类型

  1. func classifier(items ...interface{}) {
  2. for i, x := range items {
  3. switch x.(type) {
  4. case bool: fmt.Printf(“param #%d is a bool\n”, i)
  5. case float64: fmt.Printf(“param #%d is a float64\n”, i)
  6. case int, int64: fmt.Printf(“param #%d is an int\n”, i)
  7. case nil: fmt.Printf(“param #%d is nil\n”, i)
  8. case string: fmt.Printf(“param #%d is a string\n”, i)
  9. default: fmt.Printf(“param #%d’s type is unknown\n”, i)
  10. }
  11. } 

空接口,interface{}

  空接口没有任何方法,所以所有类型都实现了空接口。

  1. var a int
  2. var b interface{}
  3. b = a

Go-day05的更多相关文章

  1. My way to Python - Day05 - 面向对象-思维导图

    My way to Python - Day05 - 面向对象   思维导图

  2. day05 Servlet 开发和 ServletConfig 与 ServletContext 对象

    day05 Servlet 开发和 ServletConfig 与 ServletContext 对象 1. Servlet 开发入门 - hello world 2. Servlet 的调用过程和生 ...

  3. python day05笔记总结

    2019.4.2 S21 day05笔记总结 一.昨日内容回顾与补充 1.extend(列表独有功能) 循环添加到一个列表中 a.有列表users = ['张三',‘李四]   people = [' ...

  4. Python基础(协程函数、内置函数、递归、模块和包)-day05

    写在前面 上课第五天,打卡: 凭着爱,再回首: 一.协程函数(生成器:yield的表达式形式) 1.yield 的语句形式: yield 1 - 这种方式在 Python基础(函数部分)-day04  ...

  5. day05(Object,tostring(),equals(),System,Date,SimpleDateFormat,拆装箱,正则表达式)

    Object类, 是所应类的父类: 拥有自己的方法:常用的    红颜色标记的为常用的方法 toString() 用法:打印对象的地址值 getClass() 获取当前类的字节码文件getName() ...

  6. 超全面的JavaWeb笔记day05<xml&dtd&jaxp>

    0.表单提交方式(*****) button提交 超链接提交 事件 1.xml简介和应用(了解) 2.xml文档声明和乱码解决(*****) 文档声明 必须放在第一行第一列 设置xml编码和保存编码一 ...

  7. Day05 xml详解

    day05总结 今日内容 XML语法 XML约束之DTD XML解析器介绍 XML解析之JAXP( DOM.SAX ) DOM4J Schema   一.XML语法 XML概述   1 什么是XML ...

  8. day05 --class --home

    # -*- coding: utf-8 -*-# @Time : 2018/12/25 14:24# @Author : Endless-cloud# @Site : # @File : day05 ...

  9. python开发学习-day05(正则深入、冒泡排序算法、自定义模块、常用标准模块)

    s12-20160130-day05 *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: ...

  10. 2017-2018-1 JAVA实验站 冲刺 day05

    2017-2018-1 JAVA实验站 冲刺 day05 各个成员今日完成的任务 小组成员 今日工作 完成进度 张韵琪 进行工作总结 100% 齐力锋 找按钮音乐 100% 张浩林 写博客 100% ...

随机推荐

  1. 使用cmd命令行窗口操作SqlServer

    本文主要介绍使用windows下的使用cmd命令行窗口操作Sqlserver, 首先我们可以运行 osql  ?/   ,这样就把所有可以通过CMD命令行操作sqlserver的命令显示出来 (有图有 ...

  2. WebAPI MVC Change Identity Default Table

    看过之前的文章小伙伴们应该已经明白了,当我们新建一个带有身份验证的模板时,会自带Identity Server,并且它的表名和字段名也都是默认的. 那么该如何修改它,并让EF知道呢?不废话,直接上代码 ...

  3. JarvisOJ Basic 爱吃培根的出题人

    听说你也喜欢吃培根?那我们一起来欣赏一段培根的介绍吧: bacoN is one of aMerICa'S sWEethEartS. it's A dARlinG, SuCCulEnt fOoD tH ...

  4. FTC诉高通垄断案苹果从中受益

    据外媒报道,美国当地时间周二,美国联邦贸易委员会(FTC)诉芯片制造商高通公司(Qualcomm)垄断案进入了终结辩论阶段.这意味着,这起审判也进入最后阶段,它可能颠覆高通在智能手机时代取得成功的至关 ...

  5. 了解AutoCAD对象层次结构 —— 2 ——文档

    再次想象另外一个场景:启动AutoCAD程序后,您新建了两个.dwg文件,也就是说创建了两个文档(Document)对象.将窗口进行层叠,您看到的窗口应该与下图类似: 图 4‑3 如何访问这些文档呢? ...

  6. kebu之rook-ceph

    准备工作 所有节点开启ip_forward cat <<EOF > /etc/sysctl.d/ceph.conf net.ipv4.ip_forward = 1 net.bridg ...

  7. JSON笔记

    JSPN示例1: { "firstName": "Brett", "lastName":"McLaughlin", &q ...

  8. [Codeforces757G]Can Bash Save the Day?——动态点分治(可持久化点分树)

    题目链接: Codeforces757G 题目大意:给出一棵n个点的树及一个1~n的排列pi,边有边权,有q次操作: 1 l r x 求 $\sum\limits_{i=l}^{r}dis(p_{i} ...

  9. BZOJ1014[JSOI2008]火星人——非旋转treap+二分答案+hash

    题目描述 火星人最近研究了一种操作:求一个字串两个后缀的公共前缀.比方说,有这样一个字符串:madamimadam,我们将这个字符串的各个字符予以标号:序号: 1 2 3 4 5 6 7 8 9 10 ...

  10. veu——引入iconfont图标

    我这里是阿里的iconfont图标,如何下载请看下面这个博文 https://www.cnblogs.com/wangyang0210/articles/9248324.html 创建文件夹 在ass ...