小编Ale*_*eed的帖子

在编译时禁用Dll文化文件夹

我正在使用2个dll(Microsoft.Expression.Interactions.dllSystem.Windows.Interactivity.dll),当编译父应用程序时,创建大量的文化文件夹:

每个内部都有2个dll(Microsoft.Expression.Interactions.resources.dllSystem.Windows.Interactivity.resources.dll).我已经google了,我找不到任何与如何阻止这个恼人的自动生成内容相关的内容.

.net c# wpf culture

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

rails model has_many本身

我有一个活动模型.事件可以具有父事件,从模型中的列(parent_event_id)设置.我需要能够has_many :event在模型上做,所以我可以做,例如,event.child_eventevent.parent_event.但我的谷歌搜索并没有那么好.

我的型号:

class Event < ActiveRecord::Base
    attr_accessible :days_before, :event_name, :event_date, :list_id, :recipient_email, :recipient_name, :parent_event_id, :is_deleted, :user_id

    belongs_to :user
    has_many :event_email
    has_many :event
end
Run Code Online (Sandbox Code Playgroud)

我的架构:

create_table "events", :force => true do |t|
    t.datetime "event_date"
    t.integer  "days_before"
    t.string   "recipient_email"
    t.integer  "list_id"
    t.string   "recipient_name"
    t.datetime "created_at",                         :null => false
    t.datetime "updated_at",                         :null => false
    t.integer  "user_id"
    t.string   "event_name"
    t.integer  "parent_event_id"
    t.boolean  "is_deleted",      :default => false
end
Run Code Online (Sandbox Code Playgroud)

activerecord model ruby-on-rails has-many

33
推荐指数
1
解决办法
8778
查看次数

删除数组的第一个x entires

我有一系列项目,我需要删除它的前几个项目.Ruby Array类中是否有内置函数来执行此操作?我有一个搜索周围,只发现,看起来像,非常混乱或低效的方式来做到这一点.

我最喜欢这样的东西:

my_items = [ 'item1', 'item2', 'item3', 'item4' ]
trimmed_items = my_items.delete(y, x) # deleting x entries from index y
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails

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

尝试设置非空字符串以键入'System.Int32'

实体框架抛出此异常:

'BranchIdentity'上的'PasswordIterations'属性无法设置为'System.String'值.您必须将此属性设置为类型为"System.Int32"的非null值.

这是在抛出这条线:

// Validate uniqueness or email and username
var user = sqlStorage.BranchIdentities.FirstOrDefault(i => i.Username.ToLower() == viewModel.Username.ToLower());
Run Code Online (Sandbox Code Playgroud)

仅当存在与查询匹配的实体时才会抛出异常.如果没有匹配项,则不会抛出异常.

我的BranchIdentity模型:

namespace Branch.Models.Sql
{
    public class BranchIdentity
    {
        [Key]
        public int Id { get; set; }

        [Required]
        public string Username { get; set; }

        [Required]
        public string PasswordHash { get; set; }

        [Required]
        public string PasswordSalt { get; set; }

        [Required]
        public int PasswordIterations { get; set; }

        [Required]
        public string Email { get; set; }

        [Required]
        public string FullName { …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework ef-code-first ef-migrations

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

命名空间'AuntieDot'中不存在类型或命名空间名称'Core'

我有4个PCL,它们都针对相同的框架:

AuntieDot:

AuntieDot

AuntieDot.Authentication:

AuntieDot.Authentication

AuntieDot.Core:

AuntieDot.Core

AuntieDot.Models:

AuntieDot.Models

但出于某种原因,在'AuntieDot.Authentication'命名空间中使用'AuntieDot.Core.Helpers'(尽管'AuntieDot.Core'被添加为'AuntieDot.Authentication'的引用,但它说它不存在.我已经google了,我得到的唯一回复是我需要确保其他库是针对相同的框架,它们是.

我正在使用的唯一外部代码是JSON.net,我通过NuGet添加,所以我不认为这是问题.

'AuntieDot.Core'中的代码; 助手 例外

抛出问题的代码只是在错误列表和编译中抱怨,它没有像往常一样的红色下划线:

错误:(

我只是觉得发布Build Output可能有所帮助; http://pastebin.com/raw.php?i=wn74UKyc

c# portable-class-library

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

我可以使用Square Brackets从类中提取值

我有一个具有变量"Magic"的类.这是一个4字符串.我可以在C#中做这样的事吗?

string offset = chunkList["_blf"].offset;
Run Code Online (Sandbox Code Playgroud)

*假设"chunkList"是IList /"chunk"对象列表.

c#

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

将文件放入WPF窗口

我有用于将文件拖放到WPF窗口中的代码:

XAML(在Home.xaml中):

Drop="HomeWindow_Drop" AllowDrop="True">
Run Code Online (Sandbox Code Playgroud)

C#(在Home.xaml.cs中)

private void HomeWindow_Drop(object sender, DragEventArgs e)
{
    // Handle this
}
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试将文件拖到主窗口中时,出现窗口“不可用”光标(尽管它带有一条线的圆圈),并且该事件不会被触发。我不知道为什么要这么做。

我在Windows 7上从来没有这个问题,现在在Windows 8上,但是我认为这与它无关吗?

c# wpf drag-and-drop

5
推荐指数
1
解决办法
2757
查看次数

"操作必须是普通对象.使用自定义中间件进行异步操作." 与react/redux

我遇到了这个错误,花了最后几个小时试图找出它.我看过所有看似重复的问题 - 但它们并没有解决问题.

在我的react/redux应用程序中,当我在我的一个操作中发出ajax请求时,它会抛出此错误: Uncaught Error: Actions must be plain objects. Use custom middleware for async actions.

我的商店创建如下:

import { composeWithDevTools } from 'redux-devtools-extension';
import reducers from './reducers';
import thunkMiddleware from 'redux-thunk';
import { applyMiddleware, createStore } from 'redux';

export default createStore(reducers, composeWithDevTools(
	applyMiddleware(thunkMiddleware)
));
Run Code Online (Sandbox Code Playgroud)

相关的减速器看起来像这样:

import * as actions from './../../actions/tools/vehicle-lookup';

const defaultState = {
	vrm: void 0,
	isLoading: false,
	response: void 0,
	error: void 0,
};

export default function (state = defaultState, action) {
	switch (action.type) {
		case …
Run Code Online (Sandbox Code Playgroud)

reactjs redux redux-thunk react-redux axios

5
推荐指数
1
解决办法
5664
查看次数

在asp.net中,MySql Update Query无法正常工作

我提交了查询,并没有抛出异常,它确实写入数据库,但不是我想要的.出于某种原因,除了我告诉查询的第一件事之外,它没有触及任何东西,并将其设置为0.

这是我的代码:

    public static int UpdateTagDefinition(Dictionary<string, object> sqlQueryParams)
    {
        MySqlCommand query = new MySqlCommand();
        query.CommandText = "UPDATE `windows_dev` SET `name` = @name AND `desc_short` = @desc_short AND `desc_long` = @desc_long AND `tags` = @tags AND `image_title` = @image_title AND `images` = @images AND `release_date` = @release_date AND `update_date` = @update_date AND `is_on_sourcecontrol` = @is_on_sourcecontrol AND `sourcecontrol_type` = @sourcecontrol_type AND `sourcecontrol_uri` = @sourcecontrol_uri AND `download_uri` = @download_uri AND `project_uri` = @project_uri AND `source_uri` = @source_uri AND `is_public` = @is_public WHERE `DID` …
Run Code Online (Sandbox Code Playgroud)

c# mysql sql asp.net

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

将RGB浮点数据转换为十六进制字符串

我正在编写一个修改游戏的工具,游戏使用float来存储RGB数据(范围从0.0 - > 1.0).您最好如何建议我从浮点RGB数据转换为十六进制字符串/字节RGB数据?

c# rgb

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

用字符串替换char

如何用字符串替换字符串中的char?

例如:用"test"替换所有char的'e':"Hello World" - >"Htestllo World".

A,string.replace(char,string),如果你愿意的话.

c# replace

0
推荐指数
1
解决办法
196
查看次数