小编Cro*_*ton的帖子

如何修复"凉亭ENOTFOUND"

我正在尝试在VPS上安装https://github.com/catarse/catarse脚本(在我的本地机器上工作正常),当我输入命令时出错bower install:

bower checkout      catarse_admin#master
bower resolved      https://github.com/catarse/catarse_admin.git#3151581f33
bower ENOTFOUND     Package option not found
Run Code Online (Sandbox Code Playgroud)

bower.json

{
  "name": "catarse",
  "version": "1.0.0",
  "homepage": "https://github.com/catarse/catarse",
  "description": "The first open source crowdfunding platform for creative projects in the world!",
  "license": "MIT",
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "vendor/assets/components",
    "test",
    "tests"
  ],
  "dependencies": {
    "jquery": "~2.1.4",
    "backbone": "~1.2.0",
    "underscore": "~1.8.3",
    "jquery-sticky": "~1.0.1",
    "jquery-smooth-scroll": "~1.5.5",
    "jquery-typewatch": "~2.2.1",
    "store": "~2.3.0",
    "jQuery-Mask-Plugin": "~1.11.4",
    "jquery-ui": "~1.11.4",
    "jquery-ujs": "~1.0.3",
    "jquery.fixedmask": "~1.0.0",
    "mithril": "~0.2.0",
    "catarse_admin": "https://github.com/catarse/catarse_admin.git#master"
  }
}
Run Code Online (Sandbox Code Playgroud)

javascript bower bower-install

21
推荐指数
1
解决办法
1万
查看次数

在Ruby/Rails中合并数组

如何合并两个数组?像这样的东西:

@movie = Movie.first()
@options = Movie.order("RANDOM()").first(3).merge(@movie)
Run Code Online (Sandbox Code Playgroud)

但它不起作用.

@options我需要一个包含四个元素的数组@movie.

ruby orm ruby-on-rails ruby-on-rails-4

17
推荐指数
3
解决办法
3万
查看次数

nginx:[emerg]一个重复的默认服务器

当我尝试重启nginx并在控制台中写入此命令时

nginx -t

我有一个错误:

nginx: [emerg] a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default.save:20
nginx: configuration file /etc/nginx/nginx.conf test failed
Run Code Online (Sandbox Code Playgroud)

启用站点-/默认

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        server_name localhost;
        passenger_enabled on;
        rails_env    production;
        root         /home/hh/public;

        access_log  /var/log/nginx/host.access.log;
        # redirect server error pages to the static page /50x.html
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
}
Run Code Online (Sandbox Code Playgroud)

nginx.conf

user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
        worker_connections 768;
}

http {

        sendfile on; …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails passenger nginx

6
推荐指数
1
解决办法
6283
查看次数

如何在Rails表单中隐藏标签(Haml)?

我有一点形式:

  = f.label :option_1, "title"
  = f.check_box :option_1
Run Code Online (Sandbox Code Playgroud)

这是渲染:

IMG IMG 如何从标签中删除" 选项1 "?

forms checkbox haml ruby-on-rails ruby-on-rails-4

6
推荐指数
1
解决办法
1058
查看次数

静态文件的Httprouter问题

我正在使用路由器(httprouter)并希望从 root 提供静态文件。

css文件在

static/style.css

在模板中

<link href="./static/style.css" rel="stylesheet">

main.go

router := httprouter.New()
router.ServeFiles("/static/*filepath", http.Dir("/static/"))
router.GET("/", Index)
Run Code Online (Sandbox Code Playgroud)

但是http://localhost:3001/static/style.css给了我一个 404 错误并且渲染页面中的样式也不起作用。

go

2
推荐指数
1
解决办法
3242
查看次数

Go Echo 未从 Vue 获取 POST 正文

我有 SignUp 函数并尝试获取 Vue 框架发送的请求正文,但它是空的。

type SignUpForm struct {
    Username string
    Email    string
    Password string
}

func SignUp(c echo.Context) error {
    form := SignUpForm{
        Username: c.FormValue("username"),
        Email:    c.FormValue("email"),
        Password: c.FormValue("password")}

    user := models.User{
        Username: form.Username,
        Email:    form.Email,
        Password: models.HashPassword(form.Password),
    }

    log.Printf("#####################")
    values, _ := c.FormParams()
    log.Printf("%v\n", values)
    log.Printf("%v", c.Response().Header())
    log.Printf("#####################")

    err := database.Connection().Create(&user).Error
    if err != nil {
        return c.JSON(http.StatusInternalServerError, err)
    } else {
        return generateJwtToken(c, user)
    }
}
Run Code Online (Sandbox Code Playgroud)

维埃

 sendForm: function() {
  var link = '/auth/sign_up'
  axios.post(link, { …
Run Code Online (Sandbox Code Playgroud)

javascript http go vue.js axios

0
推荐指数
1
解决办法
3460
查看次数

sync.WaitGroup 和嵌套循环

我想添加并发性来迭代嵌套循环,但遇到了麻烦。这个sync.WaitGroup 的示例用法有什么问题?

originCities := [3]string{"LED", "MOW", "PRS"}
destinationCities := [2]string{"UKT", "AAC"}

wg := &sync.WaitGroup{}
wg.Add(len(originCities) * len(destinationCities))

for _, originIata := range originCities {
    for _, destinationIata := range destinationCities {
        go func () {
            fmt.Println(originIata)
            fmt.Println(destinationIata)
            wg.Done()
        }()
    }
}
wg.Wait()
Run Code Online (Sandbox Code Playgroud)

我越来越

PRS AAC PRS AAC PRS AAC PRS AAC PRS AAC PRS AAC

正如您所看到的,它跳过两个数组的第一个元素并仅迭代最后一个元素。有什么想法可以解决此行为吗?

go goroutine

0
推荐指数
1
解决办法
4193
查看次数