小编Mir*_*rco的帖子

什么是私人包裹的交易?

我一直在与OSGi合作一段时间,但我仍然不了解私有包.

  • 导出的包是其他包可见的包
  • 导入的包是由导出包的包导入的包.
  • 私有包是其他包不可见的包(我不明白)

并非所有未导出的捆绑包对所有其他包都不可见吗?如果是这样,那么未导出的私有包和包有什么区别?

我已经阅读了OSGi in Action和"OSGi和Apache Felix 3.0 - 初学者指南",但我无法找到差异.

java osgi module

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

PromQL if/else 类似表达式

我正在尝试使用高斯的复活节算法在 PromQL 中计算复活节(我需要忽略公共假期的一些警报规则)。

我可以计算日期,但我在月份方面遇到问题,因为我需要类似 if/else 表达式的东西。如果东部是四月,我的记录规则 easter_sunday_in_april 返回 1;如果东部是三月,则返回 0。

(如何)我可以用 PromQL 表达以下内容吗?

if(easter_sunday_in_april > 0)
    return 4
else
    return 3
Run Code Online (Sandbox Code Playgroud)

为了完整起见,我在这里附上我的录音规则:

- record: a
    expr: year(europe_time) % 4

  - record: b
    expr: year(europe_time) % 7

  - record: c
    expr: year(europe_time) % 19

  - record: d
    expr: (19*c + 24) % 30

  - record: e
    expr: (2*a + 4*b + 6*d + 5) % 7

  - record: f
    expr: floor((c + 11*d + 22*e)/451)

  - record: easter_sunday_day_of_month_temp
    expr: 22 …
Run Code Online (Sandbox Code Playgroud)

prometheus promql

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

GIS"Hello World"是否相当?

是否有相当于GIS应用程序的"Hello World"程序?

我希望更熟悉GIS应用程序的开发.哪些流行的(和免费/低成本)教程和/或示例应用程序可以帮助某人入门?是否有任何您认为对初学GIS开发人员至关重要的书籍?

gis geospatial

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

Tycho在每个版本上下载p2.indexes

我正在使用Maven和Tycho构建一个RCP和其他几个插件.这非常好,除非有一个问题:

在每个(!)构建中,Tycho加载所有需要的eclipse库,即使在10秒前已经下载的地方也是如此.它们不是自动保存在本地存储库中,还是我错过了一些配置?所有的p2.index.但这也很烦人.我可以关闭它,这样它每周只会检查一次吗?

  <properties>
    <tycho-version>0.15.0</tycho-version>
  </properties>

  <repositories>
   <repository>
      <id>eclipse-indigo</id>
      <layout>p2</layout>
      <url>http://download.eclipse.org/releases/indigo</url>
   </repository>
  </repositories>

  <build>
    <plugins>
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-maven-plugin</artifactId>
        <version>${tycho-version}</version>
        <extensions>true</extensions>
      </plugin>
    </plugins>
  </build>
Run Code Online (Sandbox Code Playgroud)

build p2 tycho

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

Optional.orElse 不使用匿名类型编译

我在使用Optionals 和匿名类时遇到了一个奇怪的问题:

public class Foo {
    interface Bar {
    }

    void doesNotCompile() {
        Optional.of(new Bar() {
        }).orElse(new Bar() {
        });
    }

    void doesNotCompile2() {
        final Bar bar = new Bar() {
        };
        Optional.of(new Bar() {
        }).orElse(bar);
    }

    void compiles1() {
        final Bar bar = new Bar() {
        };
        Optional.of(bar).orElse(new Bar() {
        });
    }
}
Run Code Online (Sandbox Code Playgroud)

前两种方法不编译会报错

java: incompatible types: <anonymous test.Foo.Bar> cannot be converted to <anonymous test.Foo.Bar>
Run Code Online (Sandbox Code Playgroud)

我预料到了,因为这两种Bar方法都实现了接口,所以这三种方法都可以工作。我也无法弄清楚为什么第三个选项解决了这个问题。任何人都可以解释一下吗?

java anonymous-class optional

8
推荐指数
3
解决办法
353
查看次数

通过Apache PDFBox将MS Office文档添加到PDF

我正在使用Apache PDFBox(http://pdfbox.apache.org/)从任意数量的文件(包括图像和其他PDF)创建PDF.现在我需要将MS Office文档(Word,Excel和Outlook MSG)添加到PDF.这些文件几乎可以包含每个Office版本,因此不会授予该文件是新的office文件(例如docx)或旧文件(例如doc).

有没有办法只用免费工具做到这一点?我的第一个想法是使用Apache POI(http://poi.apache.org/)读取每个文件的contnet,并将该文件重新创建为新的PDF页面,但这可能会变得非常昂贵,因为此PDF创建用于超过五十人的服务器.

java apache pdf ms-office

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

PowerMockito和SWT运行测试套件时出现UnsatisfiedLinkError

我正在使用JUnit和PowerMockito为Eclipse RCP应用程序中的类编写单元测试.如果我将每个测试作为独立运行,一切正常.

但是当我将测试分组到TestSuite时,所有测试都会因此错误而失败:

java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
    no swt-win32-3836 in java.library.path
    no swt-win32 in java.library.path
    Native Library C:\Users\franzm\.swt\lib\win32\x86_64\swt-win32-3836.dll already loaded in another classloader
    Can't load library: C:\Users\franzm\.swt\lib\win32\x86_64\swt-win32.dll

    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:331)
    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:240)
    at org.eclipse.swt.internal.C.<clinit>(C.java:21)
    at org.eclipse.swt.widgets.Widget.<clinit>(Widget.java:103)
    at com.example.app.client.ui.filters.FilterDtoUtil.formatDateFormat(FilterDtoUtil.java:325)
    at com.example.app.client.ui.filters.FilterDtoUtil.getMarketVariantsProductionSitesWithDates(FilterDtoUtil.java:358)
    at com.example.app.client.ui.filters.factories.FilterContributor.getFilterRow(FilterContributor.java:566)
    at com.example.app.client.ui.filters.factories.AbstractBigFilterFactory.getFilterRow(AbstractBigFilterFactory.java:59)
    at com.example.app.client.ui.excelexport.AbstractExcelTest.before(AbstractExcelTest.java:73)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.internal.runners.MethodRoadie.runBefores(MethodRoadie.java:132)
    at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:95)
    at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.executeTest(PowerMockJUnit44RunnerDelegateImpl.java:294)
    at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTestInSuper(PowerMockJUnit47RunnerDelegateImpl.java:127)
    at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTest(PowerMockJUnit47RunnerDelegateImpl.java:82)
    at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runBeforesThenTestThenAfters(PowerMockJUnit44RunnerDelegateImpl.java:282)
    at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:86)
    at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)
    at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.invokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:207)
    at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:146) …
Run Code Online (Sandbox Code Playgroud)

java swt unit-testing eclipse-rcp powermock

5
推荐指数
0
解决办法
777
查看次数

向量<char>的输入流 - 向量迭代器不可解除引用

首先,我是来自Java的C++新手.我想做一件简单的事情:使用URDL-libs从Web加载图片并将其保存到char-vector.加载图像工作正常,我能够将其保存到磁盘,但当我尝试将其加载到char-vector时,我在运行时收到此错误:

Expression: vector iterator not dereferencable
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

urdl::istream inputStream( url );
if( inputStream )
{
    inputStream >> std::noskipws;
    istream_iterator<char> inputStreamIterator( inputStream ), inputStreamEnd;
    string dateiname = "test.png";
    vector<char> imageVector;

    ofstream outputStream( dateiname, ios_base::binary );
    ostream_iterator<char> outputStreamIterator(outputStream);
    copy( inputStreamIterator, inputStreamEnd,  imageVector.begin());
}
Run Code Online (Sandbox Code Playgroud)

c++ boost vector stream

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

是否需要实施应用程序内购买或者我可以简单地将付费版本添加为新应用程序?

我已经在App Store中有我的应用程序的免费版本.现在我想添加同一个应用程序的全新付费版本(具有额外功能).

是否需要实施应用程序内购买或者我可以简单地将付费版本添加为新应用程序?

xcode app-store in-app-purchase

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

詹金斯不能用Maven构建.可能是代理问题

我正在尝试与Maven,Jenkins,SVN和Nexus建立一个环境.我通过SVN将作业添加到Jenkins,但由于Maven错误,Jenkins无法构建这些作业.

这是错误日志

[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building imagetools 1.0
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.1/maven-dependency-plugin-2.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.756s
[INFO] Finished at: Mon Apr 22 11:43:05 CEST 2013
[INFO] Final Memory: 7M/152M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving C:\Users\franzm\.jenkins\jobs\ImageTools\workspace\pom.xml to C:\Users\franzm\.jenkins\jobs\ImageTools\modules\com.ee$imagetools\builds\2013-04-22_11-42-40\archive\com.ee\imagetools\1.0\imagetools-1.0.pom
Warte bis Jenkins die Datensammlung abgeschlossen hat
mavenExecutionResult exceptions not empty
message : Plugin org.apache.maven.plugins:maven-dependency-plugin:2.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
cause : Failed to read …
Run Code Online (Sandbox Code Playgroud)

proxy nexus maven jenkins

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