我有很多不同版本的应用程序.每个都是一个单独的intellij项目.每次打开一个新配置时,配置列表都会空白:

令人烦恼的是我部署到1 vm,每次我想测试不同的版本时,我都必须复制并粘贴调试配置.Intellij根据Intellij实例创建此对话框模式,因此我无法在项目实例之间复制和粘贴字段.
我最终拍摄了一个配置的屏幕截图,并手动将字段复制到另一个项目中.这是一个非常原始的解决方案.有没有更方便的方法从一个项目到另一个项目获得运行配置?
我在Windows 7上使用Intellij 13.
我可以在不同的项目中共享IntelliJ Idea的设置吗?可能有这个答案,但问题是不同的.这是关于窗口布局.因此,我不认为它是重复的.
我正在使用pythons mock.patch,并希望更改每个调用的返回值.以下是警告:正在修补的函数没有输入,因此我无法根据输入更改返回值.
这是我的代码供参考.
def get_boolean_response():
response = io.prompt('y/n').lower()
while response not in ('y', 'n', 'yes', 'no'):
io.echo('Not a valid input. Try again'])
response = io.prompt('y/n').lower()
return response in ('y', 'yes')
Run Code Online (Sandbox Code Playgroud)
我的测试代码:
@mock.patch('io')
def test_get_boolean_response(self, mock_io):
#setup
mock_io.prompt.return_value = ['x','y']
result = operations.get_boolean_response()
#test
self.assertTrue(result)
self.assertEqual(mock_io.prompt.call_count, 2)
Run Code Online (Sandbox Code Playgroud)
io.prompt只是一个独立于平台(python 2和3)版本的"输入".所以最终我试图模拟用户输入.我已经尝试使用列表作为返回值,但这并不能解决问题.
你可以看到,如果返回值是无效的,我将在这里得到一个无限循环.所以我需要一种方法来最终改变返回值,以便我的测试实际完成.
(回答这个问题的另一种可能的方法是解释我如何在单元测试中模仿用户输入)
不是这个问题的重复,主要是因为我没有能力改变输入.
答案中关于这个问题的评论之一是相同的,但没有提供答案/评论.
我注意到,当我使用条件断点进行调试时,执行速度会大大降低.我已经了解了一段时间,现在想了解原因.究竟发生了什么导致执行速度如此之慢?我知道正在添加条件,但如果我自己添加条件,我不会减慢执行速度.
例如,假设我们有以下代码.我们假设我们添加一个条件断点a=i.让我们将条件设置为i == 10000.
public class Main {
public static void main(String[] args) {
int a = 0;
for (int i = 0; i<100000; i++) {
a = i; //put breakpoint here (if i == 10000)
}
System.out.println("Done! a=" + a);
}
}
Run Code Online (Sandbox Code Playgroud)
现在让我们自己编写条件.
public class Main {
public static void main(String[] args) {
int a = 0;
for (int i = 0; i<100000; i++) {
if (i == 10000)
a = i; //put a NON-conditional breakpoint here …Run Code Online (Sandbox Code Playgroud) 我想在我的pip项目中使用PyYaml,但是在使用它作为依赖项时遇到了麻烦.主要问题是pip中的PyYaml不是跨平台安装.
如何使用pip安装pyyaml以使其正常工作.注意,在当前新的Ubuntu安装上,运行时出现以下错误pip install pyyaml
Installing collected packages: pyyaml
Running setup.py install for pyyaml
checking if libyaml is compilable
gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIC -I/usr/include/python3.2mu -c build/temp.linux-x86_64-3.2/check_libyaml.c -o build/temp.linux-x86_64-3.2/check_libyaml.o
build/temp.linux-x86_64-3.2/check_libyaml.c:2:18: fatal error: yaml.h: No such file or directory
compilation terminated.
libyaml is not found or a compiler error: forcing --without-libyaml
(if libyaml is installed correctly, you may need to
specify the option --include-dirs or uncomment and
modify the parameter include_dirs …Run Code Online (Sandbox Code Playgroud) 我想关闭我认为是Spring Boot默认的HttpOnly会话.如何在弹簧靴上关闭HttpOnly?
我目前有以下代码:
@RequestMapping(value = "/stuff", method = GET)
public @ResponseBody
myObject doStuff(HttpSession session)
{
session.setAttribute("foo", "bar");
return new MyObject();
}
Run Code Online (Sandbox Code Playgroud)
这会在HTTP调用上返回响应头:
Set-Cookie: JSESSIONID=D14846D9767B6404F1FB4B013AB66FB3; Path=/; HttpOnly
Run Code Online (Sandbox Code Playgroud)
注意HttpOnly标志.我想把它关掉.我该怎么办?
旁注:是的我知道httpOnly是一个安全功能,通过关闭它允许javascript访问我的cookie即XSS.
另外,我没有默认配置以外的任何配置.
@ComponentScan
@EnableAutoConfiguration
public class WebApplication {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(WebApplication.class);
app.run(args);
}
}
Run Code Online (Sandbox Code Playgroud) 每次尝试获取或设置为使用configparserPython NoSectionError的部分时,如果该部分不存在,则抛出一个部分.反正有没有避免这个?另外,我还可以避免NoOptionError在获得选项时吗?
例如,使用字典,有setdefault选项:KeyError当键不存在时,字典会添加键,将键的值设置为默认值,然后返回默认值.
我目前正在执行以下操作来获取属性:
def read_config(section):
config = configparser.ConfigParser()
config.read(location)
try:
apple = config.get(section, 'apple')
except NoSectionError, NoOptionError:
apple = None
try:
pear = config.get(section, 'pear')
except NoSectionError, NoOptionError:
pear = None
try:
banana = config(section, 'banana')
except NoSectionError, NoOptionError:
banana = None
return apple, pear, banana
Run Code Online (Sandbox Code Playgroud)
以下是设置它们:
def save_to_config(section, apple, pear, banana):
config = configparser.ConfigParser()
if not os.path.exists(folder_location):
os.makedirs(folder_location)
config.read(location)
if section not in config.sections():
config.add_section(section)
config.set(section, 'apple', apple)
config.set(section, …Run Code Online (Sandbox Code Playgroud) 在*nix中,我可以简单地将.一个文件添加到文件中以使其"隐藏".还有一些方法可以在Windows中隐藏文件.
有没有办法在python中使文件隐藏CROSS PLATFORM?
目前:
def write_hidden(file_name, data):
file_name = '.' + file_name
with open(file_name_, 'w') as f:
f.write(data)
Run Code Online (Sandbox Code Playgroud)
但正如我所说,这只适用于*nix系统.
我试图推送到dockerhub上的私人存储库,并得到一个奇怪的错误:
$ docker push myrepo/my-awesome-service:latest
The push refers to a repository [docker.io/myrepo/my-awesome-service] (len: 1)
cbf09022264b: Buffering to Disk
Error parsing HTTP response: invalid character '<' looking for beginning of value: "<html><body><h1>403 Forbidden</h1>\nRequest forbidden by administrative rules.\n</body></html>\n\n"
Run Code Online (Sandbox Code Playgroud)
我已经检查并确保我在dockerhub上拥有"admin"权限.知道是什么导致了这个,或者我如何解决它?
更多信息:
$ docker --version
Docker version 1.8.0, build 0d03096
Run Code Online (Sandbox Code Playgroud) 我正在尝试将我的代码部署到AWS Beanstalk并收到此错误.我研究说可能是版本的数量超过500,所以我删除了很多版本.但是,我仍然得到这个错误.
eb deploy
ERROR: No Application Version named 'v0_9_2-76-gf5a4' found.
Run Code Online (Sandbox Code Playgroud)
我也试过了
git aws.push
Error: Failed to create the AWS Elastic Beanstalk application version
Run Code Online (Sandbox Code Playgroud)
编辑:尝试eb deploy --debug我现在得到:
实例:i-2ad238d5模块:AWSEBAutoScalingGroup ConfigSet:null命令在实例上失败.返回码:1输出:构建期间发生错误:命令挂钩失败.脚本/opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh失败,返回码为18
ebcli.objects.exceptions.ServiceError:更新环境操作已完成,但有错误.有关更多信息,请参阅故障排除文档
我有一个有趣的困境,我似乎有内存泄漏(或不断增长的数据结构).当我分析我的内存使用情况时,我得到了典型的"随时间线性提升"图表.试图找出问题的原因是什么,我做了一个堆转储.我发现超过50%的内存被分配给a ConcurrentLinkedQueue node.内存的高端消费者,com.singularity.ee.agent.util.ch并java.util.concurrent.ConcurrentLinkedQueue$Node为看到下面的图片.

我不知道util.ch它是什么,但它似乎与节点绑定,因为每个ch都有一个节点的立即引用,所以不用担心关注它.
现在尝试查找对$ Node最近的GC的引用,我得到以下内容:

奇怪的是,它没有ConcurrentLinkedQueue $ Node,甚至没有ConcurrentLinkedQueue作为父级.所有引用都是我不理解的奇怪类型,kh, uc, z, g, etc.有谁知道这些类型是什么?
我试图找出导致问题的确切原因,但我无法找到这些节点甚至是如何创建/保存的.
这是踢球者:我不在代码中的任何地方使用ConcurrentLinkedQueue.我确实使用了ConcurrentHashMap,但是没有很多HashMap $ Node,所以不应该是问题.
有没有人知道如何创建这些节点或为什么我有这么多的实例?
回答依赖问题:我正在运行tomcat 6,java 6,Java Spring.
python ×4
java ×3
configparser ×1
debugging ×1
docker ×1
dockerhub ×1
heap-dump ×1
httponly ×1
memory-leaks ×1
mocking ×1
pip ×1
python-mock ×1
spring ×1
spring-boot ×1
unit-testing ×1
yaml ×1