2014年数值分析(蔡懿慈) 实验题解
运行实验代码需要安装go
安装方法
- ubuntu
sudo apt-get install golang - archlinux
sudo pacman -S go - osx
brew install go - windows 下载二进制文件安装
每个实验独立一个go文件,相互之间没有依赖
| //our table's data | |
| const tableData = { | |
| 1 : ["Simon ugorji", "[email protected]", "01234", "Germany"], | |
| 2 : ["Tony ugorji", "[email protected]", "013234", "Turkey"], | |
| 3 : ["Victor ugorji", "[email protected]", "014234", "Germany"], | |
| 4 : ["Felix ugorji", "[email protected]", "011234", "Canada"], | |
| 5 : ["Jordan ugorji", "[email protected]", "016234", "Costa Rica"], | |
| 6 : ["Henry ugorji", "[email protected]", "0166234", "Belgium"], | |
| 7 : ["Frank Sams", "[email protected]", "01234", "Nigeria"], | |
| 8 : ["John Doe", "[email protected]", "0123466", "Australia"], |
| package main | |
| import ( | |
| "database/sql" | |
| "gopkg.in/gorp.v1" | |
| "log" | |
| "strconv" | |
| "github.com/gin-gonic/gin" | |
| _ "github.com/go-sql-driver/mysql" |
| /* | |
| GoTips.go: | |
| Golang速学速查速用代码手册 | |
| Source: github.com/coderzh/CodeTips/blob/master/GoTips.go | |
| Author: coderzh(github.com/coderzh) | |
| Blog: http://blog.coderzh.com | |
| 参考:《Go语言编程》 | |
| */ |
| package main | |
| // This is a basic example of running an nsqd instance embedded. It creates | |
| // and runs an nsqd with all of the default options, and then produces | |
| // and consumes a single message. You are probably better off running a | |
| // standalone instance, but embedding it can simplify deployment and is | |
| // useful in testing. | |
| // See https://github.com/nsqio/nsq/blob/master/nsqd/options.go and | |
| // https://github.com/nsqio/nsq/blob/master/apps/nsqd/nsqd.go for |
| package main | |
| import ( | |
| "errors" | |
| "log" | |
| "os" | |
| "github.com/PuerkitoBio/goquery" | |
| "github.com/robertkrimen/otto" | |
| ) |
| {{define "body"}} | |
| This is the start page. | |
| <br><br> | |
| Check out <a href="/user/5">user 5</a> or <a href="/user/7">user 7</a>. | |
| {{end}} | |
2014年数值分析(蔡懿慈) 实验题解
运行实验代码需要安装go
安装方法
sudo apt-get install golangsudo pacman -S gobrew install go每个实验独立一个go文件,相互之间没有依赖
| { | |
| "snippets": [ | |
| { | |
| "match": {"global": true, "pkgname": ".", "fn": ".*_test.go"}, | |
| "snippets": [ | |
| {"text": "func Test", "title": "", "value": "func Test${1:ObjectName}${2:TestName}(t *testing.T) {\n\t$0\n}"}, | |
| {"text": "func Benchmark", "title": "", "value": "func Benchmark${1:ObjectName}${2:BenchmarkName}(b *testing.B) {\n\n\tb.StopTimer()\n\n\t$0\n\n\tb.StartTimer()\n\n\tfor i := 0; i < b.N; i++ {\n\t\t\n\t}\n\n}"}, | |
| {"text": "func Example", "title": "", "value": "func Example${1:ObjectName}${2:ExampleName}() {\n\n\t$0\n\n\t// Output:\n\t// \n\n}"} | |
| ] | |
| } |
| eve-macbook:~ go run rowstojson.go | |
| [ | |
| { | |
| "id": 0, | |
| "name": "Peck Duran", | |
| "street": "Chapel Street", | |
| "city": "Orbin", | |
| "zip": "94999", | |
| "state": "Maine", | |
| "email": "[email protected]", |