如果删除 sort_asc
,则您的代码工作正常。这是因为PHP将按预期对您的子阵列进行排序。它将从子阵列的开头进行比较。 demo )
array_multisort(array_column($array, 'earnest_money_due'), $array);
( 很好。 ( demo )
array_multisort(array_map(fn($row) => $row['earnest_money_due']['value'], $array), $array);
使用 usort()
也没有错。 ( demo )
usort($array, fn($a, $b) => $a['earnest_money_due']['value'] <=> $b['earnest_money_due']['value']);
无论您使用哪种 array_multsort()
您不使用的技术,需要明确使用 sort_asc
,因为这是默认排序顺序。
您正在使用的Bootstrap的版本显然不支持通过自定义变量来自定义。至少用于定制按钮颜色。尝试使用v。5.2目前是Beta:
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous" />
<style>
.btn-primary {
--bs-btn-bg: tomato;
--bs-btn-border-color: tomato;
}
</style>
<button class="btn btn-primary">
I like tomato!
</button>
只是猜测而没有看到任何实际数据...
Sub TestTemp_Cal()
Dim ws As Worksheet, c As range, rng As range
Set ws = Activesheet
Set c = ws.Cells(Rows.Count, "J").End(xlUp)
If c.Row > 44 Then 'make sure you can offset at least 39 rows
Set rng = c.Offset(-39).Resize(12) '39 rows up and resize to 12 rows
ws.Range("J3").Formula = "=ROUND(AVERAGE(" & rng.address(False, False) & "),0)"
End If
End Sub
默认情况下,Mongorestore重建了索引,如果您想出于某种原因仅还原数据,则可以添加以下选项:
--noIndexRestore
防止Mongorestore恢复和构建相应的Mongodump输出中指定的索引。
很简单。您使用了错误的列名, values_old 而不是 value_old ,
但是您的公式将无法正常工作,然后因为这些都无法正常工作:
text.lower([value_old]) =“ n/a”或text.lower([value_old])=“ na”
,因为您正在比较刚刚转换为较低案例与上案例的东西
,因此您可能想要以下,其中包括 try 您似乎已经排除了代码
= Table.AddColumn(#"Changed Type", "Custom", each try Number.From([Value_old]) otherwise if Text.Contains([Value_old],"not required",Comparer.OrdinalIgnoreCase) or Text.Lower([Value_old]) = "n/a" or Text.Lower([Value_old]) ="na" or [Value_old] = "100" or [Value_old] = 100 then 2 else [Value_old])
出色地。 “班级”到底是什么意思?还是换句话说,为什么我们需要班级操作员过载?
当我们超载运算符时,我们定义如何操作属于同一类的数据。我们如何比较它们?让我们声明并实施一个超载的操作员'&lt;'为了解决这个问题。
class Stone
{
public:
bool operator<(const Stone& anotherStone)
{
return this->_weight < anotherStone._weight;
}
float _weight;
}
您会发现,可以比较石头的类。相似性,我们通过声明和实现'='运算符来定义同一类事物的分配。
class Stone
{
public:
bool operator<(const Stone& anotherStone)
{
return this->_weight < anotherStone._weight;
}
void operator=(const Strong& anotherStone)
{
this->_weight = anotherStone._weight;
}
float _weight;
}
总之,我们过载运算符仅用于操纵同一类中的数据,这就是操作员过载的用法。
对于您的代码,C1属于类容器,C2属于类容器,它们是完全不同的类。定义“模板复制构造函数”是没有意义的。
但是,汇编没有抱怨,因为“ int”和“ float”类型可以隐式转换。如果变量C2是容器的类型,那么您将不会像这样幸运。
RTMP是基于TCP的协议,标准入口不支持TCP服务。
Nginx Ingress Controller(看起来您正在使用)可以被配置为公开TCP服务。
首先,您需要确保在 stream> stream-server-srv
服务中同时公开HTTP和RTMP端口:(
apiVersion: v1
kind: Service
metadata:
name: stream-server-srv
namespace: default
spec:
selector:
app: stream-server
type: ClusterIP
ports:
- name: http-port
port: 8000
targetPort: 8000
protocol: TCP
- name: rtmp-port
port: 1935
targetPort: 1935
protocol: TCP
用命名空间替换默认值)
您还需要确保也暴露了1935年端口。例如:
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.2.0
name: ingress-nginx-controller
namespace: ingress-nginx
spec:
externalTrafficPolicy: Local
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- appProtocol: http
name: http
port: 80
protocol: TCP
targetPort: http
- appProtocol: https
name: https
port: 443
protocol: TCP
targetPort: https
- name: rtmp
port: 1935
protocol: TCP
targetPort: 1935
selector:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
type: LoadBalancer
最后,您需要更新/修补nginx TCP服务配置:(
kubectl patch configmap tcp-services -n ingress-nginx --patch '{"data":{"1935":"default/stream-server-srv:1935"}}'
用命名空间/serviceName替换“默认/stream-server-srv”)
您缺少检查空输入的支票。在您的测试中,您将一个空列表传递给 deleteusers
在此SQL语句中导致:
delete from user wher;
我希望DBMS将其拒绝为无效的SQL,但也许有人将其解释为>从用户
中删除,该>仅删除所有用户。 (正如@stevebosman所指出的那样, wher
被解释为表格别名 - 由于丢失的最后一个 e
- 没有保留的单词Anymoere)
基本上您有2个选项。要么通过传递空列表来删除所有用户是有效的用例 - 在这种情况下,您应该通过产生适当的SQL来正确处理它。否则,如果 IDS
为空,则应该调整代码以引发异常。
@Override
public boolean deleteUsers(List<String> ids) throws Exception {
if (ids == null || ids.size() == 0) {
throw new IllegalArgumentException("List of IDs must not be empty");
}
...
}
当然,您可以返回 false
在空输入的情况下,以表明没有删除用户。
要将值传递到测试中的 deleteusers
方法,您需要将值添加到使用的列表:
userDAOImpl.addUser("admin3", "111222");
final List<String> idsToDelete = new ArrayList<>();
idsToDelete.add("111222");
userDAOImpl.deleteUsers(idsToDelete);
通常的操作否定了所有动画和用户输入。如文档中所述:
取消任何活动动画。如果用户当前滚动,则该操作被取消。
为了归档您要做的事情,您可以使用以下类扩展名:
class SmoothPageController extends PageController {
SmoothPageController({
int initialPage = 0,
bool keepPage = true,
double viewportFraction = 1.0,
}) : super(
initialPage: initialPage,
keepPage: keepPage,
viewportFraction: viewportFraction,
);
/// Jumps the scroll position from its current value to the given value,
/// without animation, and without checking if the new value is in range.
/// Any active animation is being kept. If the user is currently scrolling,
/// that action is kept and will proceed as expected.
/// Copied from ScrollController.
void smoothJumpTo(double value) {
assert(positions.isNotEmpty,
'ScrollController not attached to any scroll views.');
for (final ScrollPosition position in List<ScrollPosition>.of(positions)) {
position.correctPixels(value);
}
}
}
现在您可以调用 SmoothJumpto()
就像 jumpto()
,但无需解雇活动动画,例如用户输入。
final SmoothPageController pageController = SmoothPageController(initialPage: 0);
您可以简单地使用:
df = pd.DataFrame(d['result']).T
或:
df = pd.DataFrame.from_dict(d['result'], orient='index')
输出:
A B C D
2011-12-01 53 28 32 0
2012-01-01 51 35 49 0
2012-02-01 63 32 56 0
您已经用 r
和 python
标记了问题,因此尚不清楚您喜欢哪个。
您提供的材料
列中只有19个唯一值,但是如果我们只采用前19种颜色,则可以在R中进行:
as.character(factor(Material, labels = colour[1:19]))
#> [1] "#ad6e8d" "#ff7699" "#ff7699" "#ff7699" "#a5d32c" "#ecb2f8" "#ff7699"
#> [8] "#ff7699" "#e45ee0" "#ff7699" "#ff7699" "#ff7699" "#6a4e0e" "#e45ee0"
#> [15] "#ff7699" "#e45ee0" "#e45ee0" "#ff7699" "#e45ee0" "#ff7699" "#e45ee0"
#> [22] "#ff7699" "#ff7699" "#e45ee0" "#e45ee0" "#ff7699" "#ff7699" "#ff7699"
#> [29] "#59ab03" "#ff7699" "#ff7699" "#ad6e8d" "#ff7699" "#ff7699" "#e45ee0"
#> [36] "#1f5392" "#e45ee0" "#ff7699" "#cbcb74" "#ff7699" "#6a4e0e" "#e45ee0"
#> [43] "#ff7699" "#6a4e0e" "#e45ee0" "#ff7699" "#ecb2f8" "#ff7699" "#ff7699"
#> [50] "#d6a0ff" "#ff7699" "#dd5609" "#dd5609" "#0079f1" "#ff7699" "#dd5609"
#> [57] "#ff7699" "#e45ee0" "#e45ee0" "#903429" "#565485" "#ecb2f8" "#e45ee0"
#> [64] "#01afe1" "#ff7699" "#59ab03" "#e45ee0" "#763c7c" "#e45ee0" "#ff7699"
#> [71] "#e45ee0" "#ff7699" "#e45ee0" "#ff7699" "#ff7699" "#d6a0ff" "#e45ee0"
#> [78] "#01a068" "#ff7699" "#e45ee0" "#ad6e8d" "#ff7699" "#6a4e0e" "#ad6e8d"
#> [85] "#e45ee0" "#ff7699" "#763c7c" "#ff7699" "#e45ee0" "#e45ee0" "#96167c"
#> [92] "#ff7699" "#0079f1" "#ff7699" "#ff7699" "#e45ee0" "#1f5392" "#ff7699"
#> [99] "#0079f1" "#ff7699" "#ff7699" "#e45ee0" "#ff7699" "#e45ee0" "#e45ee0"
#> [106] "#ff7699" "#7bdc74" "#7bdc74 "
不是在Pycharm中,而是在VirSual Studio代码中,有和扩展称为
假设我们有一系列字符串,其中列出了所有数据库模式(可以通过应用程序属性进行预配置)。
我们可以根据架构名称过滤流,并为每个模式创建一个单独的JDBC接收器。
String[] schemas = {"schema-1", "schema-2", "schema-3"};
for(int i=0; i<schemas.length; i++){
stream.filter(x -> x.schema.equals(schemas[i])).addSink(JdbcSink.sink(
"insert into " + schemas[i] ".books (id, title, authors, year) values (?, ?, ?, ?)",
(statement, book) -> {
statement.setLong(1, book.id);
statement.setString(2, book.title);
statement.setString(3, book.authors);
statement.setInt(4, book.year);
},
JdbcExecutionOptions.builder()
.withBatchSize(1000)
.withBatchIntervalMs(200)
.withMaxRetries(5)
.build(),
new JdbcConnectionOptions.JdbcConnectionOptionsBuilder()
.withUrl("jdbc:postgresql://dbhost:5432/postgresdb")
.withDriverName("org.postgresql.Driver")
.withUsername("someUser")
.withPassword("somePassword")
.build()
));
}
这是Heredoc,对于长字符串,您不必担心引用标记等。如果您注意到图表一词,然后有一行说图表;这表示字符串的末尾。
使用这种格式时要记住的重要事情是,无论您用来定义字符串末端的字符串(例如在这种情况下)角色可以在同一条线上的半分钟之后发生,甚至是空格,否则PHP认为这是字符串的一部分。
警告:非法字符串偏移'xxx'
这会在您尝试使用Square Bracket语法访问数组元素时会发生这种情况,但是您正在在字符串上而不是在数组上进行此操作,因此该操作明确没有有意义。
示例:
如果您认为该变量应该是一个数组,请查看其来自何处并在那里解决问题。
Warning: Illegal string offset 'XXX'
This happens when you try to access an array element with the square bracket syntax, but you're doing this on a string, and not on an array, so the operation clearly doesn't make sense.
Example:
If you think the variable should be an array, see where it comes from and fix the problem there.
参考 - 此错误在PHP中意味着什么?