您可以使用 frame
标签,
<ScrollViewer>
<Frame content = "{Binding MyPage}"/>
</ScrollViewer>
如果您不想在ViewModel中有一个道具,那么您应该能够
<ScrollViewer>
<Frame>
<Frame.Content>
<locals:MyPage>
</Frame.Content>
</ScrollViewer>
记住您的东西,即 testWindowViewModel
继承页面。这不是ViewModel。相反,这是一个普通的页面。
您需要看起来像这样的东西:
public class NotifyPropertyClass : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private Page myPage;
public Page MyPage
{
get { return myPage; }
set
{
myPage = value;
NotifyPropertyChanged();
}
}
}
并且您可以走更远的级别并进行抽象类:
public abstract class ViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
然后您可以像这样继承ViewModel:
public class TestWindow: Page
{
public TestWindow()
{
InitializeComponent();
}
}
public class TestWindowViewModel : ViewModel
{
private string name;
public string Name
{
get { return name; }
set
{
name = value;
NotifyPropertyChanged();
}
}
private string description;
public string Description
{
get { return description; }
set
{
Description = value;
NotifyPropertyChanged();
}
}
}
一旦正确地将其分开,您就可以使用框架并为SomePage和SomePageViewModel,然后您可以在ViewModel的帧内容上使用实际绑定。我知道这很长,但是如果您开始设置一个良好的MVVM设置,那么如果您进入异步,那么您就可以节省自己的头痛,而没有。
我遇到了类似的问题,解决我的案件的解决方案是
- 将bind-address更改为从127.0.0.0.1
- 将URL的本地主机更改为Localhost:3306
我觉得我们永远不应该放弃,我尝试了这篇文章的所有选择,也来自其他论坛...快乐它有效@saurab
@Injectable()
export class MyCustomInterceptor implements CacheInterceptor {
constructor(private reflector: Reflector) {}
intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
const myReflectionData = this.reflector.get<string[]>('mykey', context.getHandler());
//...
或者:
@Injectable()
export class MyCustomInterceptor implements CacheInterceptor {
@Inject() private reflector: Reflector;
intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
const myReflectionData = this.reflector.get<string[]>('mykey', context.getHandler());
//...
我尝试了这样的事情,它起作用了!!
export interface Context {
tags?: { [Key: string]: string | number | boolean | symbol | null | undefined }
otherValues?: number
}
另一种方法是使用记录:
export interface Context {
tags?: Record<string, string | number | boolean | symbol | null | undefined>
otherValues?: number
}
您必须解开关注键盘。简单地说,
请将键盘放下键盘使用此隐藏键盘方法。
hideKeyBoard(BuildContext context) {
FocusScope.of(context).requestFocus(FocusNode());
}
当您敲击后面按钮时,
如果要包含658368的字符串,请使用以下方式:
#include <QString>
QString displayString(){
std::string message = "ASD";
QString result;
qDebug() << "Message in ASCII Dec : ";
for(int i=0; i < message.length(); i++) {
std::cout << (int)message.at(i) << "";
result += QString::number((int)message.at(i));
}
qDebug() << result;
return result;
}
如果您希望结果在ASCII中转换回ASCII,请
QString::toStdString()
在使用QT Creator时使用QString代替常规字符串,它提供了许多功能强大的功能
modal
s的discord.js实现有点棘手(或者,如果您有处理按钮的交互经验,等等)。总而言之,当 discordclient
接收到 modal
时,交互
不会扩展相同类型的交互
您收到 messageComponentIntraction 扩展交互实现InteractionResconses
)(例如A buttonInteraction
(注意subtext:'扩展MessageComponentInteraction'), select> selectmenuinteraction
等)。因此, createMessageComponentCollector
永远不会接收交互
s modalSubmitInteraction
(请注意subtext:扩展交互的交互实现InteractionRessions
) - 因为 ModalSubmitInteraction
不是 MessageComponentInteraction
(以前的示例 ButtonInteraction
和 selectMenuInteraction
是)。
modalSubmitInteraction
是 modalInteraction
messageComponentInteraction
是 button> button Interactraction
。这有意义吗? modalSubmitInteraction
和 MessageComponentInteraction
可以被视为'兄弟姐妹',而 button> buttonInteraction
和/或 selectmenuinteraction
等等。被认为是“ MessageComponentInteraction
”的“孩子”。为了进一步澄清,我会查看模式 s 的文档,因为它为您如何使用discord.js提供了一些上下文。
可能还有其他方法可以处理模态
的“集合”,但是在您发布的示例中,我这样做的方式是通过 egaitModalSubmit
MessageComponentIntraction
MessageComponentIntraction code> 班级。例如:
const fields = {
age: new TextInputComponent()
.setCustomId(`age`)
.setLabel(`What is your age?`)
.setStyle(`SHORT`)
.setRequired(true),
.setPlaceholder(`90 years young`)
name: new TextInputComponent()
.setCustomId(`name`)
.setLabel(`What is your name?`)
.setStyle(`SHORT`)
.setRequired(true)
.setPlaceholder(`John Doe`)
}
const modal = new Modal()
.setCustomId(`test_modal`)
.setTitle(`test`)
.setComponents(
// Note that unlike how you might expect when sending a Message with Components,
// MessageActionRows for Modals **can only accept TextInputComponents** (no Buttons or
// SelectMenus or other Components), and each Action Row can have a maximum of just one
// TextInputComponent. You can have a maximum of 5 Action Rows in a Modal, so you have
// a maximum of 5 Text Inputs per Modal.
new MessageActionRow().setComponents(fields.age),
new MessageActionRow().setComponents(fields.name),
)
// Show the Modal to the User in response to the Interaction
await interaction.showModal(modal)
// Get the Modal Submit Interaction that is emitted once the User submits the Modal
const submitted = await interaction.awaitModalSubmit({
// Timeout after a minute of not receiving any valid Modals
time: 60000,
// Make sure we only accept Modals from the User who sent the original Interaction we're responding to
filter: i => i.user.id === interaction.user.id,
}).catch(error => {
// Catch any Errors that are thrown (e.g. if the awaitModalSubmit times out after 60000 ms)
console.error(error)
return null
})
// If we got our Modal, we can do whatever we want with it down here. Remember that the Modal
// can have multiple Action Rows, but each Action Row can have only one TextInputComponent. You
// can use the ModalSubmitInteraction.fields helper property to get the value of an input field
// from it's Custom ID. See https://old.discordjs.dev/#/docs/discord.js/stable/class/ModalSubmitFieldsResolver for more info.
if (submitted) {
const [ age, name ] = Object.keys(fields).map(key => submitted.fields.getTextInputValue(fields[key].customId))
await submitted.reply({
content: `Your age is ${age}, and your name is ${name}. Hi!`
})
}
_MSEARCH
查询以这种格式接受身体:
{metadata}
{query}
{metadata}
{query}
您正在尝试发送JSON数组,这就是为什么您会遇到错误的原因。
尝试此(注意,需要第一个空白对象,因为您没有发送任何元数据):
{ }
{"query": {"term": {"name": {"term": "Hulk"}}}},
{"index": "super_heroes"},
{"query": {"term": {"word": {"term": "Iron Man"}}}}
您可以使用 Janitor :: make_clean_names()
将列名称转换为同一格式(例如骆驼箱),然后将其转换为rowbind。
例如:
library(data.table)
library(janitor)
ftr <- list.files(path = c("./reports_0", "./reports_1"),
pattern = ".*\\.csv$",
names = TRUE)
DT <- rbindlist(
lapply(ftr, function(x) {
tempDT <- fread(x)
setnames(tempDT, names(tempDT), janitor::make_clean_names(names(tempDT)))
return(tempDT)
}), use.names = TRUE, fill = TRUE)
概念证明
将名称转换为snake_case
> janitor::make_clean_names("Firmware Version")
[1] "firmware_version"
> janitor::make_clean_names("Firmware version")
[1] "firmware_version"
-
您ORM配置应该是DataSource的实例
ormconfig.ts文件
像这样:导出默认新dataSource({
类型:“ Postgres”,
主机:process.env.postgres_host
端口: +process.env.postgres_port,
用户名:process.env.postgres_user,
密码:process.env.postgres_db_password,
数据库:process.env.postgres_database,
实体:[__dirname +'//* entity {.ts,.js}'],
同步:false,
迁移:[__dirname +'/migrations//* {.ts,.js}'],
});
添加到package.json下一个命令:
"typeorm": "ts-node -P tsconfig.json ./node_modules/typeorm/cli.js",
"db:drop": "yarn run typeorm schema:drop -d src/ormconfig.ts",
"db:gen": "yarn run typeorm migration:generate src/migrations/migration -d src/ormconfig.ts",
"db:migrate": "yarn run typeorm migration:run -- -d src/ormconfig.ts"
使用 flex-wrap:wrap;
当没有DIV空间时,DIV包裹到下一行。
我也使用 Jusify-content:space-betew;
填充屏幕的整个宽度
.container {
display: flex;
flex-direction: row;
justify-content: space-between;
flex-wrap: wrap;
}
<div class="container">
<div>pippo</div>
<div>pluto</div>
<div>paperino</div>
<div>topolino</div>
</div>
它与Conda提供的Python有关。
标志“ -B/HOME/PAVAN/MINICONDA3/ENVS/CODELAB/COPILER_COMPAT”将要求Crumplier从该路径中拾取LD。但是,当您使用不同的编译器工具链时,Conda提供的LD会引起一些问题。
步骤修复它:
cd /home/pavan/miniconda3/envs/codelab/compiler_compat
rm -f ld
ln -s /usr/bin/ld ld
并尝试再次构建mpi4py。
之后,撤销了这种变化:
cd /home/pavan/miniconda3/envs/codelab/compiler_compat
rm -f ld
ln -s ../bin/x86_64-conda-linux-gnu-ld ld
从表单中接受文件时,与 request.post
一起,您还应提取 request.files
...
form = ProductCreationForm(request.POST, request.FILES)
顺便说一句, create> create(name =名称,价格=价格,图像=图像)
已经保存了该项目,因此无需调用保存
方法 new_item.save()
。
仅使用模型表单
而更容易。因此,我只是在此处更新您的代码...
models.py
文件:
class Product(models.Model):
name = models.CharField(max_length=250)
price = models.FloatField(default=0)
image = models.ImageField(upload_to='image_uploads/', null=True, blank=True)
forms.py
file:
from .models import Product
from django import forms
from django.utils.translation import gettext_lazy as _
class ProductCreationForm(forms.ModelForm):
class Meta:
model = Product
fields = "__all__"
labels = {
"name": _("Product Name"),
"price": _("Price"),
"image": _("Image"),
}
required = (
'name',
'price',
'image',
)
然后在 views.pys.py 文件:
if request.method == "POST":
form = ProductCreationForm(request.POST, request.FILES)
if form.is_valid():
form.save() # This here will save the necessary data to the database
else:
print(form.errors) # To show you what field(s) are causing the form not to submit
return redirect('shelf')
最后,操作
form> form> form
tag
不需要属性,因此您可以将其删除,因为相同的函数
将处理发布请求
。
此外,请确保在您的 street.py
文件中,您为 Media_url
和 Media_root
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
在您的项目的 urls.py中 设置了一些设置。
文件:
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
...
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
只需删除:
.home {
position: absolute;
top: 0px;
left: 0px;
}
.home video {
position: absolute;
top: 0;
left: 0;
}
.footer {
position: relative;
top: 1000;
left: 0;
}
使用位置:绝对或位置:固定告诉Web浏览器不是 “保留”文档结构中的“储备”空间,并使您的页脚漂浮在视频上方。 According to https://www.impressivewebs.com/css-things -dont-occupy空间/ - 这些元素是从文档流中取出的,因此以源顺序出现在它们之后的元素不会在它们周围或以下流动。
< a href =“ https://i.sstatic.net/w897l.jpg” rel =“ nofollow noreferrer”>
您有一个简单的布局并注意 - div是将所有页面的宽度划分为默认和stack 一个 的元素,所以不要使用此处的任何定位(覆盖除外)。
这样的事情应该起作用(需要做的很小的改进):
* {
margin: 0;
}
.home {
min-height: 100vh;
display: flex;
justify-content: space-between;
align-items: center;
background: #111;
color: #fff;
z-index: 2;
}
.home video {
width: 100%;
height: 100%;
object-fit: cover;
opacity: 1.0;
}
.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0.0, 0.0, 0.0, 0.4);
}
.footer {
height: 400px;
z-index: 50;
background: aqua;
}
好的,我只是想出来了。
mod segurity启动了。不得不关闭它。
Ok, I just figured it out.
Mod segurity was on. Had to turn it off.
strapi:可以在管理中保存任何东西