小编Fly*_*FoX的帖子

Bootstrap 按钮图标未居中

我正在使用谷歌的 boostrap 社交按钮,但谷歌图标不是垂直居中的。

如何使“G”垂直居中。

body {
  background-color: #E8ECEF;
}

.centered {
    padding-top: 200px;
    text-align: center;
}

.secret-text {
  text-align: center;
  font-size: 2rem;
  color: #fff;
  background-color: #000;
}
<!-- just tried this part out also didn't change the G-->
.btn-google{
    display: flex;
   align-items: center;
   justify-content: center;
}
Run Code Online (Sandbox Code Playgroud)
<div class="container mt-5">
  <h1>Login</h1>

  <div class="row">
    <div class="col-sm-8">
      <div class="card">
        <div class="card-body">

          <!-- Makes POST request to /login route -->
          <form action="/login" method="POST">
            <div class="form-group">
              <label for="email">Email</label>
              <input type="email" class="form-control" name="username">
            </div>
            <div class="form-group"> …
Run Code Online (Sandbox Code Playgroud)

html css bootstrap-4

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

如何绑定到 ObservableCollection 的一个元素

我有一个 ObservableCollection 并且想要将一个文本框绑定到该集合的特定元素。ObservableCollection 中的项目属于实现 INotifyPropertyChanged 的​​类型。

我曾想过创建一个从 ObservableCollection 中选择正确元素的属性,但是当集合中的相应元素发生更改时,我必须使该属性实现,我不确定这是否是正确的方法。

c# data-binding wpf

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

具有可变填充零的数字的数字到数字的数组

我有一个函数,它获得了number一定数量的函数,digits并且应该返回一个数字的数组的数组(或数组列表)digits.

样本输入1:
12345,6输出:"012345"

输入样本2:123456,6
输出:"123456"

样本输入3:1,8
样本输出:"00000001"

我目前正在这样做

public int[] digitArrayFromNumber(int number, int digits){
    int[] result = number.ToString().PadLeft(digits, '0').ToArray().Select(
        ch => Convert.ToInt32(ch.ToString())
    ).ToArray();
    return result;
}
Run Code Online (Sandbox Code Playgroud)

但这看起来很丑陋,在我看来可能有更好的可读方式来做到这一点.

c#

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

迭代元组中集合中的已排序元素

我试图在2或更多的元组中迭代集合中的已排序元素.

如果我有Vec,我可以打电话

for window in my_vec.windows(2) {
    // do something with window
}
Run Code Online (Sandbox Code Playgroud)

但是Vecs没有被隐式排序,这将是非常好的.我尝试使用a BTreeSet而不是a Vec,但我似乎无法调用windows它.

试图打电话时

for window in tree_set.iter().windows(2) {
    // do something with window
}
Run Code Online (Sandbox Code Playgroud)

我收到了错误

no method named `windows` found for type `std::collections::btree_set::Iter<'_, Card>` in the current scope
Run Code Online (Sandbox Code Playgroud)

iteration collections rust

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

在 Assert.Multiple 中验证模拟

是否可以验证Assert.Multiple块中的方法调用以及对 的其他调用Assert

SomeProperty当方法调用MyMethod未验证时,我当前的解决方案不会调用 assert on 。接近我想要的唯一方法是将调用移到myInterfaceMock.Verify最后,但是当有多个方法调用要验证时,这不再起作用。

var mInterfaceMock = new Mock<IMyInterface>()
  .Setup(x => x.MyMethod())
  .Verifiable();
var systemUnderTest = new MyClass(myInterfaceMock.Object);

systemUnderTest.MethodToTest();

Assert.Multiple(() => {
  myInterfaceMock.Verify();
  Assert.That(systemUnderTest.SomeProperty, Is.True);
});
Run Code Online (Sandbox Code Playgroud)

c# nunit moq

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

ruby中的布尔逻辑'true和false == true'

> test = false and true
=> false
> test
=> false
> test = true and false #this is the point I don't understand!
=> false
> test
=> true
Run Code Online (Sandbox Code Playgroud)

为什么ruby会以这种方式运行?如何正确使用它以避免遇到此问题?

ruby boolean-logic

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

标签 统计

c# ×3

boolean-logic ×1

bootstrap-4 ×1

collections ×1

css ×1

data-binding ×1

html ×1

iteration ×1

moq ×1

nunit ×1

ruby ×1

rust ×1

wpf ×1