小编Bor*_*vić的帖子

如何将参数传递给PowerShell脚本?

有一个PowerShell名为的脚本itunesForward.ps1使iTunes快进30秒:

$iTunes = New-Object -ComObject iTunes.Application

if ($iTunes.playerstate -eq 1)
{
  $iTunes.PlayerPosition = $iTunes.PlayerPosition + 30
}
Run Code Online (Sandbox Code Playgroud)

它使用快速行命令执行:

powershell.exe itunesForward.ps1
Run Code Online (Sandbox Code Playgroud)

是否可以从命令行传递参数并将其应用于脚本而不是硬编码的30秒值?

powershell command-line automation itunes argument-passing

408
推荐指数
6
解决办法
61万
查看次数

什么是IntelliJ IDEA中Eclipse的Ctrl + O(显示大纲)快捷方式?

我喜欢使用Eclipse的快捷键Ctrl+ O来概述当前的源代码.IntelliJ IDEA中是否有等效的快捷方式?

它会打开一个对话框,允许快速搜索类中的方法和字段.

java eclipse ide keyboard-shortcuts intellij-idea

267
推荐指数
8
解决办法
6万
查看次数

为什么java类不从已实现的接口继承注释?

我一直在使用Guice的AOP来拦截一些方法调用.我的类实现了一个接口,我想注释接口方法,以便Guice可以选择正确的方法.即使注释类型使用Inherited annotation注释,实现类也不会继承Inherited的java doc中所述的注释:

另请注意,此元注释仅导致注释从超类继承; 已实现接口上的注释无效.

这可能是什么原因?了解对象类在运行时实现的所有接口并不是一件难事,因此必须有充分的理由支持这一决策.

java inheritance annotations interface guice

105
推荐指数
2
解决办法
6万
查看次数

如何从Guice的注入器中检索带注释的实例?

假设我有一个模块:

Module extends AbstractModule
{
  @Override
  protected void configure()
  {
    bind(String.class).
      annotatedWith(Names.named("annotation")).
        toInstance("DELIRIOUS");
  }
}
Run Code Online (Sandbox Code Playgroud)

我想测试模块并检查它是否在没有类和String字段的注释字段中注入正确的值Names.named("annotation")但是直接从注入器获取值:

@Test
public void test()
{
  Injector injector = Guice.createInjector(new Module());

  // THIS IS NOT GOING TO WORK!
  String delirious = injector.getInstance(String.class); 

  assertThat(delirious, IsEqual.equalTo("DELIRIOUS");
}
Run Code Online (Sandbox Code Playgroud)

java configuration annotations dependency-injection guice

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

java.sql.Connection线程安全吗?

重新解释一下这个问题:我应该避免共享java.sql.Connection在不同线程之间实现的类的实例吗?

java multithreading jdbc dbconnection thread-safety

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

如何使用JAXB生成一个从xsd实现Serializable接口的Java类?

我想在现有的Spring项目中引入缓存,该项目使用JAXB来公开WebServices.缓存将在端点级别完成.为了做到这一点,使用JAXB从XSD生成的类需要实现Serializable接口和覆盖ObjecttoString()方法.

如何使用XSD指示xjc工具生成具有所需属性的源?

java xsd jaxb xjc

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

运行String中包含的一段代码

我在String中有一段Java代码.

String javaCode = "if(polishScreenHeight >= 200 && " +
    "polishScreenHeight <= 235 && polishScreenWidth >= 220) { }";
Run Code Online (Sandbox Code Playgroud)

是否可以将此Java String转换为Java语句并运行它?可能使用Java反射?

java reflection

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

将文件提交到SVN存储库的问题

我在项目的根目录中有一个maven pom构建文件.尝试与Eclipse(Europa)中的SVN存储库同步时,红色双向箭头将添加到文件图标中.这意味着自上次同步以来,我的本地副本和存储库中的副本都已更改.

当我尝试做'覆盖并更新...'时会抛出错误消息:

Some resources were not reverted.
Attempted to lock an already-locked dir
svn: Working copy 'C:\Java\workspaces\pro\myProject-TRUNK' locked
Run Code Online (Sandbox Code Playgroud)

你知道在这种情况下应该做些什么吗?

eclipse svn subversive commit

28
推荐指数
5
解决办法
7万
查看次数

在intelliji IDEA中将语法颜色的代码块复制为rtf?

有没有一种简单的方法可以将语法颜色的代码块复制为intellij IDEA中的rtf?

syntax-highlighting copy-paste intellij-idea

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

在Vim之后如何删除与模式和行匹配的所有行?

有一个文字

Title of the text

This line contains a word that is matched by the pattern and it should be deleted.
Next line is supposed to be deleted as well.

Loren ipsum dolorem...

This line contains a word that is matched by the pattern and it should be deleted.
And this one should be deleted

The end of the article
Run Code Online (Sandbox Code Playgroud)

如何删除与第一行匹配的每一对行,例如"此行包含一个单词..."以及该行之后的行.结果将是:

Title of the text

Loren ipsum dolorem...

The end of the article
Run Code Online (Sandbox Code Playgroud)

regex vim

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