小编car*_*ost的帖子

解决"java.net.BindException:Address in in use"错误?

我正在使用Intellij,尝试部署Tomcat应用程序,但每当我尝试运行它时,我都会收到以下错误:

Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 1098; nested exception is: 
java.net.BindException: Address already in use
Run Code Online (Sandbox Code Playgroud)

现在我通过以下方式手动查找在该端口发生的进程:

lsof -i:1098
Run Code Online (Sandbox Code Playgroud)

我找到了java进程并将其杀死了:

ps aux | grep java

kill -9 20386
Run Code Online (Sandbox Code Playgroud)

这很有效,但我必须这样做每次我打开Intellij.如果我想在不退出Intellij的情况下重新运行服务器,我不能,因为我会收到此错误.有没有人知道这个的永久性修复,而不是每次都手动杀死它?

java tomcat intellij-idea

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

Mac OSX - 在Yosemite Update之后在每个C++程序(甚至Hello World)上获取分段错误

我最近刚刚在我的Mac上升级到OSX Yosemite,虽然我不确定这是不是原因,但似乎很可疑突然所有的My C++程序都抛出了分段错误.

我甚至尝试了所有基本的"Hello World"程序的基础,但我仍然遇到了分段错误.从字面上看,每个C++程序都是这样做的.

#include <iostream>

using namespace std;

int main()
{
   cout << "Hello World" << endl;
}
Run Code Online (Sandbox Code Playgroud)

我安装了Xcode更新,看看是否可以解决问题,但没有运气.我很好奇,还有其他人有同样的问题吗?无论优胜美地,你有没有这个问题,你的Mac会抛出分段错误的一切

我应该补充一点,我正在使用g ++进行编译

c++ macos xcode osx-yosemite

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

用MySQL设置Django,syncdb给出了分段错误?

我目前正在构建一个Django应用程序.我正在关注使用Django 1.54 的"tangowithdjango"教程.在他们的教程中,他们使用Sql-lite,但我打算构建这个应用程序以达到最强大的目的,这就是为什么我试图连接MySQL.

不用说,这是一场噩梦.我不能让MySQL连接我的生活.

这是我的settings.py看起来像:

DATABASE_PATH = os.path.join(PROJECT_PATH, 'app.db')

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.mysql',
    'NAME': 'rideb',
    'USER': 'root',
    'PASSWORD': 'nantucket',
    #'HOST': 'localhost',             # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
    #'PORT': '',                      # Set to empty string for default.
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的输出我得到...

(rideb)grantmcgovern@gMAC:~/Dropbox/Developer/Projects/RideB/master$ python manage.py syncdb
Segmentation fault: 11
Run Code Online (Sandbox Code Playgroud)

我安装了python-mysqldb,现在我只是得到了这个,我至少可以说是非常困惑.它是一些Django兼容性问题吗?

一切正常,因为教程建议使用SQL-lite,但不希望使用它.

OS:

Mac OSX 10.10 Yosemite

MySQL(通过Oracle网站上的.dmg安装):

Server version: 5.6.19 MySQL Community Server (GPL)
Run Code Online (Sandbox Code Playgroud)

python mysql django

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

Heroku 上的 Dockerized MongoDB?

我不确定这是否是提出这个问题的正确 StackExchange,但我正在设置一个 MEAN 堆栈应用程序,我想从一开始就做到这一点。

我真的很想使用 Docker 和 Heroku(因为他们有新的流水线组并且作为唯一的开发人员易于部署),但是我找不到任何关于如何在 Heroku 上将 MongoDB 作为 docker 映像运行的指南。

这甚至可能吗?我也不太明白如何将数据库放入二进制映像(Docker 映像)中,但我读过的每个指南都说要分离微服务。

有没有其他人这样做过?

谢谢。

编辑:或者让 Mongo 未泊坞窗并使用 MongoLabs 并为 Dev/Prod 数据库拥有两个单独的实例只是一个更好的主意?

heroku mean mongodb docker mean-stack

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

什么时候在 Erlang 中使用宏函数?

我目前正在关注Fred Herbert所著的《Learn You Some Erlang for Great Good》一书,其中一节是关于宏的。

我理解将宏用于变量(主要是常量值),但是,我不理解宏作为函数的用例。例如,赫伯特写道:

定义一个“函数”宏是类似的。这是一个简单的宏,用于从另一个数字中减去一个数字:

-define(sub(X, Y), X-Y).
Run Code Online (Sandbox Code Playgroud)

为什么不将其定义为其他地方的函数?为什么要使用宏?编译器是否有某种性能优势,或者这仅仅是“这个函数如此简单,让我们在一行中定义它”类型的事情?

我不是要开始辩论或偏好争论,但在看到一些生产 Erlang 代码后,我开始注意到大量宏函数的使用。

macros erlang

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

“未在此范围内声明,并且在实例化点通过依赖于参数的查找未找到任何声明”

我正在开始使用堆的程序,其中必须将Sort,mergeSort和quickSort插入堆中。有人指示我使用课本中的代码作为基础,甚至无法编译示例代码。我不断收到错误:

not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation
Run Code Online (Sandbox Code Playgroud)

现在我认为这与在sort.h文件中声明template <>类的顺序有关。但是,我无法想象教科书会发布根本无法编译的代码。你们介意看看吗?

完整错误:

In file included from Driver.cpp:4:0:
Sort.h: In instantiation of 'void heapsort(std::vector<Comparable>&) [with Comparable = int]':
Driver.cpp:47:21:   required from here
Sort.h:79:9: error: 'percDown' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
Sort.h:104:6: note: 'template<class Comparable> void percDown(std::vector<Comparable>&, int, int)' declared here, later in the translation unit
Sort.h:83:9: …
Run Code Online (Sandbox Code Playgroud)

c++ heap mergesort quicksort insertion-sort

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

没有找到记录器"apscheduler.executors.default"的处理程序?

我有一个python脚本通过Heroku的夜间工作运行.每隔一段时间(最近,更多),脚本由于以下错误而无法执行.

2015-02-25T05:00:02.671242+00:00 app[clock.1]: No handlers could be found for logger "apscheduler.executors.default"
Run Code Online (Sandbox Code Playgroud)

该脚本使用我的Procfile中定义的内置时钟方法执行.

clock.py:

import sys
import logging

sys.path.append('main')

from main import main
from apscheduler.schedulers.blocking import BlockingScheduler

sched = BlockingScheduler()

# Executes every night at 5:00am UTC time | 12:00am (midnight) Winston-Salem, NC time
@sched.scheduled_job('cron', hour=5)
def scheduled_job():
    logging.basicConfig()
    main()

sched.start()
Run Code Online (Sandbox Code Playgroud)

我在网上搜索过,根据我读过的一些回复,人们说这是一个警告,而不是一个错误.但是,此问题会导致整个脚本在发生时失败.我的问题首先是,有没有解决这个问题?其次,为什么有时会发生这种情况而不是总是发生?

很多人说只需在脚本中添加以下内容:

import logging
logging.basicConfig()
Run Code Online (Sandbox Code Playgroud)

正如你所看到的,我做了,但问题仍然存在.

python logging heroku scheduled-tasks apscheduler

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

在Java Jersey RESTful Web应用程序中加载属性文件,以在整个应用程序中保留?

我目前正在使用Jersey构建RESTful API.到目前为止,一切进展顺利,但是,所有配置条目都已经过硬编码.(即数据库主机,数据库用户名等).

我希望能够设置config.properties我的WEB-INF文件夹中存在的文件,以包含所有这些配置规范.

我担心如果我在Classpath上读取文件的"经典"方式,我会为每个请求执行文件I/O. 我希望能够在启动时读取一次(我知道这涉及到ServletListener我的web.xml文件中.

这是我在下面的内容:

web.xml:

<listener>
    <listener-class>com._1834Software.Config</listener-class>
</listener>
Run Code Online (Sandbox Code Playgroud)

我想做类似这样的事情(我在StackOverflow上找到了这个),但我认为它不一定适用于Jersey:

Config.java

public class Config implements ServletContextListener {
    private static final String ATTRIBUTE_NAME = "config";
    private Properties config = new Properties();

    @Override
    public void contextInitialized(ServletContextEvent event) {
        try {

            config.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("config.properties"));

        } catch (IOException err) {
            err.printStackTrace();
        }

        event.getServletContext().setAttribute(ATTRIBUTE_NAME, this);

    }

    @Override
    public void contextDestroyed(ServletContextEvent event) { /**/ }

    public static Config getInstance(ServletContext context) {
        return …
Run Code Online (Sandbox Code Playgroud)

java xml config jersey properties-file

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

如何使用BeautifulSoup(Python)从HTML标签中提取文本?

我正在编写一个Python脚本,该脚本可以与某些HTML进行交互.我目前正在使用BeautifulSoup来解析这个HTML(我以前用它来使用XML,这真是太棒了!!!)我想知道从HTML中提取时间(文本)信息的最佳方法是什么.这是我在下面谈论的图片:

我正在尝试提取"Room 225 8:00 am","Room 225 8:30 am"等等...

有没有人对BeautifulSoup函数有特定的建议,该函数用于从标签中提取文本?

在此输入图像描述

这里也是原始的HTML(美化):

<html>
 <body>
  <li class="zone even open day">
   <label for="srr-1-1397046600">
    Room 225 8:30 AM
   </label>
   <input id="srr-1-1397046600" name="srr-1-1397046600" type="checkbox" value="Y"/>
   <span class="drag-handle">
   </span>
  </li>
  ,
  <li class="zone even open day">
   <label for="srr-1-1397050200">
    Room 225 9:30 AM
   </label>
   <input id="srr-1-1397050200" name="srr-1-1397050200" type="checkbox" value="Y"/>
   <span class="drag-handle">
   </span>
  </li>
  ,
  <li class="zone even open day">
   <label for="srr-1-1397053800">
    Room 225 10:30 AM
   </label>
   <input id="srr-1-1397053800" name="srr-1-1397053800" type="checkbox" value="Y"/>
   <span class="drag-handle">
   </span>
  </li>
  ,
  <li class="zone …
Run Code Online (Sandbox Code Playgroud)

html python beautifulsoup

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

Vue 3 - Mounted() 没有在组件上被调用?

我有一个非常简单的 Vue 3 组件,它看起来与文档中的一些示例相同。代码如下:

// Typewriter.vue

<template>
  <div id="wrapper">
    <p>{{ text }}</p>
  </div>
</template>

<script>
export default {
  name: "typewriter",
  props: {
    phrase: {
      type: String,
      required: true,
    },
  },
  data() {
    return {
      text: "",
    };
  },
  mounted() {
    console.log('Hello World!');
  }
};
</script>

<style scoped></style>
Run Code Online (Sandbox Code Playgroud)

然后我通过以下方式在另一个组件中渲染它:

<template>
    <p>Blah</p>
    <typewriter phrase="some text" />
</template>

<script>
import Typewriter from "@/components/Typewriter.vue";

export default {
  name: "bio",
  components: {
    Typewriter
  }
};
</script>

<style scoped></style>
Run Code Online (Sandbox Code Playgroud)

不过,mounted()好像没有被叫到?如果我将其更改为,setup()那么该方法内的任何内容都会被调用,但是当然这不适用于我的情况,因为我需要访问this该组件。 …

javascript vue.js vuejs3

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