小编Leo*_*rak的帖子

在imageview上启动活动单击自定义数组适配器

我做了一个自定义适配器类

这是代码

public class CustomArrayAdapterForReceipts extends ArrayAdapter<Receipt> {
    private final Activity context;
    public final ArrayList<Receipt> receipt;

    public CustomArrayAdapterForReceipts(Activity context, ArrayList<Receipt> receipt) {
        super(context, R.layout.row_layout_receipts_listview, receipt);
        this.context = context;
        this.receipt = receipt;
    }

    static class ViewHolder {
        protected TextView referenceNo;
        protected TextView comments;
        protected ImageView receiptImage;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

            View view = null;
            LayoutInflater inflator = context.getLayoutInflater();
            view = inflator.inflate(R.layout.row_layout_receipts_listview, null);
            final ViewHolder viewHolder = new ViewHolder();

            viewHolder.referenceNo = (TextView) view.findViewById(R.id.rowReceiptTitle);
            viewHolder.comments = …
Run Code Online (Sandbox Code Playgroud)

java eclipse android

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

Path.getParent()为null

我刚遇到的行为我不明白:

Path path = Paths.get("somefile.txt");
System.out.println(path.getAbsolutePath());
System.out.println(path.getParent());
Run Code Online (Sandbox Code Playgroud)

好吧,说实话,我正在调试一些代码,我在运行时评估了这段代码,路径被解析为WindowsPath实例,因此有方法getAbsolutePath可用.

当我运行代码时,parent为null,但absolutePath打印了绝对路径.所以如果对象知道绝对路径并且有父目录,为什么它返回null?

java nio

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

有条件地将maven中的部分资源排除在war之外

我开发了一个应用程序,它的最终战争在开发模式下还可以,但它包含一些我需要外部化以进行生产的配置文件。我能够手动更改战争并从中删除这些文件,但我想自动化此过程。我想将配置文件保留在开发模式的战争中。

我读了几个关于 SO 的问题,但他们忽略了条件性。这同样适用于maven-war-plugin,其中包含/排除在某些条件下无法工作(根据他们的样本)。使用过滤器不起作用,因为我不想更改复制文件的内容而是跳过它们。

资料来源:

src
  main
    resources
      some.properties
      server-keystore.jks
      signature.properties
      MyRequests.xsd
Run Code Online (Sandbox Code Playgroud)

开发战:

WEB-INF
  classes
      some.properties
      server-keystore.jks
      signature.properties
      MyRequests.xsd
Run Code Online (Sandbox Code Playgroud)

生产战:

WEB-INF
  classes
      signature.properties
      MyRequests.xsd
Run Code Online (Sandbox Code Playgroud)

达到这种效果的正确方法是什么?谢谢

java maven

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

尊重当前语言环境的自定义 Android 日期格式

有没有办法指定 dateFormat 元素并遵守当前的语言环境规则?我知道我可以使用SimpleDateFormat和指定我喜欢的格式 - 但在不同的国家可能是错误的。

我试图掩盖其中的元素,DateFormat但它只接受短、中和长:

DateFormat dayMonth = DateFormat.getDateInstance(DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD | DateFormat.MONTH_FIELD);

Caused by: java.lang.IllegalArgumentException: Illegal date style: 11
at java.text.DateFormat.checkDateStyle(DateFormat.java:843)
at java.text.DateFormat.getDateInstance(DateFormat.java:378)
Run Code Online (Sandbox Code Playgroud)

我想得到“Oct 2016”或“?íj 2016”。这可以通过以下方式实现:

DateFormat dayMonth = new SimpleDateFormat("MMM yyyy");
Run Code Online (Sandbox Code Playgroud)

但我不想在我的应用程序中硬编码这种格式。我只看到一种方法:将它放入 strings.xml 中,翻译人员必须对其进行设置。或者有更好的方法吗?

android localization

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

Mongo 副本“NotPrimaryNoSecondaryOk”

我花了一周时间让自由职业者创建的 Mongo 4.4 PSA 副本能够工作。我放弃了,从所有三台服务器中删除了完整的 mongod 并按照Mongo doc从头开始​​安装。唯一的更改是在副本初始化之前创建新数据库并导入数据。

第一次失败(连接超时),我重新审视了我的防火墙规则。然后它立即连接并在所有节点上刷新 mongo shell:

rs_bud:SECONDARY> show collections
rs_bud:PRIMARY> use bud
Run Code Online (Sandbox Code Playgroud)

但是当我对辅助节点执行任何操作时,它们会因NotPrimaryNoSecondaryOk错误而失败。

rs_bud:SECONDARY> use bud
rs_bud:SECONDARY> show collections
uncaught exception: Error: listCollections failed: {
        "topologyVersion" : {
                "processId" : ObjectId("612bbc4940995c508859973a"),
                "counter" : NumberLong(4)
        },
        "operationTime" : Timestamp(1630258863, 1),
        "ok" : 0,
        "errmsg" : "not master and slaveOk=false",
        "code" : 13435,
        "codeName" : "NotPrimaryNoSecondaryOk",
        "$clusterTime" : {
                "clusterTime" : Timestamp(1630258863, 1),
                "signature" : {
                        "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                        "keyId" : NumberLong(0)
                } …
Run Code Online (Sandbox Code Playgroud)

mongodb

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

在maven-war-plugin中过滤不会排除目录

这是我昨天问题的后续问题.有条不紊地将maven中的一些资源排除在战争之外.我能够重新安排开发和生产战争,但是过滤properties会将目录复制到战争中,尽管它应根据文档排除.我可以使用packagingExcludes选项,但我想知道为什么excludes不起作用.谢谢你的解释.

<plugin>
    <artifactId>maven-war-plugin</artifactId>
    <configuration>
        <classifier>dev</classifier>
        <webappDirectory>${project.build.directory}/${project.build.finalName}-dev</webappDirectory>
        <filters>
            <filter>${project.basedir}/configurations/properties/config_dev.prop</filter>
        </filters>
        <webResources>
            <resource>
                <directory>configurations</directory>
                <filtering>true</filtering>
                <targetPath>WEB-INF/classes</targetPath>
                <excludes>
                    <exclude>**/properties</exclude>
                </excludes>
            </resource>
        </webResources>
    </configuration>
    <executions>
        <execution>
            <id>package-prod</id>
            <phase>package</phase>
            <configuration>
                <classifier>prod</classifier>
                <webappDirectory>${project.build.directory}/${project.build.finalName}-prod</webappDirectory>
                <packagingExcludes>WEB-INF/classes/*.jks,WEB-INF/classes/acquirer.properties</packagingExcludes>
                <filters>
                    <filter>${project.basedir}/configurations/properties/config_prod.prop</filter>
                </filters>
                <webResources>
                    <resource>
                        <directory>configurations</directory>
                        <filtering>true</filtering>
                        <targetPath>WEB-INF/classes</targetPath>
                        <excludes>
                            <exclude>**/properties</exclude>
                        </excludes>
                    </resource>
                </webResources>
            </configuration>
            <goals>
                <goal>war</goal>
            </goals>
        </execution>
    </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

java maven maven-war-plugin

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

ap_proxy_connect_backend禁用worker(127.0.0.1)

我们在tomcat6上部署了一个war文件.我们正面临一个错误

[Sat May 17 12:26:48 2014] [error] (110)Connection timed out: proxy: HTTP: attempt to connect to 127.0.0.1:8090 (127.0.0.1) failed
[Sat May 17 12:26:48 2014] [error] ap_proxy_connect_backend disabling worker for (127.0.0.1)
[Sat May 17 12:27:53 2014] [error] (110)Connection timed out: proxy: HTTP: attempt to connect to 127.0.0.1:8090 (127.0.0.1) failed
[Sat May 17 12:29:36 2014] [error] (110)Connection timed out: proxy: HTTP: attempt to connect to 127.0.0.1:8090 (127.0.0.1) failed
Run Code Online (Sandbox Code Playgroud)

在此问题期间,我无法在服务器上远程登录8090.

重新启动MySql后,此问题得到解决.

得到专家的赞赏.

谢谢Ranjeet Ranjan

java mysql linux tomcat6

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

停止在新控制台中推出 android 应用程序更新

不幸的是,我们在 Play 控制台中发布了一个有问题的版本。已经有数百名用户下载了这个版本。当开发人员正在修复时,我想停止发布此更新。但是新的 Google Console 中没有高级屏幕。有什么方法可以停止更新吗?所有问题都描述了旧的 APK 屏幕。

android google-play

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

Mongo NodeJS project() 不是函数

我想从结果中排除一些属性。我阅读了规范:https : //docs.mongodb.com/manual/tutorial/project-fields-from-query-results/ - 我需要使用project函数。所以我链接了这个调用,但代码开始失败。没有.project({ auth: 0, prefs: 0, consent: 0 }). 问题出在哪里?我发现这个答案看起来很相似:https : //stackoverflow.com/a/51732851/1639556

包.json

"mongodb": "^3.4.1",
Run Code Online (Sandbox Code Playgroud)

拉姆达

exports.handler = (payload, context, callback) => {
    const userId = payload.pathParameters.userId;
    context.callbackWaitsForEmptyEventLoop = false;   
    mongo.connectToDatabase()
        .then(db => {
            return findUser(db, userId);
        })
        .then(user => {
            console.log("User fetched");
        })
};

function findUser(dbClient, userId) {
    return dbClient.db()
        .collection("users")
        .findOne({ "_id": userId })
        .project({ auth: 0, prefs: 0, consent: 0 })
        .then(doc => { return doc; }); …
Run Code Online (Sandbox Code Playgroud)

mongodb node.js

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

如何在 Bootstrap Vue 中将标签与单选按钮对齐在同一行

我想让标签内嵌其单选按钮:

<b-form-group label="Zobrazit">
  <b-form-radio-group id="radio-group-2" v-model="absoluteValues" name="radio-sub-component">
    <b-form-radio value="true">Hodnoty</b-form-radio>
    <b-form-radio value="false">Procenta</b-form-radio>
  </b-form-radio-group>
</b-form-group>
Run Code Online (Sandbox Code Playgroud)

它看起来是这样的:

在此输入图像描述

我在FormGroup元素中找不到任何相关属性。对齐Label-align文本但不会合并两行。

更新:

label-col=1将所有收音机放在同一行,但收音机未垂直对齐: 在此输入图像描述

vue.js bootstrap-vue

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