刚开始使用Rails.我在windows vista上,从http://rubyinstaller.org/安装了最新版本的ruby ,一切顺利.
ruby -v
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
Run Code Online (Sandbox Code Playgroud)
我跑:
gem update --system
gem sources -a http://gemcutter.org
gem install rails
Run Code Online (Sandbox Code Playgroud)
没有错误报告.
rails --v
Rails 3.1.0
Run Code Online (Sandbox Code Playgroud)
在此之后,我为我的Rails项目创建了一个文件夹,我在里面创建了一个新的Rails应用程序,如下所示:
rails new test
cd test
bundle install
Run Code Online (Sandbox Code Playgroud)
(再次没有报错)
但是当我跑步时rails server我得到这个错误:
rails server
?[31mCould not find rails-3.1.0 in any of the sources?[
?[33mRun `bundle install` to install missing gems.?[0m
Run Code Online (Sandbox Code Playgroud)
我尝试再次运行bundle但没有再次成功...在此之后,如果我再次键入rails -v我会得到与以前相同的错误.我必须关闭Windows控制台并重新打开rails -v才能重新开始工作!
有没有人经历过这个?!你能帮我吗?
谢谢!!!
根据要求,gemfile内容为:
source 'http://rubygems.org'
gem 'rails', '3.1.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git' …Run Code Online (Sandbox Code Playgroud) 试图搜索谷歌的一些来源,提供英语,葡萄牙语和西班牙语的国家和国籍列表...没有运气.谁知道一个?
链接到一个多语言网站,其中包含三种语言中任何一个列表的表单也很棒!
IE无法识别%8和9版本的实体.我在两台电脑上测试过.
我读到它在IE中实现:http: //code.google.com/p/doctype/wiki/PercntCharacterEntity
任何的想法?
谢谢
html css internet-explorer internet-explorer-8 internet-explorer-9
我正试图从Windows中将我的postgres数据库拉入Heroku.我跑
$app_folder> heroku db:push postgres://postgres:password@localhost/db_name
Run Code Online (Sandbox Code Playgroud)
它正确地发送架构和一些数据到表,但后来我得到以下错误.
19 tables, 1,835 records
Saving session to push_201110201435.dat..
!!! Caught Server Exception
HTTP CODE: 500
Taps Server Error: LoadError: no such file to load -- sequel/adapters/
["/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/core.rb:249:in `req
uire'", "/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/core.rb:249:
in `block in tsk_require'", "/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib
/sequel/core.rb:72:in `block in check_requiring_thread'", "<internal:prelude>:10
:in `synchronize'", "/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/
core.rb:69:in `check_requiring_thread'", "/app/.bundle/gems/ruby/1.9.1/gems/sequ
el-3.20.0/lib/sequel/core.rb:249:in `tsk_require'", "/app/.bundle/gems/ruby/1.9.
1/gems/sequel-3.20.0/lib/sequel/database/connecting.rb:25:in `adapter_class'", "
/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/database/connecting.r
b:54:in `connect'", "/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/
core.rb:119:in `connect'", "/app/lib/taps/db_session.rb:14:in `conn'", "/app/lib
/taps/server.rb:91:in `block in <class:Server>'", "/app/.bundle/gems/ruby/1.9.1/
gems/sinatra-1.0/lib/sinatra/base.rb:865:in `call'", "/app/.bundle/gems/ruby/1.9
.1/gems/sinatra-1.0/lib/sinatra/base.rb:865:in `block in route'", "/app/.bundle/ …Run Code Online (Sandbox Code Playgroud) 如果用户没有点击鼠标 20秒,我想淡出div .
我有以下代码:
if($('.main-popup2').is(":visible")){
setTimeout(function() {
$('.main-popup2').fadeOut('fast');
}, 20000);
}
Run Code Online (Sandbox Code Playgroud)
问题是我不知道在检测到用户鼠标点击后如何重置setTimeout.
谢谢!
可能重复:
最终的清洁/安全功能
我在另一个帖子中被告知这段代码非常无用:
function getPost($s) {
if (array_key_exists($s, $_POST))
return mysql_real_escape_string(htmlspecialchars($_POST[$s]));
else return false;
}
function getGet($s) {
if (array_key_exists($s, $_GET))
return mysql_real_escape_string(htmlspecialchars($_GET[$s]));
else return false;
}
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮助理解为什么以及如何让它更好吗?也欢迎链接或参考.
只是想要总是改进:)
我正在尝试运行以下查询:
"insert into visits set source = 'http://google.com' and country = 'en' and ref = '1234567890';"
Run Code Online (Sandbox Code Playgroud)
查询对我来说很好,它会打印一个警告:
1 row(s) affected, 2 warning(s): 1364 Field 'country' doesn't have a default value 1292 Truncated incorrect DOUBLE value: 'http://google.com'
Run Code Online (Sandbox Code Playgroud)
并且信息未按预期存储:
id , ref , bnid, source, country
'5', NULL, NULL, '0' , ''
Run Code Online (Sandbox Code Playgroud)
如果我运行正常的语法,如:
insert into visits (source,country,ref) values('http://google.com','en','1234567890');
Run Code Online (Sandbox Code Playgroud)
我得到了预期的结果:
'6', '1234567890', NULL, 'http://google.com', 'en'
Run Code Online (Sandbox Code Playgroud)
第一个语法(插入集)在以前的服务器中工作.现在我改为使用cpanel,但没有.这是本周第二次我在两个不同的VPS中使用cpanel得到这个问题,所以我猜它应该是版本号或mysql配置.
Mysql版本:5.1.63-cll
表:
CREATE TABLE `visits` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ref` varchar(64) DEFAULT NULL,
`bnid` int(11) …Run Code Online (Sandbox Code Playgroud) 我知道这个问题已经在这里提出,我已经尝试了解决方案,但仍然没有解决。
PHP 在一段时间不活动后删除会话(我假设 24 分钟,因为它是默认值并且似乎适合测试)。
我在所有页面中都设置了以下代码:
ini_set('display_errors', 0);
$sessionCookieExpireTime = 2880000;
session_set_cookie_params($sessionCookieExpireTime);
ini_set('session.gc_maxlifetime', $sessionCookieExpireTime);
session_start();
echo ini_get('session.gc_maxlifetime'); //echos 2880000 as expected
Run Code Online (Sandbox Code Playgroud)
但是会话在 24 分钟(左右)不活动后仍然会重置。
phpinfo() 为会话返回以下输出:

知道为什么这不起作用吗?(PHP 5.3.10)
谢谢
我在点击事件中使用我的收藏时遇到问题.为每个模型触发并执行排序功能,但是不会触发重置事件,也不会在视图上更改集合.
我在我的收藏中定义了多个排序标准,例如:
feNoRequire.Collections.CompetitionCollection = Backbone.Collection.extend({
model: feNoRequire.Models.CompetitionModel,
comparator: function (property) {
return selectedStrategy.apply(model.get(property));
},
strategies: {
name: function (competition) { return competition.get("name"); },
nameReverse: function (competition) { console.log(competition); return -competition.get("name"); },
date: function (competition) { console.log(competition.get("event")); },
},
changeSort: function (sortProperty) {
this.comparator = this.strategies[sortProperty];
},
initialize: function () {
this.changeSort("name");
}
});
Run Code Online (Sandbox Code Playgroud)
在我的视图文件中:
initialize: function(options){
this.evnt = options.evnt;
this.collection.on('reset', this.render, this);
this.evnt.bind("orderByDate", this.changeSort, this);
},
changeSort: function(){
this.collection.changeSort('nameReverse')
this.collection.sort();
},
render: function() {
console.log("going for rendering")
var renderedContent = …Run Code Online (Sandbox Code Playgroud) 我在PHP中有以下查询:
$stmt = $conn->prepare('SELECT
date,
avg(sells) as sells
FROM `table` WHERE product_id = :id group by date having count(id) > 1');
$stmt->execute(array('id' => $product));
$res = $stmt->fetchAll(PDO::FETCH_ASSOC);
Run Code Online (Sandbox Code Playgroud)
正如所料,这让我回报:
array(2) {
[0]=> array(2) {
["date"]=> "2013-1-11" ["sells"]=> "73.5000"
}
[1]=> array(2) {
["date"]=> "2013-1-11" ["sells"]=> "77.0000"
}
}
Run Code Online (Sandbox Code Playgroud)
无论如何,我可以得到以下输出而不用PHP循环?
array(2) {
[0]=> array(2) {
"2013-1-11",
"73.5000"
}
[1]=> array(2) {
"2013-1-11",
"77.0000"
}
}
Run Code Online (Sandbox Code Playgroud)