分配变量时,您不使用echo
。
$name = isset($_GET['name']) ? $_GET['name'] : 'anonymous';
echo $name;
在现代php中,您可以使用零煤的操作员:
$name = $_GET['name'] ?? 'anonymous';
echo $name;
您可以触摸标记吗?并添加一个线路(在您希望线路断路的任何弹性项目之后)。添加< div class =“ line-break”></div>
在您想要链接中断的项目之后,此css .line-break {width {width:100%;可见性:隐藏;}
和flex-flow:row wrap;
to .products
.Home {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: stretch;
align-content: stretch;
}
.Products {
display: flex !important;
flex-direction: row !important;
width: 100% !important;
height: 100px;
color: white;
flex-flow: row wrap;
}
.Item {
margin-right: 3%;
/* start: added by editor for visualization purpose */
min-height: 75px;
border: 2px dashed red;
display: flex;
justify-content: center;
align-items: center;
background-color: gray;
/* end: added by editor for visualization purpose */
}
.line-break {
width: 100%;
visibility: hidden;
}
<div class="Home">
<section class="Products">
<div class="Item">1</div>
<div class="Item">2</div>
<div class="Item">3</div>
<div class="Item">4</div>
<div class="line-break"></div>
<div class="Item">5</div>
<div class="Item">6</div>
<div class="Item">7</div>
<div class="Item">8</div>
</section>
<div>
<button>Add Product</button>
</div>
</div>
或使用网格
,它总是可以进行这种布局。
.Item {
width: 100px;
height: 100px;
margin: 0.5rem;
border: 1px solid #000000;
text-align: center;
}
.Products {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
}
<div class="Home">
<section class="Products">
<div class="Item">1</div>
<div class="Item">2</div>
<div class="Item">3</div>
<div class="Item">4</div>
<div class="Item">5</div>
<div class="Item">6</div>
<div class="Item">7</div>
<div class="Item">8</div>
</section>
<div>
<button>Add Product</button>
</div>
</div>
您可以首先将JSON字符串验证为这样的对象:
public class TheThing
{
public string parameterName1 { get; set; }
public string parameterName2 { get; set; }
public Parametername3[] parameterName3 { get; set; }
}
public class Parametername3
{
public string parameterName3Key { get; set; }
public string parameterName3Value { get; set; }
}
然后使用.todictionary
:
var path = @"C:\dBConfig.json";
var jsonString = File.ReadAllText(path);
var theThing = JsonConvert.DeserializeObject<TheThing>(jsonString);
var outputDict = theThing.parameterName3.ToDictionary(x => x.parameterName3Key);
您的代码和问题都没有意义。
您的label()
函数中的打印语句甚至不应编译:
print(subTitle.text = (name))
该怎么办?打印语句将将输出记录到调试控制台。但是,express subtitle.text =(name)
看起来不像合法的swift。您是否试图判断标签字段的内容是否包含数组中的一个字符串?如果是这样,您需要使用==
(比较)不是=
(分配。)
尝试:
print("label text = \(name) ==", subTitle.text == (name))
查看文档,我可以看到每个子查询都在括号中,例如:
select *从(从“测量”中选择“值”)&lt; where_caluse&gt;
因此,对括号的beetwen“来自”和“在哪里”应该足够。
基于:
#1 https> https:htttps:// www。 InfruxData.com/blog/tldr-influxdb-tech-tips-january-26-2017/
#2 https://docs.influxdata.com/influxdb/v1.7/query_language/data_exploration/#subqueries
官方的文档说的.map是
将此流的每个元素转换为一个新的流事件。
因此,您必须聆听“流”的“ AA”变量才能开始侦听数据。喜欢:
aa.listen(
(event) => print("Data Retrieved"),
);
您可以将Insert_after
与复制
组合使用:
import copy
origin_tag.insert_after(copy.copy(origin_tag))
这使其成为原始标签的副本,并在Origin标签之后插入它。
您无法在对象上使用地图,因此应该将其转换为:
<div>
{Object.keys(nfts).map((nft, index) => (
<NFTCard nft={nft} key={index} />
))}
</div>
$text = 'This is (foo)((bar))';
$text = strtr($text, array('(' => '<del>', ')' => '</del>', '((' => '<ins>', '))' => '</ins>'));
echo $text;
output:
This is <del>foo</del><ins>bar</ins>
strtr
在这种情况下起作用,因为它首先替换了数组中的较长字符串,因此任何((...))
都将在将字符串解析为(...)
替换为del> del
标签之前,用ins
标签替换。
否则,您将需要检查开口(
不在之前或之后是其他(
)( 替换为del
标签),您可以执行此操作。带有负面的镜头:
$text = preg_replace('/(?<!\()\((?!\()([^)]*)\)/', '<del>$1</del>', $text);
$text = preg_replace('/\(\(([^)]*)\)\)/', '<ins>$1</ins>', $text);
echo $text;
输出:
This is <del>foo</del><ins>bar</ins>
请注意,请注意,使用[^)]*\)
比。*?\)
更有效“>对比。
您的JSON包含2个属性 - XML
和user_details
(不知道为什么在调试窗口中有user_logon
,也许可能未显示某些设置)。
因此,您可以访问Eg first_name
:
var firstName = resultJson2.USER_DETAILS.USER.USR_FIRST_NAME; // or USER_LOGON instead of USER_DETAILS
从客户的角度来看,似乎在您renderui
另一个元素之前,该文档已充分加载。因此,jQuery $(文档).Dready(...)
可以继续尝试将事件附加到尚不存在的元素。
避免renderui
的选项已得到给出。如果您不希望“占位符”空白空间,则可以在渲染时将图像高度设置为零:
ui <- fluidPage(
## ...
imageOutput("img", click = "photo_click",
height = 0
)
## ...
调用reset_index()
(以及add_suffix()
)
通常,reset_index()
在您调用pivot_table
之后,需要或Pivot
。例如,要进行以下转换(其中一个列成为列名)
< img src =“ https://i.sstatic.net/slcqf.png” alt =“ res”>
您使用以下代码,在pivot
之后,您可以在新创建的列名称并将索引转换为(在这种情况下为“电影”
)回到列中,然后删除轴名称的名称:
df.pivot(index='movie', columns='week', values='sales').add_prefix('week_').reset_index().rename_axis(columns=None)
如提到的其他答案,“枢轴”可能是指2个不同的操作:
- 的结果。
- 未堆放的聚合(即制作
groupby.agg
更宽 在r)
1中。聚合
pivot_table
或crosstab
只是groupby.agg
操作的未堆放结果。实际上,
pivot_table
=groupby
+unstack
(在此处阅读以获取更多信息。)crosstab
=pivot_table
nb您可以将列名称列表用作index
,<代码>列和values
参数。
df.groupby(rows+cols)[vals].agg(aggfuncs).unstack(cols)
# equivalently,
df.pivot_table(vals, rows, cols, aggfuncs)
1.1。 crosstab
是pivot_table
的特例;因此,groupby
+ unstack
以下是等效的:
pd.crosstab(df ['cola'],df ['colb'])
- <代码> df.pivot_table(index ='cola',列='colb',aggfunc ='size',fill_value = 0)
df.groupby(['cola','colb'])。 size()。unstack(fill_value = 0)
请注意,pd.crosstab
的开销明显更大,因此比这两个pivot_table
和都明显慢得多。 groupby
+ <代码> unstack 。实际上,AS 在这里注明,pivot_table
比group> group +
unstack
。
2。重塑
pivot
是pivot_table
的更有限的版本,其中其目的是将长数据框架重塑为长期。
df.set_index(rows+cols)[vals].unstack(cols)
# equivalently,
df.pivot(index=rows, columns=cols, values=vals)
2.1。增强行/列作为问题10中,
您还可以将问题10的见解应用于多列枢轴操作。有两种情况:
“远到长” :通过增加指数
来重塑
代码:
df = pd.dataframe({'a':[1,1,1,1,2,2,2,2],'b':[*'xxyyzz' ],, 'c':[*'ccdcdd'],'e':[100,200,300,400,500,600]}) 行,cols,vals = ['a','b'],['c'],'e' #使用枢轴语法 df1 =(( df.Assign(ix = df.groupby(行+cols).cumcount()) 。 。 。 ) #等效地,使用set_index + unstack语法 df1 =(( DF .set_index([ *rows,df.groupby(rows+cols).cumcount(), *cols])[vals])[vals] .unstack(fill_value = 0) 。 )
“ toff to with wide” :通过增强列来重塑列
代码:
df1 =( df.Assign(ix = df.groupby(行+cols).cumcount()) 。 。 ) df1 = df1.set_axis([f“ {c [0]} _ {c [1]}” df1中的C,axis = 1).Reset_index() #等效地,使用set_index + unstack语法 df1 =(( DF .set_index([ *rows,df.groupby(rows+cols).cumcount(), *cols])[vals])[vals] 。 ) df1 = df1.set_axis([f“ {c [0]} _ {c [1]}” df1中的C,axis = 1).Reset_index()
使用
set_index
+unstack
最小情况>语法:代码:
df1 = df.set_index(['a',df.groupby('a') = 0).add_prefix('col')。reset_index()
1 pivot_table()
值并解开它。具体来说,它使用传递的聚合方法创建了索引和列的单个平面列表,将其作为groupby()使用此列表,并使用传递的聚合方法(默认值为 earge> eargegator >) )。然后,在汇总之后,它通过列列表调用unstack()
。因此,在内部, pivot_table = groupby + unstack 。此外,如果传递了fill_value
,则调用fillna()
。
换句话说,产生pv_1
的方法与以下示例中产生gb_1
的方法相同。
pv_1 = df.pivot_table(index=rows, columns=cols, values=vals, aggfunc=aggfuncs, fill_value=0)
# internal operation of `pivot_table()`
gb_1 = df.groupby(rows+cols)[vals].agg(aggfuncs).unstack(cols).fillna(0, downcast="infer")
pv_1.equals(gb_1) # True
2 crosstab()
调用pivot_table()
,即, crosstab = pivot_table 。具体来说,它从传递的值阵列中构建一个数据框,通过通用索引和调用pivot_table()
对其进行过滤。它比pivot_table()
更有限制列作为value
。
here is you add in css `#container{height:100%}` you can replace `height:100%;` to "`min-height:100%;`"
var canvas = document.querySelector("canvas");
fitToContainer(canvas);
function fitToContainer(canvas) {
// Make it visually fill the positioned parent
canvas.style.width = "100%";
canvas.style.height = "100%";
// ...then set the internal size to match
canvas.width = canvas.offsetWidth;
canvas.height = canvas.offsetHeight;
}
* {
margin: 0;
padding: 0;
}
html, body {
height: 100%;
font-size: 16px;
font-family: "Inter", sans-serif;
}
#container {
min-height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
#container #content {
outline: 2px solid #000;
width: 80%;
height: 80%;
}
#container #content #menu {
padding: 1em;
border-bottom: 2px solid black;
}
#container #content #menu select {
padding: 1em;
}
#container #content #menu a {
background-color: #5b86c3;
text-decoration: none;
font-weight: bold;
padding: 0.8em;
color: white;
}
#container #content #menu a:hover {
background-color: #4b7abd;
}
#container #content #canvas-container {
width: 100%;
height: 100%;
}
#container #content #canvas-container canvas {
outline: 2px solid green;
}
<div id="container">
<div id="content">
<div id="menu">
...
</div>
<div id="canvas-container">
<canvas>
</canvas>
</div>
</div>
</div>
将每次复制您的价值复制,以及std ::向量preallaist cose as Bunch of Bunch。复制时间更大
sort copy your values every time and std::vector preallocate a bunch of memory. The amount of copy time is bigger
std ::矢量使结构排序缓慢? C&#x2B;&#x2B;