我正在使用cocos2d开发一款适用于iPad的游戏,其中包含一块充满不同类型瓷砖的电路板.我创建了一个自定义类,称为Tiletile的通用模板,Tile其中一些子类具有不同的属性和方法.我还创建了一个类Board,其中包括使用特殊坐标系跟踪所有切片的位置.
出于某种原因,在Board类中,编译器似乎没有被识别Tile为一种对象,即使我已经添加#import "Tile.h"在文件的顶部.
这是相关的代码(只是询问是否有你想看的代码的其他部分):
Tile.h
#import <Foundation/Foundation.h>
#import "cocos2d.h"
#import "Board.h"
@interface Tile : NSObject
-(void) updateNeighbors;
@property (nonatomic, retain) CCSprite* sprite;
@property (assign) CGPoint coords;
@property (assign) CGPoint positionInPoints;
@property (nonatomic, retain) NSMutableArray *neighbors;
@end
Run Code Online (Sandbox Code Playgroud)
Board.h
#import <Foundation/Foundation.h>
#import "cocos2d.h"
#import "Tile.h"
@interface Board : NSObject
+(Board*)sharedBoard;
- (void) putTile: (Tile*) tile AtIndex: (CGPoint) index; //<-- error here!
- (void) replaceTileAtIndex: (CGPoint) index1 WithTileAtIndex: (CGPoint) index2;
- …Run Code Online (Sandbox Code Playgroud) 我的rails应用程序使用设计来处理注册,身份验证等.我正在使用可确认模块.错误就是这样 - 当用户注册电子邮件时,Devise正在发送两封带有不同确认链接的确认电子邮件.一个链接有效,另一个链接指向用户错误页面.
Devise吐出与错误相关的消息:"确认令牌无效"并将用户带到重新发送确认电子邮件页面.
我正在使用heroku进行托管并使用sendgrid发送电子邮件.更新:该bug也发生在localhost上.
我不知道这个bug的根源在哪里,这可能比你需要看到的代码更多:
models/user.rb
...
devise :database_authenticatable, :registerable, :omniauthable,
:recoverable, :rememberable, :trackable, :validatable,
:confirmable, :authentication_keys => [:login]
...
## callbacks
after_create :account_created
# called after the account is first created
def account_created
# check if this activiy has already been created
if !self.activities.where(:kind => "created_account").blank?
puts "WARNING: user ##{self.id} already has a created account activity!"
return
end
# update points
self.points += 50
self.save
# create activity
act = self.activities.new
act.kind = "created_account"
act.created_at = …Run Code Online (Sandbox Code Playgroud) ruby-on-rails actionmailer duplicates confirmation-email devise
我正在使用heroku来托管一个主要关注托管视频的Web应用程序.这些视频是通过vimeo pro托管的,我正在使用matthooks的vimeo gem来帮助处理上传过程.上传适用于小文件,但不适用于较大的文件(例如~50mb).
看看heroku日志显示我收到http错误413,它代表"Request Entity Too Large".我相信这可能与heroku对文件上传的限制有关(根据此网页,大于30mb ).但问题是,我在这个问题上找到的任何信息似乎都已过时且存在冲突(如声称没有大小限制的此页面).我也在heroku的网站上找不到任何关于此的内容.
我搜索了谷歌,发现了一些有些相关的页面(一和二),但没有解决方案对我有用.我发现的大多数页面都处理将大文件上传到amazon s3,这与我正在尝试的不同.
这是日志的相关输出:
2012-07-18T05:13:31+00:00 heroku[nginx]: 152.3.68.6 - - [18/Jul/2012:05:13:31 +0000]
"POST /videos HTTP/1.1" 413 192 "http://neoteach.com/components/19" "Mozilla/5.0
(Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20100101 Firefox/13.0.1" neoteach.com
Run Code Online (Sandbox Code Playgroud)
日志中没有其他错误.这是我尝试上传视频太大时出现的唯一输出.这意味着这不是超时错误或超过每个dyno分配的内存的问题.
heroku真的限制了上传大小吗?如果是这样,有没有办法改变这个限制?请注意,文件本身根本没有存储在heroku的服务器上,它们只是被传递给vimeo的服务器.
如果问题不限制上传大小,是否有人知道其他可能出错的地方?
非常感谢!
我正在使用谷歌地图API并试图将一系列点数字串化,每个点都有纬度和经度.我想要做的是将数据字符串化并将其存储在数据库中,以便以后检索.问题是,由于谷歌地图存储和使用数据的方式,结果JSON.stringify有时是奇怪的随机.例如,有时数据如下所示:
[{"Na":35.99663,"Oa":-78.94982},
{"Na":35.996370000000006,"Oa":-78.94914},
{"Na":35.99595,"Oa":-78.94833000000001},...]
Run Code Online (Sandbox Code Playgroud)
有时完全相同的数据如下所示:
[{"Ia":35.99663,"Ja":-78.94982},
{"Ia":35.996370000000006,"Ja":-78.94914},
{"Ia":35.99595,"Ja":-78.94833000000001},...]
Run Code Online (Sandbox Code Playgroud)
事实上,我已经看到了十种不同的变化.当我将字符串化数据存储在数据库中并检索它时,这会导致很多问题,因为我从来不知道期望哪种格式.我想要做的是替换键,以便数据看起来更像这样:
[{"lat":35.99663,"lon":-78.94982},
{"lat":35.996370000000006,"lon":-78.94914},
{"lat":35.99595,"lon":-78.94833000000001},...]
Run Code Online (Sandbox Code Playgroud)
我已经编写了代码来弄清楚谷歌地图正在使用哪些随机字母.有了这些信息,我想用"lat"或"lon"替换那些随机字母的每一个出现.我希望使用像这样的替换方法......
function formatData(data) {
//data is an object that I want to stringify
//this testPoint and testString help us figure out which letters google is using this time around
var testPoint = new google.maps.LatLng(23,45);
var testString = JSON.stringify(testPoint);
var strangeLat = testString.substring(2,4); //this is a random two character string which represents latitude in the stringified data
var strangeLon = testString.substring(10,12); //this is a random two character …Run Code Online (Sandbox Code Playgroud) 我正在使用redis排序集的队列系统.我的lua脚本看起来像:
local moveElement = function(source, dest , score, destscore)
local element = redis.pcall('ZRANGEBYSCORE', source, '-inf',score, 'WITHSCORES' , 'LIMIT' , '0' , '1')
if element ~= false and #element ~= 0 then
redis.call('ZADD' , dest , destscore , element[1])
redis.call('ZREM' , source , element[1])
end
end
local temp = moveElement(KEYS[2], KEYS[1] , ARGV[2])
local temp = moveElement(KEYS[3], KEYS[1] , ARGV[2])
local score= redis.call('ZRANGEBYSCORE', KEYS[1], '-inf',ARGV[1], 'WITHSCORES' , 'LIMIT' , '0' , '10')
if score ~= false and #score ~= 0 then …Run Code Online (Sandbox Code Playgroud) actionmailer ×1
devise ×1
duplicates ×1
google-maps ×1
heroku ×1
http-error ×1
import ×1
javascript ×1
json ×1
lua ×1
objective-c ×1
redis ×1
upload ×1