白芷

文章 评论 浏览 28

白芷 2025-02-20 18:01:28
tibble(
    var=c('dista', 'distb', 'travelTime'),
    rc=2:4) %>% 
    print() %>% 

# A tibble: 3 x 2
#  var           rc
#  <chr>      <int>
#1 dista          2
#2 distb          3
#3 travelTime     4

    group_by(var=str_sub(var, end=4)) %>% 
    print() %>% 

# A tibble: 3 x 2
# Groups:   var [2]
#  var      rc
#  <chr> <int>
#1 dist      2
#2 dist      3
#3 trav      4

    summarise(sum=sum(rc))

# A tibble: 2 x 2
#  var     sum
#  <chr> <int>
#1 dist      5
#2 trav      4
tibble(
    var=c('dista', 'distb', 'travelTime'),
    rc=2:4) %>% 
    print() %>% 

# A tibble: 3 x 2
#  var           rc
#  <chr>      <int>
#1 dista          2
#2 distb          3
#3 travelTime     4

    group_by(var=str_sub(var, end=4)) %>% 
    print() %>% 

# A tibble: 3 x 2
# Groups:   var [2]
#  var      rc
#  <chr> <int>
#1 dist      2
#2 dist      3
#3 trav      4

    summarise(sum=sum(rc))

# A tibble: 2 x 2
#  var     sum
#  <chr> <int>
#1 dist      5
#2 trav      4

总和列基于其他列中的可变名称,该名称包含x,按照相似的字母

白芷 2025-02-20 11:18:27

每次进行新的更改时,您都应该重新阅读文件。

我不具体使用Discord.py,因此,如果我错过了Async Python编程的一些规则,请放弃我。

import json
def reloadJSON():
    with open("your_data.json", "r") as f: # Replace your_data with the file
        return json.loads(f.read())

# Now when you need to reload the file, just call this command like this:
# data = reloadJSON()
# And now, you have your json parsed and stored.

注意:此代码未经测试,因为我目前不能这样做。

You should probably reread the file every time a new change has been made.

I don't use discord.py specifically, so please spare me if I miss some rule with async python programming.

import json
def reloadJSON():
    with open("your_data.json", "r") as f: # Replace your_data with the file
        return json.loads(f.read())

# Now when you need to reload the file, just call this command like this:
# data = reloadJSON()
# And now, you have your json parsed and stored.

Note: This code is untested, as I cannot do so at this time.

Discord Bot-如何在不重新启动程序的情况下进行实时更新JSON文件?

白芷 2025-02-20 06:22:07

“ keytool -list -v \ -alias androiddebugkey -keystore c:\ users \ users \ hp.android

\

debug.keystore

keytool -list -v -keystore {keystore_name} -alias {alias_name}

" keytool -list -v \ -alias androiddebugkey -keystore C:\Users\hp.android\debug.keystore

This command is for only debug

When you publish your app you need to add release SHA-1 and SHA-256

Try this

keytool -list -v -keystore {keystore_name} -alias {alias_name}

我的Flutter App带有Firebase Authentication和Google登录,出版了IAM之后,请看到“无法使用Firebase Authentication”。

白芷 2025-02-20 05:09:31

使用ISINdf2检查序列#,然后将其用作布尔人掩码进行设置status to'Reportering':

df1.loc[df1['serial#'].isin(df2['serial#']), 'Status'] = 'Reporting'
print(df1)

# Output
  serial#          Status
0  AAA111      Compatible
1  BBB222      Compatible
2  CCC333  Not compatible
3  DDD444       Reporting
4  EEE555       Reporting

Use isin to check serial# from df2 then use it as boolean mask to set Status to 'Reporting':

df1.loc[df1['serial#'].isin(df2['serial#']), 'Status'] = 'Reporting'
print(df1)

# Output
  serial#          Status
0  AAA111      Compatible
1  BBB222      Compatible
2  CCC333  Not compatible
3  DDD444       Reporting
4  EEE555       Reporting

Pandas Python Vlookup从两个数据范围过滤数据,并使用此过滤器从特定列中替换数据

白芷 2025-02-19 13:54:19

我认为这是您需要的查询,

WITH cte AS (
    SELECT 
        gid, oid, sid, z,
        ROW_NUMBER() OVER () AS rn
    FROM data
    WHERE LOWER(z) LIKE '%a%'
          OR LOWER(Z) LIKE '%c%'
)
SELECT gid, oid, sid, z FROM cte c
WHERE NOT EXISTS (
    SELECT sid FROM cte t 
    WHERE t.z = c.z
          AND t.sid = c.sid 
          AND t.rn < c.rn
)

我使用row_number能够检查sid> sid值重复。

I think this is the query you need

WITH cte AS (
    SELECT 
        gid, oid, sid, z,
        ROW_NUMBER() OVER () AS rn
    FROM data
    WHERE LOWER(z) LIKE '%a%'
          OR LOWER(Z) LIKE '%c%'
)
SELECT gid, oid, sid, z FROM cte c
WHERE NOT EXISTS (
    SELECT sid FROM cte t 
    WHERE t.z = c.z
          AND t.sid = c.sid 
          AND t.rn < c.rn
)

I use ROW_NUMBER to be able to check if a sid value repeats.

Demo

根据条件SQL过滤记录

白芷 2025-02-19 06:53:48

您正在渲染该功能,因此当状态更新时,重新运行该功能并重置该值。

您可以使用以下方法。
采用代表该领域的一个状态是可以编辑的。并使用输入组件添加条件,仅在字段可编辑时才能呈现。

例如,

const [ISEDIAD,设置可用] = usestate(false);

&lt; button onClick = {()=&gt;设置可(!iSedable)}&gt; edit&lt;/button&gt;

isEditable && (
    <div>
        <input onChange={updateField} value={editfield} />    
    </div>
)

要获得更多想法,只需在返回之前将控制台放在之前。你会得到主意。

希望这有帮助:)

You are rendering that function so when state will updated it re-run that function and resetting the value.

You can use below approach.
Take one state which represents the field is editable or not. And add condition with input component that it should only render when field is editable.

For example,

const [isEditable, setIsEditable] = useState(false);

<button onClick={() => setIsEditable(!isEditable)}>edit</button>

isEditable && (
    <div>
        <input onChange={updateField} value={editfield} />    
    </div>
)

For more idea, just put console before return. You will get idea.

Hope this helps :)

当USESTATE具有默认值时,React Input Onchange而不是重新启动状态

白芷 2025-02-19 03:36:11

看来您对hashrouter与UI的工作方式有轻微的误解。

import { HashRouter as Router, Route, Routes } from "react-router-dom";
import Profile from "./Profile";
import SignUp from "./SignUp";
import Home from "./Home";

export default function App() {
  return (
    <Router>
      <Routes>
        <Route path="/profile" element={<Profile />} />
        <Route path="/signUp" element={<SignUp />} />
        <Route path="/" element={<Home />} />
      </Routes>
    </Router>
  );
}

hashrouter处理带有URL哈希值的路由,即在URL中的所有内容 “#”。如果您试图渲染应用程序并访问“&lt; domain&gt;/“,而不是”&lt; domain&gt;/#/“/#/”路由无法正常工作。

例如,在您的运行代码和盒子演示中,基本URL为“ https://5p7hff.csb.app/”。在此基础网址上,哈希路由器无法真正工作,您应该真正访问“ https://5p7hff.csb.app.app/#/”而不是加载哈希路由器,并加载了应用程序。内部路由可以起作用。

来自“ https://5p7hff.csb.app/#/”您应该导航到任何路由,即 ”

/profile“ 和https://5p7hff.csb.app/#/signup ?fontsize = 14&amp; hidenAvigation = 1&amp; inditialpath =%2f%23%2F&amp; module =%2FSRC%2fapp.js&amp; themp; them = dark“ rel =“ rel =“ nofollow noreferrer” /static/img/play-codesandbox.svg“ alt =”编辑Yound-Dawn-ejyruw“>

如果您切换到其他路由器,例如browserrouter the ,则” /#/“不再使用,路由器和路由从”/“”渲染。应用程序从哪里运行。路由将为“ https:// 5p7hff。 csb.app/“” https://5p7hff.csb.app/profile“” https://5p7hff.csb.app/signup”代码>。

It seems you have a slight misunderstanding of how the HashRouter works with the UI.

import { HashRouter as Router, Route, Routes } from "react-router-dom";
import Profile from "./Profile";
import SignUp from "./SignUp";
import Home from "./Home";

export default function App() {
  return (
    <Router>
      <Routes>
        <Route path="/profile" element={<Profile />} />
        <Route path="/signUp" element={<SignUp />} />
        <Route path="/" element={<Home />} />
      </Routes>
    </Router>
  );
}

The HashRouter handles routing with a URL hash value, i.e. everything after the "#" in the URL. If you are trying to render your app and access "<domain>/" instead of "<domain>/#/" the routing won't work.

For example in your running codesandbox demo, the base URL is "https://5p7hff.csb.app/". At this base URL the hash router isn't really working, and you should really be accessing "https://5p7hff.csb.app/#/" instead so the hash router is loaded and the app's internal routing can work.

From "https://5p7hff.csb.app/#/" you should be to then navigate to any of your routes, i.e. "https://5p7hff.csb.app/#/profile" and https://5p7hff.csb.app/#/signUp".

Edit young-dawn-ejyruw

If you switch to a different router, like the BrowserRouter then the "/#/" is no longer used, the router and routes render from "/" where the app is running from. The routes would be "https://5p7hff.csb.app/", "https://5p7hff.csb.app/profile", and "https://5p7hff.csb.app/signUp".

React Router V6总是渲染“//&quot”

白芷 2025-02-18 04:22:19

来自 executorService#eekingtermination 的Javadocs:

块,直到所有任务完成执行 关闭请求

这意味着等待termination仅在关闭请求后才能使用,因此您需要调用shutdown() 等待()之前。

此外,AS @alexander ivanchenko 的另一个答案提到,设置了0L的超时将不等待任何东西,> code>> > >等待终止指示该线程是否通过返回值终止。如果您的主线程被另一个线程中断,则会抛出InterruptedException

From the Javadocs of ExecutorService#awaitTermination:

Blocks until all tasks have completed execution after a shutdown request

This means that awaitTermination will only work after a shutdown request so you need to call shutdown() before awaitTermination().

Furthermore, as the other answer by @Alexander Ivanchenko mentions, setting a timeout of 0L will not wait for anything and awaitTermination indicates whether the thread terminated in time via a return value. The InterruptedException is thrown if your main thread is interrupted by another thread.

Java executorService.awaitTermination()是否会阻止主线程并等待?

白芷 2025-02-18 02:17:04

字符串变为对象,如果未定义,则显示错误。但这应该做您需要的事情。

df['relations'] = df['relations'].apply(lambda x: list(map(eval,x)))

The string becomes an object and displays an error if is not defined. But it should do what you need.

df['relations'] = df['relations'].apply(lambda x: list(map(eval,x)))

从大熊猫数据框中的字符串列表中删除单语言

白芷 2025-02-17 17:53:01

我可以建议您使用Azure密钥保险库,但并不能回答您的所有要求。
您可以检索密码,但不能从Azure Data Factory的链接服务中检索用户名,这是一个设计限制。
我强烈建议您将密码保存在Azure密钥库中,因为它的安全性很高。

请在Microsoft文档中阅读有关它的更多信息: https://learn.microsoft.com/en-us/azure/data-factory/store-credentials-in-key-vault

i can recommend to you to use Azure Key Vault, but it does not answer all your requirements.
You can retrieve your password but you can't retrieve your username from a linked service in azure data factory, its a design limitation.
i highly recommend saving your password in azure key vault since its highly secured.

please read more about it in Microsoft docs: https://learn.microsoft.com/en-us/azure/data-factory/store-credentials-in-key-vault

添加秘密用户名&amp;密码到数据工厂中的肥皂API调用

白芷 2025-02-17 15:11:36

这里的关键是意识到嵌套数据的每一行都是列表,因此您必须在其上使用列表功能,例如lapply从base r或MAP

这是一个示例,说明如何使用rsample软件包进行分割(75%用于培训)

ChickWeightNest_example<- ChickWeightNest %>%
  mutate(data_split = purrr::map(data,
                       ~rsample::initial_split(.x, prop = .75))) %>%
  mutate(data_training_only= purrr::map(data_split,
                             ~rsample::training(.x)),
         data_testing_only= purrr::map(data_split, 
                             ~rsample::testing(.x))
  )

The key here is realizing that each line of the nested data is a list and so you have to use list functions on it, for example lapply from base R or map from purrr.

Here's an example of how that would work using the rsample package to do the split (75% for training)

ChickWeightNest_example<- ChickWeightNest %>%
  mutate(data_split = purrr::map(data,
                       ~rsample::initial_split(.x, prop = .75))) %>%
  mutate(data_training_only= purrr::map(data_split,
                             ~rsample::training(.x)),
         data_testing_only= purrr::map(data_split, 
                             ~rsample::testing(.x))
  )

如何创建嵌套训练和测试集?

白芷 2025-02-16 17:12:57

这是您的数据:

var data = new[]
{
    new { input = 10.00, expected = 10.50 },
    new { input = 10.10, expected = 10.50 },
    new { input = 10.20, expected = 10.50 },
    new { input = 10.30, expected = 10.50 },
    new { input = 10.40, expected = 10.50 },
    new { input = 10.50, expected = 10.50 },
    new { input = 10.60, expected = 11.00 },
    new { input = 10.70, expected = 11.00 },
    new { input = 10.80, expected = 11.00 },
    new { input = 10.90, expected = 11.00 },
};

汇总到最近的0.5的正常方法是使用Math.ceiling(INPUT * 2.0)/2.0)

我这样做:

var output =
    data
        .Select(x => new
        {
            x.input,
            x.expected,
            actual = Math.Ceiling(x.input * 2.0) / 2.0
        });

那给了我:

net 您的要求。我想知道您是否遇到了这一要求,因为10.5没有围绕?

Here's your data:

var data = new[]
{
    new { input = 10.00, expected = 10.50 },
    new { input = 10.10, expected = 10.50 },
    new { input = 10.20, expected = 10.50 },
    new { input = 10.30, expected = 10.50 },
    new { input = 10.40, expected = 10.50 },
    new { input = 10.50, expected = 10.50 },
    new { input = 10.60, expected = 11.00 },
    new { input = 10.70, expected = 11.00 },
    new { input = 10.80, expected = 11.00 },
    new { input = 10.90, expected = 11.00 },
};

The normal way to round up to the nearest 0.5 is to use Math.Ceiling(input * 2.0) / 2.0).

I would do that this way:

var output =
    data
        .Select(x => new
        {
            x.input,
            x.expected,
            actual = Math.Ceiling(x.input * 2.0) / 2.0
        });

That gives me:

output

I do note that 10 stays as 10 instead of 10.5 as per your requirement. I wonder if you got that requirement wrong since 10.5 doesn't round up?

我该如何圆形到最近的0.5

白芷 2025-02-16 16:52:21

我已经在程序的开头设置了种子:

import numpy as np
import tensorflow as tf
import random as rn
np.random.seed(1)
tf.random.set_seed(2)
rn.seed(3)

但是通过在3行固定之前添加:

import os
os.environ['PYTHONHASHSEED'] = '0'
os.environ['CUDA_VISIBLE_DEVICES'] = ''

它可以解决我的问题。

I had already set the seed at the beginning of the programme with:

import numpy as np
import tensorflow as tf
import random as rn
np.random.seed(1)
tf.random.set_seed(2)
rn.seed(3)

but by adding before the 3 rows of seed fixation:

import os
os.environ['PYTHONHASHSEED'] = '0'
os.environ['CUDA_VISIBLE_DEVICES'] = ''

it resolves my problem.

辍学,recurrent_dropout在LSTM层中

白芷 2025-02-16 15:35:02

您可以像明智的那样做,我称 getTextwidget 方法 childrendelegate 。这将返回您要显示的小部件。我已经通过那里的索引并基于索引,它将设置文本大小。

在Init State中的方法下方的状态小部件调用中添加以下变量

List<int> bigImageIndex = [];

。这里最大计数是项目列表的数量。我已经通过了2000年的测试

void getBigImageIndex(int maxCount){
    bool isBigImagefound = false;
    var additionIndex = 0;
    var nextBigImageIndex = 0;
    var additions = [6, 4, 4, 5, 2];
    bigImageIndex.clear();
    for(int index = 0; index < maxCount; index++){
      // print("Index = > $index");
      if(index == nextBigImageIndex){
        print("big image >> $index");
        isBigImagefound = true;
        bigImageIndex.add(index);
      }

      if(isBigImagefound){
        isBigImagefound = false;
        // print("Current big image index >> $nextBigImageIndex");
        nextBigImageIndex+=additions[additionIndex];
        // print("Next big image index >> $nextBigImageIndex");
        additionIndex++;
        if(additionIndex >= additions.length){
          additionIndex = 0;
        }
      }
    }
  }

方法将将大图索引添加到BigImageIndex列表中。因此,当您需要检查索引时,是否在大索引列表中。

GridView.custom(
        padding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
        shrinkWrap: true,
        physics: const NeverScrollableScrollPhysics(),
        gridDelegate: SliverQuiltedGridDelegate(
          crossAxisCount: 3,
          mainAxisSpacing: 8,
          crossAxisSpacing: 8,
          pattern: [

            QuiltedGridTile(2, 2),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 3),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 3),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 3),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(2, 2),
            QuiltedGridTile(1, 1),
          ],
        ),
        childrenDelegate: SliverChildBuilderDelegate(
              (context, index) => getTextWidget(index: index),
          childCount: 44,
        ),
      )

Widget getTextWidget({required int index}) {
  return Container(
    color: Color((math.Random().nextDouble() * 0xFFFFFF).toInt())
        .withOpacity(1.0),
    child: Center(
      child: Text(
        "Index: $index",
        style: TextStyle(
            fontSize:
                bigImageIndex.contains(index)
                    ? 19
                    : 12),
      ),
    ),
  );
}

它看起来像下面的东西。



尽管这不能解决您的问题,请分享问题。

You can do it like wise, I have called getTextWidget method in childrenDelegate. Which will return the widget which you want to show. I have pass the index there and based on index, it will set the text size.

Add below variable in state widget

List<int> bigImageIndex = [];

call below method in init state. here max count is number of item list can have. I have passed 2000 for test

void getBigImageIndex(int maxCount){
    bool isBigImagefound = false;
    var additionIndex = 0;
    var nextBigImageIndex = 0;
    var additions = [6, 4, 4, 5, 2];
    bigImageIndex.clear();
    for(int index = 0; index < maxCount; index++){
      // print("Index = > $index");
      if(index == nextBigImageIndex){
        print("big image >> $index");
        isBigImagefound = true;
        bigImageIndex.add(index);
      }

      if(isBigImagefound){
        isBigImagefound = false;
        // print("Current big image index >> $nextBigImageIndex");
        nextBigImageIndex+=additions[additionIndex];
        // print("Next big image index >> $nextBigImageIndex");
        additionIndex++;
        if(additionIndex >= additions.length){
          additionIndex = 0;
        }
      }
    }
  }

Above method will add the big image index to the bigImageIndex list. So when you need to check index is in list of big index or not.

GridView.custom(
        padding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
        shrinkWrap: true,
        physics: const NeverScrollableScrollPhysics(),
        gridDelegate: SliverQuiltedGridDelegate(
          crossAxisCount: 3,
          mainAxisSpacing: 8,
          crossAxisSpacing: 8,
          pattern: [

            QuiltedGridTile(2, 2),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 3),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 3),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 3),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(1, 1),
            QuiltedGridTile(2, 2),
            QuiltedGridTile(1, 1),
          ],
        ),
        childrenDelegate: SliverChildBuilderDelegate(
              (context, index) => getTextWidget(index: index),
          childCount: 44,
        ),
      )

Widget getTextWidget({required int index}) {
  return Container(
    color: Color((math.Random().nextDouble() * 0xFFFFFF).toInt())
        .withOpacity(1.0),
    child: Center(
      child: Text(
        "Index: $index",
        style: TextStyle(
            fontSize:
                bigImageIndex.contains(index)
                    ? 19
                    : 12),
      ),
    ),
  );
}

It will look like something as below.

enter image description here
enter image description here
enter image description here

Though if this doesn't resolve your problem, please share the issue.

如何在交错的网格视图中以不同位置显示不同大小的文本

白芷 2025-02-16 04:20:23

转到您的SDK Manager并更改目录,将新的文件夹名称为文件夹SDK并为您的SDK目录选择它,下载SDK文件应该可以工作
通常会发生此错误,因为目录位于Android Studio的根文件夹中

go to your SDK Manager and change the directory, make a new folder name the folder sdk and select it for your SDK directory, download the sdk file it should work
this error usually occurs because the directory is in the root folder of the android studio

如何修复Android SDK缺失?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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