我有这个代码,我贴满了返回false; 这样它在执行后不会在URL的末尾附加#,但它仍然会这样做.知道我做错了什么,最好如何/哪里返回虚假?
// Called right away after someone clicks on the vote up link
$('.vote_up').mouseup(function()
{
$("#loading").show();
var problem_id = $(this).attr("data-problem_id");
vote(problem_id , 1);
//Return false to prevent page navigation
return false;
});
$('.vote_down').mouseup(function()
{
$("#loading").show();
problem_id = $(this).attr("data-problem_id");
vote ( problem_id , -1 );
//Return false to prevent page navigation
return false;
});
// Global function
var vote = function(problem_id , vote)
{
var dataString = 'problem_id=' + problem_id + '&vote=' + vote;
// The person is actually logged …Run Code Online (Sandbox Code Playgroud) 我在Ruby on Rails应用程序中安装了用于身份验证的devise gem,我运行了这样的数据库迁移:
rake db:migrate
Run Code Online (Sandbox Code Playgroud)
并得到此错误:
undefined method `reference' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x9322248>
Run Code Online (Sandbox Code Playgroud)
这有点神秘.我应该去哪里调试这个问题,问题是什么?
我做的唯一不标准的事情是给它表名"users",这是我在上一个命令中的表名:rails generate devise users
另外,我的routes.rb文件有这个新条目:
devise_for :users
Run Code Online (Sandbox Code Playgroud)
可能问题是我的数据库中的列不匹配以及auth包认为用户表应该是什么样的.我在哪里看看auth包认为列是什么样的?我在哪里可以找到create-table命令对于我所拥有的users表的位置.它最初是用scaffold命令制作的,它在我的系统中放了一大堆额外的和无用的东西.
我的db/migrate/users/create_users文件如下所示:
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.timestamps
end
end
def self.down
drop_table :users
end
end
Run Code Online (Sandbox Code Playgroud)
哪个是基本的,但我的db中的users表有以下列:
+------------------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------+------------------+------+-----+---------+-------+
| uid | int(10) unsigned | NO | PRI | 0 | |
| name | varchar(60) | NO | UNI | | …Run Code Online (Sandbox Code Playgroud) 我正在尝试调试 Rails 如何发送电子邮件。目前它对我不起作用:)
但是我应该在配置中的哪里更改我尝试发送的 SMTP?以及如何设置它,以便在 dev/stage/live 上它使用其发送邮件的服务器的适当 SMTP 配置?
谢谢,亚历克斯
ps - 我最初是使用本教程进行设置的:http://guides.rubyonrails.org/action_mailer_basics.html
我有这个我正在工作的线框:
http://problemio.com/problemionewest.pdf
在右侧有一个类别列表.我在这里使用它们
标签:http://www.problemio.com这样:
<p style="color: #2e6ea4;"><strong>Environment</strong></p>
<p style="color: #B77F37; padding-left: 80px;"><strong>Homelessness</strong></p>
<p style="color: gray; margin-left: 20px;"><strong>HealthCare</strong></p>
<p style="color: #2e6ea4; padding-left: 80px;"><strong>Business</strong></p>
<p style="color: #B77F37; padding-left: 120px;"><strong>Relationships</strong></p>
<p style="color: gray; padding-left: 80px;"><strong>Philosophy</strong></p>
<p style="color: #2e6ea4; padding-left: 20px;"><strong>Social Issues</strong></p>
<p style="color: #B77F37; padding-left: 100px;"><strong>Technology</strong></p>
<p style="color: gray; padding-left: 50px;"><strong>Finance</strong></p>
<p style="color: #2e6ea4; padding-left: 130px;"><strong>Real Estate</strong></p>
Run Code Online (Sandbox Code Playgroud)
但是它们之间的空间太大了.有没有办法减少它们之间的垂直空间?
谢谢!!
我正在尝试学习Ruby on Rails并尝试手工编写一些代码,以便我了解它是如何工作的.
我做了这个小控制器:
class TestsController < ApplicationController
def test
def show
render :text => "Hi from TestsController!"
end
end
end
Run Code Online (Sandbox Code Playgroud)
这就是我的观点:
<h3> Hello test </h3>
Run Code Online (Sandbox Code Playgroud)
这是我的routes.rb片段:
resource :test
Run Code Online (Sandbox Code Playgroud)
但它给出了一个错误: The action 'show' could not be found for TestsController
谢谢!
这是rake路线的输出:
home_index GET /home/index(.:format) home#index
root / home#index
test POST /test(.:format) tests#create
new_test GET /test/new(.:format) tests#new
edit_test GET /test/edit(.:format) tests#edit
GET /test(.:format) tests#show
PUT /test(.:format) tests#update
DELETE /test(.:format) tests#destroy
Run Code Online (Sandbox Code Playgroud) 我有一个这种布局的页面:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/question_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Your question: "
/>
<TextView
android:id="@+id/question"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
/>
<TextView
android:id="@+id/please_wait"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Please wait while the discussion loads..."
/>
<ListView
android:id="@android:id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@+id/label"
android:textSize="20px" >
</ListView>
<EditText
android:id="@+id/question_text"
android:layout_height="wrap_content"
android:hint="@string/question_comment_hint"
android:inputType="textMultiLine"
android:lines="5"
android:layout_width="fill_parent">
</EditText>
<Button
android:id="@+id/submit"
android:layout_height="wrap_content"
android:text="@string/submit"
android:onClick="sendFeedback"
android:layout_width="fill_parent">
</Button>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
出于某种原因,一旦屏幕被填满,它就不会向下滚动.知道为什么会这样吗?
谢谢!
我有一个小的HAML段落,其链接如下:
%p
=link_to("My Disclosures", "#")
=link_to("Create Disclosure", "#")
=link_to("My Programs", "#")
=link_to("Log Out", "#")
Run Code Online (Sandbox Code Playgroud)
我想做的是放一个这样的分隔符"|" 链接之间,但我不知道如何.我试着把它放在""里面的文本旁边,但它成了链接文本的一部分.当我尝试将分隔符放在行尾时,它只是没有显示出来.
知道如何让链接之后的文字字符呈现为文本吗?
谢谢!
我正在查看LinkedIn API的此文档页面:https://developer.linkedin.com/documents/profile-api
他们有一个例子:https://developer.linkedin.com/documents/profile-api
我想给他们发一个这样的网址:
/people/id=297823:(connections)
Run Code Online (Sandbox Code Playgroud)
因为他们似乎建议在"选择返回的详细信息量"部分,但它给出了这个错误:
LinkedIn::Errors::NotFoundError: (404): Not Found
Run Code Online (Sandbox Code Playgroud)
知道我在做什么错误的网址?
谢谢!
如果我创建它们呈现的内联样式,但是当尝试在xCode中的同一组和目录中引用css文件时,它们不会呈现.
这是我做的:
<html>
<head>
<link href="main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Hello, world! Learn</h1>
<p>
<a href="myscheme://advertising" class="buttonStyle">Click me!</a>
</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
然后我有一个名为main.css的css文件,如下所示:
body {background-color:#b0c4de;}
p {background-color:#e0ffff;}
Run Code Online (Sandbox Code Playgroud)
有谁知道为什么这不会渲染CSS?我错过了HTML标题中的重要内容吗?
以下是我首先调用HTML的方法:
- (void)viewDidAppear:(BOOL)animated
{
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"learn"
ofType:@"html"];
NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
[theWebView loadHTMLString:htmlString baseURL:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:htmlFile]];
[theWebView loadRequest:request];
}
Run Code Online (Sandbox Code Playgroud) 我有ActionbarSherlock的list_navigation的这个实现:
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Context context = getSupportActionBar().getThemedContext();
ArrayAdapter<CharSequence> list = ArrayAdapter.createFromResource(
context, R.array.locations, R.layout.sherlock_spinner_item);
list.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
getSupportActionBar().setListNavigationCallbacks(list, this);
Run Code Online (Sandbox Code Playgroud)
这是我的list_navigation.xml的xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="20dip">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:text="@string/list_navigation_content" />
<TextView
android:id="@+id/text"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这是导航项目的数组:
<resources>
<string-array name="locations">
<item>Home</item>
<item>Learn</item>
<item>Services</item>
<item>Next Steps</item>
</string-array>
</resources>
Run Code Online (Sandbox Code Playgroud)
下拉列表呈现.当我选择其中一个项目时会发生崩溃.这是崩溃报告:
java.lang.RuntimeException: Binary XML file line #20: You must supply a layout_height attribute.
at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:491)
at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:5319)
at android.view.ViewGroup$LayoutParams.<init>(ViewGroup.java:5271)
at android.view.ViewGroup.generateLayoutParams(ViewGroup.java:4471)
at android.view.LayoutInflater.inflate(LayoutInflater.java:477)
at …Run Code Online (Sandbox Code Playgroud)