当我在XCode中对我的iPhone游戏项目进行代码更改,然后执行CMD-B + Enter时,我希望项目能够在最新的模拟器上保存,构建和运行.然而,有时会发生的事情是,除非我清理项目然后构建,否则它不会发生我所做的小改动.
我是Java人员,也是基于C语言的新手,也是编译器.有人可以向我解释每次构建之后缓存的内容以及如何更改我的项目设置以避免每次都要清理吗?或者告诉我这是C开发的一部分的坏消息?不试图抨击它 - 我也经常在Java中将编译后的JSP卡在工作缓存中.:P
更新:这与我的构建的位置有什么关系吗?这是我能想到的唯一一个从构建配置角度改变的东西.
我正在寻找一种更好的方法来进行以下查询.我有一个看起来像这样的表:
game_id | home_team_id | away_team_id
1 | 100 | 200
2 | 200 | 300
3 | 200 | 400
4 | 300 | 100
5 | 100 | 400
Run Code Online (Sandbox Code Playgroud)
我想写一个查询,计算每个团队的主场比赛和客场比赛的数量,并输出以下内容:
team_id | home_games | away_games
100 | 2 | 1
200 | 2 | 1
300 | 1 | 1
400 | 0 | 2
Run Code Online (Sandbox Code Playgroud)
现在,我写了这个怪物有效,但它很慢(我知道它从表中拉出了整整2800行).
SELECT
home_team_id as team_id,
(SELECT count(*) FROM `game` WHERE home_team_id = temp_game.home_team_id) as home_games,
(SELECT count(*) FROM `game` WHERE home_team_id = temp_game.away_team_id) …Run Code Online (Sandbox Code Playgroud) 在阅读了最新的Coding Horror帖子后,我想知道在开源社区中是否有基于Java的ELMAH版本?一个可配置的JSP/Servlet/Portlet WAR,我可以放入大多数服务器,并有一个很好的GUI来查看系统中的日志.有人有推荐的项目吗?
重复
我从远程站点获取一个.js文件,该文件包含我想要使用我的Google App Engine站点上的simplejson库处理为JSON的数据..js文件如下所示:
var txns = [
{ apples: '100', oranges: '20', type: 'SELL'},
{ apples: '200', oranges: '10', type: 'BUY'}]
Run Code Online (Sandbox Code Playgroud)
我无法控制此文件的格式.我最初只是为了破解它所做的就是"var txns = "从字符串中删除一点然后在字符串上做一系列.replace(old, new, [count])直到它看起来像标准的JSON:
cleanJSON = malformedJSON.replace("'", '"').replace('apples:', '"apples":').replace('oranges:', '"oranges":').replace('type:', '"type":').replace('{', '{"transaction":{').replace('}', '}}')
Run Code Online (Sandbox Code Playgroud)
所以它现在看起来像:
[{ "transaction" : { "apples": "100", "oranges": "20", "type": "SELL"} },
{ "transaction" : { "apples": "200", "oranges": "10", "type": "BUY"} }]
Run Code Online (Sandbox Code Playgroud)
你会如何解决这个格式化问题?是否有一种已知的方法(库,脚本)将JavaScript数组格式化为JSON表示法?
我的iPhone应用程序中有一个简单的屏幕,我希望在屏幕底部有一个320x100的矩形来捕捉触摸.这是我的代码touchesBegan:withEvent:
for (UITouch *touch in touches) {
CGPoint touchPoint = [touch locationInView:self.view];
NSLog(@"touch @ %f, %f", touchPoint.x, touchPoint.y);
// build a rectangle where we want to capture a URL tap
CGRect rectangle = CGRectMake(0, 480, 320, 100);
NSLog(@"midX, midY = %f, %f", CGRectGetMidX(rectangle), CGRectGetMidY(rectangle));
// check to see if they tapped the URL
if (CGRectContainsPoint(rectangle, touchPoint)) {
NSLog(@"You touched inside the rectangle.");
}
}
Run Code Online (Sandbox Code Playgroud)
现在这段代码无法正常工作......从矩形中点开始的日志显示我的矩形是在内置的midX, midY = 160.000000, 530.000000.根据CGPoint文档,原点(0, 480)是左下角,但这就像原点是左上角.
当我将矩形的原点更改为0,380时,一切都按预期工作.也许我今天早上没有适当的咖啡因,但为什么我看到文档和执行之间的这种差异?
我有一个自定义的UITableViewCell实现(利用标签作为子视图)正确地呈现项目列表,但是当我向下滚动并选择一个项目(比如说第43个中的100个)时,我看到了前面一个单元格的渲染列表(例如,表格中第一个渲染页面上的数字3)显示在我选择的单元格的顶部.
这是我的方法:
- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tv dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
// index of table view correlates to index of array
Card *card = [cards objectAtIndex:indexPath.row];
UILabel *cardNameLbl = [[[UILabel alloc] initWithFrame:CGRectMake(10.0, 3.0, 200.0, 18.0)] autorelease];
cardNameLbl.tag = CARD_NAME_TAG;
cardNameLbl.text = card.name;
cardNameLbl.font = [UIFont systemFontOfSize:12.0];
cardNameLbl.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight;
[cell.contentView addSubview:cardNameLbl];
UILabel *cardNumLbl = [[[UILabel alloc] initWithFrame:CGRectMake(10.0, …Run Code Online (Sandbox Code Playgroud)