好的,这是我的程序中的一个方法,它一直给出EXC_BAD_ACCESS错误并崩溃.我在下面说明了这一行.questionsShown是一个readwrite属性,指向一个NSMutableArray,我在程序的早期点初始化容量为99.当我调试时,就所分配的属性而言,所有内容都显得正常.我认为内存管理一定存在问题,但我在查找问题时遇到了严重问题.在此先感谢您的帮助.
@synthesize questionList;
@synthesize questionLabel;
@synthesize questionsShown;
-(IBAction)next{
int numElements = [questionList count];
int r;
if (myCount == numElements){
[questionLabel setText:@"You have seen all the questions, click next again to continue anyways."];
[questionsShown release];
questionsShown = [[NSMutableArray alloc] initWithCapacity:99];
myCount = 0;
}
else {
do {
r = rand() % numElements;
} while ([questionsShown indexOfObjectIdenticalTo:r] != NSNotFound);
NSString *myString = [questionList objectAtIndex:(NSUInteger)r];
[questionLabel setText:myString];
myCount++;
[questionsShown addObject:r]; //results in crash with message EXC_BAD_ACCESS
myCount++;
}
}
Run Code Online (Sandbox Code Playgroud) 好吧,所以我有一个在netbeans中运行的遗传算法,它运行了5个小时,似乎进入了无限循环.有什么方法可以附加调试器吗?或者至少得到一些关于它在代码中的位置的线索?在我等待它再次发生的时候,我宁愿不再坐5个小时.
刚买了一个全新的mac.
但是当我尝试安装netbeans 7.0.1时,我会进入安装的一部分,它希望我选择要安装的目标.但它说"Netbeans 7.0.1无法安装在这个磁盘上.这个软件可以安装并仅适用于Java 6."
我在这里从apple开发者网站安装了新的10.7 JDK:
http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wo/5.1.17.2.1.3.3.1.0.1.1.0.3.10.3.3.1
但我仍然收到消息.
我在这里想念的是什么
我在Mongodb中遇到了一些奇怪的错误,在Mongodb中,你应该使用Mongo单身人士.我只是想确保这是非常有效的.
public class DBManager {
public static Mongo mongoSingleton = null;
public static synchronized void getMongo(){
if(mongoSingleton == null){
mongoSingleton = new Mongo();
}
return mongoSingleton;
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
我正在尝试开始使用playframework中的salat插件.我已经配置了数据库application.conf并添加了所有依赖项Build.scala并将salat添加到play.plugins文件中.我还没有在项目中添加任何代码,我只是按照github页面上的说明操作,然后尝试运行该项目.我收到以下错误消息
(Server started, use Ctrl+D to stop and go back to the console...)
[info] play - mongodb [default] connected at heroku_app4620908@ds031907.mongolab.com:31907/heroku_app4620908
[error] application -
! @6bchnaacn - Internal server error, for request [GET /] ->
play.api.Configuration$$anon$1: Configuration error [couldn't connect to [ds031907.mongolab.com/107.21.153.211:31907]]
at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:71) ~[play_2.9.1-2.0.3.jar:2.0.3]
at play.api.Configuration.reportError(Configuration.scala:258) ~[play_2.9.1-2.0.3.jar:2.0.3]
at se.radley.plugin.salat.SalatPlugin$$anonfun$onStart$1.apply(SalatPlugin.scala:105) ~[play-plugins-salat_2.9.1-1.0.8.jar:1.0.8]
at se.radley.plugin.salat.SalatPlugin$$anonfun$onStart$1.apply(SalatPlugin.scala:98) ~[play-plugins-salat_2.9.1-1.0.8.jar:1.0.8]
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194) ~[scala-library.jar:0.11.3]
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194) ~[scala-library.jar:0.11.3]
Caused by: com.mongodb.CommandResult$CommandFailure: command failed [listDatabases]: { "serverUsed" : "db-uri" , "errmsg" : "need … 所以我在我的本地机器上运行了一个django服务器,我想通过我在模拟器中运行的Android应用程序连接到该服务器.当我在Web浏览器中键入它时,一切正常(我得到了我期待的json对象).但是我的android代码无效.
try {
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet();
request.setURI(new URI("http://10.0.2.2:8080/getUserInfo/" + username + "/"));
//next line throws exception
HttpResponse response = client.execute(request);
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
Log.i("GET RESPONSE",EntityUtils.toString(resEntity));
String jsonString = EntityUtils.toString(resEntity);
return jsonToAccount(jsonString);
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
Run Code Online (Sandbox Code Playgroud)
我已经尝试过subing for for for localhost和127.0.0.1for 10.0.2.2have我尝试过8000端口而不是8080,有人能看到问题吗?
这是堆栈跟踪:(如果在新选项卡中打开它,可以阅读它)

我有一个视图控制器MKMapView作为子视图.该视图控制器又转向视图控制器,视图控制器又转向另一个视图控制器.MKMapView可以使我的Apps内存占用高达60mb.
虽然正在介绍其他视图控制器,但有没有办法减少它的占用空间MKMapView而不完全将其从超级视图中删除并取消分配它?
regexp = new RegExp(\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b);
Error:66SyntaxError: Unrecognized token '\'
Run Code Online (Sandbox Code Playgroud) 所以我对设置服务器有点新意.我整晚都在努力解决各种SQL问题.我认为我和成功运行的播放应用程序之间唯一的问题是:错误
Starting process with command `target/start -Dhttp.port=80 `
2012-04-04T05:58:52+00:00 app[web.1]: Play server process ID is 1
2012-04-04T05:58:53+00:00 app[web.1]: [info] play - database [default] connected at jdbc:mysql://us-cdbr-east.cleardb.com/heroku_cd914b667dae168
2012-04-04T05:58:56+00:00 app[web.1]: [info] play - Application started (Prod)
2012-04-04T05:58:56+00:00 app[web.1]: Oops, cannot start the server.
2012-04-04T05:58:56+00:00 app[web.1]: org.jboss.netty.channel.ChannelException: Failed to bind to: /0.0.0.0:80
... more errors
Run Code Online (Sandbox Code Playgroud)
有没有人发现任何问题?我需要任何java选项参数吗?
我尝试在中指定用户端口Procfile,并收到不同的错误消息:
2012-04-04T07:01:36+00:00 heroku[web.1]: Starting process with command `target/start -Dhttp.port=2000`
2012-04-04T07:01:37+00:00 app[web.1]: Play server process ID is 1
2012-04-04T07:01:40+00:00 app[web.1]: [info] play - database [default] connected …Run Code Online (Sandbox Code Playgroud) 我想创建一个触发器,当其中一个属性变为负数时将删除该行.到目前为止,我有这个,但它似乎不是有效的SQL:
CREATE OR REPLACE TRIGGER ZERO_COPIES_TRIGGER
after
update of counter_attribute
on my_table
referencing new as new
for each row when(new.copies < 0)
begin
delete from my_table where my_table.id = :new.id;
end;
Run Code Online (Sandbox Code Playgroud)