止于盛夏

文章 评论 浏览 30

止于盛夏 2025-02-16 01:55:28

(现代)XSLT方法(XSLT 2及更高版本,可与SaxOnc的Python API一起使用)

<!DOCTYPE printArtifactGroup [<!ENTITY ndash "–">]>
<group>
   <begin>
      <head>
         <text>(VOLS 0200)</text>
      </head>
      <data>
         <text>Health 161–1 to 16–32–End 2006</text>
      </data>
   </begin>
</group>

,然后将使用XSL:pracem-map,例如

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="3.0"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                exclude-result-prefixes="#all">

    <xsl:character-map name="characters-to-entities">
      <xsl:output-character character="–" string="&ndash;"/> 
    </xsl:character-map>
        
    <xsl:output use-character-maps="characters-to-entities"/>
    
    <xsl:mode on-no-match="shallow-copy"/>

</xsl:stylesheet>

那样text text 元素作为Eg &lt; text&gt; health 161&amp; ndash; 1至16&amp; ndash; 32&amp; ndash; end 2006&lt;/text&gt;

(注意:我仅介绍了实体/角色映射问题,我没有尝试在该示例中实现您的转换的另一部分)。

The (modern) XSLT way (XSLT 2 and later, available to Python with the Python API of SaxonC) would to use

<!DOCTYPE printArtifactGroup [<!ENTITY ndash "–">]>
<group>
   <begin>
      <head>
         <text>(VOLS 0200)</text>
      </head>
      <data>
         <text>Health 161–1 to 16–32–End 2006</text>
      </data>
   </begin>
</group>

and then an xsl:character-map e.g.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="3.0"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                exclude-result-prefixes="#all">

    <xsl:character-map name="characters-to-entities">
      <xsl:output-character character="–" string="&ndash;"/> 
    </xsl:character-map>
        
    <xsl:output use-character-maps="characters-to-entities"/>
    
    <xsl:mode on-no-match="shallow-copy"/>

</xsl:stylesheet>

That way the text element is output as e.g. <text>Health 161–1 to 16–32–End 2006</text>.

(Note: I have solely presented the entity/character map issue, I have not tried to implement the other part of your transformation in that sample).

如何保留诸如&amp; ndash之类的自定义实体;在使用XSLT转换XML的同时

止于盛夏 2025-02-16 00:42:01

我不知道我在idtokenstring参数中必须通过什么,在这种情况下我是否必须通过用户的访问令牌?

不,您将ID令牌作为方法表示。

GoogleIdTokenVerifier.java#l163

   /**
   * Verifies that the given ID token is valid using the cached public keys.
   *
   * <p>It verifies:
   *
   * <ul>
   *   <li>The RS256 signature, which uses RSA and SHA-256 based on the public keys downloaded from
   *       the public certificate endpoint.
   *   <li>The current time against the issued at and expiration time (allowing for a 5 minute clock
   *       skew).
   *   <li>The issuer is {@code "accounts.google.com"} or {@code "https://accounts.google.com"}.
   * </ul>
   *
   * @param googleIdToken Google ID token
   * @return {@code true} if verified successfully or {@code false} if failed
   */

该方法采用Google ID令牌。

id_token是身份验证&gt的结果;签名请求。使用OpenID Connect。

访问令牌是使用OAuth2的授权请求的结果。

如果您想在用户授权您的应用程序访问其配置文件数据后使用访问令牌获取用户配置文件数据。您会想到人们API。

如果要验证对用户的验证,则使用ID令牌使用googleIdTokenVerifier.builder 并通过身份验证响应传递ID令牌。

我怀疑您正在混淆两件事。身份验证(ID令牌)和授权(访问令牌)。

I have no idea what I have to pass in the idTokenString parameter, Whether I have to pass Access Token of the user in this case?

No you pass the id token as the method states.

GoogleIdTokenVerifier.java#L163

   /**
   * Verifies that the given ID token is valid using the cached public keys.
   *
   * <p>It verifies:
   *
   * <ul>
   *   <li>The RS256 signature, which uses RSA and SHA-256 based on the public keys downloaded from
   *       the public certificate endpoint.
   *   <li>The current time against the issued at and expiration time (allowing for a 5 minute clock
   *       skew).
   *   <li>The issuer is {@code "accounts.google.com"} or {@code "https://accounts.google.com"}.
   * </ul>
   *
   * @param googleIdToken Google ID token
   * @return {@code true} if verified successfully or {@code false} if failed
   */

The method takes a google Id token.

An id_token is the result of a authentication > signin request. using openid connect.

An access token is the result of an authorization request using OAuth2.

If you want to get user profile data with an access token after a user has authorized your application to access their profile data. You would go thought the people api.

If you want to verify your authencation of the user you use the id token use GoogleIdTokenVerifier.Builder and pass the id token from the authentication response.

I suspect you are confusing two different things. authentication (id token) and authorization (access token).

如何使用AccessToken(Tokenid)获取用户配置文件详细信息?

止于盛夏 2025-02-15 23:06:28

在将PubSpec.yaml文件从一个项目中复制到另一个项目后,我遇到了这个问题。宣布了一个或多个资产,但资源不在项目中。

assets:
    - assets/images/logo.png
    - assets/images/user.png #this file was not in the project

将资源添加到指定的路径或删除声明可以解决该问题。

I encountered this issue after copying the pubspec.yaml file manually from one project to another. One or more assets were declared, but the resource was not in the project.

assets:
    - assets/images/logo.png
    - assets/images/user.png #this file was not in the project

Adding the resource to the specified path or removing the declaration fixes the issue.

请求但没有使用标识符xcode.idekit.extensionsentinelhostapplications找到扩展点

止于盛夏 2025-02-15 07:41:02

我在代码上犯了一个错误。我忘了致电recondwith的处理程序:

self.addEventListener(`fetch`, (e: any) => {
    e.respondWith((async () => {
        const r = await caches.match(e.request)
        if (r) {
            return r
        }
        const response = await fetch(e.request)
        const cache = await caches.open(cacheName)
        cache.put(e.request, response.clone())
        return response
    }))
})

正确:

self.addEventListener(`fetch`, (e: any) => {
    e.respondWith((async () => {
        const r = await caches.match(e.request)
        if (r) {
            return r
        }
        const response = await fetch(e.request)
        const cache = await caches.open(cacheName)
        cache.put(e.request, response.clone())
        return response
    })())
})

I made a mistake in code. I forgot to call handler of respondWith:

self.addEventListener(`fetch`, (e: any) => {
    e.respondWith((async () => {
        const r = await caches.match(e.request)
        if (r) {
            return r
        }
        const response = await fetch(e.request)
        const cache = await caches.open(cacheName)
        cache.put(e.request, response.clone())
        return response
    }))
})

Correct:

self.addEventListener(`fetch`, (e: any) => {
    e.respondWith((async () => {
        const r = await caches.match(e.request)
        if (r) {
            return r
        }
        const response = await fetch(e.request)
        const cache = await caches.open(cacheName)
        cache.put(e.request, response.clone())
        return response
    })())
})

不允许加载本地资源:chrome-error://chromewebdata/favicon@2x.png chrome-error:// chromewebdata/

止于盛夏 2025-02-15 06:52:41

仅关注C代码方面,然后可以通过以下方式对其进行琐碎的优化:

ISR(TIM0_COMPB_vect)
{
  static const uint8_t OCR[4] = {63,127,191,255};
  OCR0B = OCR[timing];

  PORTB ^= 1u << PB3;

  timing++;
  if(timing==4)
    timing=0;
}

在GCC AVR -O3上拆卸(所有变量/寄存器),这将指示量从〜50到〜20,所以它的速度约为两倍。并减少记忆。

Focusing solely on the C code aspects, then this can be trivially optimized as:

ISR(TIM0_COMPB_vect)
{
  static const uint8_t OCR[4] = {63,127,191,255};
  OCR0B = OCR[timing];

  PORTB ^= 1u << PB3;

  timing++;
  if(timing==4)
    timing=0;
}

Disassembled on gcc AVR -O3 (with all variables/registers volatile) this brings down the amount of instructions from ~50 to ~20, so it's about twice as fast and takes less memory.

加快AVR ISR

止于盛夏 2025-02-14 17:42:55

我最终这样做:

  "oneOf": [
    {
      "required": ["A"],
      "dependencies": {
        "C": {
          "not": {
            "required": ["D"]
          }
        },
        "D": {
          "not": {
            "required": ["C"]
          }
        }
      }
    },
    {
      "required": ["B"],
      "dependencies": {
        "C": {
          "not": {
            "required": ["D"]
          }
        },
        "D": {
          "not": {
            "required": ["C"]
          }
        }
      }
    }
  ],

I ended up doing this:

  "oneOf": [
    {
      "required": ["A"],
      "dependencies": {
        "C": {
          "not": {
            "required": ["D"]
          }
        },
        "D": {
          "not": {
            "required": ["C"]
          }
        }
      }
    },
    {
      "required": ["B"],
      "dependencies": {
        "C": {
          "not": {
            "required": ["D"]
          }
        },
        "D": {
          "not": {
            "required": ["C"]
          }
        }
      }
    }
  ],

如何在JSON模式中指定一个属性或另一个属性,但并非两者?

止于盛夏 2025-02-14 07:52:02

这是因为您可能正在使用旧版本的URL-JOIN(最新版本是5.0.0)。
对我来说,我使用的是4.0.1的旧版本。
请按照下面的确切步骤进行运行:

const urljoin = require("url-join"); // import via require statement
return urljoin(arrayOfString);

注意:对于 url-join 我们导入urljoin,但对于较旧的所有小字符,即urljoin

希望这有效!

This is because you might be using an older version of url-join (the latest one is 5.0.0).
For me, I was using an older version of 4.0.1.
Follow the exact steps below to make it running:

const urljoin = require("url-join"); // import via require statement
return urljoin(arrayOfString);

Note: For the new version of url-join we import urlJoin but for older its all small characters i.e urljoin.

Hope this works!

获取TypeError:Urljoin不是功能错误

止于盛夏 2025-02-14 05:14:18

这个问题,JavaScript的默认行为用于将浮点数转换为十进制(转换为字符串,用于显示,打印或其他目的),是使用足够的数字来唯一地识别浮动 - 点值。

1000.56 * 10中,发生了两个舍入错误。当1000.56转换为浮点时,第一次发生。当执行乘法时,第二次发生。 100.56 * 10也发生了两个错误。但是,这些错误恰好是部分取消(它们是相反的方向,是代表值恰好在哪里的有效随机结果),结果足够接近1005.6,即JavaScript的算法用于格式化使用“ 1005.6”的结果。

1000.56 * 10中,结果不是最接近10005.6的代表浮点数,因此JavaScript使用了其他数字来区分它。

As explained in this question, JavaScript’s default behavior for converting floating-point numbers to decimal (when converting to a string, for display, printing, or other purposes), is to use just enough digits to uniquely identify the floating-point value.

In 1000.56 * 10, two rounding errors occur. The first occurs when 1000.56 is converted to floating point. The second occurs when the multiplication is performed. Two errors also occur in 100.56 * 10. However, the errors happen to partially cancel (they are in opposite directions, as an effectively random consequence of where representable values happen to lie), and the result is close enough to 1005.6 that JavaScript’s algorithm for formatting used “1005.6” for the result.

In 1000.56 * 10, the result was not the representable floating-point number closest to 10005.6, so JavaScript used additional digits to distinguish it.

十进制乘法JavaScript

止于盛夏 2025-02-14 00:23:14

仅使用预处理器不可用。但是,可能值得一提的是,有一种叫做 x-macro 对于您所询问的内容,您是否不使用预处理器宏。

原因是这里不能使用它是在宏的定义中不能使用#define #code> #include 。

例如,这对于定义this,和 the_other 作为变量的变量是可行的。这将它们作为列表:

// data.def
ELEMENT(this)
ELEMENT(that)
ELEMENT(the_other)

然后在main.cc中:

//main.cc
#define ELEMENT(d) int int_##d = 1;
#include "data.def"
#undef ELEMENT

#define ELEMENT(d) int float_##d = 2.2;
#include "data.def"
#undef ELEMENT

int main() {
  std::cout << "int_this: " << int_this << std::endl;
  std::cout << "int_that: " << int_that << std::endl;
  std::cout << "int_the_other: " << int_the_other << std::endl;
  std::cout << "----------------------------------------------------------"
            << std::endl;
  std::cout << "float_this: " << float_this << std::endl;
  std::cout << "float_that: " << float_that << std::endl;
  std::cout << "float_the_other: " << float_the_other << std::endl;
}

输出:

int_this: 1
int_that: 1
int_the_other: 1
---------------------------------------------------------------
float_this: 2
float_that: 2
float_the_other: 2

但是类似的事情是行不通的,因为您将在另一个宏中定义一个宏:

#define ELEMENT(d) #define DATA d; \
#include "data.def" \
#undef DATA
#undef ELEMENT

This is not doable using preprocessor only. However, it is probably worth mentioning that there is something called X-Macro that could have been used for something close to what you are asking if you weren't using preprocessor macros for each case.

The reason is that it cannot be used here is that you cannot use #define or #include in the definition of a macro.

For example, this is doable for defining this, that and the_other as variables from a file called data.def that has them as a list:

// data.def
ELEMENT(this)
ELEMENT(that)
ELEMENT(the_other)

Then in main.cc:

//main.cc
#define ELEMENT(d) int int_##d = 1;
#include "data.def"
#undef ELEMENT

#define ELEMENT(d) int float_##d = 2.2;
#include "data.def"
#undef ELEMENT

int main() {
  std::cout << "int_this: " << int_this << std::endl;
  std::cout << "int_that: " << int_that << std::endl;
  std::cout << "int_the_other: " << int_the_other << std::endl;
  std::cout << "----------------------------------------------------------"
            << std::endl;
  std::cout << "float_this: " << float_this << std::endl;
  std::cout << "float_that: " << float_that << std::endl;
  std::cout << "float_the_other: " << float_the_other << std::endl;
}

Output:

int_this: 1
int_that: 1
int_the_other: 1
---------------------------------------------------------------
float_this: 2
float_that: 2
float_the_other: 2

But something like this is not going to work because you would be defining a macro in another macro:

#define ELEMENT(d) #define DATA d; \
#include "data.def" \
#undef DATA
#undef ELEMENT

递归在值列表上包含标头文件

止于盛夏 2025-02-13 20:41:58

我用我的数学逻辑做到了

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Static Template</title>
  </head>
  <body>
    <div id="animatedDiv"></div>
  </body>
</html>
<style>
  #animatedDiv {
    background: #dc143c;
    min-height: 9000px;
    width: 100%;
    position: absolute;
  }
</style>

<script>
  var aDiv = document.getElementById("animatedDiv");

  function changeWidth() {
    var scrollVal = window.pageYOffset;

    //Changing CSS Width

/* This lags if you scroll fast.. aDiv.style.width = (100 - (scrollVal*100/800)) + "%"; 
  I just tried it out, so instead use the code down above, 800 to 1500 doesn't matter, I just increased time of animation
*/
//NOTE this line checks if PERCENT <= 10 then sets width to 10%
  ( (100 - (scrollVal*100/1500)) ) <= 10 ? aDiv.style.width = "10%" : aDiv.style.width = (100 - (scrollVal*100/1500)) + "%";
  }

  window.addEventListener(
    "scroll",
    function () {
      requestAnimationFrame(changeWidth);
    },
    false
  );
</script>

I did it with my math logic

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Static Template</title>
  </head>
  <body>
    <div id="animatedDiv"></div>
  </body>
</html>
<style>
  #animatedDiv {
    background: #dc143c;
    min-height: 9000px;
    width: 100%;
    position: absolute;
  }
</style>

<script>
  var aDiv = document.getElementById("animatedDiv");

  function changeWidth() {
    var scrollVal = window.pageYOffset;

    //Changing CSS Width

/* This lags if you scroll fast.. aDiv.style.width = (100 - (scrollVal*100/800)) + "%"; 
  I just tried it out, so instead use the code down above, 800 to 1500 doesn't matter, I just increased time of animation
*/
//NOTE this line checks if PERCENT <= 10 then sets width to 10%
  ( (100 - (scrollVal*100/1500)) ) <= 10 ? aDiv.style.width = "10%" : aDiv.style.width = (100 - (scrollVal*100/1500)) + "%";
  }

  window.addEventListener(
    "scroll",
    function () {
      requestAnimationFrame(changeWidth);
    },
    false
  );
</script>

滚动时使DIV较小

止于盛夏 2025-02-13 14:12:12

问题在于博览会分析片段。

https://github. COM/EXPO/EXPO/BLOB/0D1F072871C9A9F76CA622D3FE5CB48A4BD832D2/packages/packages/expo-analytics-schement/android/build.gradle#l87

api 'com.segment.analytics.android:analytics:4.9.4'

但如果您使用EAS,则仅将其删除。

The issue is with expo-analytics-segment.

https://github.com/expo/expo/blob/0d1f072871c9a9f76ca622d3fe5cb48a4bd832d2/packages/expo-analytics-segment/android/build.gradle#L87

api 'com.segment.analytics.android:analytics:4.9.4'

But this is only removed if you use EAS.

com.sement.analytics.android:Analytics错误在将我的应用提交给Google Play Console时

止于盛夏 2025-02-13 13:09:50

在对象文字中,当将方括号用作钥匙时,它告诉JavaScript,键是括号内变量的值。

前任。:

const key = 'name';

const person = {
  [key] = "John"
}

// Since key is a variable inside squared brackets, 
// javascript will evaluate its value as the key

// Therefore, the `person` object becomes:

{
  'name': 'John'
}

Inside a object literal, when square brackets are used as a key, it tells javascript that the key is the value of the variable inside the brackets.

Ex.:

const key = 'name';

const person = {
  [key] = "John"
}

// Since key is a variable inside squared brackets, 
// javascript will evaluate its value as the key

// Therefore, the `person` object becomes:

{
  'name': 'John'
}

为什么在创建动态状态时使用方括号

止于盛夏 2025-02-13 03:21:25

有几个选项:

缩略图

您可以将小缩略图存储为base64编码字符串或云Firestore中的base64编码字符串。好处是您可以在同一请求中检索配置文件图片。缺点是浏览器将需要做更多的工作来渲染图像。

标准尺寸的图像,

您应该将云存储用于除最小斑点以外的任何其他图像。如果您打算使用云功能使用服务器端渲染,则可以使用客户端JS(从浏览器)直接获取这些(作为JPG或PNG),也可以在响应有效载荷中传递它们。

Firebase的语言支持

云功能当前不支持Python。为了实现基于Python的后端,您需要使用gcloud函数部署每个功能。如果您打算构建SSR应用程序,则可能需要查看使用一个框架,例如Next或NUXT,您可以将其直接与Firebase CLI部署。

There are a couple of options:

Thumbnails

You can store small thumbnails as Base64 encoded strings within the RTDB or Cloud Firestore. The benefit is that you can retrieve the profile picture in the same request. The downside is that the browser will need to do a little more work to render the images.

Standard sized images

You should use Cloud Storage for anything other than the tiniest blobs. You can either fetch these directly (as JPG or PNG) using client-side JS (from the browser) or pass them in your response payload, if you intend to use Server Side Rendering with Cloud Functions.

Language support

Cloud Functions for Firebase do not currently support Python. In order to implement a Python based back-end, you will need to deploy using gcloud functions deploy for each function. If you intend to build a SSR application, you may want to look at using a framework, such as Next or Nuxt, which you can deploy directly with the Firebase CLI.

如何在Google Firebase上存储图像?

止于盛夏 2025-02-12 21:32:26

从技术上讲,您的Get-ChildItem就足以让您知道通过打印完整路径来找到该文件。无论如何,如 Mistersmith 在他的评论中提到,您需要将条件语句放在for for for for for for each-object < /代码>获得预期的结果。

这是我对此的看法:

$filename = 'Myfile.exe'
if (Get-Childitem -Path "C:\", "E:\" -Include $filename -Recurse -OutVariable "Found") {
    Write-Output -InputObject "File exists!"
    #$found.FullName
}
else {
    Write-Output -InputObject "File doesn't exist."
}

利用PowerShell的灵活性,即允许将整个表达式放置在您的内部,如果()语句,这就是您在这里需要的全部。找到文件后,是否输出文件存在,否则就不会说没有。

  • -OutVariable参数允许您将对象保存到变量($找到的),以防稍后需要引用其任何属性。

Technically speaking, your Get-ChildItem alone should suffice to let you know it's found the file by printing it's full path. Anyways, as MisterSmith mentions in his comment, you would need to place your conditional statements inside your Foreach-Object to get your expected result.

Here's my take on this:

$filename = 'Myfile.exe'
if (Get-Childitem -Path "C:\", "E:\" -Include $filename -Recurse -OutVariable "Found") {
    Write-Output -InputObject "File exists!"
    #$found.FullName
}
else {
    Write-Output -InputObject "File doesn't exist."
}

Leveraging PowerShell's flexibility of allowing the entirety of the expression to be placed inside your if() statement, that's all you would need here. Once the file is found, have it output that the file exists, else, say it doesn't.

  • The -OutVariable parameter allows you to save the object to a variable ($found) in case you need to reference any of it's properties later on.

PowerShell搜索文件并显示结果

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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