52 Matching Annotations
  1. Last 7 days
  2. May 2019
  3. Mar 2019
  4. Feb 2019
    1. Exploring the usage of the CASE software through various research and development funded initiatives, is an on‐going process with the results informing the development process of the system. Future directions in the context of CASE software design include: automatic “mind‐map” diagrams; user defined highlighting and layout preferences; user special‐interest groups; automated and peer‐reviewed scoring of annotations for display; automated abuse filtering; intelligent grouping of learners; and middleware applications to support improved integration with on‐line learning environments.
    1. seems

      Look at the seed he is sowing right there.

    2. our scholars arc nol compelled to restrict their competence to the knowledge of one or another author, but can master a multiple, diversified, almost boundless domain of culture.

      As an autodidact, he would know!

  5. Nov 2018
    1. Cobra既是一个用来创建强大的现代CLI命令行的golang库,也是一个生成程序应用和命令行文件的程序。下面是Cobra使用的一个演示:
    1. 在计算机科学领域,反射是指一类应用,它们能够自描述和自控制。也就是说,这类应用通过采用某种机制来实现对自己行为的描述(self-representation)和监测(examination),并能根据自身行为的状态和结果,调整或修改应用所描述行为的状态和相关的语义
  6. Oct 2018
    1. Channels by default are blocking on sending and receiving values, so they will be waited on

      默认情况下,通道在发送和接收值时会阻塞,因此它们将被等待。

    1. Finally, we add the `xml:"sitemap"` syntax at the end for the parser to understand where it's looking when we go to unpack this with the encoding/xml package.

      最后,我们在末尾添加`xml:“sitemap”`语法,以便解析器在我们使用encoding / xml包解压缩它时的位置。

      type Sitemapindex struct {
          Locations []Location `xml:"sitemap"`
      }
      
    1. Personally, I would test both. If the gains are insignificant by using value receivers where possible and you are using pointer receivers, sure, use all pointer receivers. If you can make sizeable gains by using value receivers where possible, however, I would personally use them.

      就个人而言,我会测试两者。

      如果在可能的情况下使用值接收器并且您正在使用指针接收器,则增益无关紧要,请确保使用所有指针接收器。

      如果使用值接收器获取的收益微不足道,那么在可能的情况下,使用指针接收器,当然,所有地方都使用指针接收器

      但是,如果使用值接收器可以获得可观的收益,那么在可能的情况下,会亲自使用它们

    2. Now, we're modifying the struct itself via pointer. Now in the code we could do something like a_car.new_top_speed(500), and this would actually modify the object itself.

      现在,我们通过指针修改结构本身。现在在代码中我们可以做类似a_car.new_top_speed(500)的事情,这实际上会修改对象本身

    1. between the func keyword and the name of the function, we pass the variable and type. We use c, short for car, and then car, which is in association with the car struct. In this case, the method gets a copy of the object, so you cannot actually modify it here, you can only take actions or do something like coming up with a calculation

      func关键字和方法名之间,我们传递了变量和类型,

      我们使用c,汽车的简称,然后汽车,这是与汽车结构相关联。这样就把struct和method关联了起来

      在这种情况下,该方法获取对象的副本,因此您无法在此实际修改它,您只能执行操作或执行类似计算的操作 通过把struct和method关联了起来,使得方法获取到了对象的副本

      func (c car) kmh() float64 {
          return float64(c.gas_pedal) * (c.top_speed_kmh/usixteenbitmax)
      }
      
    2. In order to do this, we don't need to actually modify the a_car variable, so we can use a method on a value, called a value receiver:

      我们想把gas_pedal的值转化成某种实际的速度,为了做到这一点,我们不需要实际修改a_car变量,所以我们可以在值上使用一个方法,称为值 接收器

      func (c car) kmh() float64 {
          return float64(c.gas_pedal) * (c.top_speed_kmh/usixteenbitmax)
      }
      
    3. Methods that just access values are called value receivers and methods that can modify information are pointer receivers.

      只访问值的方法称为值接收器,只有获取值的需求时,用值接收器

      可以修改信息的方法是指针接收器,需要修改struct信息时,用指针接收器

    1. 可以使用内建函数 make 也可以使用 map 关键字来定义 Map:
      // 声明变量,默认 map 是 nil
      var map_variable map[key_data_type]value_data_type
      
      // 使用make 函数
      map_variable := make(map[key_data_type]value_data_type)
      
    1. /* 打印子切片从索引 0(包含) 到索引 2(不包含) */ number2 := numbers[:2] printSlice(number2) /* 打印子切片从索引 2(包含) 到索引 5(不包含) */ number3 := numbers[2:5] printSlice(number3)
      numbers := []int{0,1,2,3,4,5,6,7,8}
      

      len=2 cap=9 slice=[0 1]

      len=3 cap=7 slice=[2 3 4]

    2. 通过内置函数make()初始化切片s,[]int 标识为其元素类型为int的切片
      s := make([]int, len, cap)
      
    3. 初始化切片s,是数组arr的引用
      s := arr[:]
      
    1. /* 未定义长度的数组只能传给不限制数组长度的函数 */ setArray(array) /* 定义了长度的数组只能传给限制了相同数组长度的函数 */ var array2 = [5]int{1, 2, 3, 4, 5}
      func setArray(params []int) {
          fmt.Println("params array length of setArray is : ", len(params))
      }
      
      func setArray2(params [5]int) {
          fmt.Println("params array length of setArray2 is : ", len(params))
      }
      
    1. 注意:以上代码中倒数第二行的 } 必须要有逗号,因为最后一行的 } 不能单独一行,也可以写成这样:
      a = [3][4]int {
          {0, 1, 2, 3} ,
          {4, 5, 6, 7} ,
          {8, 9, 10, 11} ,    // 此处的逗号是必须要有的
      }
      

      上面代码也可以等价于

      a = [3][4]int {
          {0, 1, 2, 3} ,
          {4, 5, 6, 7} ,
          {8, 9, 10, 11}}
      
    1. func getSequence() func() int { i:=0 return func() int { i+=1 return i } }

      闭包,A函数 返回一个函数,假设返回的函数为B,那么函数B,可以使用A函数中的变量

      nextNumber := getSequence()

      nextNumber 是 返回函数B类型,func() int,i是函数A中的变量,初始值 i=0

      执行nextNumber(),i+=1, reuturn i ==> 1

      再执行nextNumber(),i+=1,return i ==> 2

      再执行nextNumber(),i+=1,return i ==> 3

    1. for 循环的 range 格式可以对 slice、map、数组、字符串等进行迭代循环。
      for key, value := range oldMap {
           newMap[key] = value
      }
      
    1. 以下描述了 select 语句的语法
      • 每个case都必须是一个通信
      • 所有channel表达式都会被求值
      • 所有被发送的表达式都会被求值
      • 如果任意某个通信可以进行,它就执行;其他被忽略。
      • 如果有多个case都可以运行,Select会随机公平地选出一个执行。其他不会执行。

      否则:

      1. 如果有default子句,则执行该语句。
      2. 如果没有default字句,**select将阻塞,直到某个通信可以运行**;Go不会重新对channel或值进行求值。
      
    1. iota 表示从 0 开始自动加 1,所以 i=1<<0, j=3<<1(<< 表示左移的意思),即:i=1, j=6,这没问题,关键在 k 和 l,从输出结果看 k=3<<2,l=3<<3。
      package main
      import "fmt"
      const (
          i=1<<iota
          j=3<<iota
          k
          l
      )
      func main() {
          fmt.Println("i=", i)
          fmt.Println("j=", j)
          fmt.Println("k=", k)
          fmt.Println("l=", l)
      }
      

      以上实例运行结果为:

      i=1
      j=6
      k=12
      l=24
      
    1. 这种因式分解关键字的写法一般用于声明全局变量
      var (
          vname1 v_type1
          vname2 v_type2
      )
      
    1. 以一个大写字母开头,如:Group1,那么使用这种形式的标识符的对象就可以被外部包的代码所使用(客户端程序需要先导入这个包),这被称为导出(像面向对象语言中的 public)
    2. main 函数是每一个可执行程序所必须包含的,一般来说都是在启动后第一个执行的函数(如果有 init() 函数则会先执行该函数)
  7. Aug 2018
  8. Jan 2018
  9. Nov 2017
  10. Oct 2017
  11. Sep 2017
  12. May 2017
    1. AlphaGo is going out on top. After beating Ke Jie, the world’s best player of the ancient Chinese board game Go, for the third time today at the Future of Go Summit in Wuzhen, Google’s DeepMind unit announced that it would be the last event match the AI plays.

      This makes me feel worse somehow than if it was going to continue to play. Seems like it is saying: well, tick the box for beating humans at Go...

    1. It inspired his work at Google, where he led the creation of the historical map platform Field Trip, and then, the Pokémon Go precursor, Ingress.

      I loved field trip for Glass!

    2. Niantic, the maker of Pokémon Go, is teaming up with the Knight Foundation in a multiyear commitment promoting civic engagement in communities. That means the two entities will pitch in time, money, and plenty of Pokémon to get citizens outside, exploring their towns in city-organized events.

      Very interesting development!

    1. The regulation of an entire burgeoning industry, and the interpretation of the Constitution in the digital age, could be impacted by the court’s decision in a case inspired by Pokémon.

      This is a really interesting case. How have I not heard of it?

    1. The diffusion and the public endorsement of data FAIRness has been rapid

      Good to see posts on this.

  13. Apr 2017
  14. Jan 2017
  15. Aug 2016
  16. Apr 2016
  17. Dec 2015