小编Har*_*M V的帖子

使用setMultiChoiceItems的自定义对话框

我想创建一种方式,用户可以选择下面的图像选项

在此输入图像描述

现在我正在做以下事情

public static class CategoriesDialogFragment extends SherlockDialogFragment {

    public static CategoriesDialogFragment newInstance(int title) {
        CategoriesDialogFragment frag = new CategoriesDialogFragment();
        Bundle args = new Bundle();
        args.putInt("title", title);
        frag.setArguments(args);
        return frag;
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        int title = getArguments().getInt("title");

        return new AlertDialog.Builder(getActivity())
                .setIcon(R.drawable.alert_dialog_icon)
                .setTitle(title)
                .setMultiChoiceItems(_categories, _selections,
                        new DialogSelectionClickHandler())
                .setPositiveButton(R.string.alert_dialog_ok,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                    int whichButton) {
                                ((MainActivity) getActivity())
                                        .doPositiveClick();
                            }
                        }).create();

        /*
         * .setNegativeButton(R.string.alert_dialog_cancel, new
         * DialogInterface.OnClickListener() { public void
         * onClick(DialogInterface dialog, int whichButton) …
Run Code Online (Sandbox Code Playgroud)

android customdialog android-dialogfragment

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

Find 查询后 Prisma 将计数增加 1

views我试图通过管理表中调用的字段来计算用户查看记录的次数。我想在每次 API 拉出要发送的记录时增加计数。

在不阻塞线程将数据返回到前端的情况下,正确且最快的方法是什么?

堆栈:NextJS 和 Prisma

next.js prisma

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

我们如何根据其内容自动生成div取宽度

我想创建一个像fieldset和的效果label.

替代文字

当标题沿侧面变化时,标题的白色背景保持相同的宽度.

如果我可以使headingdiv元素的宽度足以适合其内容,它将产生适当的效果.

如果有任何其他解决方案,请告诉我.

html fieldset width

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

两个纬度和长度之间的行程距离

我想计算并给出两套Lat和Long之间的距离,以便在Road上旅行.

我查看了Google的Directions and Distance Matrix API.并且还在SO上做了很多其他问题.

但我无法找到最好的方法,你需要计算每次约20-25个位置的距离.

我们正在构建一个旅行应用程序,该应用程序需要Android设备上的用户提供此信息.

android google-api latitude-longitude google-directions-api

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

每个字段下方的Rails显示表单错误

我有以下表格

<%= form_for(@user) do |f| %>
  <% if @user.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>

      <ul>
      <% @user.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <%= @user.errors.messages[:name] %>

  <div class="field">
    <%= f.label :name %><br>
    <%= f.text_field :name %>
  </div>
  <div class="field">
    <%= f.label :email %><br>
    <%= f.text_field :email %>
  </div>
  <div class="field">
    <%= f.label :password %><br>
    <%= f.password_field :password %>
  </div>
  <div class="field">
    <%= f.label :phone …
Run Code Online (Sandbox Code Playgroud)

validation ruby-on-rails

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

Rails4 Friendly_id独特的Slug格式

我正在使用friendly_id gem来阻止我的模型.因为当我输入相同的数据来检查时,slug必须是唯一的,我会在slug中附加一个长的哈希值.

Explore     explore 
Explore     explore-7a8411ac-5af5-41a3-ab08-d32387679f2b
Run Code Online (Sandbox Code Playgroud)

有没有办法告诉friendly_id提供更好的格式化slugs,如explore-1explore-2

版: friendly_id 5.0.4

rubygems ruby-on-rails friendly-id ruby-on-rails-4

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

docker-compose 错误:FileNotFoundError:[Errno 2] 没有这样的文件或目录

我正在尝试使用 YML 文件编写 Docker 文件,如下所示。

version: '3.6'
services:
  postgres:
    image: postgres:12
    restart: always
    volumes:
    - db_data:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: postgrespassword
  graphql-engine:
    image: hasura/graphql-engine:v2.0.3
    ports:
    - "8080:8080"
    depends_on:
    - "postgres"
    restart: always
    environment:
      HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres
      ## enable the console served by server
      HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set to "false" to disable console
      ## enable debugging mode. It is recommended to disable this in production
      HASURA_GRAPHQL_DEV_MODE: "true"
      HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
      ## uncomment next line to set an admin secret
      # HASURA_GRAPHQL_ADMIN_SECRET: …
Run Code Online (Sandbox Code Playgroud)

docker hasura hasura-docker

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

jQuery Ajax URL

我正在从site.com/users/{username}进行Ajax调用

我想访问url site.com/account/deleteComment但是当我签入fireBug时它正试图访问site.com/users/account/deleteComment

这是我的代码

    $.ajax({
        url: "../account/deleteComment/" + deleteID,
        success: function () {
            $("#comment-" + deleteID).slideUp("fast");
        }
    });
Run Code Online (Sandbox Code Playgroud)

forms ajax jquery

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

android如何编写ImageView的click事件

我的界面上有一个警报符号.我想要它,如果有人点击这个,那么他/她可以得到另一个界面.那么如何编写Imageview的点击事件.请给我答案.谢谢

android onclick imageview

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

PHP日期字符串格式

我有一个字符串mm-dd-yyyy,我从表单中获取,我想将它存储在数据类型DATE(yyyy-mm-dd)的数据库中.

如何格式化字符串并将其保存在数据库中?

php cakephp date

7
推荐指数
2
解决办法
8622
查看次数