我有一个类似于这样的XML配置文件:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<config>
<mainServerHostname>MainServer</mainServerHostname>
<failoverServers>
<server>
<ipAddress>192.168.0.5</ipAddress>
<priority>1</priority>
</server>
<server>
<ipAddress>192.168.0.6</ipAddress>
<priority>2</priority>
</server>
</failoverServers>
</config>
Run Code Online (Sandbox Code Playgroud)
现在,我知道通过使用以下代码(在设置我的XMLConfiguration对象并调用它之后):
config.getList("failoverServers.server.ipAddress");
Run Code Online (Sandbox Code Playgroud)
我可以得到所有IP地址的列表.这很方便,但如果我可以做这样的事情会更方便:
config.getList("failoverServers.server");
Run Code Online (Sandbox Code Playgroud)
并获取一个对象列表,每个对象都有一个ipAddress和一个优先级.据我所知,没有办法做到这一点.有没有人对如何实现这种功能有任何想法?我甚至非常愿意定义与Java可以将数据映射到的XML结构相对应的数据结构,如果这会使事情变得更容易(事实上甚至可能更好).谢谢大家的帮助!
我正在尝试为我在服务器上设置的存储库创建一个非常简单的提交后挂钩.脚本如下:
REPOS="$1"
REV="$2"
cd /var/www/directory && svn update --username user --password pass
Run Code Online (Sandbox Code Playgroud)
当我从我的SVN客户端运行提交时,我收到以下错误:
post-commit hook failed (exit code 255) with no output.
Run Code Online (Sandbox Code Playgroud)
但是,当我使用sudo bash post-commit从cli运行我的post-commit钩子时,它会完美地执行.关于我做错了什么的任何想法?
我正在开发一个名为PHP-Bouncer的开源项目,我正在为我正在编写的MySQL Query遇到问题.基本上我们有三个表:BouncerRoles,PageInRole和BouncerPageOverrides.BouncerRoles包含访问级别,另外两个表通过外键链接回BouncerRoles并提供多个附加数据条目.我编写了以下查询以尝试同时提取我需要的所有角色数据:
select BouncerRoles.RoleID, BouncerRoles.RoleName,
GROUP_CONCAT(PageInRole.PageName separator '|') as ProvidedPages,
GROUP_CONCAT(CONCAT(BouncerPageOverrides.OverriddenPage,'&',BouncerPageOverrides.OverridingPage) separator '|') as OverriddenPages
from BouncerRoles join PageInRole on BouncerRoles.RoleID = PageInRole.RoleID
join BouncerPageOverrides on BouncerRoles.RoleID = BouncerPageOverrides.RoleID
group by BouncerRoles.RoleID;
Run Code Online (Sandbox Code Playgroud)
此查询的目标是提供RoleID,RoleName,提供的页面的管道分隔列表,以及管道分隔的覆盖列表(以覆盖页和覆盖页的形式).一切都有效,除了查询的最后一列,它会像这样重复一遍又一遍地找到的条目(以CSV格式输出):
RoleID,RoleName,ProvidedPages,OverriddenPages
2,Exchange,exchange-how.php|exchange-support.php|exchange.php|premium-promo.php|exchange-resorts.php|premiumplus-promo.php|exchange-deposit.php|exchange-requestdestination.php,whyexchange.php&exhange.php|whyexchange.php&exhange.php|whyexchange.php&exhange.php|whyexchange.php&exhange.php|whyexchange.php&exhange.php|whyexchange.php&exhange.php|whyexchange.php&exhange.php|whyexchange.php&exhange.php
3,Premium,premiumplus-promo.php|premium-cruises.php|premium-resorts.php|premium-condohome.php|premium-hotelaircar.php|premium.php|premium-restaurants.php|premium-overview.php,premium-promo.php&premium.php|premium-promo.php&premium.php|premium-promo.php&premium.php|premium-promo.php&premium.php|premium-promo.php&premium.php|premium-promo.php&premium.php|premium-promo.php&premium.php|premium-promo.php&premium.php
4,"Premium Plus",premiumplus-exclusiveescapes.php|premiumplus.php|premiumplus-overview.php|premiumplus-concierge.php|premiumplus-airportlounge.php,premiumplus-promo.php&premiumplus.php|premiumplus-promo.php&premiumplus.php|premiumplus-promo.php&premiumplus.php|premiumplus-promo.php&premiumplus.php|premiumplus-promo.php&premiumplus.php
Run Code Online (Sandbox Code Playgroud)
在我的查询中有没有我做错了导致这个?
我试图做我猜想会很简单的事情,但事实证明并非如此.我有一个ACR122 NFC阅读器和一堆Mifare Classic和Mifare Ultralight标签,我想要做的就是从Java应用程序读取和写入每个卡的mime类型和短文本字符串.这是我到目前为止所做的工作:
这是我的代码:
主要:
public static void main(String[] args){
TerminalFactory factory = TerminalFactory.getDefault();
List<CardTerminal> terminals;
try{
TerminalHandler handler = new TerminalHandler();
terminals = factory.terminals().list();
CardTerminal cardTerminal = terminals.get(0);
AcsTerminal terminal = new AcsTerminal();
terminal.setCardTerminal(cardTerminal);
handler.addTerminal(terminal);
NfcAdapter adapter = new NfcAdapter(handler.getAvailableTerminal(), TerminalMode.INITIATOR);
adapter.registerTagListener(new CustomNDEFListener());
adapter.startListening();
System.in.read();
adapter.stopListening();
}
catch(IOException e){
}
catch(CardException e){
System.out.println("CardException: " + e.getMessage());
}
}
Run Code Online (Sandbox Code Playgroud)
CustomNDEFListener:
public class CustomNDEFListener extends AbstractCardTool
{
@Override
public void doWithReaderWriter(MfClassicReaderWriter readerWriter)
throws IOException{
NdefMessageDecoder …Run Code Online (Sandbox Code Playgroud) 我正在考虑编写一个Windows服务,它将在用户指定的时间打开或关闭某个功能(使用我将提供的配置实用程序).基本上,用户将指定PC将进入"仅工作"模式(阻止Facebook和其他分散注意力的站点)的某些时间,然后当这些时间到来时,PC将返回到正常模式.
我已经想出了一些方法来创建"仅限工作"模式,但我正在努力的是如何知道何时进出该模式.我真的不想使用线程和计时器,如果我可以避免它,因为这似乎会产生大量的开销,所以我正在寻找的将是某种方式:
有谁知道最好的方法吗?
我有WCF配置问题.我有一个WCF Web服务,我希望能够使用GET参数通过Web浏览器访问(最终在PHP中使用simplexml_load_file()).我的Visual Studio解决方案被设置为一个WCF服务库项目,其中包含一个接口(定义服务的位置),一个类(实现服务的地方,以及一个默认存在的app.config).我也有一个WCF服务项目,包含.svc文件(指向我的类)和web.config.我的服务接口设计如下:
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using RTXEngineLib.externalLibrary;
namespace RTXEngineLib {
[ServiceContract(Name = "RTXEngine", Namespace = "")]
public interface IRTXEngine {
[OperationContract(Name = "GetCountryList"), WebGet(UriTemplate = "/GetCountryList/", ResponseFormat = WebMessageFormat.Xml)]
List<Country> GetCountryList();
[OperationContract(Name = "GetRegions"), WebGet(UriTemplate = "/GetRegions/?countryID={countryID}", ResponseFormat = WebMessageFormat.Xml)]
List<Region> GetRegions(int countryID);
[OperationContract(Name = "GetExchangeAvailability"), WebGet(UriTemplate = "/GetExchangeAvailability/?countryID={countryID}&month={month}&year={year}®ionID={regionID}&resortID={resortID}", ResponseFormat = WebMessageFormat.Xml)]
AvailabilityList GetExchangeAvailability(int countryID, String month, int year, String regionID = "?", String resortID = "");
[OperationContract(Name = "GetResortsForDate"), WebGet(UriTemplate = …Run Code Online (Sandbox Code Playgroud) 我有一个问题,希望你能帮忙.假设我为一家名为"Blammo"的假想公司工作,我们有一个名为"Log"的假设产品.我正在尝试建立一个系统,有人可以登录到logfromblammo.com并订购我们的一些产品,然后当他们准备购买时,请到checkout.blammo.com支付他们的订单.最终我想允许Blammo在其自己的网站上推出一个新的假设产品:rockfromblammo.com,并且该网站还能够与checkout.blammo.com共享会话,以便用户可以在这两个产品上拥有一个购物车网站.
当然,上面描述的假设情景并不是我公司的实际运作方式,但它是我需要做的一个公平的例子.我们有一个现有的用户数据库,我们有办法对我们任何网站上的任何用户进行身份验证,但我的目标是允许用户无需重新进行身份验证即可从一个站点无缝跨越到另一个站点.这也允许我们将诸如购物车之类的数据无缝地传输到结账站点.
我(简要地)看过OpenID这样的解决方案,但是我需要能够将我们现有的任何解决方案与现有的身份验证方法集成在一起,这种方法并不十分强大.有没有什么好方法可以通过PHP单独做到这一点?
我有几个使用Maven的项目,我想在我的工作网络上运行一个内部存储库.我有几个来自第三方的库,不能发布到野外,还有一些我们自己的库需要在网络中可用(包括我们的TeamCity CI服务器),但不能在网络外部署.经过一些研究,我发现了三个关于如何实现这一目标的主要建议:Archiva,Artifactory和Nexus.我已经尝试了每个,并且未能使用其中任何一个创建的内部存储库成功构建我的任何项目.
这让我相信我误解了某些事情或做错了什么.有没有人知道一个教程,它将引导我完成设置和内部Maven存储库并将其与我的项目集成?
我有一些分层数据,我需要在一系列嵌套的UL中显示.对于每个项目,我有一个名称,一个ID和一个深度值.通常我会按深度对这些项进行分组,但实际上我需要使用我的数据创建树结构,如下所示:

这是我的问题:有没有一种很好的方法来生成有效的标记(如果我能用正确的标签打印出来,我会很喜欢它,但这很难)我的数据将被嵌套在UL中?我已经有一个有点工作的解决方案,但我得到一个单一的迷路标签.这是我的代码:
<?php
include("includes/classes/Database.class.php");
$db = new Database();
$query = "SELECT COUNT(parent.Name) - 2 as level, node.Name AS Name, node.ID
FROM Region AS node, Region AS parent
WHERE node.LeftVal BETWEEN parent.LeftVal AND parent.RightVal and node.Name <> 'Earth'
GROUP BY node.ID
ORDER BY node.LeftVal";
$results = $db->executeQuery($query);
?>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
$last_level = 0;
?>
<ul id="regionTree">
<?php
while ($row = mysql_fetch_assoc($results)) {
$link = '<li>'.PHP_EOL.'<a href="addChild.php?parentid='.$row["ID"].'">'.$row["Name"]."</a>".PHP_EOL;
$diff = $last_level - $row["level"];
if($diff …Run Code Online (Sandbox Code Playgroud) 我有一个多模块maven项目,我无法编译.我在我的本地网络上有一个Nexus存储库,它正在工作(IntelliJ Idea能够解析仅存在于该存储库中的依赖关系),我正在通过Jetbrains TeamCity构建.我相当确定TeamCity正在工作,因为我设置的其他几个构建配置仍然有效(使用相同的settings.xml).对于可能导致问题的原因,我有点失落.这是我的pom文件:
父母pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company.product.plugins</groupId>
<artifactId>plugin-parent</artifactId>
<version>1.2-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>product-wireless-plugin</module>
<module>product-paging-plugin</module>
</modules>
<distributionManagement>
<repository>
<id>releases</id>
<url>http://192.168.2.192:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://192.168.2.192:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<pluginRepositories>
<pluginRepository>
<id>autoincrement-versions-maven-plugin</id>
<name>autoincrement-versions-maven-plugin</name>
<url>http://autoincrement-versions-maven-plugin.googlecode.com/svn/repo</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>autoincrement-versions-maven-plugin</artifactId>
<version>2.0-SNAPSHOT</version>
<executions>
<execution>
<id>update-pom-versions</id>
<goals>
<goal>increment</goal>
<goal>commit</goal>
</goals>
<phase>compile</phase>
<configuration>
<autoIncrementVersion>true</autoIncrementVersion>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
产品 - 无线pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" …Run Code Online (Sandbox Code Playgroud) 我正在使用项目中的第三方库,它包含两个.dll文件和一个.jar fie来提供JNI Wrapper.可以使用以下命令调用.jar文件中包含的第三方供应商的测试项目:
java -cp product.jar com.company.samples.product.Test
Run Code Online (Sandbox Code Playgroud)
只要.jar和两个dll都在同一个目录中,这就可以了.
在我的项目中,我将jar文件和dll放在同一目录中,然后将jar文件作为IntelliJ Idea中的库引用,但这会导致库无法找到dll.有没有办法可以告诉Idea哪里有dll,所以它可以在执行期间将它们输出到与jar文件相同的目录中?
我试图在一些PHP代码中集成我从同事(在VB中实现它)收到的正则表达式.正则表达式旨在验证密码是否满足某些复杂性要求,但我的函数总是返回false,即使密码符合我们的复杂性要求.要求是:
至少8个字符,最多20个字符,不能包含空格,必须包含至少一(1)个数字和一(1)个特殊字符.密码中可以使用以下特殊字符: - !@#$%&*()_ + =.?.
我提供的正则表达式是:
ValidationExpression = "^.*(?=.{8,20})(?=.*\d)(?=.*[a-zA-Z])(?=.*[-!@#$%&*()_+=.?])(?!.*\s).*$"
Run Code Online (Sandbox Code Playgroud)
我写的用于验证密码的函数是:
function validatePassword($pass){
$regex = "^.*(?=.{8,20})(?=.*\d)(?=.*[a-zA-Z])(?=.*[-!@#$%&*()_+=.?])(?!.*\s).*$";
return preg_match($regex, $pass);
}
Run Code Online (Sandbox Code Playgroud)
我怀疑问题在于我在做一些愚蠢的事情,但由于正则表达式仍然令我困惑,我不知道问题是什么.有任何想法吗?