这就是我从heroku查看我的production.logs得到的结果:
Completed 200 OK in 63ms (Views: 6.0ms | ActiveRecord: 50.3ms)
Processing by EventsController#show as HTML
Parameters: {"id"=>"2"}
Rendered events/show.html.erb within layouts/application (3.7ms)
Completed 500 Internal Server Error in 15ms
Run Code Online (Sandbox Code Playgroud)
一切都在本地工作,我甚至使用db:push将数据库推送到heroku.对于heroku而言,还有比上面那些无用的强大日志记录吗?
我想滚动到包含自定义单元格的tableview的底部.
这是我用来滚动的代码:
NSIndexPath *lastMessage = [NSIndexPath indexPathForRow:[self.conversation.messages count]-1 inSection:0];
[self.messageTable scrollToRowAtIndexPath:lastMessage atScrollPosition:UITableViewScrollPositionTop animated:YES];
Run Code Online (Sandbox Code Playgroud)
这会滚动视图; 然而,只有最后一个细胞的顶部是可见的,其中~3/4的细胞仍然低于我必须手动向下滚动到的折叠.有想法该怎么解决这个吗?
好的,所以我几乎直接从文档中取出它,似乎没有任何工作(我实际上现在直接翻录他们的html而不仅仅是示例).
首先我的头部分,'模板'文件是我的自定义文件:
<head>
<title>Hello World</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/assets/responsive_template/css/bootstrap.css" rel="stylesheet">
<link href="/assets/responsive_template/css/bootstrap-responsive.css" rel="stylesheet">
<link href="/assets/responsive_template/css/template.css" rel="stylesheet">
<script src="/assets/responsive_template/js/jquery.js"></script>
<script src="/assets/responsive_template/js/jquery-ui-1.10.0.min.js"></script>
<script src="/assets/responsive_template/js/bootstrap.js"></script>
<script src="/assets/responsive_template/js/template.js"></script>
</head>
Run Code Online (Sandbox Code Playgroud)
现在实际的导航栏部分:
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<a href="#" class="btn btn-navbar" data-toggle="collapse" data-target=".navbar-responsive-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="#">Prototype</a>
<div class="nav-collapse collapse navbar-responsive-collapse">
<ul class="nav">
<li><a id="back-button" href="#">Back</a></li>
<li><a id="submit-button" href="#">Submit</a></li>
</ul>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
然而,运行它没有任何崩溃...它只占用了我的iPhone上面的三个整线.当它低于940px时,我没有看到任何通过Chrome控制台的错误......有什么想法吗?
我有一个原型tableview单元格,在tableview单元格内部有一个自定义视图.包含tableview的视图控制器仅以横向模式显示.目标是在tableview单元格内部的UIView根据形状因子调整其宽度.例如,左侧和右侧可能有20pt的间距,然后uiview调整其宽度以填充剩余的空间.我希望通过故事板和自动布局来做到这一点.
在3.5英寸的外形中它看起来像这样(这也是它在4英寸模式下的样子)
在4英寸外形中它看起来像这样(宽度没有自动调整大小)

我知道这里的'自动布局'是合法的,因为4英寸外形尺寸的水平空间也大于20.问题的核心是......当屏幕宽度使用storyboard/autolayout/constraints进行更改时,如何让子视图自动调整其宽度?
这是我的详细视图的视图结构(博客应用程序,我想查看在scrollview内部具有动态高度的整个帖子):
UIView
-UIScrollView
-SinglePostView (custom view)
-Title
-Subtitle
-Content
Run Code Online (Sandbox Code Playgroud)
通常要向UIView添加一个"单个视图"我只是实例化它,将它提供给我的Post对象,然后添加一个约束,将singlePostView的宽度固定到superview上,此时就可以很好地布局.但是,当我尝试将其添加到滚动视图时,它不会显示,也不会滚动.
UIScrollView *scrollView = [[UIScrollView alloc] init];
[self.view addSubview:scrollView];
NOBSinglePostView *singlePost = [[NOBSinglePostView alloc] initWithPost:self.post];
[scrollView addSubview:singlePost];
singlePost.translatesAutoresizingMaskIntoConstraints = NO;
scrollView.translatesAutoresizingMaskIntoConstraints = NO;
NSDictionary *viewsDictionary = NSDictionaryOfVariableBindings(scrollView,singlePost);
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[scrollView]|" options:0 metrics: 0 views:viewsDictionary]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[scrollView]|" options:0 metrics: 0 views:viewsDictionary]];
[scrollView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[singlePost]|" options:0 metrics: 0 views:viewsDictionary]];
Run Code Online (Sandbox Code Playgroud) 是否有任何内置函数在PHP中进行unix时间戳比较?
编辑:我的意思是"2001-12-20 00:00:01"形式的时间戳.还编辑了标题...我的道歉,因为这不是一个unix时间戳
所以我只是尝试做一个简单的jquery效果,但是我遇到了.hover函数的第二部分问题.这是代码:
<div id="toprightboxes">
<ul>
<li><div id="login"><img src="img/login.png"/></div></li>
<li>info</li>
</ul>
</div>
<script>
$("#login").hover(
function () {
$(this).replaceWith('<div id="login"><img src="img/loginhighlight.png"/></div>');
},
function () {
$(this).replaceWith('<div id="login"><img src="img/loginhighlight.png"/></div>');
}
);
</script>
Run Code Online (Sandbox Code Playgroud)
悬停的第一部分工作,高光图像显示,但当我离开图像时没有任何反应.
好吧,所以我有一个这样的嵌套路线:
resources :apps do
resources :forms
end
Run Code Online (Sandbox Code Playgroud)
在我的表单索引中我有这个块:
<% @forms.each do |form| %>
<tr>
<td><%= form.app_id %></td>
<td><%= form.title %></td>
<td><%= link_to 'Show', app_form(@app,form) %></td>
<td><%= link_to 'Destroy', form, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
Run Code Online (Sandbox Code Playgroud)
该页面在app_form行上抛出NoMethodError; 但是我认为我正在传递应用程序和表单(我也尝试传递@ app.id).调用rake路线......甚至显示路线:
app_form GET /apps/:app_id/forms/:id(.:format) {:controller=>"forms", :action=>"show"}
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激!
所以我试图在我的数据库上执行此查询:
select
count(*)
from (select
userID
from users
where rating> 1000
except (select
userID
from users
where rating > 1000
except select sellerID from auctions));
Run Code Online (Sandbox Code Playgroud)
我收到此错误:"错误:靠近第1行:靠近"(":语法错误"
任何帮助赞赏
所以我知道你使用反斜杠来逃避php中的大多数事情,但@符号是一个抑制错误消息的运算符.
我试图将一个像这样的电子邮件字符串放在数组"myname@gmail.com"中,但是php会抛出错误.
你怎么逃避@符号?
编辑:这是抛出错误的代码示例:
$arr = array(3=> "usertest3@gmail.com",4=> "testingagain@msn.com");
Run Code Online (Sandbox Code Playgroud)
但是用单引号替换双引号可以修复下面回答的错误....为什么这是真的?
好奇怪的错误.一切都很好..现在不是.
目前我有一个简单的多对一协会.
路线设置如下:
resources :apps do
resources :forms
end
Run Code Online (Sandbox Code Playgroud)
应用程序:
has_many :forms
Run Code Online (Sandbox Code Playgroud)
形成:
belongs_to :app
Run Code Online (Sandbox Code Playgroud)
Forms_controller索引操作:
def index
@app = App.find(params[:app_id])
@forms = @app.forms
respond_to do |format|
format.html # index.html.erb
format.json { render json: @forms }
end
end
Run Code Online (Sandbox Code Playgroud)
我已经从forms.html.erb布局文件中获取了每一段代码/ html,因此它应该呈现一个空白页面.
相反,我收到此错误:
nil的未定义方法`status':NilClass
我的应用程序中的任何位置都没有定义状态
帮助将不胜感激.
编辑:
这是我的development.log文件中显示的内容
Started GET "/apps/4/forms" for 127.0.0.1 at 2011-09-05 23:14:16 -0700
Processing by FormsController#index as HTML
Parameters: {"app_id"=>"4"}
[1m[36mApp Load (0.1ms)[0m [1mSELECT "apps".* FROM "apps" WHERE "apps"."id" = ? LIMIT 1[0m [["id", "4"]]
[1m[35m (0.1ms)[0m SELECT …Run Code Online (Sandbox Code Playgroud) ios ×3
autolayout ×2
objective-c ×2
php ×2
uiscrollview ×2
uitableview ×2
constraints ×1
css ×1
escaping ×1
heroku ×1
html ×1
iphone ×1
javascript ×1
jquery ×1
navbar ×1
nested ×1
routes ×1
sql ×1
sqlite ×1