我在stackoverflow.com上看过类似的问题,但没有一个解决方案对我有帮助.我使用的以下配置(maven项目结构):src/main/resources/properties/app.properties
文件
#possible values: dev test prod
mode: dev
Run Code Online (Sandbox Code Playgroud)
在Spring配置中:
<context:property-placeholder location="classpath:properties/app.properties"/>
<import resource="classpath:/spring/db/${mode}-datasource-config.xml"/>
Run Code Online (Sandbox Code Playgroud)
基于${mode}
我想要导入相应数据源配置文件的值.
当我使用mvn clean install tomcat7:run
命令运行嵌入式tomcat7时,我收到错误:
10, 2013 5:52:29 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /SpringWebFlow threw load() exception
java.lang.IllegalArgumentException: Could not resolve placeholder 'mode' in string value "classpath:/spring/db/${mode}-datasource-config.xml"
Run Code Online (Sandbox Code Playgroud)
该target/classes/properties/app.properties
文件存在.
我正在使用IntelliJ IDEA,在编辑器中我可以单击"$ {mode}" <import resource="classpath:/spring/db/${mode}-datasource-config.xml"/>
并在属性文件中查看其值.编辑器本身也改变${mode}
为灰色dev
显示它可以识别属性值.在编辑器中我看到:<import resource="classpath:/spring/db/dev-datasource-config.xml"/>
任何想法为什么我得到错误以及如何解决?
我正在尝试从 C# UWP 应用程序的非托管 dll 调用方法。我这样做,但在非托管 dll 上调用“LoadLibrary()”以便我可以使用它。
这在调试模式下一切正常,但是在发布模式下,我收到一个奇怪的错误:
消息:类初始化方法 Tests.UnitTests.InitializeClient 抛出异常。System.TypeLoadException: System.TypeLoadException: 程序集“Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”中未解决的 P/Invoke 方法“LoadLibrary!kernel32”,因为它在 UWP 应用程序中不可用。请使用其他 API 或使用 [DllImport(ExactSpelling=true) 来表明您了解使用非 UWP 应用程序 API 的含义。
这是我调用加载库的方法:
[DllImport("kernel32", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern IntPtr LoadLibrary(string librayName);
Run Code Online (Sandbox Code Playgroud)
不幸的是,如果我添加“ExactSpelling = true”如下:
[DllImport("kernel32", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
public static extern IntPtr LoadLibrary(string librayName);
Run Code Online (Sandbox Code Playgroud)
然后调用它会抛出异常:
System.EntryPointNotFoundException: '无法在 DLL 'kernel32' 中找到名为 'LoadLibrary' 的入口点。
任何帮助深表感谢!
我可以使用 log4j2 配置方面的一些帮助。当我调试记录器时,看起来它关闭了所有附加程序,然后我再也没有收到任何应用程序日志。幸运的是,我知道 log4j 至少找到属性文件并提供记录器初始化调试输出。
这是我的 log4j2.properties 文件:
status = debug
name = PropertiesConfig
filters = threshold
filter.threshold.type = ThresholdFilter
filter.threshold.level = info
appenders = console
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yy-MM-dd HH:mm:ss:SSS} %-5p %c{1}:%L - %m%n
rootLogger.level = debug
rootLogger.appenderRefs = stdout
rootLogger.appenderRef.stdout.ref = STDOUT
appender.file.type = File
appender.file.name = application
appender.file.fileName=${filename}/propertieslogs.log
appender.file.layout.type=PatternLayout
appender.file.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
Run Code Online (Sandbox Code Playgroud)
这是记录器调试初始化输出:
DEBUG Starting LoggerContext[name=ROOT] from configuration at null
DEBUG Starting LoggerContext[name=ROOT, org.apache.logging.log4j.core.LoggerContext@448dc39b] with …
Run Code Online (Sandbox Code Playgroud) 在最新的iOS更新之后,对MPMusicPlayerController的setCurrentPlaybackRate调用停止工作,现在出现此错误:
2018-04-15 16:24:06.904562-0600 SampleProject[5659:1836398] [SDKPlayback] -
[MPMusicPlayerController setCurrentPlaybackRate:0.670213] completed error:
Error Domain=MPCPlayerRequestErrorDomain Code=1 "No commands provided."
UserInfo={NSDebugDescription=No commands provided.}
Run Code Online (Sandbox Code Playgroud)
我传入的有效double值大于0且小于2.
这是调用:[appMusicPlayer setCurrentPlaybackRate:0.7];
感谢您的任何意见或帮助!
PS我也遇到了很多其他奇怪的错误.这里有一些:
2018-04-15 17:30:01.976932-0600 SampleProject[5733:1868672] [SDKPlayback]
Failed validators: {(
setRepeatMode
)}
2018-04-15 17:30:03.976879-0600 SampleProject[5733:1868672] [SDKPlayback]
Failed to get a valid response. Resetting expectations.
2018-04-15 17:30:01.976932-0600 SampleProject[5733:1868672] [SDKPlayback]
Failed validators: {(
setRepeatMode
)}
2018-04-15 17:30:03.976879-0600 SampleProject[5733:1868672] [SDKPlayback]
Failed to get a valid response. Resetting expectations.
Run Code Online (Sandbox Code Playgroud) 我想知道是否有办法在 swift UITests 项目中为 XCUIApplication 设置暗模式代码。
我需要在同一个测试中以亮模式和暗模式启动应用程序。在方案中将此设置为硬编码值将不起作用,或者从外部入侵模拟器也不起作用(出于性能和可维护性等原因)。
目前我设置启动参数如下:
let app = XCUIApplication()
var launchArguments: [AnyHashable] = []
launchArguments.append("-AppleLanguages")
launchArguments.append(langCode)
launchArguments.append("-AppleLocale")
launchArguments.append(localeCode)
app.launchArguments = launchArguments
app.launch()
Run Code Online (Sandbox Code Playgroud)
而且效果很好。
如何为 XCUIApplication 实例设置暗模式?
我所做的:
谢谢你的帮助!
I have an iPhone 8, and I'm trying to trigger a sysdiagnose with iOS 14.4 and up. You'd think that this is well-documented, and it is, but I still can't get it to work.
Here's what I've tried:
If you go to the Profiles and logs page here and filter by iOS: https://developer.apple.com/bug-reporting/profiles-and-logs/?platform=ios
There is documentation labelled "Sysdiagnose" which takes you here: https://download.developer.apple.com/iOS/iOS_Logs/sysdiagnose_Logging_Instructions.pdf
The instructions are pretty straightforward.
Hold the two volume buttons and the side button for 1-1.5 seconds. …
我正在实现按住以拖动网页的元素表。
由于Android和iOS上的各种长按菜单以及跨浏览器触摸功能的差异,该功能非常困难。
我的块项目基本上是包含图像和链接的 div 标签。父块项目需要可拖动。
不幸的是,在较新的 iPad 上,Safari 允许您拖动任何网页上的任何图像或链接。这会扰乱我的拖放操作,因为它将开始拖动父块,然后块内的图像将分离出来并可以自行拖动。
从其他堆栈溢出帖子中,推荐使用以下 CSS。我已将其应用于所有子元素、链接和图像,但图像和链接仍然是分开的,并且可以在较新的 ipad 上自行拖动。
如何防止在具有 3D Touch 功能的新型 iPad 上长按拖放图像和链接?
.drag-parent-wrapper * {
@include user-select(none);
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-touch-callout: none;
-ms-text-size-adjust: none;
-webkit-text-size-adjust: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
Run Code Online (Sandbox Code Playgroud)
这些都不起作用。我已经验证它递归地应用于所有在较新的 ipad 上仍然可拖动的子 img 和链接元素。
默认情况下,我无法阻止任何触摸或鼠标事件,否则我的功能在所有设备上都面临风险。
我已经使用git多年了,最近换成了一个项目的mercurial.在过去的6个月里,我已经学会了如何通过命令行很好地使用Mercurial.
这可能是我的想象,但在我看来,mercurial在合并时更糟糕,并导致更多冲突的文件.我会经常将默认分支合并到我的功能分支中,它有时会做一些非常时髦的事情,并且无法自动合并看起来应该在视觉上合并的文件 - IE在同一行上没有变化等.
我做了很多研究,看看合并算法可能有什么不同,运气很少.大多数文章都是人们关于git和mercurial如何工作的意见和信息,而没有太多关注合并算法本身以及差异的简单语言示例的上行/下行.
我总是使用良好的合并策略并通过树合并,并且永远不会进入默认(hg)/ master(git)分支而不首先合并到远程以确保没有冲突.
到目前为止,我在研究中发现的是:
1)Mercurial不能合并或有多个父母合并的问题.我不确定有人会在这种情况下结束,但也许这很常见?
这是真的?这会导致每天开发中更频繁地合并冲突吗?
2)Mercurial不支持章鱼合并,git就是这样做的.
对于章鱼合并,我说"谁在乎!",这不是必需品.
除此之外,似乎合并算法同样创建?是否可以更改合并算法?这有什么好文章吗?
如果您在k3diff,p4merge和meld之类的合并工具上发布信息,那么您就错过了重点 - 我想在冲突解决之前获得有关自动合并策略的信息.
感谢您提供有用的参考和/或信息!
我一直在编写 UITests,在录制测试以打开模态视图并将模态向下滑动到屏幕底部以关闭它之后,我得到了一些这样的代码(因为那里有一个表视图):
var tablesQuery = app.tables.element(boundBy: 0)
tablesQuery.swipeDown()
Run Code Online (Sandbox Code Playgroud)
问题是,这并不总是有效。有时(尤其是在 iPad 上),在回放测试时,视图会向下移动一点并跳回原位(而不是关闭)。
Apple 一定有同样的问题,并提出了更好的解决方案来消除 iOS 13 XCUITests 上的模态视图 (.present)。
有没有办法可靠地消除核心测试框架支持的这些傻瓜,这样我就不必对手势或诸如此类的东西进行任何自定义摆弄?
谢谢你的帮助!
如果没有任何明显的解决方案,我想一个被黑的重型向下手势也可能回答这个问题......因为所有答案都是针对非常微小或轻微版本的滑动,而不是全屏关闭手势。但我想先了解您对受支持解决方案的上下文(例如,您是否知道不存在受支持的解决方案?)
谢谢你的帮助!- Apple 通过 XCTest 框架拒绝视图的方式支持/维护,或者有关此不存在的信息将回答此问题。
我还是MVC 3的新手,我需要将@ Html.Action方法中的数据通过控制器传递到局部视图。
这就是我的流程。
我将这样调用@ Html.Action:
@Html.Action("SidebarMain", "Home", new List<int>(new int[] {1, 2, 3}))
Run Code Online (Sandbox Code Playgroud)
然后它将击中我的控制器。这是我的家庭控制器中的方法:
public ActionResult SidebarMain(List<int> items)
{
return View(items);
}
Run Code Online (Sandbox Code Playgroud)
然后我的Partial View应该能够像这样访问数据:
@model List<int>
@{
ViewBag.Title = "SidebarMain";
Layout = null;
}
<div>
@foreach (int item in Model)
{
<div>@item</div>
}
</div>
Run Code Online (Sandbox Code Playgroud)
但是:我收到模型的空异常,这意味着它没有通过。
我发现当我的 iOS 设备自动配置代理时,我的所有 NSURLSession 都使用它进行下载/上传/请求。当我尝试从同一本地网络上的其他设备发出这些请求时,这会成为一个问题。我需要禁用设备自动检测 NSURLSession 的代理。
每个地方的帖子都指示如何设置代理字典,但是,我找不到任何地方如何确保 NRURLSession 不使用代理。
任何帮助,将不胜感激!
我已成功本地化并测试了 26 种语言。我可以使用以下选项成功导出所有 26 个本地化版本:“编辑器”->“导出本地化...”,然后选择所有这些本地化版本。
但是,当我使用以下 xcodebuild 命令时,它会导出我的默认语言“en”,而不会导出其他任何内容。
xcodebuild -exportLocalizations -localizationPath TempLocalizationExport
Run Code Online (Sandbox Code Playgroud)
如何导出所有 26 个本地化版本而不仅仅是“en”?
该命令没有输出任何命令行错误。
我在developer.apple.com 上到处搜索官方 xcodebuild 命令行命令文档,但找不到解决其他 -exportLocalizations 选项和标准行为的详细且有用的来源。
ios ×5
c# ×2
java ×2
swift ×2
.net ×1
3dtouch ×1
asp.net ×1
css ×1
git ×1
ios11 ×1
localization ×1
log4j ×1
log4j2 ×1
maven ×1
mercurial ×1
merge ×1
nsurlsession ×1
objective-c ×1
pinvoke ×1
properties ×1
slf4j ×1
spring ×1
spring-mvc ×1
sysdiagnose ×1
tomcat ×1
uwp ×1
xcode ×1
xcodebuild ×1
xctest ×1
xcuitest ×1