小编MJB*_*MJB的帖子

Java不能与正则表达式一起使用,表示:无效的转义序列

我想用"+"替换字符串中的所有空白字符,用"ss"替换所有"ß"......它适用于"ß",但不知何故eclipse不会让我使用\ s作为空格.我尝试了"\ t",但它也不起作用..我收到以下错误:

无效的转义序列(有效转义序列为\ b\t \n\f\r \"\\\ \)

这是我的代码:

try {
    String temp1 = from.getText().toString();
    start_from  = temp1.replaceAll("ß", "ss");
    start_from  = start_from.replaceAll("\s", "+");
}
Run Code Online (Sandbox Code Playgroud)

为什么不起作用?这是android,eclipse还是什么问题?

提前致谢!

java regex whitespace android

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

AutocompleteTextView:在"NEXT"上突出显示下一个TextView,在"DONE"上,键盘消失

我有两个 AutocompleTextViews,如果用户按下"NEXT",我想切换到下一个,并在第二个AutocompleTextView点击"DONE"时使虚拟键盘消失.到目前为止,按钮"NEXT"/"DONE"什么都不做......不幸的是我找不到解决这个问题的资源.

有什么建议?谢谢

编辑:只是想补充说,这是当Android在版本2.3或类似的东西时被问到的.

keyboard android autocomplete highlight

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

我想在eclipse中使用哪个文本文件?

我启动程序时需要读取文本文件.我正在使用eclipse并启动了一个新的java项目.在我的项目文件夹中,我得到了"src"文件夹和标准的"JRE系统库"+ staedteliste.txt ...我只是不知道在哪里放文本文件.我真的尝试了我能想到的每个文件夹....我不能使用"硬编码"路径,因为文本文件需要包含在我的应用程序中...

我使用以下代码来读取文件,但是我收到此错误:

Error:java.io.FileNotFoundException:staedteliste.txt(No such file or directory)
Run Code Online (Sandbox Code Playgroud)
public class Test {

ArrayList<String[]> values;

public static void main(String[] args) {
    // TODO Auto-generated method stub

    URL url = Test.class.getClassLoader().getResource("src/mjb/staedteliste.txt");
    System.out.println(url.getPath()); // I get a nullpointerexception here!
    loadList();
}

public static void loadList() {
    BufferedReader reader;
    String zeile = null;

    try {
        reader = new BufferedReader(new FileReader("src/mjb/staedteliste.txt"));
        zeile = reader.readLine();          

        ArrayList<String[]> values = new ArrayList<String[]>();

        while (zeile != null) {             
            values.add(zeile.split(";"));
            zeile = reader.readLine();
        }
        System.out.println(values.size());
        System.out.println(zeile);

    } catch (IOException …
Run Code Online (Sandbox Code Playgroud)

java eclipse file-io readfile

25
推荐指数
2
解决办法
16万
查看次数

继续得到"这个NSPersistentStoreCoordinator没有持久存储.它无法执行保存操作." 关闭我的应用程序(OSX)

我已经检查了互联网和stackOverflow上的几个帖子,但到目前为止找不到答案.这是我的AppDelegate,据我所知,这些实现非常标准..我只是添加了以下行并传递了参数,但它没有帮助..

NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
  [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
  [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
Run Code Online (Sandbox Code Playgroud)

我清理了我的项目,这也没有帮助.此外,不会创建ApplicationSupport文件夹.这可能是导致问题的原因吗?我没有使用"使用核心数据"选项创建应用程序,但我提供了必要的方法......

- (NSPersistentStoreCoordinator*)persistentStoreCoordinator {...}位于底部!

非常感谢帮助!

#import "WebLogClientAppDelegate.h"

// create anonymous catergories for uses in this class
@interface WebLogClientAppDelegate();
@property(nonatomic, readonly) NSString *applicationSupportFolder;
@property(nonatomic, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;
@end

@implementation WebLogClientAppDelegate
@synthesize autorPrefFeld, benutzerPrefFeld, passwortPrefFeld, hauptfenster,
managedObjectModel, managedObjectContext, autor;

- (void) applicationWillFinishLaunching:(NSNotification *)notification
{
    NSLog(@"applicationWillFinishLaunching");
    NSDictionary *defaultsDict = [NSDictionary dictionaryWithObjectsAndKeys:@"Mathias Mustermann", @"autor", 
                                  @"mathias", @"benutzer", 
                                  @"passwort",@"passwort", nil];
    [[NSUserDefaults standardUserDefaults] registerDefaults:defaultsDict];
}

- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
{
    [moc commitEditing];
    if ([moc hasChanges]) …
Run Code Online (Sandbox Code Playgroud)

iphone macos cocoa cocoa-touch core-data

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

无法使用bootstrap-sass与webpack一起工作

我遵循bootstrap-sass-loader页面上的instrtuctions

在我的package.json我得到了

"bootstrap-sass": "^3.3.6",
"bootstrap-sass-loader": "^1.0.9"
Run Code Online (Sandbox Code Playgroud)

这是我的webpack.config.js

module.exports = {
  entry: ['./app.js'],
  output: {
    publicPath: 'http://localhost:8080/',
    filename: 'build/bundle.js'
  },
  devtool: 'eval',
  module: {
    /* used on code before it's transformed */
    preLoaders: [
      {
        test: /\.jsx?$/,
        exclude: /(node_modules)/,
        loader: 'source-map'
      }
    ],
    /* used to modify code */
    loaders: [

      {test: /bootstrap\/js\//, loader: 'imports?jQuery=jquery'},
      {test: /\.obj|\.mtl|\.html|\.dae|\.txt/, loader: "raw"},
      {test: /\.jsx?$/, exclude: /(node_modules)/, loader: 'babel'},
      {test: /\.css$/, loader: 'style-loader!css-loader'},
      {test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file"},
      {test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=application/font-woff'},
      {test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, …
Run Code Online (Sandbox Code Playgroud)

javascript twitter-bootstrap bootstrap-sass webpack

10
推荐指数
2
解决办法
7764
查看次数

我的sub-viewControllers的弱或强属性?

#import <UIKit/UIKit.h>
#import "UCMapviewController.h"
#import "UCMenuviewController.h"
#import "UCOverviewController.h"

@interface UCRootViewController : UIViewController

@property (weak, nonatomic) UCMapviewController *mapviewController;
@property (weak, nonatomic) UCMenuviewController *menuviewController;
@property (weak, nonatomic) UCOverviewController *overviewController;
Run Code Online (Sandbox Code Playgroud)

这是我的UCRootViewController的声明,它应该管理这些sub-viewControllers.他后来也将成为他们的代表,以便在何时应该显示一个控制器时进行处理.

rootViewController在UIAppDelegate中保持强大,并将一直保持活动状态.

那么使这些子视图控制器变弱是否正确?我不是100%肯定,但据我所知,当没有强指针指向它们时,弱指针会被释放.因为根很强大,让它们变弱是正确的,对吗?

#import <UIKit/UIKit.h>

@class UCRootViewController;
@interface UCOverviewController : UIViewController

@property (weak, nonatomic) UCRootViewController *rootviewController;
Run Code Online (Sandbox Code Playgroud)

这是我的一个子viewControllers的标题.它们有一个指向(稍后)委托rootviewController的弱指针.是否足以声明@class UCRootviewController让他们调用委托方法?我甚至需要这个吗?

谢谢

编辑:我刚读了一篇关于ViewControllers文章的好文章:

始终使用高质量的视图控制器容器或+ [UIViewController presentModalViewController:animated:]来显示应用程序中的视图控制器.如果你需要在某处保持对视图控制器的引用,请使用弱引用,除非你真的希望它为了缓存目的而保持更长时间.在这种情况下,请确保正确响应低内存条件.

它说使用弱参考,你对此有何看法?

cocoa-touch delegates properties uiviewcontroller ios

9
推荐指数
1
解决办法
4877
查看次数

点击jquery mobile更改数据图标

这是我的代码:

function togglePOIAndDisplay(toggle){
    var display = $(toggle).attr('data-icon');
    console.log(display);
    if(display == 'minus'){
        $(toggle).attr('data-icon', 'check');
            console.log(display);
    } else {
        $(toggle).attr('data-icon', 'minus');
        removeMarkers(toggle);
    }
}   
Run Code Online (Sandbox Code Playgroud)

它将登录minus到控制台并进入第一个if()块并正确执行displayAllPOIOfType(),但它不会反映值的更改,尽管它已正确设置.任何想法,因为它显然正确读取/设置属性.

function我需要调用更新吗?谢谢

jquery jquery-mobile

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

无法为openlayers地图设置地图的div高度

此代码使地图的div宽度最大但高度为0(%值无关紧要,始终为0)

<div id="map" style="width: 100%; height: 100%;"></div>
Run Code Online (Sandbox Code Playgroud)

这是有效的,因为它将地图的div设置为固定大小,但显然不是我想要的.

<div id="map" style="width: 100%; height: 500px;"></div>
Run Code Online (Sandbox Code Playgroud)

有人经历过这个吗?有人建议如何解决这个问题?

我也在使用jquery(-mobile)

谢谢

openlayers

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

jquery ajax POST没有表单元素

我需要发布数据,网址只是"v1/wave",它需要五个参数.我尝试过这个,但到目前为止它没有用:

function request(minLat, minLon, maxLat, maxLon, maxNrOfResults, callback){

$.ajax({

        url: 'v1/wave?minLat='+minLat+'&minLong='+minLon+'&maxLat='+maxLat+'&maxLong='+maxLong'+&maxNrOfResults='+maxNrOfResults,
        type: "GET",
        success: function (data) {
            callback(data);
            if(data.msgCode == LOGIN_SUCCESS){
                console.log("request success");



            } else if(data.msgCode == LOGIN_FAILED){
                console.log("request failed");
            }
        },
        error: function(data) {
            handleRequestError(data);
        }
    })
Run Code Online (Sandbox Code Playgroud)

错误:未捕获的SyntaxError:url行中的意外字符串.

ajax jquery

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

使用javascript为google + link设置文本

我想用一些数据打开谷歌共享对话框,我现在使用它:

var GOOGLE_BASE_URL = "https://plus.google.com/share?url=";
url += GOOGLE_BASE_URL + urlToShare;
window.open(url, null, DIMENSIONS);
Run Code Online (Sandbox Code Playgroud)

如何设置插入评论部分的文本?

html javascript url sharing google-plus

4
推荐指数
1
解决办法
1810
查看次数