问题列表 - 第36699页

"使用"是否具有任何优势?

引用某些方法时,可以使用using或显式键入整个命名空间.使用一种方法比另一种方法有任何速度优势,还是只是简单地输入整个命名空间?谢谢

c# namespaces using

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

Android系统.SQLite异常:没有这样的列_id

我有一些麻烦试图将信息存储在我的数据库中并在ListView中显示它.

这是我想要显示行的ListActivity:

public class Prueba extends ListActivity{

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.i_prueba);

        DataBaseAccess db = new DataBaseAccess(this);
        db.open();

        Cursor result = db.getAllContact();
        startManagingCursor(result);


        // the desired columns to be bound
        String[] columns = new String[] {"_id", "nombre", "telefono", "mail"};
        // the XML defined views which the data will be bound to
        int[] to = new int[] { R.id.textid, R.id.textNombre, R.id.textTelefono, R.id.textMail };

        SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this, R.layout.i_listadb, …
Run Code Online (Sandbox Code Playgroud)

sqlite android listactivity

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

本地C++和Java程序之间的通信有哪些好的替代方案?

"本地"是指两者都在同一子网中运行,在大多数情况下是相同的主机/ VM,因此一些标准的跨网络跨平台RPC机制(如SOAP,XML-RPC,CORBA等)似乎是不必要的.

有效载荷主要是数字(主要是表格)数据,包含从C++到Java的少量元数据(例如可用的数据服务,数据描述/类型等),以及从Java到C++的控制台/脚本化UI事件.因此,C++程序就像客户端的服务器和Java程序一样.

我可以列举几个选项(主要来自搜索这个精彩的网站),但我从来没有在真实世界的重型场景中使用或看过一个,所以我真的希望有人"在那里,做到这一点"可以教育我关于选项的利弊.

  1. 共享内存
  2. 管道,stdin/stdout等
  3. 普通套接字上的自定义数据结构(可能是UDP)(这个问题)
  4. 普通套接字上的消息可能是Google协议缓冲区,Thrift,JSON等(此答案等)
  5. 带有C++ RMI服务器的Java RMI(这个问题)
  6. JNI(这个问题的一些答案)

我很确定我错过了很多选择.感谢大家的帮助!


编辑:我忘了提到性能不是一个主要问题,因为数据吞吐量预计不会很大(服务器严重受数据库限制),但重要的是要知道一个选项是否更快或更慢.例如,我认为没有什么比共享内存更好(如果做得对).

c++ java sockets rpc communication

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

"final int i"如何在Java for循环中工作?

我很惊讶地发现以下Java代码片段已编译并运行:

for(final int i : listOfNumbers) {
     System.out.println(i);
}
Run Code Online (Sandbox Code Playgroud)

其中listOfNumbers是一个整数数组.

我认为最终的声明只分配了一次.编译器是否创建了Integer对象并更改了它引用的内容?

java final

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

计算int中的位 - 为什么此代码有效?

我试图更多地了解比特,我遇到了这个例子.

这段代码如何计算这些位?(顺便说一句,我的C很生锈).

unsigned int v; // count the number of bits set in v
unsigned int c; // c accumulates the total bits set in v

for (c = 0; v; v >>= 1)
{
  c += v & 1;
}
Run Code Online (Sandbox Code Playgroud)

c binary integer bit

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

将C程序的输出管道输出到文件(bash)

我只是尝试用bash,所以我用C编写了一个简单的程序来计算文件中的字符数.

这是我的C程序:

#include <stdio.h>

int main()
{
  int i, nc;
  nc = 0;
  i = getchar();
  while (i!=EOF){
    nc = nc + 1;
    i = getchar();
  }
  printf("%d\n",nc);

  return 0;
}
Run Code Online (Sandbox Code Playgroud)

这是我用来编译和执行的bash命令:

gcc sign.c < bright_side_of_life > output
Run Code Online (Sandbox Code Playgroud)

我的输出文件完全是空的.我哪里错了?

c bash piping

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

HTML 5 Doctype和IE 6

我经常在我正在查看的某些页面上看到此doctype声明

<!DOCTYPE html>
Run Code Online (Sandbox Code Playgroud)

我做了一些软研究,这是HTML 5 doctype声明.现代浏览器可以解释这一点并强制在标准模式下运行.

我的问题是,我的一些目标用户仍在使用IE6.当我声明这样的doctype声明时,IE6将如何响应.

在这种情况下,我会获得任何利益或损失吗?

谢谢.

html html5 internet-explorer-6

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

关于指针和多维数组的困惑

如果可能的话:

MyFunction(int *array, int size)
{
    for(int i=0 ; i<size ; i++)
    {
        printf(“%d”, array[i]);
    }
}

main()
{
    int array[6] = {0, 1, 2, 3, 4, 5};
    MyFunction(array, 6);
}
Run Code Online (Sandbox Code Playgroud)

为什么以下不是?

MyFunction(int **array, int row, int col)
{
    for(int i=0 ; i<row ; i++)
    {
        for(int j=0 ; j<col ; j++)
        {
            printf(“%d”, array[i][j]);
        }
    }
}

main()
{
    int array[3][3] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
    MyFunction(array, 3, 3);
}
Run Code Online (Sandbox Code Playgroud)

c pointers multidimensional-array

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

如果minSdkVersion低于targetSdkVersion会发生什么?

我收到警告:

Attribute minSdkVersion (3) is lower than the project target API level (8)
Run Code Online (Sandbox Code Playgroud)

这将如何影响我的应用程序?

xml android android-manifest

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

php :: textarea中的新行?

当你通过php插入文本时,如何在textarea中创建一个新行?

我以为它是\n在文本区域印刷的.

谢谢

php textarea

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