小编gan*_*ers的帖子

什么是TypeScript,为什么我会用它代替JavaScript?

你能描述一下TypeScript语言是什么吗?

JavaScript或可用库无法做什么,这会让我有理由考虑它?

javascript typescript

1637
推荐指数
5
解决办法
50万
查看次数

如何使用Bootstrap在移动设备上显示表格?

我的桌子在桌面上显示得很好,但是一旦我尝试查看移动版本,我的桌子就会变得太宽,无法移动设备屏幕.我正在使用响应式布局.

如何为移动视图设置表格宽度?还有哪些其他替代方法可以使用Bootstrap在移动视图上显示表格数据?

twitter-bootstrap twitter-bootstrap-3

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

从bootstrap 3导航栏的折叠中排除菜单项

这就是我所拥有的,我已经尝试在"品牌"中移动我的部分,并在品牌外部和折叠之外做一个向右拉动并做左/右拉,同时也尝试在之前或之后放置它崩溃部分.

将它添加到品牌部分时,它可以正常工作,但它会归结为新的一行.我如何将它保持在同一条线上?

    <body>
        <header>
            <nav class="navbar navbar-default navbar-inverse" role="navigation" style="font-size: 18px">
                <div class="container">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <div class="navbar-brand site-title" style="text-decoration: none; font-size: 24px; font-weight:bold">@Html.ActionLink("Manager", "Index", "Player")</div>
                    </div>

                    <div class="collapse navbar-collapse navbar-ex1-collapse navbar-right">
                        <ul class="nav navbar-nav">
@*                          <li class="active">@Html.ActionLink("Home", "Index", "Player")</li>
                            <li class="active">@Html.ActionLink("Match", "Index", "Match")</li>                             <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown">Profile <b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                    <li>@Html.ActionLink("Change Password", "ManagePassword", "Account")</li>
                                    <li>@Html.ActionLink("Update Profile Info", "UpdateProfile", "Account")</li>
                                    <li>@Html.ActionLink("Log Off", "LogOff", …
Run Code Online (Sandbox Code Playgroud)

html css twitter-bootstrap twitter-bootstrap-3

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

Bootstrap 4卡片组,基于视口的列数

我正在尝试在bootstrap 4中实现卡片功能,以使我的所有卡片都具有相同的高度.

bootstrap提供的示例显示4张漂亮的卡片,但无论是视口,它都是4行卡片.请在此处查看codeply .

这对我来说没有意义,因为我认为,为了让你的内容看起来还不错,你需要将卡的最小尺寸缩小.

然后我尝试添加一些视口类来打破屏幕大小,但是一旦添加了div,卡片组就不再适用,因此不会使卡片的高度相等.

我怎样才能完成这项工作?这是缺少的功能,将在Bootstrap 4的完整版本中解决吗?

这是小提琴:https://jsfiddle.net/crrm5q9m/

<div class="card-deck-wrapper">
  <div class="card-deck">
    <div class="card card-inverse card-success text-center col-xs-6 col-sm-4 col-md-3 col-lg-2 col-xl-1">
      <div class="card-block">
        <blockquote class="card-blockquote">
          <p>It's really good news that the new Bootstrap 4 now has support for CSS 3 flexbox.</p>
          <footer>Makes flexible layouts <cite title="Source Title">Faster</cite></footer>
        </blockquote>
      </div>
    </div>
    <div class="card card-inverse card-danger text-center col-xs-6 col-sm-4 col-md-3 col-lg-2 col-xl-1">
      <div class="card-block">
        <blockquote class="card-blockquote">
          <p>The Bootstrap 3.x element that was called "Panel" before, …
Run Code Online (Sandbox Code Playgroud)

css twitter-bootstrap twitter-bootstrap-4 bootstrap-4

46
推荐指数
6
解决办法
7万
查看次数

ASP.NET 5 MVC 6中没有实体框架的身份验证和授权

我正在尝试使用现有的数据库和表来配置我的身份验证和授权,而不使用Entity Framework(使用Dapper).

我已经正确配置了Dapper,现在我正在尝试连接SignInManager,而UserManager通过Dapper调用我的数据库,但在此之前可能发生,我在自定义角色存储中遇到了一些错误.

这是我点击网站上的"注册"按钮时收到的错误(这只是一个简单的项目,包含所有预先定义的帐户等开箱即用的东西)

InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNet.Identity.IRoleStore`1[TestAsyncWebsite.Configuration.WrestleStatRole]' while attempting to activate 'Microsoft.AspNet.Identity.RoleManager`1[TestAsyncWebsite.Configuration.WrestleStatRole]'
Run Code Online (Sandbox Code Playgroud)

目前,这是我如何配置我的自定义用户,角色,用户界面,角色存储,用户管理器和角色管理器:

    public class WrestleStatUser : ApplicationUser
    {
        public WrestleStatUser() : base()
        {

        }
    }

    public class WrestleStatRole : IdentityRole
    {

    }

public class WrestleStatUserStore : IUserStore<WrestleStatUser>
{
   // all methods implemented
}

public class WrestleStatRoleStore : IRoleStore<WrestleStatRole>
{
   // all methods implemented
}

    public class WrestleStatUserManager : UserManager<WrestleStatUser>
    {
        public WrestleStatUserManager(IUserStore<WrestleStatUser> store, IOptions<IdentityOptions> optionsAccessor, IPasswordHasher<WrestleStatUser> passwordHasher, IEnumerable<IUserValidator<WrestleStatUser>> userValidators, IEnumerable<IPasswordValidator<WrestleStatUser>> passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc dapper asp.net-core

16
推荐指数
1
解决办法
8393
查看次数

Angular 2单元测试错误无法获取未定义或空引用的属性'preventDefault'

我为一个组件创建了一系列单元测试.它最初失败了,因为我得到了上述错误,所以我拿出了event.defaultPrevented的东西,却没有真正知道它在做什么.

好吧,这修复了我的错误,但显然对UI行为产生了非常糟糕的副作用,所以我不得不把这些东西放回我的代码中.

所以,现在我回来修复我的单元测试.我怎样才能将事件内容模拟/注入我的单元测试中?

只是由Angular CLI删除的默认"应该创建"测试失败,这里是代码:

let component: MemberAddComponent;
let fixture: ComponentFixture<MemberAddComponent>;
let contractsService: ContractsService;
let notesService: NotesService;
let saveButton: any;

beforeEach(async(() => {
    let router = { navigate: jasmine.createSpy('navigate') };

    TestBed.configureTestingModule({
        imports: [
            HttpModule,
            FormsModule,
            ReactiveFormsModule,
            RouterTestingModule
        ],
        declarations: [
            MemberAddComponent,
            // lots more here
        ],
        providers: [
            AppDataService,
            ErrorService,
            {
                provide: ContractsService,
                useClass: MockContractsService
            },
            {
                provide: NotesService,
                useClass: MockNotesService
            }
        ]
    })
    .compileComponents();
}));

beforeEach(() => {
    fixture = TestBed.createComponent(MemberAddComponent);
    component = fixture.componentInstance;
    contractsService = fixture.debugElement.injector.get(ContractsService);
    saveButton = …
Run Code Online (Sandbox Code Playgroud)

unit-testing jasmine angular-cli angular

13
推荐指数
1
解决办法
888
查看次数

对象类型末尾的&符号是什么?

我不得不重新编译一些代码,我不知道这个语法是什么?你们可以帮忙,还是指点一下这是什么意思?我用Google搜索并搜索了这个网站,找不到任何东西.

只需一行代码:

Rectangle pageBounds;
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
Rectangle& local = @pageBounds;
Run Code Online (Sandbox Code Playgroud)

@Rectangle对象类型末尾的符号是什么,变量@之前的符号是什么pageBounds

这是我需要修复的最后一行代码,以便再次编译这个可执行文件.

这是使用此语法的方法,我可以删除它吗?

protected override void OnPrintPage(PrintPageEventArgs e)
{
  Application.DoEvents();
  ++this._pageNum;
  float num1;
  if (this.Header != null)
  {
    num1 = this.Header.CalculateHeight(this, e.Graphics);
    this.Header.Draw(this, (float) e.MarginBounds.Top, e.Graphics, e.MarginBounds);
  }
  else
    num1 = 0.0f;
  float num2;
  if (this.Footer != null)
  {
    num2 = this.Footer.CalculateHeight(this, e.Graphics);
    this.Footer.Draw(this, (float) e.MarginBounds.Bottom - num2, e.Graphics, e.MarginBounds);
  }
  else
    num2 = 0.0f; …
Run Code Online (Sandbox Code Playgroud)

c# reflector decompiling

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

在iOS Safari上的浏览器会话之间未保存Cookie

我有一个MVC 4网站,用户可以登录,我保存一个cookie及其会话信息,这样他们就不必再次登录了.

public void SetCookie(HttpCookie cookie)
{
    HttpContext.Current.Response.Cookies.Set(cookie);
}
Run Code Online (Sandbox Code Playgroud)

这适用于桌面设备,但是当我在iOS上运行它时,它在100%的时间内都不起作用.如果我在移动浏览器(Chrome或Safari)中打开至少1页并导航回我的网站,则会找到我的会话cookie,而不必登录.但是,如果我关闭该浏览器的所有窗口,那么下次我导航回我的网站时,找不到会话cookie.我在我的cookie上设置了1年的持续时间/到期时间,因此它没有到期.

到目前为止,我唯一发现的是这是.NET 4.0中的一个错误,并在.NET 4.5中得到修复.我相信我已经在运行.NET 4.5,通过查看我的*.csproj和TargetFrameworkVersion元素:

<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>
    </ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{xxxxxxxxxxxxxxxxxx}</ProjectGuid>
    <ProjectTypeGuids>{xxxxxxxx};{xxxxxxxxxxxxx};{xxxxxxxxxxxxxxxx}</ProjectTypeGuids>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>MyApp</RootNamespace>
    <AssemblyName>MyApp</AssemblyName>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <MvcBuildViews>false</MvcBuildViews>
    <UseIISExpress>true</UseIISExpress>
    <IISExpressSSLPort />
    <IISExpressAnonymousAuthentication />
    <IISExpressWindowsAuthentication />
    <IISExpressUseClassicPipelineMode />
  </PropertyGroup>
Run Code Online (Sandbox Code Playgroud)

这是.NET(或MVC)的错误,还是我的编码?我是否需要升级到MVC 5(而不是升级到.NET 4.5的原始建议)?

这真的被窃听我,因为在未来的未来几个月大部分的流量到我的网站将是移动用户,我可能会失去他们中的一些,如果他们要保持记录的每次(我知道我讨厌不得不在移动设备上登录...)

编辑:

顺便说一句 - 这是关于同一主题的另一个页面:使用iPhone UIWebView时的Asp.Net Forms身份验证

我也试过实现这个,它也没有用:

http://www.bloggersworld.com/index.php/asp-net-forms-authentication-iphone-cookies/

以上内容包括Scott Hanselmans建议修复:

http://www.hanselman.com/blog/FormsAuthenticationOnASPNETSitesWithTheGoogleChromeBrowserOnIOS.aspx

这是我的cookie创建代码,以防它有用:

private void CreateAndSetAuthenticationCookie(int loginId, string username)
    { …
Run Code Online (Sandbox Code Playgroud)

c# cookies asp.net-mvc session ios

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

System.DirectoryServices.DirectorySearcher.PropertiesToLoad中可用的不同属性有哪些

这就是我所需要的......我用google搜索的所有东西都说你可以将它们添加为字符串数组,但是没有说明可用的选项.

TIA

c# directoryservices active-directory

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

混合模式组件是针对"v2.0.50727"错误构建的

首先,我在这里找到了StackOverflow上的其他帖子,但它没有解决我的错误.

我有3个不同的环境/域,每个位置都有一个构建服务器.我的Dev和UAT环境构建得很好,但生产版本不起作用.

我收到了错误

混合模式程序集是针对运行时的版本"v2.0.50727"构建的,如果没有其他配置信息,则无法在4.0运行时加载

我已将此标记添加到我的app.config文件中(这是我上面链接中的建议修复)

  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>
Run Code Online (Sandbox Code Playgroud)

导致此问题的构建服务器/环境/域之间还有什么不同?

在回答艾伦的问题时,我相信这就是你所要求的:

<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>8.0.30703</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{D3D87C05-2811-489B-9F0D-7676B6485AA0}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>MVST.Batch.CorrespondenceConversion</RootNamespace>
    <AssemblyName>MVST.Batch.CorrespondenceConversion</AssemblyName>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
Run Code Online (Sandbox Code Playgroud)

我有超过100个其他项目设置完全相同的方式,那些构建正常.

.net c# mixed-mode .net-4.0 .net-2.0

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