parallel-testing 相关问题


perl subs何时将参数作为`$_`传递,什么时候是`$_[0]`?

我注意到 Parallel::Loops 模块使用 $_ 作为其 subref 的参数。这个问题与 Parallel::Loops 本身无关,而是与 coderef 调用约定有关。 这是他们的例子...


在react-testing-library中查询font-awesome元素

在我的渲染方法中我有 使用反应测试库...


源数组不够长。检查 srcIndex 和长度,以及数组的下限

我有一个 C# 列表,它将在 Parallel Foreach 中添加值。现在它总是返回异常System.IndexOutOfRangeException。当我指向 listTotalCost 时,它显示以下消息...


react-testing-library:无法关闭 MUI Select 的下拉菜单

我有一个 SelectExample.js 从“react”导入 React, { useState }; 从“@mui/material”导入{InputLabel、MenuItem、FormControl、Select、Typography };> 导出默认fu...


在 Windows 10 上的 Python3.8 中安装 charm-crypto 时出错

我不明白这个错误,有谁知道这个错误的含义是什么? (venv) C:\Users dmin\PycharmProjects\Testing>pip install charm-crypto==0.43 收集魅力加密==0.43 使用


如何让运行在 WSL2 上的节点服务器通过 LAN 转发,以便可以通过电话访问?

我尝试过以下方法: https://www.youtube.com/watch?v=yCK3easuYm4 https://medium.com/codemonday/access-wsl-localhost-from-lan-for-mobile-testing-8635697f008 https://superuser.com/questions/1679...


更改每个案例的 UI 测试区域

我正在使用 swift-snapshot-testing 库进行快照测试。对我来说,使用不同的本地化进行所有测试以在文本更改时检查所有 UI 非常重要。 例如,t...


为什么我的全景切换按钮不起作用?

我正在尝试制作一个按钮,以便将其绑定到全景图中的特定位置。也就是说,当用户观看 360 度全景图时,按钮不应旋转。 我正在尝试制作一个按钮,以便将其绑定到全景图中的特定位置。也就是说,当用户查看 360 度全景图时,按钮不应旋转。 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>panoramas</title> <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script> <style> #switchButton { cursor: pointer; } </style> </head> <body> <a-scene> <a-assets> <img id="panorama1" src="1.jpg"> <img id="panorama2" src="2.jpg"> </a-assets> <a-sky id="panorama" src="#panorama1" rotation="0 -130 0"></a-sky> <a-entity id="cameraRig"> <a-camera></a-camera> </a-entity> <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#CCC" id="switchButton"></a-plane> </a-scene> <script> const button = document.querySelector('#switchButton'); let currentPanorama = 1; button.addEventListener('mouseenter', () => { const panorama = document.querySelector('#panorama'); if (currentPanorama === 1) { panorama.setAttribute('src', '#panorama2'); currentPanorama = 2; } else { panorama.setAttribute('src', '#panorama1'); currentPanorama = 1; } }); </script> </body> </html> 我正在尝试制作一个按钮,以便将其绑定到全景图中的特定位置。也就是说,当用户查看 360 度全景图时,按钮不应旋转。 我解决你的问题 您需要做的是添加一个光标来处理 onlcick 事件,这是唯一的方法。 <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width"> <title>A-Frame HTML Shader - Dynamic</title> <script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script> <script src="https://unpkg.com/[email protected]/dist/aframe-html-shader.min.js"></script> <script> let currentPanorama = 1; AFRAME.registerComponent("click-log", { init: function () { this.myFunction = function () { const panorama = document.querySelector('#panorama'); if (currentPanorama === 1) { panorama.setAttribute('src', '#panorama2'); currentPanorama = 2; } else { panorama.setAttribute('src', '#panorama1'); currentPanorama = 1; } }; this.el.addEventListener("click", this.myFunction); }, remove: function () { this.el.removeEventListener("click", this.myFunction); } }); </script> </head> <body> <a-scene update-html> <a-camera> <a-cursor material="color: red"></a-cursor> </a-camera> <a-assets> <img id="panorama1" src="https://l13.alamy.com/360/PWNBM9/testing-new-cameralens-combination-in-my-garden-in-aarhus-denmark-PWNBM9.jpg"> <img id="panorama2" src="https://aframe.io/aframe/examples/boilerplate/panorama/puydesancy.jpg"> </a-assets> <a-sky id="panorama" src="#panorama1" rotation="0 -130 0"></a-sky> <a-entity id="cameraRig"> <a-camera></a-camera> </a-entity> <a-plane click-log position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#CCC" id="switchButton"></a-plane> </a-scene> </body> </html>


Google 识别的 JSON LD 格式的 Schema.org,但 Facebook Pixel Helper 无法检测到它

我使用添加了JSON LD格式的schema.org标签,当我使用Google结构化数据测试工具测试我的页面时,我可以看到我的所有标签。 但是,当我安装 Facebook Pixel Helper 时 </desc> <question vote="15"> <p>我使用<pre><code>JSON LD</code></pre>以<pre><code>&lt;script&gt;</code></pre>格式添加了schema.org标签,当我使用<a href="https://search.google.com/structured-data/testing-tool/u/0/" rel="noreferrer">Google结构化数据测试工具</a>测试我的页面时,我可以看到我的所有标签。</p> <p>但是,当我安装 <a href="https://chrome.google.com/webstore/detail/facebook-pixel-helper/fdgfkebogiimcoedlicjlajpkdmockpc?hl=en" rel="noreferrer">Facebook Pixel helper chrome 扩展</a> 来测试我的页面时,schema.org 标签显示为空白。不知道为什么 Facebook Pixel Helper 无法检测到它。</p> <p>非常感谢任何帮助。</p> </question> <answer tick="false" vote="9"> <p>我发现Facebook Pixel对结构化数据的解析更加严格。字段中的空白换行将导致它发出警告。当我在地址中进行换行时,我就发生了这种情况。谷歌正确解释了该地址,但 Facebook Pixel 在控制台中发出了警告。</p> <p>添加以下代码解决了我的情况:</p> <pre><code>$address = preg_replace( &#34;/\r|\n/&#34;, &#34; &#34;, $address ); </code></pre> <p>当然,正如这里指出的那样<a href="https://stackoverflow.com/questions/2392766/multiline-strings-in-json">JSON不支持真正的换行符</a>。</p> </answer> <answer tick="false" vote="3"> <p>聚会迟到了,但对于来这里的人来说仍然如此。 FB Pixel 现在支持 JSON-LD:<a href="https://www.facebook.com/business/help/1175004275966513" rel="nofollow noreferrer">https://www.facebook.com/business/help/1175004275966513</a></p> </answer> <answer tick="false" vote="3"> <p>对我来说,多个空格都有错误(据我所知)。 <br/>因此,我使用这段代码:</p> <pre><code>$description = preg_replace(&#34;#\r|\n|(\s+)#iu&#34;, &#34; &#34;, $description); </code></pre> </answer> <answer tick="false" vote="0"> <p>JSON 扩展还为所有其他网页添加了 JSON-LD 格式的架构标记,这是 Google 喜欢的。 “Facebook Pixel”不读取架构元标签或 JSON-LD(Pinterest 读取架构元标签,但不读取 JSON-LD)。</p> <p>听起来您可能有点困惑 – Facebook 不读取架构标记 – Facebook 读取开放图元标签。您可以在这里找到该标准的详细信息:<a href="http://ogp.me/" rel="nofollow noreferrer">http://ogp.me/</a>。</p> <p>仅供参考 <a href="https://www.withintheflow.com/facebook-pixel-helper/" rel="nofollow noreferrer">https://www.withintheflow.com/facebook-pixel-helper/</a></p> </answer> <answer tick="false" vote="0"> <p>您可能碰巧在 init 调用中有 <pre><code>fbq(&#39;set&#39;, &#39;autoConfig&#39;, &#39;false&#39;)</code></pre>。 </p> <p>Facebook Pixel 会将元数据发送到您的 Pixel 设置,但在初始化代码中,如果您将 <pre><code>autoConfig</code></pre> 设置为 <pre><code>false</code></pre>,Facebook Pixel 将不会发送此附加信息。</p> </answer> <answer tick="false" vote="0"> <p>我还使用 Json-LD 脚本标签。就我而言,实际上是在标签开始发送此数据之前移动 Facebook 像素脚本!</p> </answer> </body></html>


.NET MAUI:自定义Shell TitleView并绑定到当前页面标题

我想用我自己的自定义布局替换默认的 Shell 标头,如下所示: 我想用我自己的自定义布局替换默认的 Shell 标头,如下所示: <?xml version="1.0" encoding="UTF-8" ?> <Shell x:Class="MyNamespace.App.AppShell" xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:MyNamespace.App" xmlns:pages="clr-namespace:MyNamespace.App.Pages" BindingContext="{x:Static local:MainView.Instance}" Shell.FlyoutBehavior="{Binding ShellFlyoutType}" x:Name="shellMain"> <Shell.TitleView> <Grid ColumnDefinitions="*,200"> <Label BindingContext="{x:Reference shellMain}" Text="{Binding Path=CurrentPage.Title, Mode=OneWay}" FontSize="Large" TextColor="White" /> <ActivityIndicator IsRunning="{Binding IsBusy}" Color="Orange" Grid.Column="1" HorizontalOptions="End" /> </Grid> </Shell.TitleView> <ShellContent Title=" Login" ContentTemplate="{DataTemplate local:MainPage}" Route="login" FlyoutItemIsVisible="False" /> <ShellContent Title="Dashboard" ContentTemplate="{DataTemplate pages:DashboardPage}" Route="dashboard" /> </Shell> 我无法绑定当前页面标题。 我的 AppShell.xaml Shell 声明如下 <Shell ... x:Name="shellMain"> 作为替代方案,您可以在 OnNaviged 方法中设置 titleview : 在 AppShell.xaml 中,定义标签的名称 <Shell.TitleView> <Grid ColumnDefinitions="*,200"> <Label BindingContext="{x:Reference shellMain}" x:Name="mylabel" FontSize="Large" TextColor="White" /> <ActivityIndicator IsRunning="{Binding IsBusy}" Color="Orange" Grid.Column="1" HorizontalOptions="End" /> </Grid> </Shell.TitleView> 在AppShell.xaml.cs中,重写OnNaviged方法,获取当前项目 protected override void OnNavigated(ShellNavigatedEventArgs args) { base.OnNavigated(args); var shellItem = Shell.Current?.CurrentItem; string title = shellItem?.Title; int iterationCount = 0; while (shellItem != null && title == null) { title = shellItem.Title; shellItem = shellItem.CurrentItem; if (iterationCount > 10) break; // max nesting reached iterationCount++; } myLabel.Text = title; } 希望它对你有用。 我正在尝试同样的方法来修改 TitleView 的外观。它可以在 iOS 上运行,尽管那里还有另一个错误。但在 Android 上我遇到了同样的问题。在前进导航中,它会更新标题,但当您按后退按钮时,标题不会更新。我已经打开了一个问题并添加了一个存储库。 https://github.com/dotnet/maui/issues/12416#issuecomment-1372627514 还有其他方法可以修改TitleView的外观吗? 我使用视图模型开发了这个解决方法,主要不是为了提供 MVVM 解决方案,而是因为其他建议的答案对我不起作用。 (我怀疑 Liqun Shen 2 月 15 日针对他自己的问题的评论中的建议会起作用。但我没有注意到这一点,直到我自己修复)。 当前页面的标题保存在可由 shell 的视图模型和每个内容页面的视图模型访问的类中: public class ServiceHelper { private static ServiceHelper? _default; public static ServiceHelper Default => _default ??= new ServiceHelper(); internal string CurrentPageTitle { get; set; } = string.Empty; } shell 中每个内容页面的视图模型提供其页面标题。为了促进这一点,大部分工作都是由基本视图模型完成的,它们都是从该模型派生而来的: public abstract class ViewModelBase(string title) : ObservableObject { private ServiceHelper? _serviceHelper; public string Title { get; } = title; internal ServiceHelper ServiceHelper { get => _serviceHelper ??= ServiceHelper.Default; set => _serviceHelper = value; // For unit testing. } public virtual void OnAppearing() { ServiceHelper.CurrentPageTitle = Title; } } 每个 shell 内容页面视图模型只需要让其基础视图模型知道它的标题: public class LocationsViewModel : ViewModelBase { public LocationsViewModel() : base("Locations") { } } 每个 shell 内容页面都需要在其视图模型中触发所需的事件响应方法: public partial class LocationsPage : ContentPage { private LocationsViewModel? _viewModel; public LocationsPage() { InitializeComponent(); } private LocationsViewModel ViewModel => _viewModel ??= (LocationsViewModel)BindingContext; protected override void OnAppearing() { base.OnAppearing(); ViewModel.OnAppearing(); } } Shell 的视图模型为标题栏提供当前页面的标题: public class AppShellViewModel() : ViewModelBase(Global.ApplicationTitle) { private string _currentPageTitle = string.Empty; public string CurrentPageTitle { get => _currentPageTitle; set { _currentPageTitle = value; OnPropertyChanged(); } } public void OnNavigated() { CurrentPageTitle = ServiceHelper.CurrentPageTitle; } } Shell 需要在其视图模型中触发所需的事件响应方法: public partial class AppShell : Shell { private AppShellViewModel? _viewModel; public AppShell() { InitializeComponent(); } private AppShellViewModel ViewModel => _viewModel ??= (AppShellViewModel)BindingContext; protected override void OnNavigated(ShellNavigatedEventArgs args) { base.OnNavigated(args); ViewModel.OnNavigated(); } } 最后,Shell 的 XAML 在标题栏/导航栏上显示由 Shell 视图模型提供的当前页面的标题: <Shell.TitleView> <HorizontalStackLayout VerticalOptions="Fill"> <Image Source="falcon_svg_repo_com.png" HeightRequest="50"/> <Label x:Name="CurrentPageTitleLabel" Text="{Binding CurrentPageTitle}" FontSize="24" Margin="10,0" VerticalTextAlignment="Center"/> </HorizontalStackLayout> </Shell.TitleView>


© www.soinside.com 2019 - 2024. All rights reserved.