鼻尖触碰

文章 评论 浏览 29

鼻尖触碰 2025-02-20 20:30:30

单击第2页时,该页面没有重新加载。相反,它向网站的后端发出了 get 请求。
该请求将发送至: https://apexranked.com/wp-admin/admin/admin/admin/admin/admin/admin/admin/admin/admin -ajax.php
另外,将几个参数直接解析到先前的URL上。
?action = get_player_data& pag = 3& total_pages = 195& _ = 1657230896643

参数

  • 操作:动作:作为端点可以处理多个目的,您必须指示执行的操作。当然是强制性参数,不要省略它。
  • 页面:指示请求的页面(即索引您要仔细阅读)。
  • total_pages:指示页面的总数(也许可以省略,否则您可以在主页上删除它)
  • _:这是一个与上面相同的unix时间戳,相同的想法对应,请尝试忽略并查看会发生什么。 您可以使用time.time()非常轻松地获得UNIX TIMESTAMP

否则, 在请求标题中登录以获取JSON,但这只是一个细节。

所有这些信息都结束了:

import requests
import time

url = "https://apexranked.com/wp-admin/admin-ajax.php"

# Issued from a previous scraping on the main page
total_pages = 195

params = {
    "total_pages": total_pages,
    "_": round(time.time() * 1000),
    "action": "get_player_data"
}

# Make sure to include all mandatory fields
headers = {
    ...
}

for k in range(1, total_pages + 1):
     params['page'] = k
     res = requests.get(url, headers=headers, params=params)
     # Make your thing :)

The page is not reloading when you click on page 2. Instead, it is firing a GET request to the website's backend.
The request is being sent to : https://apexranked.com/wp-admin/admin-ajax.php
In addition, several parameters are parsed directly onto the previous url.
?action=get_player_data&page=3&total_pages=195&_=1657230896643

Parameters :

  • action: As the endpoint can handle several purpose, you must indicate the performed action. Surely a mandatory parameter, don't omit it.
  • page: indicates the requested page (i.e the index you're iteraring over).
  • total_pages: indicates the total number of page (maybe it can be omitted, otherwise you can scrap it on the main page)
  • _: this one corresponds to an unix timestamp, same idea as above, try to omit and see what happens. Otherwise you can get a unix timestamp quite easily with time.time()

Once you get a response, it yields a rendered HTML, maybe try to set Accept: application/json field in request headers to get a Json, but that's just a detail.

All these informations wrapped up:

import requests
import time

url = "https://apexranked.com/wp-admin/admin-ajax.php"

# Issued from a previous scraping on the main page
total_pages = 195

params = {
    "total_pages": total_pages,
    "_": round(time.time() * 1000),
    "action": "get_player_data"
}

# Make sure to include all mandatory fields
headers = {
    ...
}

for k in range(1, total_pages + 1):
     params['page'] = k
     res = requests.get(url, headers=headers, params=params)
     # Make your thing :)

我需要帮助获得每个页面的链接

鼻尖触碰 2025-02-20 02:31:17

尝试一下

   using Newtonsoft.Json;
   using Newtonsoft.Json.Linq;

    var followers = (JArray)JObject.Parse(json)["Followers"];
    var id=1;
    
    int selectedViewers = followers.Where(f=> (int)f["ID"]==id)
                                   .Select(f => (int) f["Viewers"])
                                   .FirstOrDefault();  //31

try this

   using Newtonsoft.Json;
   using Newtonsoft.Json.Linq;

    var followers = (JArray)JObject.Parse(json)["Followers"];
    var id=1;
    
    int selectedViewers = followers.Where(f=> (int)f["ID"]==id)
                                   .Select(f => (int) f["Viewers"])
                                   .FirstOrDefault();  //31

我如何拿一个JSON字符串并选择一个随机条目并从该条目获取变量

鼻尖触碰 2025-02-19 23:17:02

您的returnurl参数不包含动作名称,而只是相对URL路径。

尝试使用重定向(字符串URL)方法,而不是redirectToAction(String ActionName)

Your returnUrl parameter contains not an action name but just a relative url path.

Try to use Redirect(string url) method instead of RedirectToAction(string actionName).

ASP.NET核心身份重定向ToAction

鼻尖触碰 2025-02-19 08:26:35

您必须每次使用str访问者:

df['n'].fillna(df['d'].str['p'].str[0].str['lt'].str['ls1'], inplace=True)
print(df)

# Output
          n                                                  d
0  0.148554  {'status': {'version': '1.0.0'}, 'p': [{'ident...
1       NaN                                                NaN

You have to use str accessor everytime:

df['n'].fillna(df['d'].str['p'].str[0].str['lt'].str['ls1'], inplace=True)
print(df)

# Output
          n                                                  d
0  0.148554  {'status': {'version': '1.0.0'}, 'p': [{'ident...
1       NaN                                                NaN

从大熊猫的字典中读取数据并分配新的列值

鼻尖触碰 2025-02-19 07:47:06

在大多数情况下,如果您使用的是react-hook-form,则无需使用usestate挂钩跟踪表单字段。

使用控制器组件是正确的方法。但是,您的第一个方法中的Onchange处理程序存在问题。

提交表单时,您将获得默认日期null,因为field被破坏,但未传递给datepicker。因此,onChange field的prop 在更改日期时不会触发 react> react-hook-form没有新日期。

如果出于某种原因,您需要更新组件状态,那么您的渲染方法应该是这样的

render={({field}) =>
     <LocalizationProvider dateAdapter={AdapterDateFns}>
          <DatePicker
              label="Original Release Date"
              renderInput={(params) =>
              <TextField
                   {...params}
              />}
              {...field}
          />
      </LocalizationProvider>
}

,然后您必须将数据发送到react-hook-form,然后更新本地状态

render={({field: {onChange,...restField}) =>
         <LocalizationProvider dateAdapter={AdapterDateFns}>
              <DatePicker
                  label="Original Release Date"
                  onChange={(event) => {
                                            onChange(event);
                                            setOriginalReleaseDate(event.target.value);
                                        }}
                  renderInput={(params) =>
                  <TextField
                       {...params}
                  />}
                  {...restField}
              />
          </LocalizationProvider>
    }

In most cases, if you are using react-hook-form, you don't need to track form fields with useState hook.

Using a Controller component is the right way to go. But there is a problem with onChange handler in your 1st method.

When you submit form, you are getting default date null because field is destructed, but it's not passed to DatePicker. So, onChange prop of field is not triggered when date is changed and react-hook-form doesn't have new date.

Here's how your render method should be

render={({field}) =>
     <LocalizationProvider dateAdapter={AdapterDateFns}>
          <DatePicker
              label="Original Release Date"
              renderInput={(params) =>
              <TextField
                   {...params}
              />}
              {...field}
          />
      </LocalizationProvider>
}

If for some reason, you need to update component state then you have to send data to react-hook-form and then update local state

render={({field: {onChange,...restField}) =>
         <LocalizationProvider dateAdapter={AdapterDateFns}>
              <DatePicker
                  label="Original Release Date"
                  onChange={(event) => {
                                            onChange(event);
                                            setOriginalReleaseDate(event.target.value);
                                        }}
                  renderInput={(params) =>
                  <TextField
                       {...params}
                  />}
                  {...restField}
              />
          </LocalizationProvider>
    }

材料UI(MUI)挑选式搭钩形式的选择器

鼻尖触碰 2025-02-19 03:39:09

只是提出一些想法:

  1. 为每个元素添加边界底,以及带有所需内容的售后元素(在CSS中)。

  2. 用简单的“ div”包裹每个胜利栏,然后做这样的事情:

<div style={{ width: 'fit-content', display: flex; flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
  <VictoryBar ... />
  <span style={{ width: '200px', height: '10px', backgroundColor: 'black' }}/>
  <span>low</span>
</div>

这将保持胜利键的大小(确保其比跨度更长,否则要花费最小),将在其下方添加一条黑线(因为我们将Flex与方向列和中心相中),然后添加所需的文本。

还有许多其他方法可以获得这一结果,让我知道它是否有帮助,如果没有,我们将尝试另一种。

just throwing some ideas:

  1. Add border-bottom for each element, and a after-pseudo element (in css) with the desired content.

  2. Wrap each of the VictoryBars with a simple 'div', and do something like this:

<div style={{ width: 'fit-content', display: flex; flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
  <VictoryBar ... />
  <span style={{ width: '200px', height: '10px', backgroundColor: 'black' }}/>
  <span>low</span>
</div>

this will keep the size of the VictoryBar (make sure its longer than the span, otherwise take min), will add a black line below it (because we use flex with direction column and center it) and then will add the text you want.

there are many other ways to get this result, let me know if it helped and if not we will try another.

如何将标签添加到JavaScript图表

鼻尖触碰 2025-02-18 05:38:42

假设我们有moduleamoduleb,访问moduleb modulea add add add 实现项目(“” :moduleb“) to modulea build> build.gradle file。

请注意,Moduleb中的所有文件将可用于modulea,但modulea中的文件 moduleb

be确保在设置中声明您的模块

包括':modulea'

include':moduleb'

let's assume we have moduleA and moduleB, to access moduleB inside of moduleA add implementation project(":moduleB") to moduleA build.gradle file.

Note that all files inside moduleB will be available to moduleA but files inside moduleA aren't available to moduleB

be sure to declare your modules in settings.gradle

include ':moduleA'

include ':moduleB'

如何将模块访问Android的另一个模块

鼻尖触碰 2025-02-17 15:56:36

您可以通过重置索引来完成:

np.random.seed(42)
df2=pd.DataFrame(np.random.randint(1,10, 10), columns=['numbers'])
df2=df2.sort_values('numbers').reset_index(drop=True)
#reset indexes
df2.reset_index(inplace=True)
#put value of new indexes (+1) in ord column
df2['ord']=df2['index']+1
#clean index column created
df2.drop(columns='index',inplace=True)

print(df2)

结果:

   numbers  ord
0        3    1
1        4    2
2        4    3
3        5    4
4        5    5
5        7    6
6        7    7
7        7    8
8        8    9
9        8   10

you can do as well by reseting indexes:

np.random.seed(42)
df2=pd.DataFrame(np.random.randint(1,10, 10), columns=['numbers'])
df2=df2.sort_values('numbers').reset_index(drop=True)
#reset indexes
df2.reset_index(inplace=True)
#put value of new indexes (+1) in ord column
df2['ord']=df2['index']+1
#clean index column created
df2.drop(columns='index',inplace=True)

print(df2)

Result:

   numbers  ord
0        3    1
1        4    2
2        4    3
3        5    4
4        5    5
5        7    6
6        7    7
7        7    8
8        8    9
9        8   10

如何根据DataFrame添加基于订单号的Colmun?

鼻尖触碰 2025-02-17 09:36:44

示例数据的

if (!file.exists("HadISST_ice.nc")) { 
     download.file("https://www.metoffice.gov.uk/hadobs/hadisst/data/HadISST_ice.nc.gz","HadISST_ice.nc.gz")
     R.utils:::gunzip("HadISST_ice.nc.gz")
}
library(terra)
hadISST <- rast('HadISST_ice.nc') 

年度平均值(

y <- format(time(hadISST), "%Y")
m <- tapp(hadISST, y, mean)

按年度为最低的三个月值的最低平均值(由于使用用户定义的R函数而需要更长的时间)。我现在看到Cran版本中有一个错误。您可以使用版本1.5-47,可以像This install.packages('Terra',repos ='https://rspatial.r-universe.dev')

f <- function(i) mean(sort(i)[1:3])
m3 <- tapp(hadISST, y, f)

为了使这个更快(如果您有多个内核):

m3 <- tapp(hadISST, y, f, cores=4)

Example data

if (!file.exists("HadISST_ice.nc")) { 
     download.file("https://www.metoffice.gov.uk/hadobs/hadisst/data/HadISST_ice.nc.gz","HadISST_ice.nc.gz")
     R.utils:::gunzip("HadISST_ice.nc.gz")
}
library(terra)
hadISST <- rast('HadISST_ice.nc') 

Annual mean

y <- format(time(hadISST), "%Y")
m <- tapp(hadISST, y, mean)

Mean of the lowest three monthly values by year (this takes much longer because a user-defined R function is used). I now see that there is a bug in the CRAN version. You can instead use version 1.5-47 that you can install like this install.packages('terra', repos='https://rspatial.r-universe.dev').

f <- function(i) mean(sort(i)[1:3])
m3 <- tapp(hadISST, y, f)

To make this faster (if you have multiple cores):

m3 <- tapp(hadISST, y, f, cores=4)

子集栅格砖每年的平均三个月的平均值

鼻尖触碰 2025-02-17 05:53:39

您可以使用for循环遍历数组,并检查所需的选定值列表中的遍历元素:

import numpy as np

a = np.array([1, 2, 3, 4, 5])
nums = [3]

for i in range(len(a)):
    if a[i] in nums:
        pass
    else:
        a[i] = 0
print(a)

output:

[0 0 3 0 0]

You can traverse the array with a for loop and check if the traversed element is in a list of desired selected values:

import numpy as np

a = np.array([1, 2, 3, 4, 5])
nums = [3]

for i in range(len(a)):
    if a[i] in nums:
        pass
    else:
        a[i] = 0
print(a)

Output:

[0 0 3 0 0]

用零替换值

鼻尖触碰 2025-02-16 19:58:23
import os
import time

source = ['/Users/yaroslav_skripnik/notes']

target_dir = '/Users/yaroslav_skripnik/backup'

os.makedirs(target_dir, exist_ok = True)

target = target_dir + os.sep + time.strftime('%Y%m%d%H%M%S') + '.zip'

zip_command = "zip -qr {0} {1}".format(target, ' '.join(source))

if os.system(zip_command) == 0:
    print("SUCCESS", target)
else:
    print("NOPE")
  • There was a spacing issue with the zip_command
  • Maybe the error was because target_dir does not exist in the file system. So I've added an os.makedirs which will create the directory is it does not exist already.
import os
import time

source = ['/Users/yaroslav_skripnik/notes']

target_dir = '/Users/yaroslav_skripnik/backup'

os.makedirs(target_dir, exist_ok = True)

target = target_dir + os.sep + time.strftime('%Y%m%d%H%M%S') + '.zip'

zip_command = "zip -qr {0} {1}".format(target, ' '.join(source))

if os.system(zip_command) == 0:
    print("SUCCESS", target)
else:
    print("NOPE")

如何在Python的OSX上创建正确的备份路径?

鼻尖触碰 2025-02-16 14:44:18

否。由于Counter()返回一个字符串,并且您无法将字符串解析为CSS中的一个数字。通过拥有的P元素的数量,更新的唯一方法是,如果您添加很多

...    
   p:nth-child(20){
     --color-rgb: 60; 
   }
...

No. Since counter() returns a string, and you cannot parse a string to a number in CSS. The only way to update your --color_rgb by the number of p elements you have is if you add a lot of

...    
   p:nth-child(20){
     --color-rgb: 60; 
   }
...

如何仅在CSS中动态更改CSS变量的值?是否可以?

鼻尖触碰 2025-02-16 09:40:45

您正在追随函数函数超负荷情况将像这样实现:

function test(a: number, b: number): number;
function test(a: string): string;

function test(...args: any[]): string | number {
  // implementation based on args
}

在您的IDE中使用类似的呈现 - 请注意1/2表示可能的过载,但是您可以循环:

“在此处输入图像说明”

You're after function overloading, which in your case would be implemented like so:

function test(a: number, b: number): number;
function test(a: string): string;

function test(...args: any[]): string | number {
  // implementation based on args
}

Which presents like this in your IDE - notice the 1/2 to denote the possible overloads, which you can cycle though:

enter image description here

动态类型取决于IDE中的参数数量

鼻尖触碰 2025-02-16 09:04:24

在给定的示例中,您的要求尚不清楚。
我给出了一个负距离以关闭按钮,并将其放在行的尽头。这是您要实现的目标。

.basket-row {
    display: grid;
    grid-gap: 16px;
    grid-template-columns: 70px 1fr;
    border-bottom: 1px solid #ebe5e8;
    padding: 16px;
}
.basket-row .basket-image {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.checkout .basket-row .basket-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
}
.checkout .basket-row .basket-content .title {
    grid-column: 1 / span 2;
}
.basket-row .title {
    grid-template-columns: 1fr 28px;
}

.basket-row .stock {
    display: flex;
    column-gap: 6px;
    padding: 10px 0;
}
.close-wrapper{
  text-align:right;
}
.close-wrapper{
  margin-right:-12px;
}
.basket-row{
  background:yellow;
}
.basket-content,.basket-image{
  background:#e4e4e4;
}
display: grid;
    grid-template-columns: 3fr 1fr;
    column-gap: 8px;
}
<link href="https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet"/>
<link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet"/>
<div class="basket-row">
        <div class="basket-image">
 <img src="@url" />
            }
        </div>
      
        <div class="basket-content">
          <div class="close-wrapper">
        <a href="#"
               class="icon icon-small icon-remove">
                </a>
                </div>
            <div class="title">
               <span>Jane Austen - I'm a very long title, aka product name</span>
            </div>

            <div class="stock grid-stock">
                <i class="icon icon-small icon-status-green"></i>
                In warehouse
            </div>

            <div class="basket-buttons input-group">
                <div class="quantity-group">
                    <span>@price</span>

                    <div class="quantity">
                        <a href="#"
                       class="button">
                            <i class="icon icon-small icon-subtract"></i>
                        </a>

                        <input type="text"
                           value="@quanity"
                           class="input" />

                        <a href="#">
                            <i class="icon icon-small icon-add"></i>
                        </a>
                    </div>
                </div>
                <div class="price">
                   50 EU
                </div>
            </div>
        </div>
    </div>

<div class="close-wrapper">
  <a href="#" class="icon icon-small icon-remove"></a>
</div>

.close-wrapper{
  text-align:right;
}
.close-wrapper{
  margin-right:-12px;
}

这是我在您的代码中添加的两个更改。黄色背景是行,灰色背景是列。
如果这不是您要实现的目标,请清楚地了解设计。

Your requirement is not clear in the given example.
I had given a minus margin to close button and placed it to end of row.Is this what you are trying to achieve.

.basket-row {
    display: grid;
    grid-gap: 16px;
    grid-template-columns: 70px 1fr;
    border-bottom: 1px solid #ebe5e8;
    padding: 16px;
}
.basket-row .basket-image {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.checkout .basket-row .basket-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
}
.checkout .basket-row .basket-content .title {
    grid-column: 1 / span 2;
}
.basket-row .title {
    grid-template-columns: 1fr 28px;
}

.basket-row .stock {
    display: flex;
    column-gap: 6px;
    padding: 10px 0;
}
.close-wrapper{
  text-align:right;
}
.close-wrapper{
  margin-right:-12px;
}
.basket-row{
  background:yellow;
}
.basket-content,.basket-image{
  background:#e4e4e4;
}
display: grid;
    grid-template-columns: 3fr 1fr;
    column-gap: 8px;
}
<link href="https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet"/>
<link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet"/>
<div class="basket-row">
        <div class="basket-image">
 <img src="@url" />
            }
        </div>
      
        <div class="basket-content">
          <div class="close-wrapper">
        <a href="#"
               class="icon icon-small icon-remove">
                </a>
                </div>
            <div class="title">
               <span>Jane Austen - I'm a very long title, aka product name</span>
            </div>

            <div class="stock grid-stock">
                <i class="icon icon-small icon-status-green"></i>
                In warehouse
            </div>

            <div class="basket-buttons input-group">
                <div class="quantity-group">
                    <span>@price</span>

                    <div class="quantity">
                        <a href="#"
                       class="button">
                            <i class="icon icon-small icon-subtract"></i>
                        </a>

                        <input type="text"
                           value="@quanity"
                           class="input" />

                        <a href="#">
                            <i class="icon icon-small icon-add"></i>
                        </a>
                    </div>
                </div>
                <div class="price">
                   50 EU
                </div>
            </div>
        </div>
    </div>

<div class="close-wrapper">
  <a href="#" class="icon icon-small icon-remove"></a>
</div>

.close-wrapper{
  text-align:right;
}
.close-wrapper{
  margin-right:-12px;
}

These are the two changes i had added to your code. yellow background is the row and grey backgrounds are the columns.
If this is not what you are trying to achieve then please give a clear view of the design.

将网格的第一项放在行末尾?

鼻尖触碰 2025-02-16 03:05:40

查看霓虹灯内在搜索作为有用的指南,然后车道乘以(另一个向量寄存器的车道)以获取标量值:
FMUL VD.4S,VN.4S,VM.S [LANE]

Looking at Neon intrinsics search, as a useful guide, and then lane multiply (lane of another vector register) to get the scalar value:
FMUL Vd.4S,Vn.4S,Vm.S[lane]

霓虹灯:用标量值执行矢量乘法

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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