问题列表 - 第40414页

从c ++调用lib文件中的c函数

我必须从c ++调用在lib文件中声明的ac函数.我必须为此设置哪些指令/属性/配置?

c c++ windows

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

在log4j中使用FileNamePattern,RollingFileAppender

我有一个名为app.log的日志文件.当它翻身时(我将其设置为每分钟仅用于测试目的),我希望将其重命名为app-YYYY-MM-dd_HH-mm.log但它不起作用.以下是我的log4j设置:

log4j.appender.myLog=org.apache.log4j.RollingFileAppender
log4j.appender.myLog.rollingPolicy=TimeBasedRollingPolicy
log4j.appender.myLog.File=logs/app.log
log4j.appender.myLog.rollingPolicy.FileNamePattern=logs/app-%d{yyyy-MM-dd_HH-mm}.log
log4j.appender.myLog.Append=true
log4j.appender.myLog.layout=org.apache.log4j.PatternLayout
log4j.appender.myLog.layout.ConversionPattern=%d %-5p [%t] %-17c{2} (%13F:%L) %3x - %m%n
Run Code Online (Sandbox Code Playgroud)

有谁知道这是什么问题?在翻转期间,它只是将文件重命名为app.log.1.

java logging log4j

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

测试stream.good()或!stream.eof()读取最后一行两次

可能重复:
为什么循环条件中的iostream :: eof被认为是错误的?

我有以下代码:

ifstream f("x.txt");
string line;
while (f.good()) {
  getline(f, line);
  // Use line here.
}
Run Code Online (Sandbox Code Playgroud)

但这会两次读到最后一行.为什么会发生这种情况,我该如何解决?

与以下情况非常相似:

ifstream f("x.txt");
string line;
while (!f.eof()) {
  getline(f, line);
  // Use line here.
}
Run Code Online (Sandbox Code Playgroud)

c++ iostream

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

可以在Android模拟器上启用TrafficStats吗?

我正在尝试从设备获取传输的总字节数(使用getMobileTxBytes()).

我从模拟器中的方法调用获得的数字是-1(这意味着设备不支持此方法).有没有办法让模拟器在这里返回一个合理的数字?当我在模拟器中浏览网页时,最好的数字会增加.

android traffic-measurement android-emulator

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

在IE中写入脚本控制台(console.log)的正确方法是什么?

我有这个替代console.log定义document.ready():

$(document).ready(function(){
  console.log("doc ready");
  if(typeof console === "undefined"){
    console = { log: function() { } };
  }
}
Run Code Online (Sandbox Code Playgroud)

我认为IE应该有这个功能,但是,当我包括上面的调用

  console.log("doc ready");
Run Code Online (Sandbox Code Playgroud)

输出显示在Firefox控制台中但不在IE中 - 实际上IE脚本执行在此时完全中断.

在IE中写入控制台的正确方法是什么?

javascript console jquery logging internet-explorer

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

在Eclipse(Helios)中设置项目Pydev PYTHONPATH的最有效方法是什么?

我想将Pydev项目中的所有文件夹添加到PYTHONPATH中,这样我就可以轻松看到未使用的导入等.为了做到这一点,我似乎必须手动添加所有文件夹,包括子文件夹,逐个.有没有办法一次性添加它们(递归)或者我完全错了吗?

现在,我右键单击导航器中的项目,然后选择"首选项".从那里我去Pydev-PYTHONPATH,最后我可以添加文件夹.

eclipse pydev

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

UIPickerView在文本字段编辑时有多个来源

到目前为止我所拥有的是什么

@synthesize txtCountry,txtState;
int flgTextField;
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField { 
    [pickerView reloadAllComponents];

    // Make a new view, or do what you want here
    if(textField == txtCountry || textField == txtState){
        flgTextField = textField.tag;
        [UIView beginAnimations:nil context:NULL];
        //[pvState setFrame:CGRectMake(0.0f, 199.0f, 320.0f, 216.0f)];
        [UIView commitAnimations];  
        return NO;
    }
    else {
        return YES;
    }

}
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView;
{
    return 1;
}

- (NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component {

    if(flgTextField==1){
        return [arryCountry count];
    }
    else {
        return [arryState count];
    }

}

- (NSString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row …
Run Code Online (Sandbox Code Playgroud)

uipickerview uipicker ios4

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

UITableViewCell内的水平UIScrollView

我正在尝试创建与用于查看屏幕截图的AppStore应用程序完全相同的效果:在UITableView中,我有UITableViewCell的自定义子类.其中一个旨在显示某些产品的预览,比如4个图像.我希望它们以与AppStore呈现应用程序截图相同的方式显示:在水平UIScrollView内部及其附加的UIPageControl.

所以我将我的UIScrollView和我的UIPageControl添加到我的UITableViewCell中,就像这样:

@implementation phVolumePreviewCell
- (id)init {
    if (self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kVolumePreviewCellIdentifier]) {
        [self setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
        [self setSelectionStyle:UITableViewCellSeparatorStyleNone];

        previews = [[NSMutableArray alloc] initWithCapacity:4];
        for (int i = 0; i < 4; i++) {
            [previews addObject:@"dummy"];
        }

        scrollView = [[UIScrollView alloc] initWithFrame:CGRectZero];
        [scrollView setPagingEnabled:YES];
        [scrollView setBackgroundColor:[UIColor grayColor]];
        [scrollView setIndicatorStyle:UIScrollViewIndicatorStyleBlack];
        [scrollView setShowsHorizontalScrollIndicator:YES];
        [scrollView setBounces:YES];
        [scrollView setScrollEnabled:YES];
        [scrollView setDelegate:self];
        [self.contentView addSubview:scrollView];
        [scrollView release];

        pageControl = [[UIPageControl alloc] initWithFrame:CGRectZero];
        [pageControl setNumberOfPages:[previews count]];
        [pageControl setBackgroundColor:[UIColor grayColor]];
        [self.contentView addSubview:pageControl];
        [pageControl release];
    }
    return self;
}
Run Code Online (Sandbox Code Playgroud)

(注意:我在这里使用虚拟数据填充"预览",只是为了使[预览计数]有效;我想查看scrollView的滚动指示器仅用于测试目的,我稍后会隐藏它们). …

iphone scroll uitableview uiscrollview

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

C#:声明函数永远不会返回null?

背景: 有这个开发人员原则"如果请求的项目不存在,我的函数应该返回null还是抛出异常?" 我不想在这里讨论.我决定为所有必须返回值的情况抛出异常,并且只有在(编程或逻辑)无效请求的情况下才会存在此值.

最后我的问题是: 我可以标记一个函数,以便编译器知道它永远不会返回null并警告任何检查返回值是否为空的人?

c# compiler-construction

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

什么是Windows等效的en_US.UTF-8语言环境?

如果我想在Windows上进行以下工作,那么正确的语言环境是什么?如何检测它实际存在: 此代码是通用的,还是仅仅是我的系统?

c++ unicode locale utf-8

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