小编Xet*_*ius的帖子

如何检查NSString是否以某个字符开头

如何检查NSString是否以某个字符(字符*)开头.

*是单元格类型的指示符,所以我需要没有*的NSString的内容,但需要知道*是否存在.

objective-c nsstring

208
推荐指数
4
解决办法
11万
查看次数

如何从.plist文件读取数据结构到NSArray

我正在使用以下方法手动创建数据结构:

NSDictionary* league1 = [[NSDictionary alloc] initWithObjectsAndKeys: @"Barclays Premier League", @"name",
                 @"Premier League", @"shortname",
                 @"101", @"id", nil];
NSDictionary* league2 = [[NSDictionary alloc] initWithObjectsAndKeys: @"Coca-Cola Championship", @"name",
                 @"Championship", @"shortname",
                 @"102", @"id", nil];
NSDictionary* league3 = [[NSDictionary alloc] initWithObjectsAndKeys: @"Scottish Premier League", @"name",
                 @"SPL", @"shortname",
                 @"201", @"id", nil];
NSDictionary* league4 = [[NSDictionary alloc] initWithObjectsAndKeys: @"Champions League", @"name",
                 @"UCL", @"shortname",
                 @"501", @"id", nil];

contentArray = [[NSArray alloc] initWithObjects:

                [[NSDictionary alloc] initWithObjectsAndKeys: @"English", @"category", [[NSArray alloc] initWithObjects: league1, league2, nil], @"leagues", nil],
                [[NSDictionary alloc] …
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch objective-c plist ios

49
推荐指数
1
解决办法
8万
查看次数

将Maven文件过滤到WEB-INF中

我试图添加一些过滤到应用程序上下文文件,该文件驻留在WEB-INF目录中.

我在文件夹/ src/main/resources中有要过滤的文件(xmlgateway-context.xml).

我在文件夹src/main/filters中有属性文件(config-e05.properties)

我的POM设置如下:

<!-- environment profiles -->
<profiles>
 <profile>
  <id>e04</id>
  <properties>
   <targetenv>e04</targetenv>
  </properties>
 </profile>
 <profile>
  <id>e05</id>
  <properties>
   <targetenv>e05</targetenv>
  </properties>
 </profile>
</profiles>

<!-- build settings (filtering) -->
<build>
 <filters>
  <filter>src/main/filters/config-${targetenv}.properties</filter>
 </filters>
 <resources>
  <resource>
   <targetPath>WEB-INF</targetPath>
   <filtering>true</filtering>
   <directory>src/main/resources</directory>
  </resource>
 </resources>
</build>
Run Code Online (Sandbox Code Playgroud)

这将正确安装mvn,但是当我打开输出war文件时,我希望文件xmlgateway-context.xml位于/ WEB-INF目录中,但它最终位于/ WEB-INF/classes/WEB文件夹中-INF.

如何将此文件放到正确的位置.

或者,我可以将应用程序上下文放在不同的位置并在那里引用它.

java maven-2 pom.xml

44
推荐指数
2
解决办法
4万
查看次数

什么是Perl最好的XML解析器?

我尝试了很多Perl XML Parsers.我对Sablotron Parser很感兴趣,但安装在Windows机箱上真是太痛苦了.目前我已经开始使用XML :: LibXMLXML :: LibXSLT这两者似乎都做我需要的一切.

它们似乎也很标准.是否有比这更好的XML解析器?

xml perl libxml2

32
推荐指数
5
解决办法
2万
查看次数

Xcode - 循环打开窗口

有没有办法循环打开窗户.当我想在另一个文件中引用某些东西时,我经常使用它.在Windows上,这通常是Ctrl+ Tab,但我找不到在Mac上的Xcode中执行此操作的方法.

xcode keyboard-shortcuts

29
推荐指数
1
解决办法
1万
查看次数

正则表达式匹配除<p>和</ p>之外的所有HTML标记

我需要使用Perl中的正则表达式匹配并删除所有标记.我有以下内容:

<\\??(?!p).+?>
Run Code Online (Sandbox Code Playgroud)

但这仍然与结束</p>标签相匹配.关于如何与结束标签匹配的任何提示?

注意,这是在xhtml上执行的.

html regex perl

22
推荐指数
4
解决办法
4万
查看次数

在IntelliJ中运行Java 8 TestNG的问题

我正在使用OpenJDK 1.8编写Maven应用程序并使用TestNG运行测试.

当我从命令行运行Maven时一切正常,但是当我尝试在IntelliJ中运行测试时,make进程显示以下错误:

java: javacTask: source release 8 requires target release 1.8
Run Code Online (Sandbox Code Playgroud)

我的项目设置指向1.8 JDK和Project Language Level 8.

在Maven内部我有以下块(我猜测它还没有被调用,因为它似乎是造成问题的原因)

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
      <source>1.8</source>
      <target>1.8</target>
    </configuration>
  </plugin>
Run Code Online (Sandbox Code Playgroud)

我甚至将Maven Runner JRE配置为指向1.8 JDK.

我似乎无法让IntelliJ 12.0.4正确运行测试

我错过了什么吗?

intellij-idea java-8

22
推荐指数
2
解决办法
1万
查看次数

iPhone上的斜体,粗体和带下划线的字体

如何将字体设置为粗体和斜体.有一个boldSystemFontOfSize和italicSystemFoneOfSize,但我看不到将字体设置为斜体和粗体的方法.

作为第二个问题,有没有办法在字体上设置下划线,或者只是在文本下画一条线.

iphone fonts

21
推荐指数
1
解决办法
5万
查看次数

iPhone - 如何在矩形中间绘制文本

是否有方法在矩形的中间绘制文本.我可以找到各种对齐方式,但我尝试过的任何内容都不能将文本垂直居中.

有没有一种简单的方法可以做到这一点,或者是否有某种方法可以使矩形居中然后绘制?

我正在直接绘制CGContext,尝试使用NSString :: drawWithRect或类似的东西,因为我真的不想添加一个Label来呈现一些基本文本.

iphone

19
推荐指数
3
解决办法
4万
查看次数

indentationLevelForRowAtIndexPath不缩进自定义单元格

我已tableView:indentationLevelForRowAtIndexPath在我的UITableViewController派生类中重写了该方法,如下所示:

- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSDictionary* item = [self.projects objectAtIndex:indexPath.row];
    int indentationLevel = [[item objectForKey:@"indent"] intValue];
    DLog (@"Indentation Level for Row %d : %d", indexPath.row, indentationLevel);
    return indentationLevel;
}
Run Code Online (Sandbox Code Playgroud)

我最初认为这没有被调用,但这是操作员错误(错误,我的),我没有定义符号DEBUG = 1.

然而,它被称为(对我!),这是日志输出:

 -[RootViewController tableView:indentationLevelForRowAtIndexPath:] [Line 129] Indentation Level for Row 0 : 1
 -[RootViewController tableView:indentationLevelForRowAtIndexPath:] [Line 129] Indentation Level for Row 1 : 1
 -[RootViewController tableView:indentationLevelForRowAtIndexPath:] [Line 129] Indentation Level for Row 2 : 2
 -[RootViewController tableView:indentationLevelForRowAtIndexPath:] [Line 129] Indentation Level for Row …
Run Code Online (Sandbox Code Playgroud)

iphone uitableview

19
推荐指数
1
解决办法
2万
查看次数