问题列表 - 第49052页

Java线程创建跟踪

我有一个Java应用程序,重点关注并发性和可突发容量.这意味着它使用线程池来排队和执行事件.

所有这些线程池都是固定大小的,但是当应用程序部署在Linux(CentOS 5.5)服务器上时,我经常发现自己遇到了打开文件描述符限制.

据我所知,应用程序在加载时,任何时候都不应该创建超过20个线程,但我的命中ulimit率为1024.

有没有什么办法可以跟踪这些线程回到创建它们的代码/池?

java linux multithreading centos5 threadpool

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

Django:在一个循环中遍历模板中的多个连续多对多关系

我有这样的情况:有三个 Django 模型,我们称它们为 article、section 和 tag,还有一个 through-model。

class Tag(models.Model):
    name = models.CharField(max_length=100, primary_key=True)

class Section(models.Model):
    # all sorts of fields here

class Article(models.Model):
    tags = models.ManyToManyField(Tag, null=True, blank=True)
    sections = models.ManyToManyField(Section, null=True, blank=True, through='SectionInArticle', related_name='articles')

class SectionInArticle(models.Model):
    article = models.ForeignKey(Article)
    section = models.ForeignKey(Section)
    order = models.IntegerField()
Run Code Online (Sandbox Code Playgroud)

然后,在该部分的详细信息模板中,我想列出相关文章中的所有标签。为此,我首先必须反向遍历 Section-Article ManyToMany 关系(使用 related_name),然后遍历 Article-Tag ManyToMany 关系。我试过这个:

{# doesn't print anything: #}
{% for tag in object.articles.tags.all %}
{{ tag.name }}
{% endfor %}
Run Code Online (Sandbox Code Playgroud)

但由于某种原因,这不起作用。{% for tag in object.articles.all.tags.all %} 也不起作用。我可以使用嵌套循环打印所有标签,但这意味着重复会成为一个问题。

{# duplicates …
Run Code Online (Sandbox Code Playgroud)

django django-templates django-views

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

Java是否支持Mulitiple继承?

从Java的事实来看,Java中的所有类都有父类Object.但是同样的Java说它不支持多重继承.但这段代码意味着什么?

public class A extends B
{
          //Blah blah blah
}
Run Code Online (Sandbox Code Playgroud)

从上面的代码来看,它意味着Class A扩展了Class B.现在Class A也继承了Object类的属性,它是超类B.这是不是意味着Class A继承了Class BObjectClass,这就是我们所谓的Multiple inheritance吧?

那么现在Java支持多重继承,如果没有,那么上面代码的答案是什么(显示了多重继承)

java oop inheritance

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

Android蓝牙java.io.IOException:连接被拒绝了?

我需要使用SPP 将KwikBlue-2模块开发套件连接到Nexus One上的Android BluetoothChat示例.在将BluetoothChat示例示例中的UUID更改为SPP设备的00001101-0000-1000-8000-00805F9B34FB 之后,我能够使用tera术语连接和交换串行数据(一次).然后我循环使用KwikBlue-2模块开发套件来验证连接是否可重复,但java.io.IOException: Connection refused在我尝试连接时不断获得 .有任何想法吗?

43.200: ERROR/BluetoothEventLoop.cpp(96): event_filter: Received signal org.bluez.Adapter:PropertyChanged from /org/bluez/219/hci0
52.200: ERROR/BluetoothChat(707): - ON PAUSE -
54.470: ERROR/BluetoothService.cpp(96): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
54.520: ERROR/BluetoothChat(707): + ON RESUME +
54.530: ERROR/BluetoothService.cpp(96): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
54.620: ERROR/BluetoothService.cpp(96): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
55.520: ERROR/BluetoothEventLoop.cpp(96): event_filter: Received signal org.bluez.Device:PropertyChanged from /org/bluez/219/hci0/dev_00_60_57_FD_42_18
56.010: ERROR/BluetoothChatService(707): …
Run Code Online (Sandbox Code Playgroud)

java android bluetooth

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

根据==,从同一个float创建的两个NSNumber不相等

我有几个floats转换为NSNumbers并添加到数组,然后按数字顺序排序.

然后我把原始的floats转换成NSNumbers,但是如果我试着比较它们if(numinarray = newnum){就永远不会去.当我NSLog()输出值时,值匹配:

float distance  = [barnardCastle distanceFromLocation:loc1] / 1000;
float distance2 = [billingham distanceFromLocation:loc1] / 1000;
float distance3 = [bishopAukland distanceFromLocation:loc1] / 1000;
float distance4 = [cockerton distanceFromLocation:loc1] / 1000;
float distance5 = [darlington distanceFromLocation:loc1] / 1000;
float distance6 = [guisborough distanceFromLocation:loc1] / 1000;
float distance7 = [hartlepool distanceFromLocation:loc1] / 1000;
float distance8 = [middlesbrough distanceFromLocation:loc1] / 1000;
float distance9 = [northallerton distanceFromLocation:loc1] / 1000;
float …
Run Code Online (Sandbox Code Playgroud)

comparison cocoa-touch objective-c nsnumber

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

iOS中的Eurostile字体支持?

我需要一个iPhone应用程序,其中应用程序字体应该是'Eurostile Font'.我检查了iOS提供的可用字体,它没有'Eurostile Font'.是否可以将此字体导入应用程序?如果没有,'Eurostile Font'是否有任何等效字体?

ios

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

UILabel在重新加载时不会在UITableViewCell中刷新

我将两个添加UILabels到a UITableViewCell,然后为该单元格命名和编号标签.当我重新加载数据时UITableView(无论是从表格视图添加还是删除联系人),标签中的数据都是重叠的,这意味着它不会重新加载标签,直到重新加载整个视图.

有人可以帮忙吗?

码:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";
    UILabel *name;
    UILabel *number;

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];

        //NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES];
        //      NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
        //      [sortDescriptor release];
    }
    CGRect Label1Frame = CGRectMake(10, 10, 140, 25);
    name = [[UILabel alloc] initWithFrame:Label1Frame];
    name.tag = 1;
    [name setBackgroundColor:[UIColor clearColor]];
    [cell.contentView addSubview:name];

    CGRect …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uitableview uilabel ios

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

我有enum的范围问题

基本上,我有一个类与国际象棋游戏的代码,它有一个枚举类..

namespace WindowsFormsApplication1
{
    enum STATE { PROMOTION, CASTLING, CHECK, CHECKMATE, DONOTHING };

.....
Run Code Online (Sandbox Code Playgroud)

我想从我的表单代码中引用它:这是代码:

namespace WindowsFormsApplication1
{

    public partial class ChessBoard: Form
    {
public STATE Gamestate { set; get; }

......
Run Code Online (Sandbox Code Playgroud)

我明白了:

错误1可访问性不一致:属性类型"WindowsFormsApplication1.STATE"的可访问性低于属性"WindowsFormsApplication1.ChessBoard.Gamestate"D:\ Documents and Settings\Dima\My Documents\Visual Studio 2008\Projects\ChessBoardGame\ChessBoardGame\ChessBoard.cs 15 22 ChessBoardGame

为什么我会得到它,我该如何防止它?

c# enums

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

我可以限制edittext小部件只接受电话号码吗?

EditText小部件电话号码是否来自简单数字?例如,edittext有一个输入方法作为密码,它指定输入的是密码.此外,我们可以限制它只输入数字,但我想解决电话号码.

android phone-number android-edittext

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

wchar_t数组

我想有一个wchar_t的数组.

以下作品:

char** stringArray;
int maxWords = 3;
stringArray = new char*[maxWords];
stringArray[0] = "I";
stringArray[1] = " Love ";
stringArray[2] = "C++"
Run Code Online (Sandbox Code Playgroud)

但事实并非如此

wchar_t ** wcAltFinalText;
wcAltFinalText = new wchar_t *[MAX_ALT_SOURCE];   // MAX_ALT_SOURCE = 4
wcAltFinalText[0] = L'\0';
wcAltFinalText[1] = L'\0';
wcAltFinalText[2] = L'\0';
wcAltFinalText[3] = L'\0';
Run Code Online (Sandbox Code Playgroud)

我没有得到任何错误,但wcAltFinalText是一个糟糕的ptr

非常感谢任何帮助和评论.

c++ unmanaged wchar-t wchar visual-c++-2005

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