我有一个UIPageViewController,我正在使用的实现提供网页数据UIPageControllerDelegate和UIPageControllerDataSource.
它一切正常,但我希望能够向页面数据添加项目并重新排序页面数据.
如果用户已经到达最后一个页面,然后我添加了一个项目,则他们无法访问下一页,因为viewControllerAfterViewController:已经调用过.如果他们向后滚动一个然后向前滚动两个,他们可以很好地进入新页面,因此数据设置正确.我怎么能告诉它UIPageViewController刷新下一步的商店?
同样,我想重新排序支持页面视图的集合.但如果我这样做,我会遇到同样的问题 - 页面视图会认为下一页仍然是上次加载当前页面时的情况.
我想我在寻找类似的东西reloadData:上UITableView.
我有以下代码行:
suffix = suffix.isEmpty() ? "1" : Integer.toString(Integer.parseInt(suffix)+1);
Run Code Online (Sandbox Code Playgroud)
在一个块中,后缀已被声明为空String("").该块正在查找重复的文件名并在任何重复项上添加一个数字,因此它们不再具有相同的名称.
上面的代码行编译得很好,但是如果我改成它,
suffix = suffix.isEmpty() ? "1" : Integer.toString(Integer.parseInt(suffix)++);
Run Code Online (Sandbox Code Playgroud)
我得到Invalid argument to operation ++/--.既然Integer.parseInt()返回和int,为什么我不能使用++运算符?
我正在使用带有HTTP Basic Auth的spring-security来保护java webapp.在我的webapp中,我需要获取当前用户的用户名和密码,以进一步针对其他服务进行身份验证.我可以获取用户名,但不能获取密码.
我已尝试使用SecurityContextHolder.getContext().getAuthentication()此处建议访问此信息如何从spring-security获取明文密码?但密码返回为null.
我怎样才能获得密码?
谢谢.
这是我的applicationContext-security.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:sec="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<sec:http authentication-manager-ref='authenticationManager'>
<sec:intercept-url pattern="/spring/**" access="ROLE_USER" />
<sec:http-basic />
</sec:http>
<bean id="basicAuthenticationFilter"
class="org.springframework.security.web.authentication.www.BasicAuthenticationFilter">
<property name="authenticationManager" ref="authenticationManager" />
<property name="authenticationEntryPoint" ref="authenticationEntryPoint" />
</bean>
<bean id="authenticationEntryPoint"
class="org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint">
<property name="realmName" value="Announcements Rest Realm" />
</bean>
<bean id="authenticationManager"
class="org.springframework.security.authentication.ProviderManager">
<property name="providers">
<list>
<ref local="authProvider" />
</list>
</property>
</bean>
<bean id="authProvider"
class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
<property name="userDetailsService" ref="userDetailsService" />
</bean>
<bean id="filterChainProxy" class="org.springframework.security.web.FilterChainProxy">
<constructor-arg>
<list>
<sec:filter-chain pattern="/spring/**" …Run Code Online (Sandbox Code Playgroud) 我正在寻找将我们的tomcat实例从5.5.27升级到6.0.32,并且在shared/lib目录中从jars进行日志记录时遇到了一些问题(我在tomcat 6中重新创建了这个目录).
我们有一个jar文件,我们在构建过程中创建了一个jar文件,其中包含一些公共代码,而在tomcat 5下,它存在于shared/lib下.当我们从这个jar文件中的代码编写日志语句时,它们被写入当时调用jar的Web应用程序的日志文件中.我们的每个webapps在其WEB-INF/lib目录中都有一个log4j.properites和log4j.jar,在shared/lib中也有一个log4j.jar,但没有log4j/properties.
我们使用log4j并获取对日志的引用,如下所示:
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class MyClass {
private final static Log CLASS_LOG = LogFactory.getLog(MyClass.class);
}
Run Code Online (Sandbox Code Playgroud)
但是当我将我们的jar,webapps,log4.properties和log4j.jars完全相同的配置移动到tomcat 6中时,来自我们常见jar的日志记录语句就转到catalina.log.
我已经做了相当多的阅读(包括http://www.mulesoft.com/tomcat-classpath,以及tomcat网站上的类加载器和日志记录文档),大多数时候我无法弄清楚它是如何工作的在tomcat 5做了!(我没有设置它,这是我继承的东西,直到现在'只是工作').
有没有人尝试将共享库中的日志转换为webapp日志文件?我认为将共享jar放在每个webapp的WEB-INF/lib目录中会对此进行排序,但后来我最终得到了同样东西的许多副本.
我在tomcat 6中有以下目录结构:
tomcat
|-lib
| |- logback-classic.jar
| |- logback-core.jar
| |- slf4j-api.jar
| |- myState.jar
|-shared
| |-lib
| | |- myStateLogback.xml
|-webapps
| |-myApp
| | |-WEB-INF
| | | |-logback.xml
| | | |-lib
| | | | |-jcl-over-slf4j.jar
| | | | |-logback-classic.jar
| | | | |-logback-core.jar
| | | | |-slf4j-api.jar
Run Code Online (Sandbox Code Playgroud)
myState.jar需要存在于tomcat/lib目录中,因为它包含tomcat启动时作为全局资源所需的类.它将其记录到slf4j,因此还需要slf4j和logback jar.它使用JoranConfigurator加载myStateLogback.xml.
myApp webapp将其记录到commons-logging,但是我希望它通过slf4j进行logback以准备将所有日志记录移动到slf4j,所以我使用的是jcl-over-slf4j桥.
通过上面的设置,日志记录全部有效,但我在启动时收到以下警告:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/tomcat/lib/logback-classic-0.9.29.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/tomcat/webapps/myApp/WEB-INF/lib/logback-classic-0.9.29.jar!/org/slf4j/impl/StaticLoggerBinder.class]
Run Code Online (Sandbox Code Playgroud)
如果我从webapp的lib目录中取出logback-classic,我会得到以下异常: …
我想使用 SSH Jenkins 插件发布来传输一些文件,然后在目标 Linux 机器上运行一些命令。尽管我们有大约 10 台潜在的目标机器,但需要将该目标机器指定为构建参数。
我知道我可以使用参数化发布来选择用于通过 SSH 构建步骤发布的主机,但似乎我必须在此处定义每个可能的服务器,并为每个服务器复制文件集和命令。有没有办法只提供一次文件集和命令并将其应用于所有潜在的目标计算机?
即此屏幕截图中红色圆圈中的位可以为两台服务器只指定一次吗?我的意思并不是只是将这些命令放入脚本中并为所有服务器传输该命令 - 我仍然需要将传输命令放入每个服务器配置块中。
谢谢,莎拉

我正在使用 VSTS 中内置的 nuget 任务来执行包恢复。我们的提要托管在内部 Artifactory 服务器上,并在我的 nuget.config 中作为包源进行引用。然后,我使用 VSTS 中的 nuget 服务端点来存储访问该源的凭据。
但是,当我运行构建时,我会在构建日志中看到以下内容,并且对 nuget feed 的每个请求都会导致 401 Unauthorized。
CredentialProvider.TeamBuild: URI Prefixes:
CredentialProvider.TeamBuild: https://ukipo.visualstudio.com/
CredentialProvider.TeamBuild: https://ukipo.pkgs.visualstudio.com/
CredentialProvider.TeamBuild: URI: http://repo1:8081/artifactory/api/nuget/nuget-repos
CredentialProvider.TeamBuild: Is retry: False
CredentialProvider.TeamBuild: Matched prefix:
CredentialProvider.TeamBuild: This provider only handles URIs from the build's Team Project Collection
Unauthorized http://repo1:8081/artifactory/api/nuget/nuget-repos/Packages(Id='Microsoft.AspNet.Razor',Version='3.2.3') 16ms
WARNING: Unable to find version '3.2.3' of package 'Microsoft.AspNet.Razor'.
http://repo1:8081/artifactory/api/nuget/nuget-repos: The V2 feed at 'http://repo1:8081/artifactory/api/nuget/nuget-repos/Packages(Id='Microsoft.AspNet.Razor',Version='3.2.3')' returned an unexpected status code '401 Unauthorized'.
Run Code Online (Sandbox Code Playgroud)
我还需要配置其他任何内容才能获取在服务端点中获取凭据的任务吗?如果我只是将它们放入packageSourceCredentialsnuget.config 中,一切都会正常工作。
我在 vsts 中有一个发布定义,需要访问我在变量组中定义为秘密变量的密码。我已将该组链接到此发布定义,但是当我运行任务时,参数最终为空。我需要做什么特别的事情来获取秘密变量的值吗?
使用密码的powershell任务的定义
关联变量组
错误输出:
2017-08-09T14:01:17.9262375Z ##[command]. 'C:\agent_work\r1\a\$(AGENT.BUILDDIRECTORY)\RCV\deploys\common\Get-FromArtifactory.ps1' -repoUsername developer -repoPassword -repoPath libs-snapshot-local
2017-08-09T14:01:18.8168538Z ##[error]C:\agent_work\r1\a\$(AGENT.BUILDDIRECTORY)\RCV\deploys\common\Get-FromArtifactory.ps1 : Missing an argument for parameter 'repoPassword'. Specify a parameter of type 'System.String' and try again.
Run Code Online (Sandbox Code Playgroud)
编辑以根据要求添加更多信息。
这是我的 Get-FromArtifactory.ps1 的开始
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[String]
$repoUsername,
[Parameter()]
[String]
$repoPassword,
# Other params
)
#setup credentials object for arty access
$secPassword = $repoPassword | ConvertTo-SecureString -asPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($repoUsername, $secPassword)
Run Code Online (Sandbox Code Playgroud)
2017 年 8 月 15 日编辑 - 我已将其更新为使用 @Marina-MSFT 建议的引号,但它仍然只是空白。
修改脚本以打印出部分密码:
[CmdletBinding()]
param …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 maven 版本插件将我的 pom 更新到下一个快照版本。例如。0.0.1应该改为0.0.2-SNAPSHOT.
根据我对http://www.mojohaus.org/versions-maven-plugin/set-mojo.html 的阅读,我希望mvn versions:set -DnextSnapshot=true这样做,但实际上它只是提示我使用当前版本的默认值的新版本( 0.0.1). 我在这里错过了什么吗?我想将此更新作为脚本的一部分进行,因此不需要任何手动干预。
我正在使用版本插件的 v2.5。上面的链接说nextSnapshot可以从 2.10 获得,但 2.5 似乎是我能找到的最新版本。