小编ibi*_*iza的帖子

找不到类型或命名空间IAppBuilder(缺少使用指令作为程序集引用)

我正在开发一个Asp.Net MVC 4应用程序,我在其中使用SignalR 2.0.1并使用Owin Startup类映射它,并且它最初工作正常.

突然间,当我尝试重建我的应用程序时,它说类型名称空间IAppbuilder无法找到.

以下是我的启动课程

using Microsoft.Owin;
using Owin;
using WhiteBoardApp;

namespace WhiteBoardApp
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.MapSignalR();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我也安装了Owin包,由于某些原因我找不到Owin Startup类,所以我只添加了一个普通类并包含了所需的所有引用.我可以知道我在哪里弄错了

c# asp.net-mvc-4 signalr owin

62
推荐指数
4
解决办法
5万
查看次数

C#使用ICC配置文件将RGB值转换为CMYK?

这个问题似乎发布在很多地方的互联网和SO,但我找不到一个满意的答案:(

如何使用ICC配置文件将RGB值转换为CMYK值?

我有最接近的答案,它解释了如何从CMYK转换为RGB而不是相反,这是我需要的.(http://stackoverflow.com/questions/4920482/cmyk-to-rgb-formula-of-photoshop/5076731#5076731)

float[] colorValues = new float[4];
colorValues[0] = c / 255f;
colorValues[1] = m / 255f;
colorValues[2] = y / 255f;
colorValues[3] = k / 255f;

System.Windows.Media.Color color = Color.FromValues(colorValues,
new Uri(@"C:\Users\me\Documents\ISOcoated_v2_300_eci.icc"));
System.Drawing.Color rgbColor = System.Drawing.Color.FromArgb(color.R, color.G, color.B);
Run Code Online (Sandbox Code Playgroud)

我想我应该使用System.Windows.Media命名空间中的一些类/结构/方法.

System.Windows.Media.Color结构包含一个方法FromRgb,但是我无法在System.Windows.Media.Color中获取CMYK值!

非常感谢

c# printing rgb colors cmyk

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

如何从上到下逐步显示ImageView

有没有办法从上到下逐步显示ImageView,如下所示:

在此输入图像描述

抱歉这个糟糕的动画.

android android-imageview

14
推荐指数
1
解决办法
7399
查看次数

为什么在实现接口时我不能使用兼容的具体类型

我希望能够做到这样的事情:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Test
{
    public interface IFoo
    {
        IEnumerable<int> integers { get; set; }
    }

    public class Bar : IFoo
    {
        public List<int> integers { get; set; }
    }
}
Run Code Online (Sandbox Code Playgroud)

为什么编译器抱怨..?

Error   2   'Test.Bar' does not implement interface member 'Test.IFoo.integers'. 'Test.Bar.integers' cannot implement 'Test.IFoo.integers' because it does not have the matching return type of 'System.Collections.Generic.IEnumerable<int>'.
Run Code Online (Sandbox Code Playgroud)

据我所知,接口说IEnumerable,类使用List,但List IEnumerable .....

我能做什么?我不想在类中指定IEnumerable,我想使用一个实现IEnumerable的具体类型,比如List ...

c# interface class

12
推荐指数
2
解决办法
2438
查看次数

C#多态性简单问题

我得到了一个X类和一个Y类,后者派生自X:

class x {}
class y : x {}
Run Code Online (Sandbox Code Playgroud)

然后在某处我使用X列表:

List<X> lstX;
...
Run Code Online (Sandbox Code Playgroud)

然后我想从我的其他列表中的数据中使用一个新的Y列表......沿着这些方向:

List<Y> lstY = lstX;
Run Code Online (Sandbox Code Playgroud)

我相信X列表中的项目会自动转换为Y,但事实并非如此.

另外,我如何从某个X初始化Y的新实例?我想要做 :

var newX = new X();
var newY = new Y(X);
Run Code Online (Sandbox Code Playgroud)

但它似乎并没有像那样工作.

谢谢你的帮助!抱歉格式化,尽我所能

c# polymorphism

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

如何声明字符串数组(在多行上)

为什么$dlls.Count返回单个元素?我尝试声明我的字符串数组:

$basePath = Split-Path $MyInvocation.MyCommand.Path

$dlls = @(
    $basePath + "\bin\debug\dll1.dll",
    $basePath + "\bin\debug\dll2.dll",
    $basePath + "\bin\debug\dll3.dll"
)
Run Code Online (Sandbox Code Playgroud)

arrays powershell

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

RelativeLayout Gravity没有应用?

我有一个具有以下布局的活动:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/testlayoutOverlays"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/testlayoutMain"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <RelativeLayout
        android:id="@+id/testlayout_bottom"
        android:layout_width="fill_parent"
        android:layout_height="62dp"
        android:background="#122334" >

        <ImageView
            android:id="@+id/testbtnBlock"
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:layout_alignParentLeft="true"
            android:layout_gravity="left|center_vertical"
            android:contentDescription="Test1"
            android:padding="@dimen/padding_medium"
            android:src="@drawable/btnblock" />

        <TextView
            android:id="@+id/testtxtZoomPan"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_toLeftOf="@+id/testbtnX"
            android:layout_toRightOf="@+id/testbtnBlock"
            android:gravity="center_horizontal"
            android:text="@string/txtZoomPan"
            android:textColor="#FFFFFF" />

        <ImageView
            android:id="@+id/testbtnX"
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:layout_alignParentRight="true"
            android:layout_gravity="right|center_vertical"
            android:contentDescription="Test2"
            android:padding="@dimen/padding_medium"
            android:src="@drawable/btnx" />
    </RelativeLayout>

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/testlayoutPuzzleInfo"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:orientation="horizontal" >

        <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:id="@+id/testlayoutChronoErrors"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <Chronometer
                android:id="@+id/testchronometer"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="0"
                android:format="@string/chronometer_initial_format"
                android:gravity="center" />

            <LinearLayout …
Run Code Online (Sandbox Code Playgroud)

android android-widget android-layout

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

这个简单的SQL查询可以优化吗?

我有以下查询:

SELECT COUNT(*) 
FROM Address adr INNER JOIN 
     Audit a on adr.UniqueId = a.UniqueId
Run Code Online (Sandbox Code Playgroud)
  • 在数据库上(130万个地址,超过400万次审计)
  • 两个UniqueId列都是群集主键

查询需要很长时间才能完成.我觉得愚蠢,但有没有办法优化它?我想计算所有具有基础可审计的地址条目.

编辑:非常感谢您的所有输入,这里有一些更多的细节:

  • 查询将不会经常运行(它仅用于验证),但是感谢索引的视图提示,我将肯定地添加到我的知识中.
  • 所有地址都有一对一的审核.并非所有审核都是地址.
  • 查询需要1分钟以上才能完成.我发现这个太长了,不需要简单计算.

sql sql-server

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

如何用Webpack打包到'生产'我的反应网站?

我设法使用这个react-hot-boilerplate配置脚本来创建和测试一个简单的React Flux webapp.

现在,当我运行时,我有一个我喜欢的网站npm start,在配置中添加生产版本的最简单/最好的方法是什么?当我使用'package'命令时,我想得到一个prod包含我需要的所有最终html和缩小js文件的小文件夹,这是我应该期待的吗?

这是我的package.json:

{
  "name": "react-hot-boilerplate",
  "version": "1.0.0",
  "description": "Boilerplate for ReactJS project with hot code reloading",
  "scripts": {
    "start": "node server.js",
    "lint": "eslint src"
  },
  "author": "Dan Abramov <dan.abramov@me.com> (http://github.com/gaearon)",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/gaearon/react-hot-boilerplate/issues"
  },
  "homepage": "https://github.com/gaearon/react-hot-boilerplate",
  "devDependencies": {
    "babel-core": "^5.4.7",
    "babel-eslint": "^3.1.9",
    "babel-loader": "^5.1.2",
    "eslint-plugin-react": "^2.3.0",
    "react-hot-loader": "^1.2.7",
    "webpack": "^1.9.6",
    "webpack-dev-server": "^1.8.2"
  },
  "dependencies": {
    "react": "^0.13.0",
    "flux": "^2.0.2",
    "events": "^1.0.2",
    "object-assign": "^3.0.0",
    "jquery": "^2.1.4", …
Run Code Online (Sandbox Code Playgroud)

javascript packaging npm reactjs webpack

7
推荐指数
1
解决办法
2871
查看次数

[System.IO.Path] ::结合不将我的powershell变量作为参数?

为什么函数不是[System.IO.Path]::Combine我的第一个参数?

PS C:\WINDOWS\system32> $g_basePath
F:\Dev\OneClickTools



PS C:\WINDOWS\system32> [Tests.Utils]::CUSTOMASSEMBLY_TEST
CustomLogic.dll



PS C:\WINDOWS\system32> [System.IO.Path]::Combine($g_basePath, "\bin\debug", [Tests.Utils]::CUSTOMASSEMBLY_TEST)
\bin\debug\CustomLogic.dll
Run Code Online (Sandbox Code Playgroud)

第三个命令显示只连接了第二个和第三个参数,或者是否使用空字符串作为$g_basePath..?

powershell

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