问题列表 - 第26943页

C#函数正常返回值VS out或ref参数

我在C#中有一个方法需要返回一个非常大的数组(或任何其他大数据结构).

使用ref或out参数而不是标准返回值是否有性能提升?

IE在使用中有任何性能或其他收益

void function(sometype input, ref largearray)
Run Code Online (Sandbox Code Playgroud)

过度

largearray function(sometype input)
Run Code Online (Sandbox Code Playgroud)

c# arguments return

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

在动作3中搜索一个很长的单词列表的最快方法是什么?

所以我有一个单词列表(整个英语词典).

对于单词匹配游戏,当玩家移动一个棋子时,我需要检查整个词典,看看玩家所做的单词是否存在于词典中.我需要尽快做到这一点.简单地遍历字典太慢了.

什么是AS3中最快的算法来搜索匹配的长列表,以及我应该使用什么数据类型?(即数组,对象,字典等)

arrays sorting search actionscript-3

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

Spring @Configuration类的问题

我使用带有@Configuration批注的类来配置我的spring应用程序:


@Configuration
public class SpringConfiguration {

 @Value("${driver}")
 String driver;

 @Value("${url}")
 String url;

 @Value("${minIdle}")
 private int minIdle;
       // snipp ..  

 @Bean(destroyMethod = "close")
 public DataSource dataSource() {
  DataSource dataSource = new DataSource();
  dataSource.setDriverClassName(driver);
  dataSource.setUrl(url);
  dataSource.setUsername(user);
  dataSource.setPassword(password);
  dataSource.setMinIdle(minIdle);

  return dataSource;
 }



和CLASSPATH中的属性文件

driver=org.postgresql.Driver
url=jdbc:postgresql:servicerepodb
minIdle=1

我想在我的DAO类中获取我的DataSource配置对象:

ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfiguration.class);   
DataSource dataSource = ctx.getBean(DataSource.class);

但我得到错误:


org.springframework.beans.factory.BeanCreationException:
 Error creating bean with name 'springConfiguration': Injection of autowired dependencies 
failed; nested exception is org.springframework.beans.factory.BeanCreationException: 
Could not autowire field: private int de.hska.repo.configuration.SpringConfiguration.minIdle; nested exception is …

configuration spring

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

函数参数的默认值

1.

int Add (int a, int b = 3);
int Add (int a, int b)
{

}
Run Code Online (Sandbox Code Playgroud)

2.

int Add (int a, int b);
int Add (int a, int b = 3)
{

}
Run Code Online (Sandbox Code Playgroud)

两者都有效; 这是标准的方式,为什么

c++ syntax optional-parameters

124
推荐指数
3
解决办法
11万
查看次数

这是什么活动?

有人可以解释这个C#代码在做什么吗?

// launch the camera capture when the user touch the screen
this.MouseLeftButtonUp += (s, e) => new CameraCaptureTask().Show();

// this static event is raised when a task completes its job
ChooserListener.ChooserCompleted += (s, e) =>
{
    //some code here
};
Run Code Online (Sandbox Code Playgroud)

我知道CameraCaptureTask是一个类,并且有一个公共方法Show().这是什么样的事件?是什么(s, e)

c# windows-phone-7

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

SDL和GLUT之间的区别

我正在Eclipse学习Opengl图形编程.有人可以告诉我GLUT应用程序和SDL应用程序之间的区别,以便我可以深入研究其中任何一个吗?韩国社交协会.

c eclipse graphics glut sdl

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

关于"角色的变化冲突"例外

其实我得到了一个例外

检测到关系"DataModel.FK_TableName_RelateTableName"的角色"TableName"发生冲突的更改

从ObjectContext调用ApplyChanges方法时.我不知道这个例外是什么.我只是想知道这个异常的原因.

.net entity-framework

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

将大于cellHeight的子视图添加到UITableViewCell?

我正在尝试向UITableViewCell添加子视图,而我正在使用的设计要求这个特定的子视图(图像)需要比实际的UITableViewCell更大,因此部分重叠其兄弟.

所以我设置了我的表格单元格,生成了我的图像并将其添加到单元格的contentView中:

// rowHeight for the UITableView is 45.0f

UIImage *image = [self createCellThumbnail: someImage];
UIImageView *thumbView = [[UIImageView alloc] initWithFrame: CGRectMake(150, -5, 55,55)];
thumbView.transform = CGAffineTransformMakeRotation(0.1f);
thumbView.image = image;

cell.clipsToBounds = NO;
cell.contentView.clipsToBounds = NO;

[cell.contentView addSubview: thumbView];
Run Code Online (Sandbox Code Playgroud)

当图像"溢出"到其下方的单元格中时,图像的顶部始终被剪裁,如下所示:

IMG

有谁知道我现在的做法是否有可能做到?

或者我应该想办法在绘制完所有单元格后将这些图像绘制到UITableView上(它是一个不可滚动的tableview,这样就可以了,并且相当容易).

更新:

还尝试添加以下内容,但无济于事:

cell.opaque = NO;
cell.contentView.opaque = NO;

cell.clearsContextBeforeDrawing = NO;
cell.contentView.clearsContextBeforeDrawing = NO;

cell.clipsToBounds = NO;    
cell.contentView.clipsToBounds = NO;
Run Code Online (Sandbox Code Playgroud)

iphone clipping uitableview

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

重新格式化Java字符串

我有一个看起来像这样的字符串:

CALDARI_STARSHIP_ENGINEERING
Run Code Online (Sandbox Code Playgroud)

我需要编辑它看起来像

Caldari Starship Engineering
Run Code Online (Sandbox Code Playgroud)

不幸的是,早上三点,我不能为我的生活弄清楚这一点.我总是在更换字符串中的东西时遇到麻烦,所以任何帮助都会很棒,并且会帮助我了解将来如何做到这一点.

java replace camelcasing string-formatting

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

如何在我的iPhone应用程序的文档文件夹中创建文件夹结构

我的服务器中有一个文件夹结构,我需要在设备端浏览该文件夹.我收到XML格式的文件夹结构.我的查询是: - 1)我可以在我的iPhone应用程序的文档文件夹中创建相同的文件夹结构.

2)最好的方法是在设备文档文件夹中创建文件夹,还是只读取XML并在解析它时显示文件夹(我的意思是不创建文件夹).

等待你的回复

iphone iphone-sdk-3.0

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