小编Has*_*ana的帖子

使用webRTC时AVCaptureSession崩溃

我正在使用WebRTC及其使用AVCaptureSession。它可以正常工作几次,但有时会因此异常而崩溃。

断言失败:(_ internal-> figCaptureSession == NULL),功能-[AVCaptureVideoPreviewLayer attachToFigCaptureSession:],文件/BuildRoot/Library/Caches/com.apple.xbs/Sources/EmbeddedAVAVation/EmbeddedAVFoundation-1187.37.2.1/Aspen/AVCaptureVideoPreviewLayer

avcapturesession webrtc

7
推荐指数
1
解决办法
233
查看次数

使用 google geocoding api webservices 进行批处理(寻找更新)

谷歌引用了这个:https : //developers.google.com/maps/documentation/javascript/geocoding

并指出:

每个会话的速率限制会阻止将客户端服务用于批处理请求,例如批处理地理编码。对于批处理请求,请使用地理编码 API Web 服务

但是,当您转到地理编码 API Web 服务页面时,我看不到批处理的参考。上面这句话推断你可以做批处理。我需要发送大量地址来获取纬度和经度,但是对每个地址进行单独调用需要非常长的时间,并且需要一种更有效的方法。希望通过一次批量调用即可发送所有地址。

关于如何在谷歌上批量处理地址以获取纬度和经度的任何想法?

我见过这个Google Batch Geocoding API

但是,它指出您不能,这不是上述 google 声明所推断的。

google-maps google-maps-api-3

7
推荐指数
1
解决办法
2520
查看次数

应用程序启动时不会调用 FirebaseMessagingService

我想使用 FirebaseMessagingService 处理来自服务器的推送通知。onCreate但一开始并没有调用函数。我认为该服务是在应用程序启动时自动初始化的。另外,我开始从 firebase 云消息发送测试通知,但它不起作用。

    class PushNotificationService: FirebaseMessagingService() {
    private lateinit var app: App

    override fun onCreate() {
        super.onCreate()
        App.log("FireBaseMsg: starting service")
        app = application as App
    }

    override fun onMessageReceived(msg: RemoteMessage?) {
        super.onMessageReceived(msg)

        App.log("FireBaseMsg: onMessageReceived")
        val pNotification = msg?.notification
        if (pNotification != null){
            val title = pNotification.title
            val text = pNotification.body

            if (!title.isNullOrEmpty() && !text.isNullOrEmpty()){
                val p = PushNotification(app, NOTIFICATION_CHANNEL_ID_PUSH, title = title, text = text)
                p.fireNotification(NOTIFICATION_ID_PUSH)
            }
        }
    }

    override fun onNewToken(token: String) {
        App.log("FireBaseMsg: Received …
Run Code Online (Sandbox Code Playgroud)

android firebase firebase-cloud-messaging

7
推荐指数
1
解决办法
4010
查看次数

unable to add image to drawble folder in xamarin forms visual studio 2019

解决方案资源管理器的屏幕截图

I am trying to add an image to drawable in xamarin forms app in visual studio 2019 I am getting an error as the system cannot find the path specified.

xamarin.forms

6
推荐指数
1
解决办法
1062
查看次数

React Gatsbyjs 根据纵横比向 gatsby-image 添加类

gatsby-image 使用 gatsby-image-wrapper div 包装每个图像,该 div 填充 100% 的可用视口宽度。这个包装 div 可以很容易地用 CSS 设置样式,但没有办法以不同的方式对待横向、纵向或方形图像。

像这个例子 如果您想让横向图像填充可用宽度的 80%-100%,但让纵向和方形图像填充不超过视口宽度的 40-50%,该怎么办。

所以理想情况下,每个 gatsby-image-wrapper div 都会根据其纵横比添加一个类,要么是;landscapeportraitsquare

一种方法是使用 childImageSharp 附带的纵横比编写一些条件语句:

      edges {
        node {
          name
          childImageSharp {
            fluid(maxWidth: 915, quality: 90) {
              aspectRatio
              ...GatsbyImageSharpFluid_withWebp
            }
          }
        }
      }
Run Code Online (Sandbox Code Playgroud)

当我映射了我所有的画廊图像,我可以抓住的宽高比和使用的className它添加到每个盖茨比形象的方式包装,但它不是在它的原始格式非常有用,因为对于的aspectRatio返回的数据都是相同的数字0.6666666666666666肖像图像或1.5003750937734435为风景。使用上面提到的那些类会更好;landscapeportraitsquare

这就是我如何从当前帖子中获取我的所有图库图片以及它们的aspectRatio.

export default ({ data }) => {
  return (
    <Layout>
      <article>
        {data.allFile.edges.map(({ node }, index) => (
          <div> …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs graphql gatsby

5
推荐指数
1
解决办法
1620
查看次数

如何在循环内将大对象复制到omp任务?

我正在使用while循环来启动几个omp任务。每个任务都需要复制一个相当大的对象(作为第一个私有对象)。由于我的设置,大对象(在此示例中为矢量)将被天真地复制两次:

struct bigStruct {
    bool next() {
        /* do something with m_bigVector */
    }

    std::vector<int> m_bigVector;
    /* other (big) data members */
};

bigStruct s;

#pragma omp parallel
{
    #pragma omp single
    while (s.next()) {
        auto obj = s.m_bigVector; //copy the first time

        #pragma omp task firstprivate(obj) //copy the second time
        {
            /* do something with obj */
        }
    }
} //end parallel
Run Code Online (Sandbox Code Playgroud)

gcc优化(-O3)似乎并没有以任何方式优化两个复制步骤。一个(不太优雅的)解决方案是使用显式的new/delete

#pragma omp parallel
{
    #pragma omp single
    while (s.next()) {
        auto obj_ptr = new …
Run Code Online (Sandbox Code Playgroud)

c++ openmp

5
推荐指数
1
解决办法
72
查看次数

如何在 Python 中加载图像,但保持压缩状态?

我有一系列图像,都可以在 JP2 和 PNG 上使用,我需要在 python 程序上加载此图像以按顺序显示它们。现在我只需要显示序列的一部分,例如:

  • 从第 12 帧到第 24 帧一次,
  • 第二次从Frame2到Frame7,
  • 加载

    所有图像占用了我太多的内存,并且每次加载新序列都是一项漫长的任务。
    有一个函数/方法可以在程序中加载图像,但保持压缩?我可以将这些图像保存在内存中以供随时使用,但内存占用较低吗?

  • python image python-3.x

    4
    推荐指数
    1
    解决办法
    9330
    查看次数

    日期格式将第12小时值(hh)解析为00

    日期格式将第12小时值(hh)解析为00,同时将格式应用为"yyyy-MM-dd'T'hh:mm:ss"但不解析第13小时到下午1点.PFB示例代码段.

    Date testDate = DateUtil.parse("yyyy-MM-dd'T'hh:mm:ss","2010-07-09T12:50:58"); 能不能让我知道为什么这样转换......?

    java java-date

    3
    推荐指数
    1
    解决办法
    5776
    查看次数

    如何使用 Java 读取 XML 响应

    我正在调用 Web 服务并获取 XML 格式的响应。这是 XML 响应,

    <Response>
        <NO>1</NO>
        <NAME>John Doe</NAME>
    </Response>
    <Response>
        <NO>2</NO>
        <NAME>Jane Doe</NAME>
    </Response>
    
    Run Code Online (Sandbox Code Playgroud)

    我试图从每个响应中获取每个数据。我需要获取每个值。

    这是我的Java代码,

    Document document = DocumentBuilderFactory
                        .newInstance()
                        .newDocumentBuilder()
                        .parse(new InputSource(new StringReader(response.toString())));
    
                NodeList nodeList = document.getElementsByTagName("Response");
                System.out.println(nodeList.getLength());
    
                for (int i = 0; i < nodeList.getLength(); i++) {
                    Node node = nodeList.item(i);
    
                    if (node.getNodeType() == Node.ELEMENT_NODE) {
                        Element element = (Element) node;
    
                        NodeList id = (NodeList) element.getElementsByTagName("Response");
                        System.out.println(id);
                        NodeList nodeLists = element.getChildNodes();
    
                        for (int j = 0; j < nodeLists.getLength(); j++) {
                            Node n = …
    Run Code Online (Sandbox Code Playgroud)

    java xml xml-parsing

    2
    推荐指数
    1
    解决办法
    1万
    查看次数

    Unity - 如何将运行时源添加到 ParentConstraint

    如何在运行时将 GameObject(或 Transform ->object.transform)添加到父约束组件? https://docs.unity3d.com/ScriptReference/Animations.ParentConstraint.html

    在检查器中,Unity 显示父控件组件采用变换作为源,如下图所示。在代码中,ParentConstraint.AddSource需要一个 ConstraintSource 对象。但尝试在代码中执行此操作时,它会抱怨constraintSource不能是Transform

    https://drive.google.com/open?id=1YOdCQj6MWKgZkgfkaw0DDV5SlI_Apd35

    ConstraintSource mySource = m_RealObjOnPlane.transform;//error - can't convert Transform to Animations.ConstraintSource
    
    Xaxis.GetComponent<ParentConstraint>().AddSource(mySource);//AddSource only takes a ConstraintSource 
    
    Run Code Online (Sandbox Code Playgroud)

    期望我可以在运行时更改父控件的来源

    c# constraints unity-game-engine

    2
    推荐指数
    1
    解决办法
    8588
    查看次数

    宏 VBA Excel 创建 XML 文件日期

    使用 Excel 中的宏 VBA,我需要在 excel 文件中的 1 张纸上转换日期。为此,我已经创建了一个脚本,但是在 XML 中正确生成日期时遇到了问题,我需要第一行一个标题,然后一个公式读取所有包含数据的行。

     Sub createXML()
    
    Sheets("Sheet1").Select
    
        FullPath = baseDirectory & projectName & "\xmlBatch\inputTest.xml"
    
        Set objStream = CreateObject("ADODB.Stream")
        objStream.Charset = "iso-8859-1"
    
        objStream.Open
        objStream.WriteText ("<?xml version='1.0' encoding='UTF-8'?>" & vbLf)
        objStream.WriteText ("<y:input xmlns:y='http://www.test.com/engine/3'>" & vbLf)
        objStream.WriteText ("  <y:datas>" & vbLf)
        objStream.WriteText ("      <y:instance yid='theGeneralData'>" & vbLf)
        objStream.WriteText ("" & vbLf)
    
        objStream.WriteText ("<language yid='LANG_en' />" & vbLf)
    
        objStream.WriteText ("<client yclass='Client'>" & vbLf)
        objStream.WriteText ("  <firstName>" & Cells(1, 1).Text & "</firstName>" & vbLf)
        objStream.WriteText ("  <lastName>" & Cells(1, …
    Run Code Online (Sandbox Code Playgroud)

    xml excel vba

    1
    推荐指数
    1
    解决办法
    1万
    查看次数