煮酒

文章 评论 浏览 27

煮酒 2025-02-20 04:29:22

这是如何做的:
首先,安装Google-Signin软件包,进行必要的设置更改:
@react-native-native-google-google-signin/google-signin/google-signin

一次确定您已经完成了配置,可以执行如下所示:

 try {
      await GoogleSignin.hasPlayServices();
      await GoogleSignin.signIn();
      const { accessToken } = await GoogleSignin.getTokens();
      const resp = await axios.get(`/auth/google/callback?access_token=${accessToken}`);
      if (resp.status !== 200) {
        //Handle fail case
        return;
      }

      const data = resp.data
      // Handle the data and do your stuff like navigate to the home screen.
    } catch (error: any) {
      if (error.code === statusCodes.SIGN_IN_CANCELLED) {
        // user cancelled the login flow
      } else if (error.code === statusCodes.IN_PROGRESS) {
        // operation (e.g. sign in) is in progress already
      } else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
        // play services not available or outdated
      } else {
        // some other error happened
      }
    }

Here is how to do it:
First of all, install google-signin package and do the necessary setup changes:
@react-native-google-signin/google-signin

Once you are sure that you have finished the configuration, you can perform login like below:

 try {
      await GoogleSignin.hasPlayServices();
      await GoogleSignin.signIn();
      const { accessToken } = await GoogleSignin.getTokens();
      const resp = await axios.get(`/auth/google/callback?access_token=${accessToken}`);
      if (resp.status !== 200) {
        //Handle fail case
        return;
      }

      const data = resp.data
      // Handle the data and do your stuff like navigate to the home screen.
    } catch (error: any) {
      if (error.code === statusCodes.SIGN_IN_CANCELLED) {
        // user cancelled the login flow
      } else if (error.code === statusCodes.IN_PROGRESS) {
        // operation (e.g. sign in) is in progress already
      } else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
        // play services not available or outdated
      } else {
        // some other error happened
      }
    }

使用Strapi的Google ReactNative App中的Google登录

煮酒 2025-02-20 02:39:48

我找到了一个与TROIS和NUXT 3进行测试的回购,可能已经过时了,也许有些API已更改,但是如果您想检查一下: alvarosabu/nuxt3-trois

另外,Trois作者还有一个官方回购,其中有一个NUXT 3自定义插件(也可能已经过时)在这里 a>

I found a repo with some testing with Trois and Nuxt 3, probably outdated and maybe some apis have changed, but if you wanna check it out: alvarosabu/nuxt3-trois

Also, there's an official repo from the Trois author with a Nuxt 3 custom plugin (probably outdated too) here

如何在NUXT 3项目中使用troisjs

煮酒 2025-02-19 03:04:42

如果您已将切片分配给变量并想要使用以下变量设置:

df2 = df[df['A'] > 2]
df2['B'] = value

并且您不想使用 jeff的解决方案” ,因为您的条件计算 df2 是长期或出于某些其他原因,因此您可以使用以下内容:

df.loc[df2.index.tolist(), 'B'] = value

<代码> df2.index.tolist()返回DF2中所有条目的索引,然后将其用于在原始DataFrame中设置B列。

If you have assigned the slice to a variable and want to set using the variable as in the following:

df2 = df[df['A'] > 2]
df2['B'] = value

And you do not want to use Jeff's solution, because your condition computing df2 is to long or for some other reason, then you can use the following:

df.loc[df2.index.tolist(), 'B'] = value

df2.index.tolist() returns the indices from all entries in df2, which will then be used to set column B in the original dataframe.

如何处理熊猫的withcopywarning

煮酒 2025-02-18 18:19:13

mainActivity 中添加一个公共功能,该功能从 fragmentOne 添加到 fragmenttwo 然后获取 mainActivity in fragmentOne 代码>并调用该函数,因此您的代码 fragmentOne 应该看起来像这样:

(requireActivity() as AuthActivity).navigateFromFragmentAToFragmentB()

在您的活动中,您需要创建名为 nave navefromfragmentatofragmentb 的公共函数,该函数将从 fragmentone <代码> fragmenttwo

add a public function in MainActivity that navigate from FragmentOne to FragmentTwo then get MainActivity in FragmentOne and call that function, so your code in FragmentOne should look like this:

(requireActivity() as AuthActivity).navigateFromFragmentAToFragmentB()

And in your activity you need to create that public function named navigateFromFragmentAToFragmentB that will navigate from FragmentOne to FragmentTwo

如何从fragmenta类中从fragmenta到fragmentB?

煮酒 2025-02-18 16:15:44

对于聚集聚类,添加其他数据点需要重新计算簇,因为这种类型的聚类的工作方式。聚集聚类迭代基于起始点构建簇,然后根据链接度量合并,因此添加新的数据点可以并且将修改最终簇。

...
cluster_model.fit_predict(distance_matrix)

df['label'] = cluster_model.labels_

查看 fit_predict ,这与无监督或托管估计器更相关。

输出:

     sepal length (cm)  sepal width (cm)  petal length (cm)  petal width (cm)  target     target_name  iris_setosa  iris_versicolor  iris_virginica  label
0                  5.1               3.5                1.4               0.2       0     iris-setosa            1                0               0      1
1                  4.9               3.0                1.4               0.2       0     iris-setosa            1                0               0      1
2                  4.7               3.2                1.3               0.2       0     iris-setosa            1                0               0      1
3                  4.6               3.1                1.5               0.2       0     iris-setosa            1                0               0      1
4                  5.0               3.6                1.4               0.2       0     iris-setosa            1                0               0      1
..                 ...               ...                ...               ...     ...             ...          ...              ...             ...    ...
145                6.7               3.0                5.2               2.3       2  iris-virginica            0                0               1      2
146                6.3               2.5                5.0               1.9       2  iris-virginica            0                0               1      2
147                6.5               3.0                5.2               2.0       2  iris-virginica            0                0               1      2
148                6.2               3.4                5.4               2.3       2  iris-virginica            0                0               1      2
149                5.9               3.0                5.1               1.8       2  iris-virginica            0                0               1      2

For Agglomerative Clustering, adding additional data points requires a recompute of the clusters because of how this type of clustering works. Agglomerative Clustering iteratively builds clusters based on started points, and then merges according to a linkage measure, so adding new data points can and will modify the final clusters.

...
cluster_model.fit_predict(distance_matrix)

df['label'] = cluster_model.labels_

Check out fit_predict, which is more relevant for unsupervised or transductive estimators.

output:

     sepal length (cm)  sepal width (cm)  petal length (cm)  petal width (cm)  target     target_name  iris_setosa  iris_versicolor  iris_virginica  label
0                  5.1               3.5                1.4               0.2       0     iris-setosa            1                0               0      1
1                  4.9               3.0                1.4               0.2       0     iris-setosa            1                0               0      1
2                  4.7               3.2                1.3               0.2       0     iris-setosa            1                0               0      1
3                  4.6               3.1                1.5               0.2       0     iris-setosa            1                0               0      1
4                  5.0               3.6                1.4               0.2       0     iris-setosa            1                0               0      1
..                 ...               ...                ...               ...     ...             ...          ...              ...             ...    ...
145                6.7               3.0                5.2               2.3       2  iris-virginica            0                0               1      2
146                6.3               2.5                5.0               1.9       2  iris-virginica            0                0               1      2
147                6.5               3.0                5.2               2.0       2  iris-virginica            0                0               1      2
148                6.2               3.4                5.4               2.3       2  iris-virginica            0                0               1      2
149                5.9               3.0                5.1               1.8       2  iris-virginica            0                0               1      2

Python聚类软件包,可以基于距离矩阵的聚类,但也可以预测新行(没有新的群集/距离矩阵)

煮酒 2025-02-18 08:52:49

好吧,简单地说:

您正在尝试访问未创建或当前未在内存中的对象。

因此,如何解决此问题:

  1. 调试并让调试器中断...它将直接带您进入损坏的变量...现在您的任务就是简单地解决此问题。.使用 new new 在适当位置的关键字。

  2. 如果它是在某些数据库命令上引起的,因为该对象不存在,那么您需要做的就是进行null检查并处理:

     如果(i == null){
        //处理这个
    }
     
  3. 最难的一个..如果 gc 已经收集了该对象...如果您想使用字符串找到一个对象,则通常会发生这种情况...也就是说,通过对象的名称找到它,那么GC可能已经将其清除了...这很难找到和将成为一个很大的问题...解决此问题的更好方法是在开发过程中必要的任何地方进行零检查。这将为您节省很多时间。

通过名称查找,我的意思是某个框架允许您使用字符串查找对象,并且代码可能看起来像: findObject(“ objectName”);

Well, in simple terms:

You are trying to access an object that isn't created or currently not in memory.

So how to tackle this:

  1. Debug and let the debugger break... It will directly take you to the variable that is broken... Now your task is to simply fix this.. Using the new keyword in the appropriate place.

  2. If it is caused on some database commands because the object isn't present then all you need to do is do a null check and handle it:

    if (i == null) {
        // Handle this
    }
    
  3. The hardest one .. if the GC collected the object already... This generally occurs if you are trying to find an object using strings... That is, finding it by name of the object then it may happen that the GC might already cleaned it up... This is hard to find and will become quite a problem... A better way to tackle this is do null checks wherever necessary during the development process. This will save you a lot of time.

By finding by name I mean some framework allow you to FIndObjects using strings and the code might look like this: FindObject("ObjectName");

什么是NullReferenceException,我该如何修复?

煮酒 2025-02-18 08:07:45

这是因为您尝试登录(请求,用户)即使 authenticate 返回 none 而不是用户 object。最简单的修复是:

if not user:
    # render/redirect as you please - user=None means that given credentials didn't pass to any User
else:
    login(request, user)

It is because you try to login(request, user) even if authenticate returns None instead of User object. Simpliest fix is:

if not user:
    # render/redirect as you please - user=None means that given credentials didn't pass to any User
else:
    login(request, user)

attributeError at /&#x27; anonymoususer&#x27;对象没有属性&#x27; _Meta&#x27;

煮酒 2025-02-18 06:43:16

回答我自己的问题:

在这种情况下,我不知道控制台为什么保持空白/死亡,但是相关的代码在这里:

https://github.com/u-boot/u-boot/u-boot/u-boot/boot/boot/boot/blob/master/board/board/xilinx/zynqmp/zynqmp/zynqmp-. .c#l850

根据此 switch 语句,当启动模式为 sd_mode 时,情况不考虑 config_env_is_in_in_spi_flash ,因此该功能返回 envl_nowhere 使用 config_env_is_in_fat <​​/code> disabled从SD启动时。

修改此函数以返回 envl_spi_flash 在这种情况下,启用u-boot访问qspi flash中的环境:

    case SD_MODE1:
        if (IS_ENABLED(CONFIG_ENV_IS_IN_FAT))
            return ENVL_FAT;
        if (IS_ENABLED(CONFIG_ENV_IS_IN_EXT4))
            return ENVL_EXT4;
++      if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH))
++          return ENVL_SPI_FLASH;
        return ENVL_NOWHERE;

Answering my own question:

I do not know why the console remains blank/dead in this case, but the related code is this function here:

https://github.com/u-boot/u-boot/blob/master/board/xilinx/zynqmp/zynqmp.c#L850

According to this switch statement, when the boot mode is SD_MODE, the case does not consider CONFIG_ENV_IS_IN_SPI_FLASH at all, and therefore the function returns ENVL_NOWHERE when booted from SD with CONFIG_ENV_IS_IN_FAT disabled.

Modifying this function to return ENVL_SPI_FLASH in this case enables U-Boot access to the Environment in the QSPI Flash:

    case SD_MODE1:
        if (IS_ENABLED(CONFIG_ENV_IS_IN_FAT))
            return ENVL_FAT;
        if (IS_ENABLED(CONFIG_ENV_IS_IN_EXT4))
            return ENVL_EXT4;
++      if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH))
++          return ENVL_SPI_FLASH;
        return ENVL_NOWHERE;

U-Boot:如何从SD卡加载U-Boot,但是是否从QSPI Flash加载环境?

煮酒 2025-02-18 04:34:50

问题在于嵌套,我正在接受具有以下结构的数据:

$rules = [
   'userDetails' => ['required', 'array'],
   'userDetails.firstName' => ['required', 'string'],
   'userDetails.lastName' => ['required', 'string']
]

userDetails 数组中未经过滤的任何内容,通过删除'userDetails'=&gt; ['必需','array'] 来自验证规则。

看来无需使用 array 验证

The problem was in nesting, I was accepting data with following structure:

$rules = [
   'userDetails' => ['required', 'array'],
   'userDetails.firstName' => ['required', 'string'],
   'userDetails.lastName' => ['required', 'string']
]

And whatever was passed in userDetails array was not being filtered, fixed by removing 'userDetails' => ['required', 'array'] from validation rules.

Looks like there's no need to use array validation

$ request-&gt;已验证()返回不仅已验证的项目,而且还返回所有内容

煮酒 2025-02-18 01:45:16

基于替换的另一个可能的解决方案:

example$count <- replace(example$count, is.na(example$count), example2$count)
example

#>    count
#> 1      1
#> 2      3
#> 3      4
#> 4      7
#> 5      8
#> 6      8
#> 7      9
#> 8      0
#> 9      4
#> 10     6
#> 11     7
#> 12     5
#> 13     8
#> 14     7

Another possible solution, based on replace:

example$count <- replace(example$count, is.na(example$count), example2$count)
example

#>    count
#> 1      1
#> 2      3
#> 3      4
#> 4      7
#> 5      8
#> 6      8
#> 7      9
#> 8      0
#> 9      4
#> 10     6
#> 11     7
#> 12     5
#> 13     8
#> 14     7

如何在数据框架的一列中替换Na值,并用不同的数据框中的列中的值替换值?

煮酒 2025-02-17 18:53:26

这是双向数据绑定商店概念在许多新的JavaScript框架中使用的地方之一,这对您来说非常有用...

因此,如果您使用< a href =“ https://en.wikipedia.org/wiki/angular_(web_framework)” rel =“ noreferrer”> angular , react 或任何其他进行双向数据绑定或存储概念的框架,此问题简单地解决了您,因此,简单的单词是不确定的在第一阶段,因此您在收到数据之前就已经得到 result = undefined ,然后一旦获得结果,它将被更新并分配给新的重视您的Ajax调用的哪个响应...

但是您如何在纯JavaScript或JQuery中进行此响应,例如您在此问题中所要求的?

您可以使用回调,承诺并最近可观察到为您处理。例如,在承诺中,我们具有一些功能,例如 success() then(),当您的数据准备就绪时将执行。可观察到的回调或 subscribe 函数相同。

例如,在您正在使用jQuery的情况下,您可以做类似的事情:

$(document).ready(function(){
    function foo() {
        $.ajax({url: "api/data", success: function(data){
            fooDone(data); // After we have data, we pass it to fooDone
        }});
    };

    function fooDone(data) {
        console.log(data); // fooDone has the data and console.log it
    };

    foo(); // The call happens here
});

有关更多信息,研究承诺和观察物是做这种异步工作的新方法。

This is one of the places which two-way data binding or store concept that's used in many new JavaScript frameworks will work great for you...

So if you are using Angular, React, or any other frameworks which do two-way data binding or store concept, this issue is simply fixed for you, so in easy words, your result is undefined at the first stage, so you have got result = undefined before you receive the data, then as soon as you get the result, it will be updated and get assigned to the new value which response of your Ajax call...

But how you can do it in pure JavaScript or jQuery for example as you asked in this question?

You can use a callback, promise and recently observable to handle it for you. For example, in promises we have some function like success() or then() which will be executed when your data is ready for you. The same with callback or the subscribe function on an observable.

For example, in your case which you are using jQuery, you can do something like this:

$(document).ready(function(){
    function foo() {
        $.ajax({url: "api/data", success: function(data){
            fooDone(data); // After we have data, we pass it to fooDone
        }});
    };

    function fooDone(data) {
        console.log(data); // fooDone has the data and console.log it
    };

    foo(); // The call happens here
});

For more information, study promises and observables which are newer ways to do this async stuff.

如何从异步电话中返回响应?

煮酒 2025-02-17 11:49:36

使用DAL/APEX工具包,没有API功能可以在模板中预览文档。但是,如果基于此模板构建的草稿状态已发送一个信封,则可以使用API​​函数“ getEnderviewurl”预览信封。
如果您有兴趣,请参考文档:

With DAL/Apex toolkit, there is no API function allowing to preview a document inside a template. However if an envelope was already sent in draft state, built based on this template, you can preview the envelope with the API function "getSenderViewUrl".
If you're interested, please refer to the documentation: https://developers.docusign.com/docs/salesforce/apex-toolkit-reference/envelopeservice.html

Salesforce-记录页面上的DocuSign预览按钮

煮酒 2025-02-17 08:56:28

您需要指定属性 paper 对象的head ,并且不要忘记在末尾使用(s)命名 papers ,因为它是一个数组包含许多 paper

{Papers.map((Paper) => (
  <div className='news-papper' dangerouslySetInnerHTML={{__html: Paper.Head}}/>
))}

ps: papers 不以json的格式,它是对象的数组
JS。

You need to specify the property Head of Paper object, and don't forget to name the array Papers with (s) at the end, since it'is an array contains many Paper.

{Papers.map((Paper) => (
  <div className='news-papper' dangerouslySetInnerHTML={{__html: Paper.Head}}/>
))}

PS: Papers's not in format JSON, instead it is an array of object in
JS.

React-JS中的JSON数据打印问题

煮酒 2025-02-17 07:00:19

好的,因此问题通过将更新功能(由Firebase提供的一个)包装到我的情况下

auth.currentUser.reload().then(() => { /* update profile function here */ })

或在我的情况下通过: -

 const updateUserProfile = () => {
    auth.currentUser.reload().then(() => {
      updateProfile(auth.currentUser, {
        displayName: name,
      })
        .then(() => {
          console.log("profile Updated" + name + " " + email);
        })
        .catch((error) => {
          console.log(error + "In update profile");
        });
      updateEmailUser();
    });
  };

Okay So the problem got resolved gust by wrapping updateProfile function(one provided by firebase) into

auth.currentUser.reload().then(() => { /* update profile function here */ })

Or In my case :-

 const updateUserProfile = () => {
    auth.currentUser.reload().then(() => {
      updateProfile(auth.currentUser, {
        displayName: name,
      })
        .then(() => {
          console.log("profile Updated" + name + " " + email);
        })
        .catch((error) => {
          console.log(error + "In update profile");
        });
      updateEmailUser();
    });
  };

FirebaseError:firebase:错误(Auth/用户指定)

煮酒 2025-02-17 02:11:42

我通过 go_router )的实现解决了这一问题。结合 state.queryparams router.neglect(context,()=&gt; context.go('/?k = $ myoriginalParam'))(来自任何想要回到没有浏览器返回按钮历史记录的原始路线的页面,我可以成功保留浏览器栏中的查询参数。

I resolved this via the implementation of go_router. With the combination of state.queryParams and Router.neglect(context, () => context.go('/?k=$myOriginalParam')) (from any pages that wanted to go back to the original route with no browser back button history), I can retain the query parameter in the browser bar successfully.

在初始加载时删除了flutter Web URL查询参数

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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