这是一个存储的POC,它将根据输入字符串和指定的定界符产生一个动态列的表结果。
如果您正在寻找一种基于值生成动态列名称的方法,我建议您在此处访问Felipe Hoffa的博客条目:
https://medium.com/medium.com/snowflake/snowflake/dynemic-pivots-pivots-pivots-pivots-pivots-po- snowflake-c76393987c in-sql-with-with-snowflake
create or replace procedure pivot_dyn_results(input string, delimiter string)
returns table ()
language SQL
AS
declare
max_count integer default 0;
lcount integer default 0;
rs resultset;
stmt1 string;
stmt2 string;
begin
-- Get number of delimiter separated values (assumes no leading or trailing delimiter)
select regexp_count(:input, '\\'||:delimiter, 1) into :max_count from dual;
-- Generate the initial row-based result set of parsed values
stmt1 := 'SELECT * from lateral split_to_table(?,?)';
-- Build dynamic query to produce the pivoted column based results
stmt2 := 'select * from (select * from table(result_scan(last_query_id(-1)))) pivot(max(value) for index in (';
-- initialize look counter for resulting columns
lcount := 1;
stmt2 := stmt2 || '\'' || lcount || '\'';
-- append pivot statement for each column to be represented
FOR l in 1 to max_count do
lcount := lcount + 1;
stmt2 := stmt2 || ',\'' || lcount || '\'';
END FOR;
-- close out the pivot statement
stmt2 := stmt2 || '))';
-- execute the
EXECUTE IMMEDIATE :stmt1 using (input, delimiter);
rs := (EXECUTE IMMEDIATE :stmt2);
return table(rs);
end;
调用:
调用pivot_dyn_results([string],[DeLimiter]);
call pivot_dyn_results('Sales External?HR?Billing?Purchase Department','?');
结果:
JavaScript本身本身就是实现的,因此语言本身有意不存在诸如内存地址之类的概念。在语言之外,您可以使用浏览器的调试工具来获取内存快照,并且可能包含信息。但是请注意,没有真正的保证对象会保留其地址。
但是,下面不是答案,而是另一个解决方案。
function findLongestWordLength(str) {
const splitted = str.split(' ');
let wordLength =0;
splitted.forEach((word) =>{
const wordSplitted = word.split('');
if(wordSplitted.length > wordLength){
wordLength = wordSplitted.length;
}
});
return wordLength;
}
console.log(findLongestWordLength("Thep quick brown fox jumped over the lazy dog"));
您需要查找的索引[3,3,3]
为此,您可以使用 all(axis = -1)
,然后替换为 [0,0, 0]
:
row, col = np.where((c==3).all(-1))
c[row, col] = [0,0,0]
print(c)
输出:
[[[0 0 0]
[2 2 2]
[0 0 0]
[4 4 4]]
[[1 1 1]
[2 2 2]
[7 3 3]
[4 4 4]]
[[1 1 1]
[0 0 0]
[0 0 0]
[4 4 4]]
[[1 1 1]
[2 2 2]
[3 8 3]
[0 0 0]]
[[0 0 0]
[2 2 2]
[0 0 0]
[4 4 4]]]
[slug]
用于具有嵌套路由。但是正确的是 [... slug] .js
( info )
示例:myurl.com/article/ [id]/[otherid]
在上面的示例中,我们可以看到[id]中可以是嵌套的孩子。您可以根据需要命名此参数。
如果您想将结构作为 myurl.com/article/55
,则需要以下结构:
在 pages
文件夹中:
- 您创建一个文件夹
文章
(pages/article
) - 您创建2个文件:index.js(or .tsx)和
[id] .js
(您可以将其命名为[slug ] .js或[Specialid] .js-无论是什么名称 - ,您都会获得具有参数名称的信息
。
import { useRouter } from 'next/router'
const Post = () => {
const router = useRouter()
//same name as name of your file, can be [slug].js; [specialId].js - any name you want
const { pid } = router.query
//result will be '55' (string)
return <p>Post: {pid}</p>
}
export default Post
还要考虑以下方法
select name_one as player,
array_agg(struct(name_two as most_from, points as most_points) order by points desc limit 1)[offset(0)].*,
array_agg(struct(name_two as least_from, points as least_points) order by points limit 1)[offset(0)].*
from (
select name_one, name_two, sum(points_name_one) points
from your_table group by 1,2
union all
select name_two, name_one, sum(points_name_two)
from your_table group by 1,2
)
group by player
,如果将方法应用于您的问题中的样本数据-USTUPS
在科纳(Kona)提出的有关标识符范围的问题:
在KONA在Kona举行的核心工作组的讨论中,就初始化器中的标识符范围提出了一个问题。我们是否要允许班级范围具有前向查找的可能性?还是我们要要求在解析时定义良好的初始化器?
所需的内容:
类scope查找的动机是,我们希望能够将任何内容放入非静态数据成员的初始化器中,而我们可以将其放入mem-Inialializer中,而无需显着更改语义(Modulo Direct Direct Initialization Vs.复制初始化):
int x();
struct S {
int i;
S() : i(x()) {} // currently well-formed, uses S::x()
// ...
static int x();
};
struct T {
int i = x(); // should use T::x(), ::x() would be a surprise
// ...
static int x();
};
问题1:
不幸的是,这使得在解析声明时形成了“(表达列表)”的初始化形式:
struct S {
int i(x); // data member with initializer
// ...
static int x;
};
struct T {
int i(x); // member function declaration
// ...
typedef int x;
};
一种可能的解决方案是依靠现有规则,即如果声明可以是对象或函数,则是一个函数:
struct S {
int i(j); // ill-formed...parsed as a member function,
// type j looked up but not found
// ...
static int j;
};
类似的解决方案将是应用另一个仅在模板中使用的现有规则,即如果t可以是一种类型或其他类型,那么它是其他的。如果我们真的是指类型:
,我们可以使用“键入”
struct S {
int i(x); // unabmiguously a data member
int j(typename y); // unabmiguously a member function
};
这两种解决方案都引入了许多用户可能会误解的微妙之处(正如Comp.lang.lang.c ++上的许多问题所证明的那样,关于“ Int I()”;在块范围内没有声明默认初始化的int)。
本文提出的解决方案是仅允许“ = initializer-clause”和“ {initializer-list}”表单。例如,在大多数情况下解决了歧义问题,例如:
HashingFunction hash_algorithm{"MD5"};
在这里,我们无法使用= form,因为HasningFunction的构造函数是明确的。
在特别棘手的情况下,可能必须两次提及一种类型。考虑:
vector<int> x = 3; // error: the constructor taking an int is explicit
vector<int> x(3); // three elements default-initialized
vector<int> x{3}; // one element with the value 3
在这种情况下,我们必须使用适当的符号在两个替代方案之间进行选择:
vector<int> x = vector<int>(3); // rather than vector<int> x(3);
vector<int> x{3}; // one element with the value 3
问题2:
另一个问题是,因为我们建议对静态数据成员的初始化规则没有更改,因此添加静态关键字可能会使形成良好的初始化器不正确:
struct S {
const int i = f(); // well-formed with forward lookup
static const int j = f(); // always ill-formed for statics
// ...
constexpr static int f() { return 0; }
};
问题3:
第三个问题是,类Scope查找可能会将编译时错误转换为运行时错误:
struct S {
int i = j; // ill-formed without forward lookup, undefined behavior with
int j = 3;
};
(除非由编译器捕获,否
提案:
CWG在科纳(Kona)进行了6比3的稻草民意调查,以支持课堂镜头。这就是本文提出的,非静态数据成员的初始化器仅限于“ = initializer-care”和“ {initializer-list}”表单。
我们相信:
问题1:这个问题不会发生,因为我们不建议()符号。 = and {}初始化符号不会遭受此问题的困扰。
问题2:添加静态关键字有很多差异,这是其中最少的。
问题3:这不是一个新问题,而是与构造函数初始化器已经存在的命中序列问题。
spath
是正确的命令,但它仅适用于有效的JSON字符串。 jsonlint.com认为给定的字符串无效。
这是一个使用 rex
提取版本ID的解决方法。
index="$index" "$filterString"
| rex field=context "version=\\\"(?<versionId>[^\\\"]+)"
| stats count by versionId
您可以使用 fieldViewBuilder 为此。
这样的事情:
@override
Widget build(BuildContext context) {
return Autocomplete<String>(
optionsBuilder: (TextEditingValue textEditingValue) {
if (textEditingValue.text == '') {
return const Iterable<String>.empty();
}
return _kOptions.where((String option) {
return option.contains(textEditingValue.text.toLowerCase());
});
},
fieldViewBuilder: (BuildContext context,
TextEditingController textEditingController,
FocusNode focusNode,
VoidCallback onFieldSubmitted) {
return TextFormField(
controller: textEditingController,
focusNode: focusNode,
onFieldSubmitted: (str) => onFieldSubmitted(),
decoration: const InputDecoration(
border: UnderlineInputBorder(),
contentPadding: EdgeInsets.only(left: 12.0),
)
);
},
onSelected: (String selection) {
debugPrint('You just selected $selection');
},
);
}
尝试以下操作:
import numpy as np
df['opens'] = (
df['opens']
.str.strip('[')
.str.strip(']')
.str.strip(' ')
.str.replace(', ', ',')
.str.split(',')
.apply(np.array, dtype=float)
)
您要遇到的错误( valueError:无法将字符串转换为float:'[[63.240001
)是由于列中的值 opens opens
被读为字符串,而不是值列表。
例如,打开的第一个值
是:
"[63.2400016784668, 62.20000076293945, 61.91999816894531, 61.40000152587891, 60.65999984741211, 60.04000091552734, 61.27999877929688, 60.0, 59.11999893188477, 57.88000106811523, 57.7599983215332, 59.04000091552734, 58.18000030517578, 55.29999923706055, 54.13999938964844, 54.52000045776367, 54.13999938964844, 56.72000122070312, 57.0, 58.29999923706055, 58.34000015258789, 58.04000091552734, 58.5, 58.45999908447266, 58.34000015258789, 56.09999847412109, 56.72000122070312, 58.5, 59.13999938964844, 58.41999816894531, 58.65999984741211, 57.90000152587891, 56.43999862670898, 55.7599983215332, 56.27999877929688, 55.22000122070312, 56.5, 56.58000183105469, 56.72000122070312, 56.38000106811523, 55.72000122070312, 55.88000106811523, 56.7400016784668, 58.06000137329102, 58.79999923706055, 59.40000152587891, 59.56000137329102, 58.18000030517578, 58.11999893188477, 57.72000122070312, 57.79999923706055, 56.88000106811523, 57.31999969482422, 56.11999893188477, 56.59999847412109, 56.38000106811523, 57.15999984741211, 56.08000183105469, 56.93999862670898, 57.86000061035156, 57.88000106811523, 58.54000091552734, 58.70000076293945, 57.81999969482422, 58.68000030517578, 58.58000183105469]"
而不是类似的内容:
['63.2400016784668',
'62.20000076293945',
'61.91999816894531',
'61.40000152587891',
'60.65999984741211',
'60.04000091552734',
'61.27999877929688',
'60.0',
'59.11999893188477',
'57.88000106811523',
'57.7599983215332',
'59.04000091552734',
'58.18000030517578',
'55.29999923706055',
'54.13999938964844',
'54.52000045776367',
'54.13999938964844',
'56.72000122070312',
'57.0',
'58.29999923706055',
'58.34000015258789',
'58.04000091552734',
'58.5',
'58.45999908447266',
'58.34000015258789',
'56.09999847412109',
'56.72000122070312',
'58.5',
'59.13999938964844',
'58.41999816894531',
'58.65999984741211',
'57.90000152587891',
'56.43999862670898',
'55.7599983215332',
'56.27999877929688',
'55.22000122070312',
'56.5',
'56.58000183105469',
'56.72000122070312',
'56.38000106811523',
'55.72000122070312',
'55.88000106811523',
'56.7400016784668',
'58.06000137329102',
'58.79999923706055',
'59.40000152587891',
'59.56000137329102',
'58.18000030517578',
'58.11999893188477',
'57.72000122070312',
'57.79999923706055',
'56.88000106811523',
'57.31999969482422',
'56.11999893188477',
'56.59999847412109',
'56.38000106811523',
'57.15999984741211',
'56.08000183105469',
'56.93999862670898',
'57.86000061035156',
'57.88000106811523',
'58.54000091552734',
'58.70000076293945',
'57.81999969482422',
'58.68000030517578',
'58.58000183105469']
如果您知道您将始终在前面有 d。
private static KeyValuePair<string, string> Helper(KeyValuePair<string, string> x)
{
// starting index of 2, to skip "d.", and length of the key minus "d." and ".f"
var substring = x.Key.Substring(2, x.Key.Length - 4);
return new KeyValuePair<string, string>(substring, x.Value);
}
另外,如果您实际上将在前面和后面具有更多字符(而不是 d。
和 .f
),则可以计算第一个的索引。
和最后一个。
,然后从中创建一个子字符串:
private static KeyValuePair<string, string> Helper(KeyValuePair<string, string> x)
{
// d.b.f
var startIndex = x.Key.IndexOf('.') + 1; // 2
var endIndex = x.Key.LastIndexOf('.'); // 3
var length = endIndex - startIndex; // 1
var substring = x.Key.Substring(startIndex, length); // b
return new KeyValuePair<string, string>(substring, x.Value);
}
我看到,当我在Storytriggers列表中仅添加1个元素时,它在检查员上看起来确实很奇怪,如问题所示。
但是,当我添加多个元素时,它会停止看起来很奇怪。这样我就可以使用它。
我认为这是Unity编辑器上的一个错误,因为怪异行为的条件在列表中的元素数量上。
编辑:
此后不久,我意识到,无论我添加多少个元素,第一个元素在扩展时总是看起来很奇怪(如问题所示)。尽管如此,与之合作并非不可能。我已经向Unity发送了一个错误报告。
将 .read()
添加到第一个 loads
输入:
from json import loads
from collections import namedtuple
from os import path
class CamConfigurator:
with open(path.join('utility', 'cam', 'configurator.json')) as __configFile:
__configurator = loads(
__configFile.read(), # <- there
object_hook=lambda dictonary: namedtuple(
'X', dictonary.keys()
)(*dictonary.values())
)
camIndex = __configurator.availableCams[-1]
pathToSnapshots = __configurator.pathToSnapshots
从本质上讲,您具有以下结构:
这意味着,当您单击此“ editar”按钮时,将作为邮政请求进行表单提交。该请求应该在servlet侧的
dopost
方法处理,并且URL为/servletpacientes
。这就是为什么您导航到/servletpacientes
。包装&lt; a&gt;
元素中的链接将无效。如果您期望导航到
servletpacientes之类的东西?param = editar&amp; dni = 20216447
,您必须使嵌套input> input> input
element a普通按钮,而不是
提交
:&lt; input type =“ button” value =“ editar”&gt;
。You essentially have the following structure:
This means that when you click on this "Editar" button, a form submission will happen as a POST request. This request is supposed to be processed by a
doPost
method on the servlet side, and the URL would be/ServletPacientes
. This is why you navigate to/ServletPacientes
. The link in the wrapping<a>
element will have no effect.If you expect to navigate to something like
ServletPacientes?Param=editar&dni=20216447
, you'll have to make the nestedinput
element a regularbutton
, not asubmit
:<input type="button" value="Editar">
.为什么我的表格不会将我重定向到即时通行的路线?