小编spr*_*t12的帖子

如何对查找进行排序?

嗨,我有一个存储字符串和整数的查找类型.

static Lookup<string, int> lookup;
lookup = (Lookup<string, int>)list.ToLookup(i => i.IP, i => i.Number);
Run Code Online (Sandbox Code Playgroud)

但现在我需要通过值(数字)对此查找进行排序,并获得前10个键及其值.

这怎么可能?

linq sorting lookup

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

如何混合jQuery Mobile和ASP.NET

我正在使用jQuery Mobile和ASP.NET 4.0 Webforms创建一个移动网站.我创建了一个初始登录页面(Default.aspx),其中按钮调用ajax JavaScript函数,该函数在后端调用页面方法,如下所示:

Default.aspx的

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="UCP.Default" %>
<!DOCTYPE html>
<html>
<head>
    <title>UA Cover Plus</title>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
    <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
</head>
<body>
    <!-- Login -->
    <div data-role="page" id="login">
        <div data-role="header" data-position="fixed">
           <h1>Login</h1>
            <a href="#Family" data-icon="gear" class="ui-btn-right" data-iconpos="notext" data-theme="b" >Options</a>
        </div>
       <div data-role="content" data-theme="a">   
            <input type="text" id="txtUserName" placeholder="Username" />
            <input type="password" name="passwordinput" id="txtPassword"  placeholder="Password" value=""  />
            <a href="javascript:Authenticate();" data-role="button" data-icon="check" data-iconpos="right">Log Me In!</a>
       </div><!-- /content -->
    </div><!-- /page -->
</body>
Run Code Online (Sandbox Code Playgroud)

Ajax JQuery函数:

function …
Run Code Online (Sandbox Code Playgroud)

asp.net ajax webforms jquery-mobile

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

为什么我的网站项目名称中的括号中有一个数字?

这只是好奇心/烦恼而不是真正的问题.

我有一个使用VS 2013的Web表单网站项目.不知何故,项目名称包括名称中的(1)(2),我已尝试编辑解决方案文件,删除所有其他网站,重建/清理等,仍然无法弄清楚从哪里得到(2).

在此输入图像描述

解决方案文件

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2013 for Web
VisualStudioVersion = 12.0.30501.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Site", "http://localhost:52806", "{5411FD57-5AFE-4A3A-9474-0DCD64C89003}"
    ProjectSection(WebsiteProperties) = preProject
        UseIISExpress = "true"
        TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
        Debug.AspNetCompiler.VirtualPath = "/localhost_52806"
        Debug.AspNetCompiler.PhysicalPath = "..\..\..\..\..\..\Dropbox\Projects\Site\"
        Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_52806\"
        Debug.AspNetCompiler.Updateable = "true"
        Debug.AspNetCompiler.ForceOverwrite = "true"
        Debug.AspNetCompiler.FixedNames = "false"
        Debug.AspNetCompiler.Debug = "True"
        Release.AspNetCompiler.VirtualPath = "/localhost_52806"
        Release.AspNetCompiler.PhysicalPath = "..\..\..\..\..\..\Dropbox\Projects\Site\"
        Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_52806\"
        Release.AspNetCompiler.Updateable = "true"
        Release.AspNetCompiler.ForceOverwrite = …
Run Code Online (Sandbox Code Playgroud)

asp.net web visual-studio-2013

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

来自同一分支的多个拉取请求

说我有3个分支:masterreleasemyfeature。是否可以从myfeature两者创建2个拉取请求,masterrelease无需创建另一个分支?

我为什么要这个?

说master是最新的,发布是一年前的。修复了错误后,便针对发行版本创建了PR,现在也需要将此修复程序放到主站中,完美的选择,但是就我所知,这将需要一个新的分支。我只希望可以使用相同的原始修订分支合并到两者中(只要master仍然兼容)。

git pull-request git-branch

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

是否可以从基类构造函数创建派生类?

我说过3个课程,动物,猫和狗.

// calling code
var x = new Animal("Rex"); // would like this to return a dog type
var x = new Animal("Mittens"); // would like this to return a cat type

if(x.GetType() == typeof(Dog))
{
   x.Bark();
}
else
{
  x.Meow();
}


class Animal
{
   public Animal(string name)
   {
      // check against some list of dog names ... find rex
      // return Animal of type Dog.

      // if not...

      // check against some list of cat names ... find mittens …
Run Code Online (Sandbox Code Playgroud)

c# polymorphism inheritance

6
推荐指数
2
解决办法
1310
查看次数

getSupportFragmentManager无法在DialogFragment上编译

我怎么能这样说:

public class TagsDialog extends DialogFragment
{
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState)
    {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        LayoutInflater inflater = getActivity().getLayoutInflater();
        builder.setView(inflater.inflate(R.layout.tags_dialog, null));
        builder.setMessage("This is a message").setTitle("TAGS");
        return builder.create();
    }
}
Run Code Online (Sandbox Code Playgroud)

从我的Fragment内心来看ViewPager:

    public class MyFragment extends Fragment
    {
        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {

    ...

            ImageView btnTags = (ImageView)view.findViewById(R.id.btnTags);
            btnTags.setOnClickListener(new View.OnClickListener()
            {
                @Override
                public void onClick(View view)
                {

                    DialogFragment dlg = new TagsDialog();
                    //this line doesn't compile
                    dlg.show(getSupportFragmentManager(), "tags");

                }
            }); …
Run Code Online (Sandbox Code Playgroud)

android dialog android-fragments android-viewpager fragmentmanager

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

如何水平和垂直对齐内联块

最好/最干净的方法是CSS将标题对齐#dates div到标题的右侧,并垂直居中。

我试过了float: right,但就是不允许vertical-align。我想避免使用浮动,所以我使用inline-block, 并使用相对定位。有没有更正确的做法呢?

我不喜欢这样的事实:我必须将顶部设置为 30 像素,并不断尝试直到它居中。

<div id="header">
    <a id="logo" href="~/" runat="server">
        <img src="Images/Interface/logo.png" alt="logo" />
    </a>
    <div id="dates">
        <div id="hijri-date">2 Ramadhaan, 1435 AH</div>
        <div id="gregorian-date">Sunday 29 June 2014</div>
    </div>
</div>

#header
{
    background-color: white;
    padding: 15px;
    position: relative;
}

#logo
{
    display: inline-block;
    vertical-align: middle;
}

    #logo img
    {
        vertical-align: bottom; /* to get rid of text descender space underneath image */
    }

#dates
{
    display: inline-block; …
Run Code Online (Sandbox Code Playgroud)

html css alignment vertical-alignment

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

Visual Studio不会撤消我的git更改

出于某种原因,我的VS不会在"撤消更改"后从更改视图中删除文件:

在此输入图像描述

当我查看差异时,实际的更改已经消失,但我希望文件不显示.我想知道一个永久的解决方案.我已经知道我可以在VS之外做一个藏匿或类似的东西来隐藏文件显示.

编辑:

我找到了解决办法.当我撤消时,然后用剩下的文件选择阶段,它们就会消失!

git version-control visual-studio-2015

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

Vue.js 卡在 40% 的服务上如何恢复?

我决定删除节点模块文件夹,npm install然后做一个npm run serve它总是卡在 40% 左右并永远停留在那里。从 UI 完成后,它也会卡在类似的数量上:

$ vue-cli-service serve --open --mode development --https --dashboard INFO 正在启动开发服务器...

40% 构建 118/134 个模块 16 个活动 ...tApp\node_modules\axios\lib\defaults.js

下一次:

40% 构建 134/147 个模块 13 个活动 ...\node_modules\axios\lib\adapters\xhr.js

我注意到 Node.js 进程一直以 15% 左右的速度运行,但如果我等待、等待和等待,什么也不会发生。

在此处输入图片说明

包.json

{
  "name": "myapp",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "test:e2e": "vue-cli-service test:e2e",
    "test:unit": "vue-cli-service test:unit"
  },
  "dependencies": {
    "@aspnet/signalr": "^1.1.4",
    "axios": "^0.18.0",
    "vue": "^2.6.10",
    "vue-axios": "^2.1.4",
    "vue-router": "^3.0.6", …
Run Code Online (Sandbox Code Playgroud)

node.js vue.js vue-cli

6
推荐指数
3
解决办法
8091
查看次数

为什么我不能从代码中设置SolidColorBrush资源值?

我在我的xaml中定义了一个资源:

<core:WidgetBase xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  x:Class="....Silverlight.LiquidityConstraintsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:core="clr-namespace:...Silverlight;assembly=....Silverlight"
    xmlns:local="clr-namespace:....Silverlight"
    mc:Ignorable="d">

    <core:WidgetBase.Resources>
        <SolidColorBrush x:Key="..." />
    </core:WidgetBase.Resources>
...
Run Code Online (Sandbox Code Playgroud)

我试图从代码中设置它:

void _administrationClient_GetByFilterModuleSettingCompleted(object sender, GetByFilterModuleSettingCompletedEventArgs e)
{
        this.Resources["..."] = new SolidColorBrush(Colors.Red);
}
Run Code Online (Sandbox Code Playgroud)

但我得到错误:

该方法或操作未实现.

堆栈跟踪 :

   at System.Windows.ResourceDictionary.set_Item(Object key, Object value)
   at ....Silverlight.LiquidityConstraintsView._administrationClient_GetByFilterModuleSettingCompleted(Object sender, GetByFilterModuleSettingCompletedEventArgs e)
   at ....Service.AdministrationServiceClient.OnGetByFilterModuleSettingCompleted(Object state)
Run Code Online (Sandbox Code Playgroud)

当我向服务器发送请求以获取颜色时会发生这种情况,然后当它返回时我尝试将该颜色设置为资源,即使我尝试在此时将其设置为红色也会失败.

如果它有帮助,我设置它的方法是从WCF调用到服务器的异步回调方法.

silverlight wpf resources colors

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