这个错误是在此功能中,您正在清除每个保存的数组:
let array = [];
function saveIdexedTiledMap() {
for (let l = 0; l < canvas.height / 32; l++) {
array[l] = [];
for (let c = 0; c < canvas.width / 32; c++) {
array[l][c] = 0;
}
}
array[mouseCanvasGrids.y / 32][mouseCanvasGrids.x / 32] =
selectedTile[0].index;
console.log(array);
}
因此您需要将清理移到外面:
let array = [];
for (let l = 0; l < canvas.height / 32; l++) {
array[l] = [];
for (let c = 0; c < canvas.width / 32; c++) {
array[l][c] = 0;
}
}
function saveIdexedTiledMap() {
array[mouseCanvasGrids.y / 32][mouseCanvasGrids.x / 32] =
selectedTile[0].index;
console.log(array);
}
对于任何想知道的人,我都可以通过执行以下操作来解决它。
我将iFolderPicker界面添加到我的剃须刀类库中。然后使用Nuget软件包在WPF项目中实现文件夹。
Install-Package WindowsAPICodePack-Shell -Version 1.1.1
public interface IFolderPicker
{
public string DisplayFolderPicker();
}
public class FolderPicker : IFolderPicker
{
public string DisplayFolderPicker()
{
var dialog = new CommonOpenFileDialog();
dialog.IsFolderPicker = true;
CommonFileDialogResult result = dialog.ShowDialog();
if (result == CommonFileDialogResult.Ok)
return dialog.FileName;
return "";
}
}
然后,我使用mainwindow.xaml.cs文件中的DI容器注册依赖关系。
public MainWindow()
{
InitializeComponent();
Application.Current.MainWindow.WindowState = WindowState.Maximized;
var serviceCollection = new ServiceCollection();
serviceCollection.AddWpfBlazorWebView();
serviceCollection.AddTransient<IFolderPicker, FolderPicker>();
Resources.Add("services", serviceCollection.BuildServiceProvider());
}
然后在剃须刀组件中,我有一个按钮,可以调用displayFolderPicker方法。
@inject IFolderPicker _folderPicker
<button @onclick="OnClickOpenNativeFileExplorer">Open</button>
<p>@path</p>
@code {
private string path = "";
private void OnClickOpenNativeFileExplorer(MouseEventArgs e)
{
path = _folderPicker.DisplayFolderPicker();
}
}
外卖:我想这个不仅可以用于folderpicker,还可以调用任何本机组件。
您可以创建一个模型,以记录哪个用户获得价格以及何时:
class Prize(models.Model):
user = models.ForeignKey(User, on_delete=models.PROTECT)
creation_date = models.DateTimeField(auto_now_add=True)
# Other fields
当用户点击“获取价格”时,您可以在后端检查一下,如果他当天已经有3个价格,则使用一个简单的查询,例如:
can_get_price = Price.objects.filter(creation_date__gte=datetime.now()-timedelta(days=1)).count() < 3
否则,如果您只想使用前端,您可以缓存获得奖品的数据。但是,此方法易于黑客入侵,并且不适用于多个计算机/平台。
您可以使用 sourceaddressadapter 来自Respections-toolbelt:sourceaddressadapter
import requests
from requests_toolbelt.adapters import source
source = source.SourceAddressAdapter('127.0.0.1')
with requests.Session() as session:
session.mount('http://', source)
r = session.get("http://example.com/foo/bar")
一个选项是 pivot_longer> pivot_longer a href =“ https://pyjanitor-devs.github.io/pyjanitor/” rel =“ nofollow noreferrer”> pyjanitor :
# pip install pyjanitor
import pandas as pd
import janitor
(df
.pivot_longer(
index = 'ID',
names_to = 'Alphabet',
names_pattern = ['.+'],
sort_by_appearance = True)
.dropna()
)
ID Alphabet
0 1 A
1 1 G
2 1 L
3 2 B
6 3 C
7 3 H
9 4 D
10 4 I
11 4 M
12 5 E
13 5 J
15 6 F
16 6 K
17 6 O
在上面的代码中, names_pattern
接受正则表达式匹配所需的列,将所有匹配都整理到一个列名中 alphabet
in names_to
。
我希望能够将任何一种用于同一堆栈诺德实现。是否可以使用模板?
简短答案:否。
很长的答案。
我能想象的最好的方法是使用(以示例)标准 std :: Integral_constant
类使用类型中的类型和包装值。
因此,您可以写一些
StackNode<int, StackNode<std::integral_constant<int, 4>, StackNode<std::string>>>;
//.......................^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the value 4 become a class
新的(C ++ 17) auto
“值”设施,您可以简化一些写入简单的值包装器
template<auto>
value_wrapper
{ };
,以便避免值的类型
StackNode<int, StackNode<value_wrapper<4>, StackNode<std::string>>>;
// ......................^^^^^^^^^^^^^^^^ now 4 is simply 4, without it's type
您的问题是您的工作没有排队。您必须设置一些事情才能按照您想要的方式工作。首先,您必须在工作文件中执行以下操作
use Illuminate\Contracts\Queue\ShouldQueue;
class SomeName implements ShouldQueue {
//....
}
,之后您必须安装 suppprocisor 并设置一些东西。您可以找到有关如何保持Laravel队列在此线程中运行的更多信息
。 >如何保持Laravel队列系统在服务器上运行
我认为您是要定义 y1
和 y2
的方式有所不同。
x = ["2021", "2020", "2019"]
fig = plt.figure(figsize=(20,5))
colors = ['red', 'blue']
for i, region in enumerate(df_region.index):
y = df_region.loc[region, :]
plt.plot(x, y, color = colors[i], label = region)
plt.legend(loc='best')
plt.show()
绘制并读取来自数据框的区域名称。
updatedoc()
函数需要更新文档。您可以使用函数以从数组中删除元素。
import { doc, updateDoc, arrayUnion, arrayRemove } from "firebase/firestore";
const docRef = doc(db, "collection", "docId");
await updateDoc(docRef, {
posts: arrayRemove("1") // removes "1" from the array
});
请注意,如果您有一系列对象,则必须传递整个对象,以在 arrayremove()
中删除。
我不确定我是否会准确地理解您的问题,但是如果您想存储回复的结果,可以尝试一下
function Componenet(){
const [result, setResult]=([]);
function getDrData = () => {
// After process you're trying to get drData from database
if(drData.length !==0){
drData.map((option) => {
const newObj = {uid: option.data.uid, name: option.data.name};
setResult([...result, newObj]));
}
}
}
return(
<ComponentYouWantRender />
);
}
也许不是简化
,但假设有很多供稿,用户只看到其中的少量,下面的查询应该具有更好的执行计划(值得检查)。
额外选择列的任何范围的列不再是问题
SELECT
view_count,
video_feed_unscored.*
FROM video_feed_unscored
LEFT JOIN (
select
count(*) view_count,
b.video_id
from video_user_interaction b
where
b.user_id = '8601ab73-d742-429e-b8e3-ba349725e5f5'
group by b.video_id
) c on (c.video_id = video_feed_unscored.id)
,并且总有子查询(如果执行计划足够好)
SELECT
(SELECT
COUNT(video_views.user_id)
FROM video_user_interaction video_views
WHERE
video_views.user_id = '8601ab73-d742-429e-b8e3-ba349725e5f5'
AND video_views.video_id = video_feed_unscored.id
) AS view_count,
video_feed_unscored.*
FROM video_feed_unscored
请
class Sidenav extends StatelessWidget {
final int selectedIndex;
Sidenav(this.selectedIndex);...
在下面更正下面的代码
drawer: Sidenav (selectedIndex),
我的package.json看起来像这样:
在您的软件包中。
My package.json looks like this:
In your package.json you are missing the output path
../tailwind/output.css
设置后尾风配置不起作用