我不咬妳我踢妳

文章 评论 浏览 30

我不咬妳我踢妳 2025-02-20 17:48:56

我的package.json看起来像这样:

"scripts": {
  "build": "npx tailwindcss --config tailwind.config.js --postcss postcss.config.js -i ./wwwroot/css/tail.css -o ./wwwroot/css/tail.min.css",
  "watch": "npx tailwindcss --watch --config tailwind.config.js --postcss postcss.config.js -i ./wwwroot/css/tail.css -o ./wwwroot/css/tail.min.css",
  "publish": "npx tailwindcss --minify --config tailwind.config.js --postcss postcss.config.js -i ./wwwroot/css/tail.css -o ./wwwroot/css/tail.min.css"
},

在您的软件包中。

My package.json looks like this:

"scripts": {
  "build": "npx tailwindcss --config tailwind.config.js --postcss postcss.config.js -i ./wwwroot/css/tail.css -o ./wwwroot/css/tail.min.css",
  "watch": "npx tailwindcss --watch --config tailwind.config.js --postcss postcss.config.js -i ./wwwroot/css/tail.css -o ./wwwroot/css/tail.min.css",
  "publish": "npx tailwindcss --minify --config tailwind.config.js --postcss postcss.config.js -i ./wwwroot/css/tail.css -o ./wwwroot/css/tail.min.css"
},

In your package.json you are missing the output path ../tailwind/output.css

设置后尾风配置不起作用

我不咬妳我踢妳 2025-02-20 03:00:20

这个错误是在此功能中,您正在清除每个保存的数组:

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);
}

This mistake is in this function, you are clearing the array on every save:

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);
}

So you need to move the clearing outside like this:

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);
}

我试图在多维数组中进行本地化,该数组等于鼠标坐标并将瓷砖ID放在其上,但每次都会刷新数组

我不咬妳我踢妳 2025-02-19 12:46:41

我找到了答案,可以从Unicode官方数据中制定该代码:

该文件告诉如何获取UTF-16代码,接下来我必须转换UTF-16-&gt; UTF-8,使用 utf8encode()

I found the answer, this code can be made from the Unicode official data:
ftp://ftp.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/JIS/SHIFTJIS.TXT .

That file tells how to get UTF-16 codes, and next I must convert UTF-16 -> UTF-8, using UTF8Encode().

从帕斯卡(Pascal)从UTF-8转换为Shift-Jis

我不咬妳我踢妳 2025-02-19 02:53:42

JDBC连接通过该网络,通常可以通过TCP/IP工作,并且可以选择与SSL一起使用。您可以阅读为什么它很昂贵。

您可以将单个连接跨多个方法用于不同的DB操作,因为对于每个数据库操作,您需要创建一个语句才能执行。

连接池避免在请求期间创建连接的开销,应尽可能使用。 Hikari是最快的。

Jdbc Connection goes through the network and usually works over TCP/IP and optionally with SSL. You can read this post to find out why it is expensive.

You can use a single connection across multiple methods for different db operations because for each DB operations you would need to create a Statement to execute.

Connection pooling avoids the overhead of creating Connections during a request and should be used whenever possible. Hikari is one of the fastest.

连接池中DB连接的打开和关闭的昂贵?

我不咬妳我踢妳 2025-02-18 14:47:44

对于任何想知道的人,我都可以通过执行以下操作来解决它。

我将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,还可以调用任何本机组件。

For anyone wondering, I was able to solve it by doing the following.

I added the IFolderPicker interface to my razor class library. Then implement the FolderPicker in the WPF project using a NuGet package.

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 "";
        }
}

I then register the dependency using the DI container within the MainWindow.xaml.cs file.

public MainWindow()
        {
            InitializeComponent();

            Application.Current.MainWindow.WindowState = WindowState.Maximized;

            var serviceCollection = new ServiceCollection();
            serviceCollection.AddWpfBlazorWebView();

            serviceCollection.AddTransient<IFolderPicker, FolderPicker>();

            Resources.Add("services", serviceCollection.BuildServiceProvider());
        }

Then within the razor component, I have a button that calls the DisplayFolderPicker method.

@inject IFolderPicker _folderPicker


<button @onclick="OnClickOpenNativeFileExplorer">Open</button>
<p>@path</p>

@code {
    private string path = "";
    private void OnClickOpenNativeFileExplorer(MouseEventArgs e)
    {
        path = _folderPicker.DisplayFolderPicker();

    }
}

Take-away: I suppose not only will this work for FolderPicker but for calling any native component.

.NET BLAZOR桌面文件夹选择器?

我不咬妳我踢妳 2025-02-18 10:41:06

您可以创建一个模型,以记录哪个用户获得价格以及何时:

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

否则,如果您只想使用前端,您可以缓存获得奖品的数据。但是,此方法易于黑客入侵,并且不适用于多个计算机/平台。

You could create a model that records which user got the price and when:

class Prize(models.Model):
   user = models.ForeignKey(User, on_delete=models.PROTECT)
   creation_date = models.DateTimeField(auto_now_add=True)
   # Other fields

When the user clicks "get price" you could check in the backend if he has already got 3 prices that day with a simple query like:

can_get_price = Price.objects.filter(creation_date__gte=datetime.now()-timedelta(days=1)).count() < 3

Otherwise if you only want to use the frontend, you could cache the datetimes on which prizes were got. However, this method is easily hackable and does not work with multiple computers/platforms.

Django:如何控制用户对Web内容的访问,每天有限允许?

我不咬妳我踢妳 2025-02-18 00:41:01

您可以使用 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")

You can use a SourceAddressAdapter from requests-toolbelt:

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")

如何在Python请求中指定源IP地址

我不咬妳我踢妳 2025-02-17 17:15:50

一个选项是 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

One option is with pivot_longer from 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

In the code above, the names_pattern accepts a list of regular expression to match the desired columns, all the matches are collated into one column names Alphabet in names_to.

保持第一列值。

我不咬妳我踢妳 2025-02-17 05:16:52

我希望能够将任何一种用于同一堆栈诺德实现。是否可以使用模板?

简短答案:否。

很长的答案。
我能想象的最好的方法是使用(以示例)标准 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

I want to be able to use either for the same StackNode implementation. Is this possible using templates?

Short answer: no.

Long answer.
The best I can imagine is to use types and wrap values inside types, using (by example) the standard std::integral_constant class.

So you can write something as

StackNode<int, StackNode<std::integral_constant<int, 4>, StackNode<std::string>>>;
//.......................^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  the value 4 become a class

Using the new (C++17) auto value facility, you can simplify a little writing a simple value wrapper

template<auto>
value_wrapper
{ };

so you can avoid the type of the value

StackNode<int, StackNode<value_wrapper<4>, StackNode<std::string>>>;
// ......................^^^^^^^^^^^^^^^^  now 4 is simply 4, without it's type

C&#x2B;&#x2B;接受值或类型的模板参数

我不咬妳我踢妳 2025-02-17 03:00:22

您的问题是您的工作没有排队。您必须设置一些事情才能按照您想要的方式工作。首先,您必须在工作文件中执行以下操作

use Illuminate\Contracts\Queue\ShouldQueue;

class SomeName implements ShouldQueue {
     //....
}

,之后您必须安装 suppprocisor 并设置一些东西。您可以找到有关如何保持Laravel队列在此线程中运行的更多信息

。 >如何保持Laravel队列系统在服务器上运行

Your problem is that your job is not queued. There are a few things that you must set up in order this to work the way you want. First of all, you must do the following in your job file

use Illuminate\Contracts\Queue\ShouldQueue;

class SomeName implements ShouldQueue {
     //....
}

After that you must install supervisor and set up some things. You can find more information for how to keep laravel queue running in this thread

How to keep Laravel Queue system running on server

Laravel-完成工作时的页面很忙

我不咬妳我踢妳 2025-02-16 23:05:42

我认为您是要定义 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()

绘制并读取来自数据框的区域名称。

I think you meant to define your y1 and y2 a little differently.

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()

which plots AND reads the region names from the DataFrame.

enter image description here

如何使用pandas和matplotlib从Excel中的同一图中绘制两条线?

我不咬妳我踢妳 2025-02-16 20:12:44

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()中删除。

The updateDoc() function is required to update a document. You can use arrayRemove() function to remove an element from the array.

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 
});

Do note that if you have an array of objects then you must pass the entire object to be removed in arrayRemove().

使用Firebase 9删除数组元件9

我不咬妳我踢妳 2025-02-16 18:19:51

我不确定我是否会准确地理解您的问题,但是如果您想存储回复的结果,可以尝试一下

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 />
    );
}

I'm not sure that I'm understanding your question exactly but if you want to store the result of response, you can try this

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 />
    );
}

我希望我的状态中的这个动态选项值js

我不咬妳我踢妳 2025-02-15 16:40:18

也许不是简化,但假设有很多供稿,用户只看到其中的少量,下面的查询应该具有更好的执行计划(值得检查)。

额外选择列的任何范围的列不再是问题

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

Maybe not simplify but assuming, that there is a lot of feeds, and user see only few of them, query below should have better execution plan (it's worth to check).

Additionaly selecting columns any range of columns is no longer a problem

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)

And there is always place for subquery (if execution plan is good enough)

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

Postgres:避免列出所有列(&#x201C;必须通过子句出现在组中,或在聚合函数中使用&#x201D;)

我不咬妳我踢妳 2025-02-15 10:35:52

class Sidenav extends StatelessWidget {
  final int selectedIndex;
  Sidenav(this.selectedIndex);...

在下面更正下面的代码

  drawer: Sidenav (selectedIndex),

Please correct below code

class Sidenav extends StatelessWidget {
  final int selectedIndex;
  Sidenav(this.selectedIndex);...

Also this too

  drawer: Sidenav (selectedIndex),

为什么我在这里得到位置论点?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文