雪化雨蝶

文章 评论 浏览 30

雪化雨蝶 2025-02-10 00:59:33

问题是文件名。不支持完整的结肠。因此,相反,我将其格式化为下面的格式。

ftp.rename(fromname="/path/to/some/directory/filename.txt", toname="/path/to/backup/filename" + "_" + str(datetime.datetime.now().strftime("%Y-%m-%d %H%M%S")).replace(" ", "_") + ".txt")

现在正在工作。
谢谢,@martin指出了错误。

The issue was with the filename. Full colons were not supported. So instead appending the full timestamp, I've formatted it as below.

ftp.rename(fromname="/path/to/some/directory/filename.txt", toname="/path/to/backup/filename" + "_" + str(datetime.datetime.now().strftime("%Y-%m-%d %H%M%S")).replace(" ", "_") + ".txt")

And it's working now.
Thanks, @Martin for pointing out the mistake.

python ftplib ftp.rename()在某些服务器中投掷错误

雪化雨蝶 2025-02-09 12:22:11

让我们查看查询的各个部分

插入

第一个问题是您的 insert 语句。您写道:

insertInto(Tables.USER_ORGANIZATION_ROLE.asterisk(), ...)

但是JOOQ API中没有这样的方法。你为什么这样写? dslContext.InterTinto(table<? =“ https://www.jooq.org/javadoc/latest/org.jooq/org/jooq/qualifyasterask.html” rel =“ nofollow noreforrer”> org.jooq.qualififiedapstrifififed.qualifififedask.qualifyAstersk

您可能使用了 asterisk()方法,因为您认为这将以某种方式映射到所有列中?但是您也不使用 user_organization_role。*作为SQL查询中的表达式,那为什么要这呢?

为什么不直接翻译您的原始查询:

// I'm just going to assume the usual static imports, to reduce "noise"
insertInto(USER_ORGANIZATION_ROLE,
    USER_ORGANIZATION_ROLE.ID_USER,
    USER_ORGANIZATION_ROLE.ID_ORGANIZATION,
    USER_ORGANIZATION_ROLE.ID_ROLE,
    USER_ORGANIZATION_ROLE.ID_WORKSPACE)

插入。选择

您尝试将选择表达式直接传递到 insertinto()方法,但是同样,JOOQ API没有具有任何此类方法,该方法与表一起选择选择似乎很清楚

create.insertInto(table)
      .select(select)
      .execute();

因此,被翻译成您的用例:

// The WITH .. SELECT 
Select<Record4<.., .., .., ..>> select = ...

// The code from before
insertInto(USER_ORGANIZATION_ROLE,
    USER_ORGANIZATION_ROLE.ID_USER,
    USER_ORGANIZATION_ROLE.ID_ORGANIZATION,
    USER_ORGANIZATION_ROLE.ID_ROLE,
    USER_ORGANIZATION_ROLE.ID_WORKSPACE)

// Put your WITH .. SELECT in here
.select(select)

此时,还值得注意的是,Jooq中的每个查询都是 Dynamic SQL查询,因此,如果有助于更好地构造和理解查询的各个部分,则没有什么可以阻止您将零件分配给本地变量。

使用..选择

该部分还有更多问题,包括:

可能还有其他问题

评论何时使用JOOQ

JOOQ在复杂的查询中非常有效,尤其是当它们动态时。在某些情况下,即当涉及派生表或CTE时,JOOQ仍然可以处理复杂性,但是内部DSL方法使SQL语句有点难以读 /写入,主要是因为不可能参考尚未尚未的表格被宣布。编写静态SQL时,整个类型的安全参数会因派生表或CTE而失败,即非动态SQL。

因此,在Jooq世界中,每当您使用派生表或CTE时,请考虑:

  • 是否可以使用本机SQL作为复杂部分,例如 plin sql templating 或视图等(严重的是,仅仅因为您使用的是Jooq并不意味着您意味着您必须将其用于每个查询
  • 是否可以将查询重新编写到更简单的内容(通常更好地使用JOOQ)是否可以

将查询重写为更简单的查询

似乎是您的查询似乎是做同样的事情吗?

insert into user_organization_role (
  id_user, id_organization, id_role, id_workspace
)
select distinct
  ur.id_user,
  ur0.id_organization,
  ur0.id_role,
  ur0.id_workspace
from 
  user_organization_role ur,
  user_orgainzation_role ur0
where ur.id_user <> 0
and ur0.id_user = 0
and (ur.id_user, ur0.id_organization, ur0.id_role, ur0.id_workspace) not in (
  select id_user, id_organization, id_role, id_workspace
  from user_organization_role 
  where id_user <> 0
)

我认为您首先不需要CTE。这似乎完全等效。我不太确定用例。您似乎在关系表上操作,并为每个尚未有此的用户自动在“默认”组织/角色/工作区中添加关系。因此,也许经典插入忽略甚至会更好吗?即喜欢这个?

insert ignore into user_organization_role (
  id_user, id_organization, id_role, id_workspace
)
select distinct
  ur.id_user,
  ur0.id_organization,
  ur0.id_role,
  ur0.id_workspace
from 
  user_organization_role ur,
  user_orgainzation_role ur0
where ur.id_user <> 0
and ur0.id_user = 0

这是假设4列形成 unique 约束

Let's look at the individual parts of your query

INSERT

The first problem is your INSERT statement. You wrote:

insertInto(Tables.USER_ORGANIZATION_ROLE.asterisk(), ...)

But there's no such method in the jOOQ API. Why did you write it this way? DSLContext.insertInto(Table<?>, ...) accepts a table first, not an org.jooq.QualifiedAsterisk.

You probably used the asterisk() method, because you thought this would somehow map to inserting into all columns? But you're not using USER_ORGANIZATION_ROLE.* as an expression in your SQL query either, so why do this?

Why not translate your original query directly:

// I'm just going to assume the usual static imports, to reduce "noise"
insertInto(USER_ORGANIZATION_ROLE,
    USER_ORGANIZATION_ROLE.ID_USER,
    USER_ORGANIZATION_ROLE.ID_ORGANIZATION,
    USER_ORGANIZATION_ROLE.ID_ROLE,
    USER_ORGANIZATION_ROLE.ID_WORKSPACE)

INSERT .. SELECT

You tried to pass the Select expression directly to the insertInto() method, but again, the jOOQ API doesn't have any such method that accepts a Select along with the table. The example from the manual seems clear?

create.insertInto(table)
      .select(select)
      .execute();

So, translated to your use-case:

// The WITH .. SELECT 
Select<Record4<.., .., .., ..>> select = ...

// The code from before
insertInto(USER_ORGANIZATION_ROLE,
    USER_ORGANIZATION_ROLE.ID_USER,
    USER_ORGANIZATION_ROLE.ID_ORGANIZATION,
    USER_ORGANIZATION_ROLE.ID_ROLE,
    USER_ORGANIZATION_ROLE.ID_WORKSPACE)

// Put your WITH .. SELECT in here
.select(select)

At this point, it's also worth noting that every query in jOOQ is a dynamic SQL query, so nothing stops you from assigning parts to local variables if that helps better structure and understand the individual parts of your query.

WITH .. SELECT

That part has a few more issues, including:

  • table(name("cte_0")).field("ID_ROLE") doesn't work this way. The Table<?> you're creating this way does not know anything about an ID_ROLE field, so it can't look it up. This is documented in the Javadoc. I.e.

    The returned table does not know its field references, i.e. Fields.fields() returns an empty array.

    You have to use field(name("cte_0", "ID_ROLE")) instead

  • Data types should be added to your field projections, so you get type safety and the correct projection when you execute the query, i.e. this would be better: field(name("cte_0", "ID_ROLE"), ID_ROLE.getDataType())

There may be other issues

A comment on when to use jOOQ

jOOQ works very well for complex queries, especially when they're dynamic. In some cases, namely when derived tables or CTE are involved, jOOQ can still handle the complexity, but the internal DSL approach makes the SQL statement a bit hard to read / write, mainly because it's not possible to reference a table that has not yet been declared. The whole type safety argument fails with derived tables or CTE when you write static SQL, i.e. non-dynamic SQL.

So, in the jOOQ world, whenever you're using derived tables or CTE, think about:

  • Whether you can use native SQL for the complex part, e.g. via plain SQL templating or a view, etc. (Seriously, just because you're using jOOQ doesn't mean you have to use it for every query)
  • Whether you can re-write your query to something much simpler (which is usually better irrespective of using jOOQ or not)

Rewriting the query to something simpler

Your query seems to be doing the same thing as this?

insert into user_organization_role (
  id_user, id_organization, id_role, id_workspace
)
select distinct
  ur.id_user,
  ur0.id_organization,
  ur0.id_role,
  ur0.id_workspace
from 
  user_organization_role ur,
  user_orgainzation_role ur0
where ur.id_user <> 0
and ur0.id_user = 0
and (ur.id_user, ur0.id_organization, ur0.id_role, ur0.id_workspace) not in (
  select id_user, id_organization, id_role, id_workspace
  from user_organization_role 
  where id_user <> 0
)

I don't think you needed the CTE in the first place. This seems exactly equivalent. I'm not quite sure about the use-case. You seem to be operating on a relationship table, and automatically add a relationship to the "default" organization/role/workspace for every user who doesn't have this yet. So, maybe, a classic INSERT IGNORE would even be better? I.e. like this?

insert ignore into user_organization_role (
  id_user, id_organization, id_role, id_workspace
)
select distinct
  ur.id_user,
  ur0.id_organization,
  ur0.id_role,
  ur0.id_workspace
from 
  user_organization_role ur,
  user_orgainzation_role ur0
where ur.id_user <> 0
and ur0.id_user = 0

This is assuming that the 4 columns form a UNIQUE constraint

如何将MySQL查询转换为JOOQ

雪化雨蝶 2025-02-09 11:47:44

在您的情况下

class User extends Authenticatable
{
    public function cart_items() {
        return $this->belongsToMany(Product::class, 'carts');
    }
}
class Product extends Model
{
    public function users()
    {
        return $this->belongsToMany(User::class, 'carts');
    }

}

,您可以使用以下方式同步/附加产品:

// Products IDS
$product_ids= [1, 2];
// Then use
$user->cart_items()->attach($product_ids); // adds to existing
// OR
$user->cart_items()->sync($product_ids); // only this will be in your cart

要获取可登录用户的购物车项目,

foreach($user->cart_items as $cart_item) {
    // do stuff
}

您可以使用

foreach(auth()->user()->cart_items as $cart_item) {
    // do stuff
}

In your case

class User extends Authenticatable
{
    public function cart_items() {
        return $this->belongsToMany(Product::class, 'carts');
    }
}
class Product extends Model
{
    public function users()
    {
        return $this->belongsToMany(User::class, 'carts');
    }

}

And you can sync/attach products to user with:

// Products IDS
$product_ids= [1, 2];
// Then use
$user->cart_items()->attach($product_ids); // adds to existing
// OR
$user->cart_items()->sync($product_ids); // only this will be in your cart

To get the cart items

foreach($user->cart_items as $cart_item) {
    // do stuff
}

For logged user you can use

foreach(auth()->user()->cart_items as $cart_item) {
    // do stuff
}

Laravel关系:从交易中检索属于用户推车的产品

雪化雨蝶 2025-02-09 03:21:50
$query = "INSERT INTO carros (marca, modelo, submodelo, combustivel, mesReg, anoReg, quilometros, cilindrada, potencia, aceitaRetoma, cor, tipoCor, tipoCaixa, nPortas, lotacao, nMudancas, registo, origem, livroRevisoesCompleto, naoFumador, segundaChave, anunciante, imagemPrincipal, imagemPrincipalLoc, imagemUm, imagemUmLoc, imagemDois, imagemDoisLoc, imagemTres, imagemTresLoc, imagemQuatro, imagemQuatroLoc, imagemCinco, imagemCincoLoc, imagemSeis, imagemSeisLoc, imagemSete, imagemSeteLoc, userid) VALUES (UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?))";

而不是:

$query = "INSERT INTO carros (marca, modelo, submodelo, combustivel, mesReg, anoReg, quilometros, cilindrada, potencia, aceitaRetoma, cor, tipoCor, tipoCaixa, nPortas, lotacao, nMudancas, registo, origem, livroRevisoesCompleto, naoFumador, segundaChave, anunciante, imagemPrincipal, imagemPrincipalLoc, imagemUm, imagemUmLoc, imagemDois, imagemDoisLoc, imagemTres, imagemTresLoc, imagemQuatro, imagemQuatroLoc, imagemCinco, imagemCincoLoc, imagemSeis, imagemSeisLoc, imagemSete, imagemSeteLoc, userid) VALUES (UPPER(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?))";

因为upper()只能接受一个参数。

$query = "INSERT INTO carros (marca, modelo, submodelo, combustivel, mesReg, anoReg, quilometros, cilindrada, potencia, aceitaRetoma, cor, tipoCor, tipoCaixa, nPortas, lotacao, nMudancas, registo, origem, livroRevisoesCompleto, naoFumador, segundaChave, anunciante, imagemPrincipal, imagemPrincipalLoc, imagemUm, imagemUmLoc, imagemDois, imagemDoisLoc, imagemTres, imagemTresLoc, imagemQuatro, imagemQuatroLoc, imagemCinco, imagemCincoLoc, imagemSeis, imagemSeisLoc, imagemSete, imagemSeteLoc, userid) VALUES (UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?),UPPER(?))";

instead of:

$query = "INSERT INTO carros (marca, modelo, submodelo, combustivel, mesReg, anoReg, quilometros, cilindrada, potencia, aceitaRetoma, cor, tipoCor, tipoCaixa, nPortas, lotacao, nMudancas, registo, origem, livroRevisoesCompleto, naoFumador, segundaChave, anunciante, imagemPrincipal, imagemPrincipalLoc, imagemUm, imagemUmLoc, imagemDois, imagemDoisLoc, imagemTres, imagemTresLoc, imagemQuatro, imagemQuatroLoc, imagemCinco, imagemCincoLoc, imagemSeis, imagemSeisLoc, imagemSete, imagemSeteLoc, userid) VALUES (UPPER(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?))";

Because UPPER() can only accept one parameter.

试图将信息插入数据库

雪化雨蝶 2025-02-08 19:10:25

在DB2-LUW中,最接近Charindex的可能是

您还可以使用

In Db2-LUW, the nearest to CHARINDEX may be LOCATE.

You might also use REGEXP_EXTRACT if your Db2-server-platform and Db2-version (which you always need to know, z/os, i-series, linux/unix/windows/cloud) supports that.

将SQL Server查询转换为DB2

雪化雨蝶 2025-02-08 13:26:18

我通过使瓷砖背景颜色与边框颜色匹配,然后用我的脚本而不是瓷砖的背景颜色设置文本的背景来解决此问题。这样,当创建缝隙时,它匹配边框颜色,看起来并不奇怪。现在,它在所有尺度上看起来都正确。它没有处理非编写图像,但是所有拉的图像均已自行折射到我的PHP中的正确尺寸。

window.onload = () => {
        var colors = ['#ffffff', '#ffbd4b', '#ff634b', '#4b9fff'];
        var nowhitecolors = ['#ffbd4b', '#ff634b', '#4b9fff'];
        document.querySelectorAll('.blog_tile').forEach(
            el => {
                        var randcolor = colors[Math.floor(Math.random() * colors.length)];
                        el.style.backgroundColor = '#ffffff';
                        el.children[1].style.backgroundColor = randcolor;
                        if (randcolor ==='#ffffff') {
                                var randnowhitecolors = nowhitecolors[Math.floor(Math.random() * nowhitecolors.length)];
                                el.style.borderColor = randnowhitecolors;
                                el.children[0].style.borderColor = randnowhitecolors;
                                el.style.backgroundColor =randnowhitecolors;
                                el.style.color = randnowhitecolors;
                        };
                }
        );

};
.blog_preview_container {
    grid-row: 2;
    grid-column: 1;
    height: 354px;
    display: flex;
    flex-flow: row wrap;
    justify-content: center;
    column-gap: 40px;
    row-gap: 40px;
}

.blog_tile {
    height: 340px;
    width: 240px;
    margin-top: 0px;
    border-width: 6px;
    border-style: solid;
    border-radius: 6px;
    box-shadow: 4px 4px 6px rgba(0, 0, 0, 0.65);
    color: white;
    display: inline;
    cursor: pointer;
    transform: scale(1);
}

.blog_tile:hover {
    transform: scale(1.04);
}

.blog_tile img {
    height: 164px;
    width: 240px;
    padding: 0px;
    margin: 0px;
    object-fit: cover;
    border-bottom-width: 6px;
    border-bottom-style: solid;
}

.blog_tile p {
    height: 138px;
    font-family: 'nunito', sans-serif;
    font-size: 1rem;
    font-weight: 900;
    line-height: 22px;
    margin: 0;
    padding: 16px;
}
<body>
  <div class="blog_preview_container">
    <div class="blog_tile">
      <img class="blog_tile_image" src="https://example.com/img_location">
      <p class="blog_tile_text">Text Goes Here</p>
    </div>
  </div>
</body>

在所有屏幕尺寸上看起来都很棒,没有更多的空白!

I fixed this by having the tile background color match the border color, and then setting the background of the text with my script instead of background color of the tile. That way when gaps are created it matches the border color and doesn't look weird. Now it looks correct at all scales. it doesn't handle non-cropped images but all the images pulled are autocropped to the correct size in my PHP.

window.onload = () => {
        var colors = ['#ffffff', '#ffbd4b', '#ff634b', '#4b9fff'];
        var nowhitecolors = ['#ffbd4b', '#ff634b', '#4b9fff'];
        document.querySelectorAll('.blog_tile').forEach(
            el => {
                        var randcolor = colors[Math.floor(Math.random() * colors.length)];
                        el.style.backgroundColor = '#ffffff';
                        el.children[1].style.backgroundColor = randcolor;
                        if (randcolor ==='#ffffff') {
                                var randnowhitecolors = nowhitecolors[Math.floor(Math.random() * nowhitecolors.length)];
                                el.style.borderColor = randnowhitecolors;
                                el.children[0].style.borderColor = randnowhitecolors;
                                el.style.backgroundColor =randnowhitecolors;
                                el.style.color = randnowhitecolors;
                        };
                }
        );

};
.blog_preview_container {
    grid-row: 2;
    grid-column: 1;
    height: 354px;
    display: flex;
    flex-flow: row wrap;
    justify-content: center;
    column-gap: 40px;
    row-gap: 40px;
}

.blog_tile {
    height: 340px;
    width: 240px;
    margin-top: 0px;
    border-width: 6px;
    border-style: solid;
    border-radius: 6px;
    box-shadow: 4px 4px 6px rgba(0, 0, 0, 0.65);
    color: white;
    display: inline;
    cursor: pointer;
    transform: scale(1);
}

.blog_tile:hover {
    transform: scale(1.04);
}

.blog_tile img {
    height: 164px;
    width: 240px;
    padding: 0px;
    margin: 0px;
    object-fit: cover;
    border-bottom-width: 6px;
    border-bottom-style: solid;
}

.blog_tile p {
    height: 138px;
    font-family: 'nunito', sans-serif;
    font-size: 1rem;
    font-weight: 900;
    line-height: 22px;
    margin: 0;
    padding: 16px;
}
<body>
  <div class="blog_preview_container">
    <div class="blog_tile">
      <img class="blog_tile_image" src="https://example.com/img_location">
      <p class="blog_tile_text">Text Goes Here</p>
    </div>
  </div>
</body>

Looks great at all screen sizes, no more gaps!

CSS边界,不需要的差距和子像素渲染问题

雪化雨蝶 2025-02-08 08:55:15

我们可以做合并

out = df1.merge(df2, on = 'ID', suffixes = ('','_x')).\
            query('date<=date_x').sort_values('date').drop_duplicates('ID',keep='last')[df1.columns]
Out[272]: 
   ID          date  cumulative_sales
1   1   2020-01-03                 15

We can do merge

out = df1.merge(df2, on = 'ID', suffixes = ('','_x')).\
            query('date<=date_x').sort_values('date').drop_duplicates('ID',keep='last')[df1.columns]
Out[272]: 
   ID          date  cumulative_sales
1   1   2020-01-03                 15

如何在a.date&lt; = b.date上加入大熊猫,然后占据唯一的a.date是max的行?

雪化雨蝶 2025-02-07 12:30:49

当它是吞噬蜡烛时,您使用的吞噬变量将为 true

因此,直接在警报调用中使用变量。

alertcondition(bullishEngulfing, title = "Bullish Engulfing", message =     "[CurrencyPair] [TimeFrame], Bullish candle engulfing previous candle")
alertcondition(bearishEngulfing, title = "Bearish Engulfing", message =     "[CurrencyPair] [TimeFrame], Bearish candle engulfing previous candle")  

The engulfing variables you use will be true when it is an engulfing candle.

So, use the variable directly in your alert calls.

alertcondition(bullishEngulfing, title = "Bullish Engulfing", message =     "[CurrencyPair] [TimeFrame], Bullish candle engulfing previous candle")
alertcondition(bearishEngulfing, title = "Bearish Engulfing", message =     "[CurrencyPair] [TimeFrame], Bearish candle engulfing previous candle")  

吞噬蜡烛脚本

雪化雨蝶 2025-02-07 08:25:12

由于缺少UNIX插座,因此系统上的PHP似乎无法正确配置,因为连接尝试失败。

检查unix_socket的位置,例如使用命令行客户端:

MariaDB [(none)]> \s
--------------
<snip>
UNIX socket:            /tmp/mysql.sock
<snap>

现在确保MySQLI的PHP设置具有相同的设置,例如使用

php -i | grep socket

或检查您的PHP配置文件。

It looks like PHP on your system is not properly configured, since connection attempt fails due to missing unix socket.

Check the location of unix_socket, e.g. with command line client:

MariaDB [(none)]> \s
--------------
<snip>
UNIX socket:            /tmp/mysql.sock
<snap>

Now make sure that the PHP settings for mysqli have the same settings, e.g. with

php -i | grep socket

or by checking your php configuration file.

Mariadb从10.5升级到10.6:mysqli :: real_connect():( hy000/2002):没有此类文件或目录

雪化雨蝶 2025-02-06 15:14:12

这是由于浮点类型的NAN所致。

您可以使用 fillna 使NANS 0:

data['ID'] = pd.to_numeric(data['ID'], errors='coerce').fillna(0, downcast='infer')

或将NAN保持为新整数NA,使用 Convert_dtypes

data['ID'] = pd.to_numeric(data['ID'], errors='coerce').convert_dtypes()

This is due to the NaNs that are of float type.

You can use fillna to make the NaNs 0:

data['ID'] = pd.to_numeric(data['ID'], errors='coerce').fillna(0, downcast='infer')

Or to keep the NaN as the new integer NA, use convert_dtypes:

data['ID'] = pd.to_numeric(data['ID'], errors='coerce').convert_dtypes()

将列转换为数字,但仍显示为float,带有.0值

雪化雨蝶 2025-02-06 06:55:18

您可以尝试将文档根目录设置为CPANEL域设置页面上的“公共”目录。


或者,您可以使用.htaccess文件;

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain-name.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain-name.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]

You can try to set the document root directory as 'public' directory on the domain settings page of cPanel.


or you can use .htaccess file like that;

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain-name.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain-name.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]

如何在Laravel 9中隐藏公众向URL隐藏

雪化雨蝶 2025-02-05 20:30:38

您可以使用列表理解列表:

C = [np.append(x, B[i]) for i, x in enumerate(A)]

输出

[array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 2, 0]), 
 array([0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 4, 0, 8]), 
 array([0, 0, 0, 0, 0, 0, 0, 0, 1, 6, 1, 0, 9])]

You can concatenate using list comprehension:

C = [np.append(x, B[i]) for i, x in enumerate(A)]

OUTPUT

[array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 2, 0]), 
 array([0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 4, 0, 8]), 
 array([0, 0, 0, 0, 0, 0, 0, 0, 1, 6, 1, 0, 9])]

numpy-数组数组识别为向量

雪化雨蝶 2025-02-05 19:50:05

我相信您正在寻找的是UpSert操作:
https://wiki.postgresql.org/wiki/upsert

健康)状况?数据库具有一组工具,例如交易和锁,以帮助您解决这些问题。

I believe what you're looking for is UPSERT operation:
https://wiki.postgresql.org/wiki/UPSERT

Why you're afraid of race condition? Databases have set of tools like transactions and locks to help you with these problems.

防止Postgres中的比赛状况

雪化雨蝶 2025-02-05 18:56:39

顺便说一下,答案非常简单。您可以构建剃须刀级图书馆项目。

我当前的过程是在主要项目中构建和编辑新组件,然后在我不想暂时不工作时将它们移至库。

The answer to this, by the way, is quite simple. You can build a Razor class library project.

My current process is to build and edit new components in the main project, then move them to the library when I won't want to work on them for a while.

提高大麻的重建速度

雪化雨蝶 2025-02-05 16:17:32

我认为了解包括和扩展的意图很重要:

“包含关系旨在重复使用的行为
另一种用例,而扩展关系的目的是
在现有用例中添加<的零件以及用于建模的可选系统服务的”(OverGaard和Palmkvist,用例:模式和蓝图。韦斯利,2004)。


。用例。

扩展= 添加(不重复使用)功能, note 可选功能。
1。将 new 功能添加到用例(是否可选)
2。任何可选用例(是否存在)。

摘要:
包括=功能重复使用
扩展=新的和/或可选功能,

您通常会发现扩展的第二个用法(即可选功能),因为如果功能不是可选的,那么大多数时候它就内置在用例本身中,而不是扩展。至少那是我的经历。 (朱利安·C(Julian C)指出,当项目进入第二阶段时,您有时会看到第一个用法(即添加新功能)。

I think it's important to understand the intention of includes and extends:

"The include relationship is intended for reusing behaviour modeled
by another use case, whereas the extend relationship is intended for
adding parts to existing use cases as well as for modeling optional system services" (Overgaard and Palmkvist, Use Cases: Patterns and Blueprints. Addison-Wesley, 2004).

This reads to me as:

Include = reuse of functionality (i.e. the included functionality is used or could be used elsewhere in the system). Include therefore denotes a dependency on another use case.

Extends = adding (not reusing) functionality and also any optional functionality. Extends therefore can denote one of two things:
1. adding new features/capabilities to a use case (optional or not)
2. any optional use cases (existing or not).

Summary:
Include = reuse of functionality
Extends = new and/or optional functionality

You will most often find the 2nd usage (i.e. optional functionality) of extends, because if functionality is not optional, then most times it is built into the use case itself, rather than being an extension. At least that's been my experience. (Julian C points out that you sometimes see the 1st usage (i.e. adding new features) of extends when a project enters it's 2nd phase).

包括用例图和扩展的用例中的差异是什么?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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