就目前而言,我是一名Java和C#开发人员.我越来越关注Ruby on Rails,我越想学习它.
你发现什么是学习RoR的最佳途径?在Windows上开发会更容易,还是应该只运行Linux的虚拟机?
是否有一个IDE可以匹配Visual Studio的健壮性?任何开发的程序都可以提供很好的开销吗?好书怎么样?
说真的,任何提示/技巧/咆哮都会很棒.
Python和Ruby通常被认为是具有相似表现力和力量的近亲(虽然具有完全不同的历史包袱).但有些人认为Rails框架的巨大成功确实与它所构建的语言有很大关系:Ruby本身.那么为什么Ruby比Python更适合这样的框架呢?
使用Mongoid.不幸的是,Mongoid不允许选择独特/不同!得到了这些结果.如您所见,有7个结果.如果你仔细观察(在user_id),只有2个用户.
[
#<Activity _id: 4cea6c4572357e00fa00011a, created_at: 2010-11-22 13:12:37 UTC, updated_at: 2010-11-22 13:12:37 UTC, action: "Attend", user_id: BSON::ObjectId('4cea2fb872357e00fa000025'), artist_id: nil, media_id: BSON::ObjectId('4cea447472357e00fa00009a')>,
#<Activity _id: 4cea6c3072357e00fa000116, created_at: 2010-11-22 13:12:16 UTC, updated_at: 2010-11-22 13:12:16 UTC, action: "Attend", user_id: BSON::ObjectId('4cea2fb872357e00fa000025'), artist_id: nil, media_id: BSON::ObjectId('4cea447472357e00fa00009a')>,
#<Activity _id: 4cea6bdd72357e00fa00010d, created_at: 2010-11-22 13:10:53 UTC, updated_at: 2010-11-22 13:10:53 UTC, action: "Attend", user_id: BSON::ObjectId('4cea2fb872357e00fa000025'), artist_id: nil, media_id: BSON::ObjectId('4cea447472357e00fa00009a')>,
#<Activity _id: 4cea46df72357e00fa0000a4, created_at: 2010-11-22 10:33:03 UTC, updated_at: 2010-11-22 10:33:03 UTC, action: "Attend", user_id: BSON::ObjectId('4cea2fb872357e00fa000025'), artist_id: nil, media_id: BSON::ObjectId('4cea447472357e00fa00009a')>,
#<Activity _id: …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个Facebook iFrame应用程序.应用程序应首先显示图像,如果用户喜欢该页面,他将可以访问某些内容.
我使用RoR,因此我无法使用Facebook PhP SDK.
当用户不喜欢该页面时,这是我的iFrame HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<style type="text/css">
body {
width:520px;
margin:0; padding:0; border:0;
font-family: verdana;
background:url(repeat.png) repeat;
margin-bottom:10px;
}
p, h1 {width:450px; margin-left:50px; color:#FFF;}
p {font-size:11px;}
</style>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
</head>
<body>
<div id="container">
<img src="welcome.png" alt="Frontimg">
</div>
Run Code Online (Sandbox Code Playgroud)
并且,如果用户喜欢该页面:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<style type="text/css">
body …Run Code Online (Sandbox Code Playgroud) 我收到错误:
Error "ActiveRecord::ConnectionTimeoutError - could not obtain a database connection within 5 seconds. The max pool size is currently 5; consider increasing it."
Run Code Online (Sandbox Code Playgroud)
如何增加最大池大小?
# DB CONNECTION
DB_CONN = ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => DB_FILE)
Run Code Online (Sandbox Code Playgroud) 下列:
new Date(1324339200000).toUTCString()
Run Code Online (Sandbox Code Playgroud)
输出:
"Tue, 20 Dec 2011 00:00:00 GMT"
Run Code Online (Sandbox Code Playgroud)
我需要它回来Dec 20.除此之外还有更好的方法toUTCString()吗?我正在寻找任何解析毫秒的方法,以返回一个人类可读的日期.
我有一个完全使用PostgreSQL的应用程序.在阅读了MongoDB之后,我有兴趣了解应用程序如何使用它.几周后,我将整个系统迁移到MongoDB.
我喜欢MongoDB的一些东西.但是,我发现我在PostgreSQL中做的某些查询,我无法在MongoDB中有效地执行.特别是,当我不得不加入几个表来计算一些逻辑时.例如,这个.
此外,我正在使用Ruby on Rails 3和一个名为Mongoid的ODM.Mongoid仍处于测试阶段.文档很好,但有时我发现ODM与Active Record在传统(SQL)数据库系统中提供的相比非常有限.
即使到了这个日期,我觉得使用PostgreSQL比使用MongoDB更舒服.只是因为我可以连接表并对数据做任何事情.
我做了两种类型的备份.一个是PostgreSQL,另一个是MongoDB.有人说,有些应用程序更适合使用一种或另一种类型的数据库.我应该继续使用MongoDB并最终希望它的RoR ODM(Mongoid)完全成熟,还是应该考虑使用PostgreSQL?
还有一些问题:1)哪一个更适合开发类似于Facebook的社交网站.2)哪一个更适合4页标准版面网站(首页,产品,关于,联系方式)
我正在尝试将CSS框架Blueprint加载到我的Rails 3.1应用程序中.
在Rails 3.0+中,我在views/layouts/application.html.erb中会有类似的东西:
<%= stylesheet_link_tag 'blueprint/screen', 'application' %>
<%= stylesheet_link_tag 'blueprint/print', 'media' => 'print' %>
<!--[if lt IE 8]>
<%= stylesheet_link_tag 'blueprint/ie' %>
<![endif]-->
Run Code Online (Sandbox Code Playgroud)
但是,Rails 3.1现在使用SASS.加载这些Blueprint CSS文件的正确方法是什么?
目前,我在app/assets/stylesheets /中有蓝图目录
我的app/assets/stylesheets/application.css看起来像:
/*
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new …Run Code Online (Sandbox Code Playgroud) 试图让tag-it与ajax调用一起使用.
到目前为止一切都有效.除此之外,我无法通过ajax调用分配tagSource.
在萤火虫中,'数据'正在返回:
["Ruby","Ruby On Rails"]
Run Code Online (Sandbox Code Playgroud)
但是当我输入输入框时它没有显示出来.
$('.tags ul').tagit({
itemName: 'question',
fieldName: 'tags',
removeConfirmation: true,
availableTags: ["c++", "java", "php", "javascript", "ruby", "python", "c"],
allowSpaces: true,
// tagSource: ['foo', 'bar']
tagSource: function() {
$.ajax({
url: "/autocomplete_tags.json",
dataType: "json",
data: { term: 'ruby' },
success: function(data) {
console.log(data);
return data;
}
});
}
});
Run Code Online (Sandbox Code Playgroud)
console.log(data)回报["Ruby", "Ruby On Rails"].
我在这里错过了什么吗?还有其他人上班吗?
我正在使用Macvim 7.3快照57.我似乎无法在我的任何文件中使用matchit.
我在开始标记上按%.它不会把我带到结束标签......
我的vimrc文件:
" Pathogen settings
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
set nocompatible
set number
set ruler
set cursorline
syntax on
" Disable all blinking
set guicursor+=a:blinkon0
" Whitespace stuff
set nowrap
set tabstop=2
set shiftwidth=2
set expandtab
set cindent
set smartindent
set autoindent
set list listchars=tab:\ \ ,trail:·
" Searching
set hlsearch
set incsearch
set ignorecase
set smartcase
" Status bar
set laststatus=2
" Start without the toolbar
set guioptions-=T
" Default gui color scheme
" "color default
" …Run Code Online (Sandbox Code Playgroud) ruby ×4
javascript ×3
jquery ×3
activerecord ×1
autocomplete ×1
database ×1
facebook ×1
ide ×1
macvim ×1
mongodb ×1
nosql ×1
postgresql ×1
python ×1
sql ×1
sqlite ×1
tag-it ×1
vim ×1