V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  hheedat  ›  全部回复第 4 页 / 共 10 页
回复总数  188
1  2  3  4  5  6  7  8  9  10  
2019-02-14 18:04:42 +08:00
回复了 imherer 创建的主题 程序员 前后端分离的项目如何防止 api 被第三方利用
这和前后端分离没关系,只是接口比页面用起来方便
2019-02-01 17:34:26 +08:00
回复了 feiyuanqiu 创建的主题 PHP PHP 的 JIT 终于要来了
支持
2019-02-01 10:53:04 +08:00
回复了 hheedat 创建的主题 生活 大家帮我看看我是不是被收了智商税?
2019-01-31 19:36:36 +08:00
回复了 hheedat 创建的主题 生活 大家帮我看看我是不是被收了智商税?
@marcong95
@bravecarrot 化验我是认可的,我只是讨论这个中药的事情,看看 v 友的看法
2019-01-31 13:44:02 +08:00
回复了 hheedat 创建的主题 生活 大家帮我看看我是不是被收了智商税?
平时在网上我是中医黑,真自己病了,看了中药回家我还是乖乖喝了...先把身体的不适解决再说...
2019-01-31 13:42:24 +08:00
回复了 hheedat 创建的主题 生活 大家帮我看看我是不是被收了智商税?
主要是时间上耗费的比较厉害,本来身体就不舒服,一直在医院等待,路上奔波,疲惫啊
2019-01-31 13:41:30 +08:00
回复了 hheedat 创建的主题 生活 大家帮我看看我是不是被收了智商税?
对了,我们公司有补充医疗保险,应该都能报销,连上检查费用,一共五百左右吧
2019-01-31 13:40:43 +08:00
回复了 hheedat 创建的主题 生活 大家帮我看看我是不是被收了智商税?
@fxxkgw 汗,不知道社区医院在哪里,靠不靠谱啊,没有看病的经验。我以为除了去大医院,就是去街边药店让药店里面的医生看看了。
2019-01-31 13:37:07 +08:00
回复了 hheedat 创建的主题 生活 大家帮我看看我是不是被收了智商税?
@laycher 是啊,我这是五年来第一次去医院看病,没有经验啊,之前从来没有在北京看过病,都是忍一忍就过去了,这次持续的时间比较久,我怕是啥毛病,所以去医院看看
2019-01-18 19:13:09 +08:00
回复了 yuankui 创建的主题 程序员 有没有觉得周围人都是麻瓜?
麻辣鸡
2019-01-17 15:06:24 +08:00
回复了 hheedat 创建的主题 Go 编程语言 go 内存 profile 的图怎么看?
原图是 svg,新标签页打开可看
AB 是指 288Byte 的内存块,一共 34.01MB 吗?
2019-01-15 15:59:46 +08:00
回复了 hheedat 创建的主题 Go 编程语言 如何理解 golang pprof 的 cum ?感觉解释不通啊
@ensonmj 真相了,我把带 goroutine 的那个 LOOP 方法去掉,就符合预期了

@janxin 下面是我的代码
```
package main

import (
"flag"
"os"
"runtime/pprof"
"log"
"fmt"
"runtime"
"bufio"
"sync"
)

var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to `file`")
var memprofile = flag.String("memprofile", "", "write memory profile to `file`")
var blockprofile = flag.String("blockprofile", "", "write block profile to `file`")
var mutexprofile = flag.String("mutexprofile", "", "write mutex profile to `file`")

func main() {
flag.Parse()
if *cpuprofile != "" {
f, err := os.Create(*cpuprofile)
if err != nil {
log.Fatal("could not create CPU profile: ", err)
}
if err := pprof.StartCPUProfile(f); err != nil {
log.Fatal("could not start CPU profile: ", err)
}
defer pprof.StopCPUProfile()
}
if *blockprofile != "" {
runtime.SetBlockProfileRate(10 * 1000)
defer writeProfTo("block", *blockprofile)
}
if *mutexprofile != "" {
runtime.SetMutexProfileFraction(2)
defer writeProfTo("mutex", *mutexprofile)
}

m := make(map[int]*TrieNode, 4)
for i := 0; i < 3; i++ {
m[i] = BuildTire()
//loop.Loop()
}
//for i := 1; i < 10; i++ {
// ctA()
//}

if *memprofile != "" {
f, err := os.Create(*memprofile)
if err != nil {
log.Fatal("could not create memory profile: ", err)
}
//runtime.GC() // get up-to-date statistics
if err := pprof.WriteHeapProfile(f); err != nil {
log.Fatal("could not write memory profile: ", err)
}
f.Close()
}
}

func ctA() int64 {
return ctB()
}

func ctB() int64 {
var x int64 = 0
for i := 0; i < 1e9; i++ {
x = x + 1
}
return x + ctC() + ctD()
}

func ctC() int64 {
var x int64 = 0
for i := 0; i < 1e8; i++ {
x = x + 1
}
return x
}

func ctD() int64 {
var x int64 = 0
for i := 0; i < 5e8; i++ {
x = x + 1
}
return x
}

func writeProfTo(name, fn string) {
p := pprof.Lookup(name)
if p == nil {
fmt.Errorf("%s prof not found", name)
return
}
f, err := os.Create(fn)
if err != nil {
fmt.Errorf("%v", err.Error())
return
}
defer f.Close()
err = p.WriteTo(f, 0)
if err != nil {
fmt.Errorf("%v", err.Error())
return
}
}

type TrieNode struct {
Child *map[string]TrieNode
Exist bool
}

var mySlice []int
var sliceLock sync.RWMutex

func BuildTire() *TrieNode {
root := TrieNode{nil, false}

inFile, _ := os.Open("/Users/admin/stopwords.txt")
defer inFile.Close()
scanner := bufio.NewScanner(inFile)
scanner.Split(bufio.ScanLines)

for scanner.Scan() {
lineStr := scanner.Text()
root.addWord(lineStr)
Loop()
}

return &root
}

func Loop() {
var wg sync.WaitGroup
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
for i := 0; i < 10; i++ {
sliceLock.Lock()
mySlice = append(mySlice, i)
sliceLock.Unlock()
}
wg.Done()
}()
}
wg.Wait()
}

func GetMySliceLen() int {
return len(mySlice)
}

func (n *TrieNode) addWord(words string) {

runes := []rune(words)
keyStr := string(runes[0])

var exist bool
var restStr string
if len(runes) == 1 {
exist = true
restStr = ""
} else {
exist = false
restStr = string(runes[1:])
}

if n.Child == nil {
tm := make(map[string]TrieNode)
n.Child = &tm
}

tmpMap := *n.Child

if _, ok := tmpMap[keyStr]; !ok {
tmpMap[keyStr] = TrieNode{nil, exist}
} else {
if exist {
//tmpMap[keyStr].Exist = exist
tm := tmpMap[keyStr]
tm.Exist = exist
tmpMap[keyStr] = tm
}
}

n.Child = &tmpMap

if len(restStr) > 0 {
tm := tmpMap[keyStr]
tm.addWord(restStr)
tmpMap[keyStr] = tm
}
}

```
2019-01-04 17:46:33 +08:00
回复了 puritania 创建的主题 MacBook Pro 用 2015 Mbp 的同学请进
13 中配定制,再战 4 年
@u011631336 https://github.com/olivere/elastic 直接用的这个库,写入有错的话 error 我都打了日志,没有发现这种 error 日志,我再仔细看下
@u011631336 应该是这个问题,不过 es 没有报错输出
2018-11-30 18:00:10 +08:00
回复了 hheedat 创建的主题 Go 编程语言 confluent-kafka-go 和 sarama 选哪个库好? golang 消费 kafka
@rrfeng 也不是官方的,是核心开发人员跳槽后搞的
2018-11-30 17:59:26 +08:00
回复了 hheedat 创建的主题 Go 编程语言 confluent-kafka-go 和 sarama 选哪个库好? golang 消费 kafka
@rrfeng 网上有人说 sarama 在消费压力大的时候有问题
2018-11-02 17:58:16 +08:00
回复了 ishiguang 创建的主题 MacBook Pro 15 寸 mpb 双肩包选择
没有放保温杯的位置!差评
1  2  3  4  5  6  7  8  9  10  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1547 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 57ms · UTC 17:13 · PVG 01:13 · LAX 10:13 · JFK 13:13
Developed with CodeLauncher
♥ Do have faith in what you're doing.