小编Eup*_*phe的帖子

Docker从容器访问本地主机端口

我有一个运行 Nuxt.js (Vue.js) 应用程序的容器,定义如下docker_composes.yml

version: '3'
services:
  vue:
    build: .
    image: registry.gitlab.com/something/app:${TAG}
    environment:
      - apiPath="http://localhost:5000/"
      - filePath="http://localhost:3000/"
    ports:
     - "${EXPOSED_PORT:-80}:${NUXT_PORT:-3000}"
    restart: always
Run Code Online (Sandbox Code Playgroud)

该应用程序是一个前端。我在本地主机上运行后端,在端口上5000。当容器化应用程序尝试连接到http://localhost:5000/它时失败。

我有哪些选择?我不想将后端放入docker_composes.yml并通过链接连接它们。如果这是唯一的选择,我会的。

docker docker-compose

24
推荐指数
4
解决办法
4万
查看次数

在分配数组元素值时,C预订值既不是数组也不是指针,也不是向量

很抱歉询问已经回答的问题,我是C的新手并且不理解解决方案.这是我的功能

int rotateArr(int *arr) {
    int D[4][4];
    int i = 0, n =0;
    for(i; i < M; i ++ ){
        for(n; n < N; n++){
            D[i][n] = arr[n][M - i + 1];
        }
    }
    return D;
}
Run Code Online (Sandbox Code Playgroud)

它抛出一个错误

main.c | 23 |错误:下标值既不是数组也不是指针也不是向量|

在线

D [i] [n] = arr [n] [M - i + 1];

怎么了?我只是将数组元素的值设置为另一个数组元素.

传递的arr声明为

int S[4][4] = { { 1, 4, 10, 3 }, { 0, 6, 3, 8 }, { 7, 10 ,8, 5 },  { 9, …
Run Code Online (Sandbox Code Playgroud)

c arrays

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

Mercurial:删除最后一次提交

我在默认工作,但认为在另一个分支工作.我承诺,但没有推.

现在我想更改分支并将更改提交到另一个分支,但也不希望提交转到默认.

如何撤消该提交?

mercurial

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

Heroku Rails部署失败,错误"无法连接到服务器:连接被拒绝"

一切都在本地工作正常,但当我尝试推送到heroku时我得到了错误:

正在运行:rake assets:预编译

   Connecting to database specified by DATABASE_URL                                                                                                                                                          
   rake aborted!                                                                                                                                                                                             
   could not connect to server: Connection refused                                                                                                                                                           
   Is the server running on host "127.0.0.1" and accepting                                                                                                                                                   
   TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)

/tmp/build_1903c764-07ce-4d06-aa45-6e78dec68af8/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in`initialize'

   /tmp/build_1903c764-07ce-4d06-aa45-6e78dec68af8/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `new'
Run Code Online (Sandbox Code Playgroud)

......等

我怀疑它必须对database.yml做一些事情,所以这里是:

development:
  adapter: mysql2
  encoding: utf8
  database: dev-db
  pool: 5
  timeout: 5000
  socket: /tmp/mysql.sock

test:
  adapter: mysql2
  encoding: utf8
  database: test-db
  pool: 5
  timeout: 5000
  socket: /tmp/mysql.sock

production:
  adapter:  postgresql
  encoding: utf8
  database: prod-db
  pool: 5
  timeout: 5000
 # socket: /tmp/mysql.sock
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails heroku

13
推荐指数
2
解决办法
5831
查看次数

Casperjs登录:casperjs管理cookie吗?

我想让我的casper登录并在会话期间保持登录状态.可能吗?如果是这样,怎么样?

cookies casperjs

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

Casperjs:我如何打印http请求和响应?

为了调试purporses,我需要查看整个请求:标头和数据.我怎样才能做到这一点?

javascript http casperjs

10
推荐指数
1
解决办法
8653
查看次数

脚本运行后如何在控制台中提供Tampermonkey添加的功能?

我创建了一个脚本,其中包含一个函数:

function updateGUI(){
    document.getElementById("cursoft").value = getSoftware();
    document.getElementById("curver").value = getCurrentVersion();
    document.getElementById("rcycles").value = getResearchCycles();
    document.getElementById("rcycle").value = getCurrentCycle();
    document.getElementById("curproc").value = getCurrentProcess();
    document.getElementById("curact").value = getCurrentAction();
}
Run Code Online (Sandbox Code Playgroud)

该脚本在页面加载时运行很好,但是当我尝试在脚本完成执行后运行此函数时,它是"未定义".
如何让它"保持"在当前范围内?

javascript tampermonkey

8
推荐指数
2
解决办法
3940
查看次数

如何从键盘输入数学表达式?

我有一个简单的C程序

int main()
{

    int n, maxn = 21;
    float SN, x;

    printf("input x:");
    scanf("%f", &x);

    printf("input maxn:");
    scanf("%d", &maxn);

    for(n=0;n<=maxn;n++){
        SN = SN + pow(x,n);
        n = n + 1;
    }

    printf("%f", SN);
    getch();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我需要使它具有多种功能,因此用户可以输入任何表达式来替换pow(x,n),无论用户从键盘输入什么.如何将表达式放入程序中?

c c++

5
推荐指数
1
解决办法
696
查看次数

Pyinstaller:路径或glob"/usr/include/python3.4m/pyconfig.h"未找到或匹配任何文件."

我正在尝试在Oracle虚拟机ubuntu 14.04.2 LTS上构建我的项目.

我的项目是在Python 34中.我通过以下方式安装了pyinstaller:

pip install https://github.com/pyinstaller/pyinstaller/archive/python3.zip
Run Code Online (Sandbox Code Playgroud)

当我运行时,pyinstaller run.py我收到以下错误:

FileNotFoundError: Path or glob "/usr/include/python3.4m/pyconfig.h" not found or matches no files.
Run Code Online (Sandbox Code Playgroud)

我确实没有目录'/usr/include/python3.4m',只有'usr/include/python2.7'.安装了Python 34(默认情况下在Ubuntu中).

我怎样才能让它发挥作用?

ubuntu pyinstaller python-3.x

5
推荐指数
1
解决办法
1874
查看次数

创建一个(对象的)SortedSet 并向其中插入元素更快,还是创建一个ArrayList 然后对其进行排序更快?

我的文件中有一百万行。从每一行创建一个对象并将其添加到集合中。compareTo()必须使用类的自定义方法对集合进行排序。

目前我ArrayList按照阅读顺序将对象添加到 an 中,然后执行Collections.sort().

制作 TreeSet 会更快吗?

java sorting arraylist

4
推荐指数
1
解决办法
2596
查看次数