我可以轻松禁用javascript按钮,它可以正常工作.我的问题是,当我尝试重新启用该按钮时,它不会重新启用.这是我正在做的事情:
<script type="text/javascript">
function startCombine(startButton) {
startButton.disabled = 'true';
startButton.disabled = 'false';
}
</script>
<input type='button' id='start' value='Combine Selected Videos'
onclick='startCombine(this);'>
Run Code Online (Sandbox Code Playgroud)
为什么这不起作用,我该怎么做才能使它工作?
我有一张运动员的表.运动员有教练,他们也是运动员.运动员可能有多名教练.
为了解决这个问题,我创建了一个运动员表,它使用带有id字段的连接表,athlete_id字段和coach_id字段.athlete_id和coach_id字段都指向运动员表到id字段.
通常,根据Cake约定,我必须将我的两个字段命名为athlete_id,但我找到了以下链接,说明如何处理:http: //book.cakephp.org/1.2/view/851/Multiple-关系到最相同的模型
根据Cake约定,我会将我的联名表命名为athlete_athletes,但我不确定它是否能正常运行?将它称为Athle_coaches似乎有意义,但我敢打赌,这可能会打破Cake的自动功能.
这是否可以将join表称为athlete_athletes?这是正确的方法吗?有没有更好的办法?
我正在尝试从名为connect的方法中获取URL的内容.它读取其配置设置并尝试获取URL.它似乎需要运行循环来执行.我虽然只执行一次并完成.似乎除了每次获取此URL时,无论何时调用connect,我都不需要运行该循环.有没有更好的方法呢?
- (BOOL) connect
{
// read serverName and eventId from preferences
NSMutableArray* preferences;
preferences = [NSMutableDictionary dictionaryWithContentsOfFile:@"/tmp/wt.plist"];
// if these values aren't nil or blank
if ([preferences valueForKey:@"serverAddress"] && [preferences valueForKey:@"eventId"]) {
[self setServerAddress:@"172.16.28.210"];
[self setEventId:@"OT-3037009"];
} else{
// return some kind of error message
}
NSLog(@"VideoDataURL: %@", [self getVideoDataURL]);
// grab the URL and query the server
NSURL *myURL = [NSURL URLWithString:@"http://localhost"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:myURL
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
timeoutInterval:2];
__unused NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES]; …Run Code Online (Sandbox Code Playgroud) 我正在为Quartz Composer定制补丁的最后润色.截至目前,我几乎所有内容都被删除了补丁,当我尝试NSLog NSDictionary值为ivar时,它崩溃告诉我BAD ACCESS,并且当我分配它时,它在上次执行时完美运行.
我的代码看起来像这样:
- (BOOL) startExecution:(id<QCPlugInContext>)context
{
lastBoutData = [[NSDictionary alloc] init ];
return YES;
}
- (BOOL) execute:(id<QCPlugInContext>)context atTime:(NSTimeInterval)time withArguments:(NSDictionary*)arguments
{
NSLog(@"self.inputBoutData: %@", self.inputBoutData);
NSLog(@"lastBoutData: %@", lastBoutData);
// have new data, put it on the output
self.lastBoutData = [NSDictionary dictionaryWithDictionary:self.inputBoutData];
NSLog(@"assigned: %@", lastBoutData);
return YES;
}
Run Code Online (Sandbox Code Playgroud)
我可以看到日志显示所有三个NSLog行完美地工作,直到self.inputBoutData输入.然后,我看到self.inputBoutData被成功复制到循环的最后一个NSLog行中的lastBoutData.
在下一次执行run:atTime:withArguments:中,self.inputBoutData仍然是满的,但lastBoutData再次为空!我不明白这是怎么回事.然后,它运行一个循环,就像最后一个循环一样,并成功将self.inputBoutData复制到lastBoutData,然后再次记录它.下一次,我在第二次NSLog语句之前得到了BAD ACCESS.
我收到一些错误消息,告诉我lastBoutData不是NSDictionary,所以出于绝望,我添加了[lastBoutData retain],并且它没有崩溃.我没有发布这种伊娃,所以我不确定为什么要保留它.在许多其他补丁中我和其他ivars做的事情非常相似,没有任何问题.我能错过什么?为什么这件事在我身上释放,或者甚至发生了什么?
我得到" - [__ NSArrayI addObject:]:无法识别的选择器发送到实例0x10dd15ee0"这里,当我尝试将addObject添加到NSMutableArray时.我不知道为什么.
我有一组嵌套的自定义类.WTEvent有一个名为mats的NSMutableArray属性,它由WTMat对象组成.mats有一个名为bouts的WTBout对象的NSMutableArray.
我希望能够在比赛中更新一回合,同时单独留下剩下的比赛.在这里,我找到了我需要分配一个回合的垫子.如果没有初始化,我会初始化它.然后,如果它是空的,我尝试添加一个newBout,它崩溃了.
我不应该像这样更改NSMutableArray的元素吗?
// Locate the correct mat
WTMat* mat = [self getMatFromBoutKey:[updateData valueForKey:@"boutKey"]];
WTBout* newBout = [WTBout buildBoutFromDictionary:updateData];
// need to initialize bouts
if ([mat bouts] == nil) {
NSLog(@"Initializing bouts");
NSMutableArray* newBouts = [[NSMutableArray alloc] init ];
[mat setBouts:newBouts];
}
if ([[mat bouts] count]) {
// if bouts has bouts, then adjust the bout stack
NSLog(@"bouts is not empty");
} else {
// if bouts is empty, just add a bout
NSLog(@"Adding a …Run Code Online (Sandbox Code Playgroud) objective-c ×3
cakephp ×1
html ×1
ivar ×1
javascript ×1
nsdictionary ×1
nsrunloop ×1
php ×1
properties ×1
retain ×1