问题列表 - 第23714页

替换标准的Android JSON解析器以获得更好的性能?

我知道Android有一个JSON解析器,但我想知道是否值得使用提供更好性能的东西(比如杰克逊 - 请参阅http://jackson.codehaus.org/)?有人试过吗?

parsing android json jackson

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

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万
查看次数

所有ajax .load()请求完成后执行函数

我有一个有标签集的页面.每个选项卡都由jQuery .load()函数加载.

我想显示一个加载动画,当所有的ajax请求都完成时,它会消失.但是,document.ready()只给了我有限的成功.

在执行代码隐藏加载动画之前,如何确保完成所有ajax请求?

ajax jquery

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

将subprocess.Popen调用的输出存储在字符串中

我正在尝试用Python进行系统调用,并将输出存储到我可以在Python程序中操作的字符串中.

#!/usr/bin/python
import subprocess
p2 = subprocess.Popen("ntpq -p")
Run Code Online (Sandbox Code Playgroud)

我尝试了一些事情,包括一些建议:

检索subprocess.call()的输出

但没有任何运气.

python subprocess

278
推荐指数
10
解决办法
40万
查看次数

在REST应用程序中维护会话的方法

我们有一个REST应用程序,主要由不需要维护其状态的应用程序使用,所以到目前为止,我们已经安静地"RESTFUL"而没有维持状态.我们使用Private/Public(类似于Amazon)进行身份验证.目前,客户端会为每个请求传递凭据

现在我们有一个新的要求,我们必须维持状态(或对话).客户端可以是Rich应用程序或手持设备.我正试图用最好的方式来实现状态.我们应该传递一个会话ID并维护该ID ..是最好也是唯一的解决方案?

rest

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

以Winforms形式滑动

我正在屏幕底部制作一个表单,我希望它向上滑动,所以我编写了以下代码:

int destinationX = (Screen.PrimaryScreen.WorkingArea.Width / 2) - (this.Width / 2);
int destinationY = Screen.PrimaryScreen.WorkingArea.Height - this.Height;

this.Location = new Point(destinationX, destinationY + this.Height);

while (this.Location != new Point(destinationX, destinationY))
{
    this.Location = new Point(destinationX, this.Location.Y - 1);
    System.Threading.Thread.Sleep(100);
}
Run Code Online (Sandbox Code Playgroud)

但代码只是贯穿并显示结束位置而没有显示形式滑动,这就是我想要的.我尝试过Refresh,DoEvents - 任何想法?

c# loops winforms

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

Spring事务参数化测试和自动装配

有没有办法获得一个扩展AbstractTransactionalJUnit4SpringContexts的类,以便与JUnit自己的@RunWith(Parameterized.class)很好地配合,以便标记为Autowired的字段正确连接?

@RunWith(Parameterized.class)
public class Foo extends AbstractTransactionalJUnit4SpringContextTests {

    @Autowired private Bar bar

    @Parameters public static Collection<Object[]> data() {
        // return parameters, following pattern in
        // http://junit.org/apidocs/org/junit/runners/Parameterized.html
    }

    @Test public void someTest(){
        bar.baz() //NullPointerException
    }
}
Run Code Online (Sandbox Code Playgroud)

java junit spring

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

php多维数组,内存管理

我需要这样的结构

    array(){
    [0] => array(){
           [0] => array(){ 
                         // this array will have 'n' values(n is large, like 2000)
                         }
           [1] => array(){ 
                         // this array will have 'n' values(n is large, like 2000)
                         }
                   }
    .
    .
    .
[n] => ............
}
Run Code Online (Sandbox Code Playgroud)

n个数组每个都有一个2元素数组,其中每个元素都有一个n值数组.

我使用$list[$m][0][$n]$list[$m][1][$n]内部2 for循环$m,$n不同0...2000

这超过了允许的内存大小..我可以在php.ini中更改大小,但我想优化我的内存使用量而不是更改限制.

会用对象帮忙吗?

请提供一些示例代码以供理解.谢谢.

php memory-management multidimensional-array

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

如何确保将Java对象(包含加密材料)归零?

我担心的是,垃圾收集器管理的加密密钥和秘密可以在内存中复制和移动而不会出现零化.

作为一种可能的解决方案,它足以:

public class Key {
  private char[] key;
  // ...
  protected void finalize() throws Throwable { 
    try {
      for(int k = 0; k < key.length; k++) {
        key[k] = '\0';
      }
    } catch (Exception e) {
      //...
    } finally {
      super.finalize();
    }
  }
  // ...
}
Run Code Online (Sandbox Code Playgroud)

编辑:请注意,我的问题不仅涉及对象的官方(引用)副本的归零,而且还涉及垃圾收集器可能已经制作的任何陈旧副本,同时它会为了空间和速度效率而改变内存.

最简单的例子是标记和扫描GC,其中对象被标记为"引用",然后所有这些对象被复制到另一个区域.其余的都是垃圾,所以他们被收集.当副本发生时,可能会留下垃圾收集器不再管理的剩余密钥数据(因为"官方"数据位于新区域中).

对此进行的试金石是,如果您在加密模块中使用密钥,将密钥归零,然后检查整个JVM进程空间,则不应该找到该密钥.

java security fips

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

在运行时调整JQGrid列的大小

我需要在运行时调整JQGrid列的大小.

例如:列加载时列的列宽为100px.之后我需要把它改成200.

请帮忙.

jqgrid

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