小编Ybr*_*rin的帖子

Xamarin iOS错误:无法解析引用

如果我在VS 2013中设置了Xamarin.Forms解决方案并尝试运行iOS版本,则会因以下错误而失败:

错误2无法解析引用:/ Users/Koray/Library/Caches/Xamarin/mtbs/builds/WalkiOS/aae389efbebffd5cd3625dcf99aad02c/C:/ Program Files(x86)/ Reference Assemblies/Microsoft/Framework/Xamarin.iOS/v1.0/Facades/System.Collections.Concurrent.dll Walk.iOS

Visual Studio的Xamarin构建主机已经建立,几周前它运行良好.我找不到任何修复错误的方法.

c# xamarin.ios ios xamarin

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

ActiveRecord连接条件满足所有关系

我有这样的数据库模型:

Post
    has_many :votes
    belongs_to :user
User
    has_many :posts
    has_many :votes
Vote
    belongs_to :post
    belongs_to :user
Run Code Online (Sandbox Code Playgroud)

我想要的是查询posts他尚未投票的特定用户.

我试过这样的:

Post.left_outer_joins(:votes).where.not(votes: { user_id: 1 })
Run Code Online (Sandbox Code Playgroud)

其中1只是一个示例用户ID.

问题是,这个查询好像获取所有posts这至少有一票的地方user_id不是1.
但由于不止一个用户会投票支持这些帖子,一旦有多个投票,所有用户现在都会收到所有帖子.

我不知道是否joins是正确的方法,但我的查询将是:

给我所有帖子,其中没有一个投票的user_id为1

是否有可能只posts为他尚未投票的用户提取?

编辑:

我上面三个表的数据库模式:

投票:

CREATE TABLE "votes" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
        "post_id" integer,
        "user_id" integer,
        "created_at" datetime NOT NULL,
        "updated_at" datetime NOT NULL,
        "vote_type" integer DEFAULT 0);
CREATE INDEX "index_votes_on_post_id" ON "votes" ("post_id");
CREATE INDEX …
Run Code Online (Sandbox Code Playgroud)

ruby mysql activerecord ruby-on-rails rails-activerecord

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

Swift相当于为属性设置多个值

我目前正在使用以客观c编写的cocoapod.在示例中,它们显示了类似的内容:

options.allowedSwipeDirections = MDCSwipeDirectionLeft | MDCSwipeDirectionRight;
Run Code Online (Sandbox Code Playgroud)

我甚至不知道调用这些变量是什么,但我已经在Swift中尝试了以下内容:

options.allowedSwipeDirections = MDCSwipeDirection.Left | MDCSwipeDirection.Right
Run Code Online (Sandbox Code Playgroud)

但编译说 No '|' candidates produce the expected contextual result type 'MDCSwipeDirection'

我如何在Swift中执行此操作?

编辑:

看起来这不是OptionSet一些答案中所说的,她是声明:

/*!
 * Contains the directions on which the swipe will be recognized
 * Must be set using a OR operator (like MDCSwipeDirectionUp | MDCSwipeDirectionDown)
 */
@property (nonatomic, assign) MDCSwipeDirection allowedSwipeDirections;
Run Code Online (Sandbox Code Playgroud)

就像这样使用:

_allowedSwipeDirections = MDCSwipeDirectionLeft | MDCSwipeDirectionRight;
Run Code Online (Sandbox Code Playgroud)

objective-c ios swift

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

Rails将主id更改为64位bigint

我正在使用rails和mysql2适配器.我想将所有主要ID和外键更改为64位整数,而不是默认的32位,因为它们现在是我的生产数据库.

这是可行的还是我必须删除数据库,更改结构并再次导入数据?

如果有办法在不丢弃数据库的情况下完成它,即使它是一个黑客,也很高兴知道.

ruby mysql ruby-on-rails

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

Maven - 将资源复制到 jar 中的特定位置

我想在构建时将项目内的资源复制到 jar 中的特定文件夹中。我在我的内部使用此代码pom.xml

<resource>
    <directory>${basedir}/locale</directory>
</resource>
Run Code Online (Sandbox Code Playgroud)

将 locale 目录中的所有文件复制到我的 jar 中。但文件全部复制到jar文件的根目录下,而不是locale文件夹内。

是否可以使用 Maven 将资源复制到导出的 jar 文件中的特定位置?

java maven

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