时间海

文章 评论 浏览 30

时间海 2025-02-20 11:23:47

我发现了。我想发布我所做的事情,以防有人遇到类似的问题。
这是我所做的:

import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
data = gpd.GeoDataFrame(data, geometry=gpd.points_from_xy(data.INTPTLON, data.INTPTLAT))
fig, ax = plt.subplots(figsize=(10, 10))
DC_BLK_PLT = DC_BLK.plot(ax=ax,edgecolor = "grey", facecolor = "None")
DC_BG_PLT = DC_BG.plot(ax=ax, edgecolor = "lightblue",facecolor = "None")
DC_CT_PLT = DC_CT.plot(ax=ax,edgecolor = "black",facecolor = "None")
data.plot(ax=ax , marker = '.')
grey  = mpatches.Patch(color = 'grey', label = 'Block')
Lblue = mpatches.Patch(color = 'Lightblue', label = 'Block Group')
Black = mpatches.Patch(color= 'black', label = 'Census Tract')
ax.set_title('Washington DC - 7x pop')
plt.legend(handles = [grey,Lblue,Black])
plt.show()

希望这会有所帮助

I figured it out. I wanted to post what I did just in case someone runs into a similar problem.
Here is what i did:

import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
data = gpd.GeoDataFrame(data, geometry=gpd.points_from_xy(data.INTPTLON, data.INTPTLAT))
fig, ax = plt.subplots(figsize=(10, 10))
DC_BLK_PLT = DC_BLK.plot(ax=ax,edgecolor = "grey", facecolor = "None")
DC_BG_PLT = DC_BG.plot(ax=ax, edgecolor = "lightblue",facecolor = "None")
DC_CT_PLT = DC_CT.plot(ax=ax,edgecolor = "black",facecolor = "None")
data.plot(ax=ax , marker = '.')
grey  = mpatches.Patch(color = 'grey', label = 'Block')
Lblue = mpatches.Patch(color = 'Lightblue', label = 'Block Group')
Black = mpatches.Patch(color= 'black', label = 'Census Tract')
ax.set_title('Washington DC - 7x pop')
plt.legend(handles = [grey,Lblue,Black])
plt.show()

Hope this helps

如何获得传奇

时间海 2025-02-20 11:07:42

现在有可能。只需选择正确的产品类型即可。

在我的病例产品中,已经添加了很多年前,并且具有“ MSIX或PWA应用程序”类型。

It is possible now. Just select right product type.

enter image description here

In my case product was added many years ago and has "MSIX or PWA app" type.

发布Microsoft商店的EXE桌面应用程序

时间海 2025-02-20 09:23:39

您已经使用了 malloc 。不这样做的原因之一是它实际上并未原始化您的对象。它只是分配的内存。结果,当访问成员字段时,您会得到未定义的行为。

您还忘记了 delete c 您使用 new 创建的对象。但是,在这种情况下,您可能希望使用 std :: simory_ptr ,以避免完全删除对象。智能指针在 main 的末尾出现范围时将自动释放内存。

auto c = std::make_unique<C>();

std::cout << c->a << std::endl;
std::cout << c->str << std::endl;

You've used malloc. One of the reasons to not do this is that it hasn't actually initialized your object. It's just allocated memory for it. As a result, when accessing member fields, you get undefined behavior.

You have also forgotten to delete the C object you created with new. But you may wish to use a std::unique_ptr in this scenario, to avoid having to explicitly delete the object at all. The smart pointer will automatically free the memory when it goes out of scope at the end of main.

auto c = std::make_unique<C>();

std::cout << c->a << std::endl;
std::cout << c->str << std::endl;

在尝试打印非初始化的字符串时,正在进行什么

时间海 2025-02-20 01:16:30

这个错误在于最内向的山地。

您是在一维值数组上要求迭代器,该迭代器会产生标量值,因此无法解开包装。

如果您的DataFrame每列只有2个项目,那么

cols = ['biz','seg','PID']
for col in cols:
   i, j = getattr(df1, col).values
   print("D" + str(i) + ":" + "F" + str(j))
   print("Q" + str(i) + ":" + "S" + str(j))
   print("AB" + str(i) + ":" + "AD" + str(j))

这应该足以替代

使用 loc

pandas ,这实际上是最简单的解决方法,但直到现在才发生在我身上。我们将列名 col loc 一起获取所有行(给出:给出 in loc> loc [:,, col]

cols = ['biz','seg','PID']
for col in cols:
    i, j = df1.loc[:, col].values

attergetter

我们可以使用 operator 库中的attergetter对象获取我们想要的单个(或尽可能多的属性):

from operator import attrgetter

cols = ['biz','seg','PID']
cols = attrgetter(*cols)(df1)
for col in cols:
   i, j = col.values

attergetter 2

此方法类似于上面的方法,除了我们选择多个多个列,有I和J在两个列表中,每个条目对应于一个列。

from operator import attrgetter

cols = ['biz','seg','PID']
cols = attrgetter(*cols)(df1)
cols = [col.values for col in cols]
all_i, all_j = zip(*cols)

熊猫解决方案

这种方法仅使用熊猫功能。它使用 df1.columns.get_loc(col_name)函数获取列索引,然后使用 .iloc 索引值。在 .iloc [a,b] 我们使用:代替A选择所有行, index 代替B来选择仅选择列。

cols = ['biz','seg','PID']
for col in cols:
    index = df1.columns.get_loc(col)
    i, j = df1.iloc[:, index]
    # do the printing here

The mistake is in the innermost forloop.

You are requesting an iterator over a 1-dimensional array of values, this iterator yields scalar values and hence they can not be unpacked.

If your dataframe only has 2 items per column, then this should suffice

cols = ['biz','seg','PID']
for col in cols:
   i, j = getattr(df1, col).values
   print("D" + str(i) + ":" + "F" + str(j))
   print("Q" + str(i) + ":" + "S" + str(j))
   print("AB" + str(i) + ":" + "AD" + str(j))

Alternatives

Pandas using loc

This is actually the simplest way to solve it but only now it occurred to me. We use the column name col along with loc to get all rows (given by : in loc[:, col])

cols = ['biz','seg','PID']
for col in cols:
    i, j = df1.loc[:, col].values

Attrgetter

We can use the attrgetter object from operator library to get a single (or as many attributes) as we want:

from operator import attrgetter

cols = ['biz','seg','PID']
cols = attrgetter(*cols)(df1)
for col in cols:
   i, j = col.values

Attrgetter 2

This approach is similar to the one above, except that we select multiple columns and have the i and j in two lists, with each entry corresponding to one column.

from operator import attrgetter

cols = ['biz','seg','PID']
cols = attrgetter(*cols)(df1)
cols = [col.values for col in cols]
all_i, all_j = zip(*cols)

Pandas solution

This approach uses just pandas functions. It gets the column index using the df1.columns.get_loc(col_name) function, and then uses .iloc to index the values. In .iloc[a,b] we use : in place of a to select all rows, and index in place of b to select just the column.

cols = ['biz','seg','PID']
for col in cols:
    index = df1.columns.get_loc(col)
    i, j = df1.iloc[:, index]
    # do the printing here

熊猫一次迭代列值一次并生成范围

时间海 2025-02-19 15:34:46

在0.7.2上测试,如果不可用,则该版本可能太低。

vim.api.nvim_create_autocmd("BufReadPost", {
    pattern = {"*"},
    callback = function()
        if vim.fn.line("'\"") > 1 and vim.fn.line("'\"") <= vim.fn.line("$") then
            vim.api.nvim_exec("normal! g'\"",false)
        end
    end
})

Tested on 0.7.2, if not available, the version may be too low.

vim.api.nvim_create_autocmd("BufReadPost", {
    pattern = {"*"},
    callback = function()
        if vim.fn.line("'\"") > 1 and vim.fn.line("'\"") <= vim.fn.line("
quot;) then
            vim.api.nvim_exec("normal! g'\"",false)
        end
    end
})

在Neovim中,如何在上次关闭的同一行号上打开文件?

时间海 2025-02-19 13:07:09

尝试使用显示flex。设置合理的内容,以弹性启动,将项目对准中心,然后将弹性包装包裹起来。并给出合理的宽度,并避免使用内联样式。

try using display flex. set up justify-content to flex-start, align items to the centre and flex-wrap to wrap. and give a justifiable width and avoid using inline styles.

让CSS列在左侧束束,而不是扩散

时间海 2025-02-19 07:32:13

如果tailwind CSS

在此处阅读描述性和非常简短的文档条目:任意变化的“ rel =“ noreferrer”>。

如我所见,您需要更改所有&lt; a&gt; 的颜色,无论它们在&lt; cards&gt; 中的深入程度如何。在&amp; a 选择器 - [&amp; _a]之间使用下划线:text -black 。这转化为:

.card--primary {
      
  /* arbitrarily nested <a> links */
  a {
    color: black
  }
}

另一方面,&gt; &amp; a =&gt; =&gt;另一方面。 [&amp;&gt; a]:text-black 将导致此CSS(只有直接的孩子&lt; a&gt; a&gt; nodes nodes被造型):

.card--primary {
      
  /* direct-child <a> links */
  > a {
    color: black
  }
}

recap :为您的情况而言,由此产生的尾风HTML:

<div className="card--primary [&_a]:text-black" >
  <a></a> !-- will be black
  <div>
    <a></a> !-- will be black
  </div>
<div/>

<div className="card--danger [&_a]:text-white" >
  <a></a> !-- will be white
  <div>
    <a></a> !-- will be white
  </div>
<div/>

就是这样。我希望这有帮助。

In case of Tailwind CSS

Read the descriptive and a very brief documentation entry here: Using arbitrary variants.

As I can see you need to change the color of all the <a> links no matter how deeply they reside in the <cards>. Use an underscore between & and a selectors - [&_a]:text-black. This translates to:

.card--primary {
      
  /* arbitrarily nested <a> links */
  a {
    color: black
  }
}

On the other hand the Tailwind directive with > between & and a => [&>a]:text-black would result in this css (only the direct child <a> nodes would be styled):

.card--primary {
      
  /* direct-child <a> links */
  > a {
    color: black
  }
}

Recap: the resulting Tailwind HTML for your case:

<div className="card--primary [&_a]:text-black" >
  <a></a> !-- will be black
  <div>
    <a></a> !-- will be black
  </div>
<div/>

<div className="card--danger [&_a]:text-white" >
  <a></a> !-- will be white
  <div>
    <a></a> !-- will be white
  </div>
<div/>

That's it. I hope it is helpful.

如何使用Tailwind CSS根据父级为嵌套元素样式?

时间海 2025-02-19 03:49:24

根据您的描述,您正在使用YAML管道中的SSH任务。有关此任务的更多信息,请参阅以下文档:

ssh部署任务-Azure Pipelines | Microsoft文档。

要使用任务,您可以在SSHENDPOINT输入中填写SSH服务连接名称。该任务将尝试使用服务连接设置访问远程计算机。

首先,您需要创建SSH服务连接。请导航到项目设置,然后单击“服务连接”选项卡。您可以创建一个新的服务连接如下:

”在此处输入图像描述

在服务连接中,请添加主机,端口,用户名和密码。另外,您也可以选择使用专用密钥文件来获得身份验证。这是可选的。

创建服务连接时,您可以复制服务连接名称并将其粘贴到Sshendpoint输入中。请参阅下面的示例。

- task: SSH@0
  displayName: 'Run shell inline on remote machine'
  inputs:
    sshEndpoint: 'my_service_connection_name'
    runOptions: inline
    inline: |
     cd / && ls

According to your description, you are using SSH task in YAML pipelines. For more about this task, please refer to this following document:

SSH Deployment task - Azure Pipelines | Microsoft Docs.

To use the task, you could fill a SSH service connection name in the sshEndpoint input. The task will try to access the remote machine with the service connection settings.

First, you need to create a SSH service connection. Please navigate to Project settings and then click into the Service connections tab. You could create a new service connection as below:

enter image description here

In the service connection, please add your host, port, username and password. Alternatively, you could also choose to use the private key file to get authentication. It's optional.

enter image description here

When the service connection is created, you could copy the service connection name and paste it into the sshEndpoint input. Please see the example below.

- task: SSH@0
  displayName: 'Run shell inline on remote machine'
  inputs:
    sshEndpoint: 'my_service_connection_name'
    runOptions: inline
    inline: |
     cd / && ls

如何在ADO中的SSH@0任务上将密码和端口添加到Sshendpoint?

时间海 2025-02-19 00:20:44

您可以打开脚本视图并在搜索框中搜索“ .STYLE”。

You can open the script view and search for ".style" in the searchbox.

我如何找到哪个JavaScript正在更改元素的样式?

时间海 2025-02-18 17:31:33

您可以使用调试,直到用户停止在您选择的时间停止打字之前,不会拨打电话

function debounce(func, wait, immediate) {
  var timeout;
  return function() {
    var context = this, args = arguments;
    clearTimeout(timeout);
    timeout = setTimeout(function() {
        timeout = null;
        if (!immediate) func.apply(context, args);
    }, wait);
    if (immediate && !timeout) func.apply(context, args);
  };
}

// in your "methods" (I put 1000ms of delay) :
searchonurl: function () {
  let ampersand = "&page=";
  debounce(searchPagination, 1000)(1, this, ampersand);
}

You could use debounce, no call will leave until the user stop typing in the amount of time you chose

function debounce(func, wait, immediate) {
  var timeout;
  return function() {
    var context = this, args = arguments;
    clearTimeout(timeout);
    timeout = setTimeout(function() {
        timeout = null;
        if (!immediate) func.apply(context, args);
    }, wait);
    if (immediate && !timeout) func.apply(context, args);
  };
}

// in your "methods" (I put 1000ms of delay) :
searchonurl: function () {
  let ampersand = "&page=";
  debounce(searchPagination, 1000)(1, this, ampersand);
}

vue.js需要在关键事件上获取URL(WP-API)时的问题

时间海 2025-02-18 04:11:45

通常,游戏具有您需要管理的一定数量的事情,例如当前状态,游戏循环等。这种状态理想地生活在客户端,并定期持续在破产上。因此,我觉得由于没有后端代码,而且这里没有太多信息,我建议您从更简单的游戏开始,如果您熟悉React,React网站上有一个TIC-TAC-TOE教程,这将是一个很好的起点一般了解游戏开发。然后,我推荐这本书,它有关于开发浏览器游戏的绝妙章节。
https://eloquentjavascript.net/

现在专门用于国际象棋,我们有一些称为Chess Engine的象棋发动机,可以处理当前状态的某种状态并建议像Stockfish这样的动作,这是一个非常复杂的动作,而不是新手可以实施的东西

Generally, games have a certain number of things you need to manage like current state, game loops, etc. This state ideally live on the client side and persisted on the serverside periodically. So i feel since there is no backend code and there's isn't much info here, i suggest you start with a simpler game, react website had a tic-tac-toe tutorial if you are familiar with react that would be a good starting point to understand game development in general. Then i would recommend this book it has an excellent chapter on developing a browser game.
https://eloquentjavascript.net/

Now specifically for chess, we have something called a chess engine which processes the current state and suggests moves like stockfish which is a very complex and not something a newbie can implement

创建一个国际象棋板,以计算Nodejs中的后端移动

时间海 2025-02-18 01:54:56

将溢出隐藏在图像容器上,将图像垂直和水平中心,而保持原始大小

.img-container {
  height: 300px;
  overflow: hidden;
  position: relative;
}

.img-container img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

h1 {
  text-align: center;
}
<h1>I Am A Beautiful Image</h1>
<div class="img-container">
  <img src="https://picsum.photos/id/1039/1920/1200" alt="">
</div>

Hide the overflow on the image container and center the image vertically and horizontally while maintaining the original size.

.img-container {
  height: 300px;
  overflow: hidden;
  position: relative;
}

.img-container img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

h1 {
  text-align: center;
}
<h1>I Am A Beautiful Image</h1>
<div class="img-container">
  <img src="https://picsum.photos/id/1039/1920/1200" alt="">
</div>

保持DIV高度,更改图像宽度 - 允许图像出血

时间海 2025-02-17 21:04:42

也许不是您要寻找的答案,但我建议不要使用纸浆。 cvxpy 更易于学习和使用(免费变量而不是绑定到模型的变量),并允许您轻松扩展扩展您的模型to nonoflowl noreferrer“> nonlinear convex systems ,这给您带来了更多的意义。努力与获得的能力相比。

例如,在CVXPY中,您的问题可能会被抛弃为:

from collections import defaultdict

from cvxpy import cp

decision_vars = {}
for an_id in ids:
  for item in a_vector:
    decision_vars[an_id][item] = cp.Variable(pos=True)

constraints = []
for an_id in ids:
  my_sum = sum(x for x in decision_vars[an_id].values())
  constraints.append(count_req[an_id]*lower_proportion <= my_sum)
  constraints.append(my_sum <= count_req[an_id]*upper_proportion)

problem = cp.Problem(cp.Minimize(OBJECTIVE_HERE), constraints)
optimal_value = problem.solve()
for an_id in ids:
  for item in a_vector:
    print(f"{an_id} {item} {decision_vars[an_id][item].value}")

请注意,使用自由变量意味着我们可以使用标准的Python构造,例如字典,总和和比较运算符来构建我们的问题。当然,您必须手动构建弹性约束,但这并不具有挑战性。

It's maybe not the answer you're looking for, but I recommend against using PuLP. cvxpy is easier to learn and use (free variables instead of variables bound to models) and allows you to easily extend your models to nonlinear convex systems, which gives you much more bang for your buck in terms of effort put into learning versus capability obtained.

For instance, in cvxpy, your problem might be cast as:

from collections import defaultdict

from cvxpy import cp

decision_vars = {}
for an_id in ids:
  for item in a_vector:
    decision_vars[an_id][item] = cp.Variable(pos=True)

constraints = []
for an_id in ids:
  my_sum = sum(x for x in decision_vars[an_id].values())
  constraints.append(count_req[an_id]*lower_proportion <= my_sum)
  constraints.append(my_sum <= count_req[an_id]*upper_proportion)

problem = cp.Problem(cp.Minimize(OBJECTIVE_HERE), constraints)
optimal_value = problem.solve()
for an_id in ids:
  for item in a_vector:
    print(f"{an_id} {item} {decision_vars[an_id][item].value}")

Note that the use of free variables means that we can use standard Python constructs like dictionaries, sums, and comparison operators to build our problem. Sure, you have to construct the elastic constraint manually, but that's not challenging.

如何将lpsum转换为lpconstraint?

时间海 2025-02-17 20:57:36

目前尚不清楚您所说的“相同”。例如,阵列 a b 下方(请注意嵌套数组)吗?

var a = ["foo", ["bar"]], b = ["foo", ["bar"]];

这是一个优化的数组比较函数,它依次使用严格的平等比较每个数组的相应元素,并且不会对本身是数组的数组元素进行递归比较,这意味着对于上述示例, arraysidentical(a,b)将返回 false 。它在一般情况下起作用,基于JSON-和基于基于的解决方案将无法:

function arraysIdentical(a, b) {
    var i = a.length;
    if (i != b.length) return false;
    while (i--) {
        if (a[i] !== b[i]) return false;
    }
    return true;
};

It's unclear what you mean by "identical". For example, are the arrays a and b below identical (note the nested arrays)?

var a = ["foo", ["bar"]], b = ["foo", ["bar"]];

Here's an optimized array comparison function that compares corresponding elements of each array in turn using strict equality and does not do recursive comparison of array elements that are themselves arrays, meaning that for the above example, arraysIdentical(a, b) would return false. It works in the general case, which JSON- and join()-based solutions will not:

function arraysIdentical(a, b) {
    var i = a.length;
    if (i != b.length) return false;
    while (i--) {
        if (a[i] !== b[i]) return false;
    }
    return true;
};

如何在JavaScript中比较数组?

时间海 2025-02-17 19:24:11

下面的示例导出 module 具有将为任何未定义的密钥提供类型类型。定义的键将导出定义的类型。

declare module 'dependency' {
    class SomeClass {
        constructor(a: boolean)
    }

    interface Module {
        [key: string]: any

        SomeClass: typeof SomeClass
    }

    const module: Module;
    export = module;
}

The example below exports Module which has index signature which will give the type any for any key that is not defined. Keys which are defined will export the defined type.

declare module 'dependency' {
    class SomeClass {
        constructor(a: boolean)
    }

    interface Module {
        [key: string]: any

        SomeClass: typeof SomeClass
    }

    const module: Module;
    export = module;
}

有没有办法声明类似于“任何”的打字稿类类型?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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