小编hig*_*ted的帖子

在Play Framework中排除热重新加载的类

我正在尝试使用Play Framework,并且非常喜欢迄今为止的体验!特别是热重装是一个巨大的节省时间.

但是,我希望能够在代码更改时从热重新加载中排除某些类实例.(例如,我已经配置了一些需要很长时间来初始化的存储库,我确信这些存储库的代码不会改变).

如何指示热重新禁用哪些类/包?

谢谢,Geert-Jan

java playframework

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

在python中组织源代码

我正在写一个游戏框架.这是我目前的文件结构:

src/
  framework/
    __init__.py
    util.py
    render.py
    game.py
  pong.py
Run Code Online (Sandbox Code Playgroud)

我希望能够简单地import gameimport render直接从pong.py文件中进行.实现这一目标的最佳方法是什么?最初util.py, render.py, game.py模块位于src文件夹中,但为了组织起见,我决定将它们放入单独的文件夹中.我对包装惯例很新,所以我不知道这是否是推荐的做事方式.

python package

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

如何在Fitnesse中抑制变量的WikiWord格式

我正在使用${varname}语法在我的Fitnesse测试中引用环境变量,形式为

| check | Project Name | ${PROJECT_NAME} |
Run Code Online (Sandbox Code Playgroud)

大部分时间这都很好,但偶尔环境变量的值是(巧合)WikiWord格式,这搞砸了测试,因为Fitnesse将其视为页面链接:

| check | Project Name | MyTestProject[?] |
Run Code Online (Sandbox Code Playgroud)

我已经尝试使用!- -!语法来抑制格式化,但这会阻止变量被解析.有没有办法解析变量抑制wikiword格式?

wiki fitnesse

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

XPath查找作为其他节点兄弟的文本节点

给出以下html片段:

<fieldset>
  <legend>My Legend</legend>
  <p>Some text</p>
  Text to capture
</fieldset>
Run Code Online (Sandbox Code Playgroud)

是否有一个xpath表达式只返回'Text to capture'文本节点?

/fieldset/text()
产生三个节点,而不仅仅是我需要的节点.

xpath

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

需要帮助解决简单的cocos2d错误

我正在使用以下代码在屏幕上呈现图像

-(id) init
{
    if( (self=[super init] )) {
        CGSize winSize = [[CCDirector sharedDirector] winSize];
        CCSprite *player = [CCSprite spriteWithFile:@"Player.png" rect:CGRectMake(0, 0, 27, 40)];
        player.position = ccp(player.contentSize.width/2, winSize.height/2);
        [self addChild:player];     
    }
    return self;
}
Run Code Online (Sandbox Code Playgroud)

当我运行代码后出现错误

continue
2011-07-11 19:25:58.220 testcellapp[441:707] cocos2d: cocos2d v1.0.0-rc3
2011-07-11 19:25:58.229 testcellapp[441:707] cocos2d: Using Director Type:CCDirectorDisplayLink
2011-07-11 19:25:58.407 testcellapp[441:707] cocos2d: OS version: 4.3.1 (0x04030100)
2011-07-11 19:25:58.411 testcellapp[441:707] cocos2d: GL_VENDOR:   Imagination         Technologies
2011-07-11 19:25:58.415 testcellapp[441:707] cocos2d: GL_RENDERER: PowerVR SGX 535
2011-07-11 19:25:58.418 testcellapp[441:707] cocos2d: GL_VERSION:  OpenGL ES-CM 1.1 …
Run Code Online (Sandbox Code Playgroud)

iphone cocos2d-iphone

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

字符串到NSDate

我正在尝试将字符串转换为日期.使用了以下代码.但是错误的日期.

谢谢,

NSString *dateString = [NSString stringWithFormat:@"12-07-2011"];
//NSString *dateString = [NSString stringWithFormat:@"%d-%d-%d", selectedDate.day, selectedDate.month, selectedDate.year];
NSLog(@"%@",dateString);

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];

[dateFormatter setLocale:[NSLocale currentLocale]];
[dateFormatter setTimeZone:[NSTimeZone localTimeZone]];
[dateFormatter setDateFormat:@"dd-mm-yyyy"];

NSDate* d = [dateFormatter dateFromString:dateString];
NSLog(@"%@",d);               
                      
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Selected Date" message: [NSString stringWithFormat:@"%@",d] delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
Run Code Online (Sandbox Code Playgroud)

iphone objective-c nsdate

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

NSTimer越来越快

我试图使用计时器来跟踪游戏中的时间.这是计时器的代码.为什么每次我从主菜单重新启动游戏时计时器几乎快两倍.是因为我在退出之前没有使计时器失效.我试图使计时器无效,但它只是给出错误exc_bad访问权限

-(void) StartTimer {
   TotalSeconds = 0;
   GameCenterTotalSeconds = 0;
   timeSec = 0;
   timeMin = 0;
   timer = [[NSTimer scheduledTimerWithTimeInterval:.1 target:self selector:@selector(timerTick:) userInfo:nil repeats:YES]retain];
   //[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
}

//Event called every time the NSTimer ticks.
- (void)timerTick:(NSTimer*) timer {        
TotalSeconds++;
    GameCenterTotalSeconds= GameCenterTotalSeconds + .1;
    timeSec = timeSec + .1;
    if (timeSec >= 60)
    {
        timeSec = 00;
        timeMin++;
    }
    //Format the string 00:00
    NSString* timeNow = [NSString stringWithFormat:@"Time: %02d:%.1f", timeMin, timeSec];
    //Display on your label
    timeLabel.text = timeNow;
} …
Run Code Online (Sandbox Code Playgroud)

objective-c nstimer

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

如何在Objective C中单击按钮传入aa参数?

所以我尝试将参数传递给我的"buttonClicked"函数,以便我可以动态控制单击按钮时发生的情况.我尝试自己做的每一种方式都会破坏我的代码.我在stackOverflow上搜索过很多不同的网站和答案,但我似乎无法找到答案.我对目标C相当新,特别是对于函数,所以我真的可以使用一些帮助来弄清楚如何做到这一点.提前致谢

这是我到目前为止的代码以及我要做的事情:

UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
NSLog(@"Hi 1!");

[button addTarget:self action:@selector(buttonClicked:buttonType:buttonID:) forControlEvents:UIControlEventTouchUpInside];

button.frame = CGRectMake(buttonViewXvalue, buttonViewYvalue, buttonViewWidth, buttonViewLength);

[self.view addSubview:button];  
Run Code Online (Sandbox Code Playgroud)

然后在头文件中的声明:

- (IBAction)buttonClicked:(id)sender theButtonType: (int)buttonType: theButtonID: (int) buttonID;
Run Code Online (Sandbox Code Playgroud)

和实施:

- (IBAction)buttonClicked:(id)sender theButtonType: (int)buttonType: theButtonID: (int)    buttonID 
{
//Here I would use the buttonType and buttonID to create a new view. 
NSLog(@"Hi!");

}
Run Code Online (Sandbox Code Playgroud)

cocoa-touch objective-c

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