小编Nir*_*han的帖子

如果指定了EHsc和EHa会发生什么

我正在处理遗留代码.

为了修复一些bug,我必须给EHa一些文件.我在测试时测试了整个项目的EHsc和EHa.这解决了我的问题,但发出警告称编译器正在用EHa覆盖EH.(选项的顺序是:/ EHsc/EHa)仅当正在构建需要EHa的文件时才会出现此警告.它不会出现在只需要EH的源文件中.

<name of the file that needs EHa>\cl : warning D9025 : overriding '/EHs' with '/EHa'
Run Code Online (Sandbox Code Playgroud)

我的问题是,这个警告是否说明实际发生了什么?EHa仅适用于实际需要EHa的源文件吗?(其他文件是否需要使用EHsc构建EH?)

谢谢.

c++ compiler-warnings compiler-options visual-c++

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

让JLabel消失

我正在编写一个执行某项任务的应用程序,并在成功完成任务后通知用户.告知用户我正在使用jlabel.我希望这个jlabel在一段时间后显示消息和后退.我使用netbeans作为我的IDE.

这是我班级的架构.

摘要,GUI代码

abstract class Admin extends JFrame{
  protected static jlabel lbl_message= new jlabel("some text");
  // other functions and variables

  abstarct protected void performButtonClickAction();

}
Run Code Online (Sandbox Code Playgroud)

用于实现抽象函数和提供其他功能的类.

final class AdminActionPerformer extends Admin{
  final public void performButtonClickAction(){
     // code for doin the task
     if(task is successful){
         new Thread(new Fader(Admin.lbl_message)).start();
     }
  }

 public static void main(String[] args) {
    new AdminActionPerformer().setVisible(true);
 }

}
Run Code Online (Sandbox Code Playgroud)

使Jlabel后退的线程

class Fader implements Runnable{
  javax.swing.JLabel label;
  Color c;

  Fader(javax.swing.JLabel label){
    this.label=label;
    c=label.getBackground();
  }

  public void run() {
    int alpha=label.getGraphics().getColor().getAlpha()-5;
    while(alpha>0){ …
Run Code Online (Sandbox Code Playgroud)

java swing

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

“identifier”:重新定义错误(错误 C2011 和错误 C2370)

每次我尝试编译代码时,都会遇到大量错误。这不是我的代码的问题,因为它在另一台计算机上运行得很好。我尝试重新安装和修复,但这没有帮助。这是完整的错误消息:

1>------ Build started: Project: Raptor Triangle 2, Configuration: Debug Win32 ------
1>  Raptor Triangle 2.cpp
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(57): error C2011: 'vc_attributes::YesNoMaybe' : 'enum' type redefinition
1>          c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(57) : see declaration of 'vc_attributes::YesNoMaybe'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(67): error C2011: 'vc_attributes::AccessType' : 'enum' type redefinition
1>          c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(67) : see declaration of 'vc_attributes::AccessType'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(81): error C2011: 'vc_attributes::Pre' : 'struct' type redefinition
1>          c:\program files\microsoft …
Run Code Online (Sandbox Code Playgroud)

c++ visual-c++

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

解析到ImageIcon的URL时出现NullPointerException

我正在关注JMonkey2.1的一些教程

当我运行这些教程时,我得到NullPointerExceptions,其中使用java.net.URL加载新的ImageIcons.

// generate a terrain texture with 3 textures
ProceduralTextureGenerator pt = new ProceduralTextureGenerator(heightMap);
pt.addTexture(new ImageIcon(Lesson3.class.getClassLoader().getResource("path/to/file")), -128, 0, 128); //line 199
pt.addTexture(new ImageIcon(Lesson3.class.getClassLoader().getResource("dirt.jpg")), 0, 128, 255);
pt.addTexture(new ImageIcon(Lesson3.class.getClassLoader().getResource("highest.jpg")), 128, 255, 384);
pt.createTexture(32);
Run Code Online (Sandbox Code Playgroud)

但是当我将文件路径解析为字符串而不是将它们作为java.net.URL读取时,它们工作正常.

例如: new ImageIcon("path/to/file")

这是堆栈跟踪

Jun 4, 2011 4:18:22 PM class jme.test.Lesson3 start()
SEVERE: Exception in game loop
java.lang.NullPointerException
at javax.swing.ImageIcon.(ImageIcon.java:167)
at jme.test.Lesson3.buildTerrain(Lesson3.java:199)
at jme.test.Lesson3.initGame(Lesson3.java:151)
at com.jme.app.BaseGame.start(BaseGame.java:74)
at jme.test.Lesson3.main(Lesson3.java:62)
at jme.test.Main.main(Main.java:14)
Jun 4, 2011 4:18:22 PM com.jme.app.BaseGame start
INFO: Application ending.
Run Code Online (Sandbox Code Playgroud)

可能是什么原因?谢谢..

java file-io nullpointerexception

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

什么是OpenCV中的CvBlobTrackerAuto类?

我试图了解blobtrack.cpp代码作为OpenCV的示例代码提供.在此代码中使用了名为CvBlobTrackerAuto的类.我试图找到关于这个类的一些文档,但它没有提供详细的解释.

我对
CvBlobTrackerAuto::Process(IplImage *pImg, IplImage *pMask = NULL)功能特别感兴趣.这是做什么的,这个面具的任务是什么?

先感谢您

opencv

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

如何使用PowerShell一次加载和处理一个文件

我得到了以下脚本来加载大约十万个.doc文件并在它们上运行程序.根据输出,文件分组到文件夹中.我在几个文件的本地目录上测试了脚本,它按预期工作.

但是当从大型文件集中加载时,脚本会打印"加载文件......"并保留在那里.似乎脚本正在等待它加载语料库中的所有文件.如果是这种情况,有没有办法一次加载和处理一个文件?

如果你能对效率方面发表意见,那将会很棒.

$path = "\\Storage\100kCorpus"
$filter = "*.doc"
$count = 0
Write-Host "Loading files....";
$files = @(get-childitem -recurse -path $path -filter $filter)
Write-Host "files loaded";
foreach ($file in $files) {
    $count ++
    Write-Host "$file.FullName";
    $out = & "D:\Test\doc\Verify.exe" /i:$file.FullName 
    $failed_file_location="D:\Test\doc\2875555\$out";
    if (($out -ne "passed") -and !(Test-Path -path $failed_file_location )){
        [IO.Directory]::CreateDirectory($failed_file_location)
        Copy-Item $file $failed_file_location
    }
}

Write-Host "There are $count files with the pattern $filer in folder $path"
Run Code Online (Sandbox Code Playgroud)

powershell foreach directory-structure

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

在java中删除数据文件的一部分

我有一个文件,我写了一些java对象.写完之后,有时我需要删除一些放在文件中ramndom位置的对象.有没有办法从文件中删除选定的对象而不替换整个文件?

谢谢.

java file-io

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