小编Bla*_*gic的帖子

OpenVPN Api生成ovpn文件

我需要在Java应用程序中使用OpenVPN API生成ovpn文件,但是我似乎无法找到有关此API的任何信息.有没有人有任何可以让我入门的经验或信息?

谢谢

java api openvpn

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

collectionView单元格重叠

我正在尝试使用4种不同的类型创建多个collectionViewCells.并且每个单元格对这4种类型中的一种具有不同的视图.根据用户选择,这些类型的每个视图都可以具有不同的内容.

我遇到的问题是,当屏幕上有多个相同类型的视图/单元时,某些卡重叠/未正确加载.

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    Card *card = [[[usermanager getSelectedUser] getCards] objectAtIndex:indexPath.item];
    NSLog(@"CARD LOADING: %@", card.title);
    [card setupLayout];
    UICollectionViewCell *cell;
    if(card.type.intValue == 1){
        cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"lifestyleCell" forIndexPath:indexPath];
    }else if(card.type.intValue == 2){
        cell= [collectionView dequeueReusableCellWithReuseIdentifier:@"sceneCell" forIndexPath:indexPath];
    }else if(card.type.intValue == 3){
        cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"energyCell" forIndexPath:indexPath];
    }else if(card.type.intValue == 4){
        cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"productCell" forIndexPath:indexPath];
    }else{
        cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cardCell" forIndexPath:indexPath];
    }
    [cell addSubview:card];

    //Add dropshadow
    cell.contentView.layer.borderWidth = 1.0f;
    cell.contentView.layer.borderColor = [UIColor clearColor].CGColor;
    cell.contentView.layer.masksToBounds = YES;

    cell.layer.shadowColor = …
Run Code Online (Sandbox Code Playgroud)

user-interface objective-c ios uicollectionview uicollectionviewcell

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

JMX Jconsole没有找到Application

我最近用MBean编写了一个应用程序,这几天工作正常.现在当它运行时,我无法使用JConsole看到它.即使我将此添加到我的运行参数:-Dcom.sun.management.jmxremote 我尝试了其他程序,如:JVisualVM和JRockit任务控制,但他们都没有看到应用程序.更重要的是,我曾经也能够看到其他程序,比如Jconsole可以看到JVisualVM,但即使这样也不能令人遗憾.有谁知道出了什么问题?谢谢

java jmx jconsole

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

EOFException getResponseCode()

我有这段代码:

public static boolean checkIfURLExists(String targetUrl) {
        HttpURLConnection httpUrlConn;
        System.setProperty("http.keepAlive", "false");
        try {
            httpUrlConn = (HttpURLConnection) new URL(targetUrl)
                    .openConnection();
            httpUrlConn.setRequestMethod("HEAD");

            // Set timeouts in milliseconds
            httpUrlConn.setConnectTimeout(500);
            httpUrlConn.setReadTimeout(1000);

            // Print HTTP status code/message for your information.
            return (httpUrlConn.getResponseCode() == HttpURLConnection.HTTP_OK);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("Removing the URL: " + targetUrl);
            return false;
        }
    }
Run Code Online (Sandbox Code Playgroud)

如果URL可以访问,则测试.我用不同的URL多​​次调用这段代码.但是,代码在这一行给了我一个EOFException:

return (httpUrlConn.getResponseCode() == HttpURLConnection.HTTP_OK);
Run Code Online (Sandbox Code Playgroud)

例外:

12-18 11:11:57.655: W/System.err(30198): java.io.EOFException
12-18 11:11:57.655: W/System.err(30198):    at java.util.zip.GZIPInputStream.readFully(GZIPInputStream.java:206)
12-18 11:11:57.655: W/System.err(30198):    at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:98)
12-18 11:11:57.665: W/System.err(30198):    at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:81) …
Run Code Online (Sandbox Code Playgroud)

java android exception eof

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

未实现的谓词 SQL 生成

我有一个具有以下一对多关系的数据库:Device -properties-> Property

我想要一台具有至少一个具有特定显示类型的属性的设备。

    NSArray *energyDisplayTypes = [[NSArray alloc] initWithObjects:[NSNumber numberWithInt:18],[NSNumber numberWithInt:39],[NSNumber numberWithInt:50],[NSNumber numberWithInt:62],[NSNumber numberWithInt:63], nil];
    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
    NSEntityDescription *entity = [NSEntityDescription entityForName:@"Device"
                                              inManagedObjectContext:context];
    NSError *error;
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"properties.displayType IN %@", energyDisplayTypes];
    [fetchRequest setPredicate:predicate];
    [fetchRequest setEntity:entity];
    NSArray *products= [context executeFetchRequest:fetchRequest error:&error];
Run Code Online (Sandbox Code Playgroud)

我不断收到此异常:

'NSInvalidArgumentException', reason: 'unimplemented SQL generation for predicate : properties.displayType IN {18, 39, 50, 62, 63}'
Run Code Online (Sandbox Code Playgroud)

我对数据库没有太多经验,所以这可能很简单。如果有人可以帮助我,我将不胜感激

database core-data ios

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

Java String比较错误的结果

我试图根据EditTexts实际更改来启用/禁用"保存"按钮,但我的字符串比较根本不起作用.

public void afterTextChanged(Editable editable) {
    String newSet = editable.toString();

    newSet = newSet.trim();
    if(!newSet.equals(ip) || !newSet.equals(port) || !newSet.equals(username) || !newSet.equals(password)){
        saveButton.setEnabled(true);
    }else{
        saveButton.setEnabled(false);
    }
}
Run Code Online (Sandbox Code Playgroud)

它一直告诉我字符串是不同的,即使它们不是.即使我打印出来,我也会得到完全相同的String.

谁能帮我?

谢谢

java string comparison android

-7
推荐指数
1
解决办法
112
查看次数