modx-resources 相关问题


定义mysql连接

我的情况: 文件夹结构是/resources/website/inc/(/resources/是存储配置的地方,/website/保存index.php和/inc/ 我已经在 config.ph 中定义了数据库连接的常量...


v-用于动态图像src

在 resources/images 目录中,我有 10 个图像,我想通过 vue3-carousel 库显示,图像名称是 1.jfif,2.jfif ..etc,但是属性绑定不能像这样工作,它给出


Spring Boot - Web Sockets - 测试

我在 Spring Boot 中有一个简单的服务器。我想实现并测试我的 Web 套接字连接,但如果我想订阅端点“/topic/resources”,超时将在 30 秒后超时。消息发送


如何在jetpack compose中使用浮动资源

我的浮点值是360F。我在 res/values 中创建了一个名为 float.xml 的文件。 浮动.xml 我的浮点值是 360F。我在 float.xml 中创建了一个名为 res/values 的文件。 float.xml <?xml version="1.0" encoding="utf-8"?> <resources> <item name="loading_circle_target" format="float" type="dimen">360</item> </resources> 然后像这样使用 @Composable fun LoadingCircle() { val currentRotation by transition.animateValue( 0F, targetValue = dimensionResource(id = R.dimen.loading_circle_target).value, // .. more code in here ) // more code in here } 我在这里遇到错误 android.content.res.Resources$NotFoundException: Resource ID #0x7f070346 type #0x4 is not valid at android.content.res.Resources.getDimension(Resources.java:766) at androidx.compose.ui.res.PrimitiveResources_androidKt.dimensionResource(PrimitiveResources.android.kt:79) 更新 我的最低sdk是21 如果您的目标至少是 API 29,则可以使用: val floatValue = LocalContext.current.resources.getFloat(R.dimen.loading_circle_target) @Composable fun LoadingCircle() { val currentRotation by transition.animateValue( 0F, targetValue = floatValue, // .. more code in here ) // more code in here } 我不得不恢复到旧的 is_phone bool,因为 booleanResource() 支持较旧的 API 级别。所以有 <resources> <bool name="is_phone">false</bool> </resources> 在 values-sw600dp 文件夹中并将其设置为正常值文件夹中的 true。然后就可以像这样使用了 @Composable fun LoadingCircle() { val currentRotation by transition.animateValue( 0F, targetValue = if (booleanResource(id = R.bool.is_phone)) 360f else 180f ) // more code in here }


无法解析 org.apache.maven.plugins 的插件描述符:maven-resources-plugin:2.4.3.. 打开 zip 文件时出错

我正在使用maven构建和编译一个spring项目,这是我收到的错误“打开zip文件时出错”。我在此处附加了 settings.xml 以表明我配置了 p...


如何将源添加到Java构建?

我正在开发一个 IntelliJIdea 插件,我需要在构建中添加一个文件 - 该插件必须在使用过程中将此文件复制到用户的源文件夹中。 我将此文件放在 /resources 文件夹中,然后


将 YAML 文件注入构造函数

我有这个 YAML 文件 src/main/resources/foo.yml: 酒吧: - 你好 - 世界 巴兹: - 洛雷姆 - ipsum 这个组件: @成分 公共类我的组件{ 公共我的组件(地图 我有这个 YAML 文件 src/main/resources/foo.yml: bar: - hello - world baz: - lorem - ipsum 这个组件: @Component public class MyComponent { public MyComponent(Map<String, List<String>> foo) { // foo.get("bar") } } 使用 Spring Boot 2.7,是否可以将配置按原样(自己的文件,无前缀,无类)注入到构造函数中? 你可以这样做 @Configuration public class MyConfiguration { @Bean public Map<String, Object> foo(@Value("classpath:foo.yaml") Resource yaml) { Yaml yaml = new Yaml(); return yaml.load(yaml.getInputStream()); } } @Component public class MyComponent { public MyComponent(@Qualifier("foo") Map<String, Object> foo) { ... } }


资源提供的整数在运行时出现乱码

在我的 Android 应用程序中,我创建了文件 app/src/main/res/values/integers.xml: 在我的 Android 应用程序中,我创建了文件 app/src/main/res/values/integers.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <integer name="server_port">8080</integer> </resources> 然后我就有了 public class MyApplication extends Application { final MyServer server = new MyServer(R.integer.server_port); } 但是,当应用程序启动时,日志语句显示该值(即 R.integer.server_port)为 2131296322。 为什么数值会出现乱码?这不是整数资源应该如何实现的吗? R.integer.server_port 给出整数的资源 ID,而不是整数本身。为了获得实际的整数,你必须做getResources().getInteger(R.integer.server_port)。但是,这需要对原始代码进行一些修改,因为在实例化 MyApplication 时尚未设置资源。相反,你可以这样做 public class MyApplication extends Application { MyServer server; @Override public void onCreate() { super.onCreate(); server = new MyServer(getResources().getInteger(R.integer.server_port)); } }


Velocity 在 Spring Boot 中找不到模板资源

我使用 Velocity 模板引擎在我的 Spring boot 应用程序中使用电子邮件模板发送电子邮件实用程序。 当前的代码如下所示。 pom.xml: 我正在使用 Velocity 模板引擎在我的 Spring boot 应用程序中使用电子邮件模板发送电子邮件实用程序。 当前代码如下所示。 pom.xml: <dependency> <groupId>org.apache.velocity</groupId> <artifactId>velocity</artifactId> <version>1.7</version> </dependency> <dependency> <groupId>org.apache.velocity</groupId> <artifactId>velocity-tools</artifactId> <version>2.0</version> </dependency> 速度引擎 bean 配置: @Configuration public class VelocityConfig { @Bean public VelocityEngine velocityEngine() { VelocityEngine ve = new VelocityEngine(); ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath"); ve.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName()); ve.init(); return ve; } } 电子邮件模板放置在 src/main/resources/email-templates/summary-email.vm <!DOCTYPE html> <head> <title>Summary</title> </head> <body> <h1>Claims Summary</h1> </body> </html> 放置在以下目录中: src ├── main │ ├── java │ │ └── com │ │ └── packageNameioot │ │ └── SpringBootApplication.java │ ├── resources │ │ ├── email-templates │ │ │ └── summary-email.vm │ │ └── application.properties 使用模板发送电子邮件的服务类: @Slf4j @Service @RequiredArgsConstructor public class EmailSummaryService { private final EmailConnector connector; private final VelocityEngine velocityEngine; public Mono<Void> sendFinanceClaimsRunEmailSummary(FinancePeriodRunEntity periodRunEntity, int successCount, int errorCount) { EmailDto emailDto = EmailDto.builder() .recipients(Set.of("[email protected]")) .subject("Claims summary") .body(createEmailBody()) .html(true) .build(); return connector.submitEmailRequest(emailDto); } private String createEmailBody() { VelocityContext context = new VelocityContext(); Template template = velocityEngine.getTemplate("email-templates/summary-email.vm"); StringWriter writer = new StringWriter(); template.merge(context, writer); return writer.toString(); } } 但是Velocity无法定位模板,出现以下错误。 ERROR velocity:96 - ResourceManager : unable to find resource 'email-templates/summary-email.vm' in any resource loader. org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'email-templates/summary-email.vm' 属性应该这样设置: VelocityEngine ve = new VelocityEngine(); ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath"); ve.setProperty("resource.loader.classpath.class", ClasspathResourceLoader.class.getName()); 根据 Apache Velocity Engine 文档。


在具有 Open Liberty Dev 模式的 Maven 项目中使用本地库

我有一个 Maven 项目,它构建了一个部署到 Open Liberty 的战争。我正在使用 Liberty maven 插件: io.openliberty.tools 我有一个 Maven 项目,它构建了一个部署到 Open Liberty 的战争。我正在使用 Liberty maven 插件: <plugin> <groupId>io.openliberty.tools</groupId> <artifactId>liberty-maven-plugin</artifactId> <version>3.9</version> <!-- Specify configuration, executions for liberty-maven-plugin --> </plugin> 我正在利用开发模式并且它运行良好。但是,我想在 Dev 模式下使用本地 jar 文件库。 我期望我能够将 jar 文件放置在项目中的特定位置,并且 Liberty 开发模式会自动拾取它们 - 类似于自动拾取 server.xml 的方式src/main/liberty/config。我的 server.xml 设置为在此处查找库:${shared.config.dir}/lib/global,因此我尝试将罐子放入 src/main/liberty/shared/config/lib/global 中,但这不起作用。 我看到的另一种选择是使用 Libity 插件的 copyDependencies 配置。 有一些推荐的方法可以实现我想做的事情吗?理想情况下,我想要最简单的解决方案,既适用于 liberty dev 模式,也适用于 vanilla maven 构建 (mvn package)。 这里的类似问题利用了 copyDependencies 配置,但具体来说,我正在寻找本地 jar 的最佳解决方案(是的,我可以使用系统范围的 Maven 坐标或在本地安装 jar) 如何在 Maven 构建期间将外部依赖项复制到 Open Liberty 谢谢 好问题,稍微概括一下问题,您可能可以使用三种方法: 1.使用资源插件 <build> <resources> <!-- Explicitly configure the default too --> <resource> <directory>${project.basedir}/src/main/resources</directory> </resource> <!-- Custom library --> <resource> <directory>${project.basedir}/mylib</directory> <targetPath>${project.build.directory}/liberty/wlp/usr/shared/lib/global</targetPath> <!-- Default, but just emphasizing the point --> <filtering>false</filtering> </resource> </resources> 由于开发模式在其“生命周期”中调用 resources:resources 目标,因此可以在没有任何插件配置的情况下进行配置(使用“/project/build/resources”(在 XPath 术语中)元素),并使用您的 <targetPath>可以复制到任何位置。 2.添加到config目录(src/main/liberty/config) 除了src/main/liberty/config/server.xml处的主服务器XML配置文件之外,您还可以将其他文件和目录放在那里,所有文件和目录都将通过开发模式复制过来。 所以你可以创建,例如src/main/liberty/config/mylib/my.jar,它会被复制到target/liberty/wlp/usr/servers/defaultServer/mylib/my.jar。然后,您可以从 server.xml 将此位置引用为相对于服务器配置目录的 "mylib/my.jar"。 (这不太适合要求复制到“.../shared/lib/global”的原始用例,但可能适合其他查看此问题的人)。 3.添加系统范围的依赖项 这在原来的问题中已经提到过。我不太喜欢这个解决方案。为了完整起见,我会提及它,但请您自行查找详细信息。 这可能会很有趣。


Javascript 函数 openFullscreen() ,如何让它在页面上的多个 iframe 上工作

在页面上我有一个 iframe,src 中有 *.pdf 文件。 <p>在页面上我有一个 iframe,src 中有 *.pdf 文件。</p> <pre><code>&lt;div class=&#34;node--view-mode-full&#34;&gt; &lt;p&gt;&lt;iframe allow=&#34;fullscreen&#34; allowfullscreen=&#34;&#34; frameborder=&#34;0&#34; height=&#34;980&#34; scrolling=&#34;no&#34; src=&#34;https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf&#34; width=&#34;660&#34;&gt;&lt;/iframe&gt;&lt;/p&gt; &lt;p&gt;&lt;iframe allow=&#34;fullscreen&#34; allowfullscreen=&#34;&#34; frameborder=&#34;0&#34; height=&#34;980&#34; scrolling=&#34;no&#34; src=&#34;https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf&#34; width=&#34;660&#34;&gt;&lt;/iframe&gt;&lt;/p&gt; &lt;/div&gt; </code></pre> <p>浏览器中内置的 pdf 查看器现在不支持 iframe 中的全屏模式。</p> <p>我找到了解决方案<a href="https://www.w3schools.com/howto/howto_js_fullscreen.asp" rel="nofollow noreferrer">https://www.w3schools.com/howto/howto_js_fullscreen.asp</a>,解决了问题 - 以全屏模式打开 iframe。在 w3schools 的示例中,打开 iframe 的按钮已存在于 HTML <a href="https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_fullscreen" rel="nofollow noreferrer">https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_fullscreen</a>.</p> <p>在我的解决方案中,我通过 javascript 添加按钮,因为带有 iframe 的页面已经存在,但没有此类按钮:</p> <pre><code>jQuery(document).ready(function($){ $(&#34;.node--view-mode-full iframe[src*=&#39;.pdf&#39;]&#34;).each(function (index) { $(this).addClass(&#39;fullscreenframe&#39;); $(this).attr(&#39;id&#39;, &#39;fullscreen-&#39;+index); $(&#39;&lt;button onclick=&#34;openFullscreen()&#34;&gt;Open in Fullscreen Mode&lt;/button&gt;&amp;nbsp;&lt;strong&gt;Tip:&lt;/strong&gt; Press the &#34;Esc&#34; key to exit full screen.&lt;br&gt;&#39;).insertBefore(this); }); }); </code></pre> <p>然后添加一个全屏打开 iframe 的功能(与 w3schools 相同):</p> <pre><code>function openFullscreen() { var elem = document.getElementsByClassName(&#34;fullscreenframe&#34;)[0]; if (elem.requestFullscreen) { elem.requestFullscreen(); } else if (elem.webkitRequestFullscreen) { /* Safari */ elem.webkitRequestFullscreen(); } else if (elem.msRequestFullscreen) { /* IE11 */ elem.msRequestFullscreen(); } }; </code></pre> <p>当页面上只有一个带有 *.pdf 的 iframe 时,Everysing 工作正常。但是,当我在页面上有两个或多个 iframe,并且单击任何 iframe 附近的“以全屏模式打开”任何按钮时,我总是在全屏模式下只看到第一个 *.pdf...</p> <p>我知道,这是因为我只得到 elem = document.getElementsByClassName("fullscreenframe")[0]; 中的第一个 iframe;</p> <p>我知道我需要使用类似的每个或类似的东西,但我无法解决它。在搜索关于页面上一个全屏元素的所有解决方案时,没有关于页面上多个元素的解决方案...谢谢。</p> </question> <answer tick="true" vote="0"> <p>也许是这样的:</p> <pre><code>jQuery(document).ready(function($){ $(&#34;.node--view-mode-full iframe[src*=&#39;.pdf&#39;]&#34;).each(function (index) { $(this).addClass(&#39;fullscreenframe&#39;); $(this).attr(&#39;id&#39;, &#39;fullscreen-&#39;+index); $(&#39;&lt;button onclick=&#34;openFullscreen(&#39; + index + &#39;)&#34;&gt;Open in Fullscreen Mode&lt;/button&gt;&amp;nbsp;&lt;strong&gt;Tip:&lt;/strong&gt; Press the &#34;Esc&#34; key to exit full screen.&lt;br&gt;&#39;).insertBefore(this); }); }); function openFullscreen(index) { var elem = document.getElementsByClassName(&#34;fullscreenframe&#34;)[index]; if (elem.requestFullscreen) { elem.requestFullscreen(); } else if (elem.webkitRequestFullscreen) { /* Safari */ elem.webkitRequestFullscreen(); } else if (elem.msRequestFullscreen) { /* IE11 */ elem.msRequestFullscreen(); } } </code></pre> </answer> <answer tick="false" vote="0"> <p>为什么不整合 jQuery?</p> <pre><code>const fullScreen = element =&gt; element.requestFullScreen(); // all modern browsers $(function(){ $(&#34;.node--view-mode-full iframe[src*=&#39;.pdf&#39;]&#34;).each(function (index) { $(this).addClass(&#39;fullscreenframe&#39;); $(this).attr(&#39;id&#39;, &#39;fullscreen-&#39;+index); $(&#39;&lt;button class=&#34;fullScreen&#34;&gt;Open in Fullscreen Mode&lt;/button&gt;&amp;nbsp;&lt;strong&gt;Tip:&lt;/strong&gt; Press the &#34;Esc&#34; key to exit full screen.&lt;br&gt;&#39;).insertBefore(this); }); $(&#34;.fullScreen&#34;).on(&#34;click&#34;, function() { const $iFrame = $(this).closest(&#39;p&#39;).find(&#39;iframe.fullscreenframe&#39;); if ($iFrame) fullScreen($iFrame.get(0)); // pass the DOM element }); }); </code></pre> </answer> </body></html>


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