小编rta*_*oni的帖子

如何检查jQuery datepicker是否为空?

我有一个日期选择器空,但我不知道如何检查是否为空(未验证或未验证)

validation jquery datepicker

9
推荐指数
1
解决办法
3万
查看次数

如何使用oauth与Ruby连接到Google?

有oauth和oauth2宝石,但我还没有找到一个用oauth连接谷歌的例子

ruby oauth

8
推荐指数
2
解决办法
3435
查看次数

RSpec和Machinist错误:打开的文件太多

今天早上我遇到以下错误:

  14) Deal on creation sets frozen to false or nil
     Failure/Error: Unable to find matching line from backtrace
     Errno::EMFILE:
       Too many open files - identify -format %wx%h '/var/folders/BJ/BJcTANEBFxWcan28U2YEKE+++TI/-Tmp-/stream20120229-36866-4l1sa8.gif[0]'
     # ./spec/support/blueprints.rb:29:in `block in <top (required)>'
Run Code Online (Sandbox Code Playgroud)

规格太慢了(即使用spork),所以它们没用.在模型中运行20个示例需要9分钟.blueprint.rb中的第29行位于以下块之间:

Company.blueprint do
  name { "Office Tronic#{rand(10 ** 10)}" }
  website { 'officetronic.com' }
  subdomain {"officetronic#{rand(10 ** 10)}"}
  facebook { 'officetronic' }
  twitter { 'officetronic' }
  description { 'We are a company dealing with electronics and office supply' }
  address_line1 {'34 John Street'}
  address_line2 {''} …
Run Code Online (Sandbox Code Playgroud)

rspec ruby-on-rails machinist

7
推荐指数
1
解决办法
3033
查看次数

更新MongoDB文档中包含的数组中包含的子文档

Documents.update(
  {_id: Session.get("current_document_id")}, 
  {$push: {schema: {type: "text", size: size, name: name, label: label}}}
);
Run Code Online (Sandbox Code Playgroud)

上面的查询是Meteor集合,'Documents.update'映射到MongoDB文档中的'db.documents.update'(http://docs.mongodb.org/manual/applications/update/).通过该查询,我可以在主文档中添加模式文档.子文档存储在一个数组中:

Document:
  schema:
    array:
      {type: "text", size: 6, name: "first_name", label: "First name"},
      {type: "text", size: 6, name: "last_name", label: "Last name"}
Run Code Online (Sandbox Code Playgroud)

我想使用此查询修改子文档的名称和大小属性:

Documents.update(
  {_id: Session.get("current_document_id"), 'schema' : "first_name"}, 
  {$push: {schema: {type: "text", size: 7, name: name, label: "First Name2"}}}
);
Run Code Online (Sandbox Code Playgroud)

但是该操作直接在模式下附加一个新对象并删除该数组:

Document:
  schema:
      {type: "text", size: 7, name: "first_name", label: "First Name2"}
Run Code Online (Sandbox Code Playgroud)

如何修改查询以更改属性以避免此问题?查询后我想有这个文件:

Document:
  schema:
    array:
      {type: "text", size: 7, name: "first_name", label: "First name2"}, …
Run Code Online (Sandbox Code Playgroud)

mongodb meteor

7
推荐指数
1
解决办法
1万
查看次数

如何使用Grails将文件存储在数据库中

我需要使用Grails将文件存储在数据库中.所以,你知道我怎么做吗?我应该在域类中使用哪种数据类型(byte []可能是一种解决方案)?

grails file-upload

6
推荐指数
2
解决办法
1万
查看次数

C++分布式编程

是否存在用于分布式内存缓存,分布式任务,发布/订阅消息传递的库?我在Java中使用过Hazelcast,我想要类似的东西.

我知道Memcached是一个内存缓存,甚至是分布式的,但它缺少消息传递和远程任务.

我只需要一些东西来协调服务器集群而不使用传统的RPC和套接字编程.

谢谢.

c++ distributed distributed-computing in-memory

6
推荐指数
1
解决办法
5486
查看次数

不推荐使用I18n消息中的{{key}}插值语法.请改用%{key}

我正在使用Rails 2.3.8运行ruby 1.8.7(2010-01-10 patchlevel 249)[i686-darwin10.3.2],我必须使用该版本.当我进行'rake test'时,我得到了

The {{key}} interpolation syntax in I18n messages is deprecated. Please use %{key} instead.
Run Code Online (Sandbox Code Playgroud)

有一个错误,但现在应该解决:https://rails.lighthouseapp.com/projects/8994/tickets/4525-favor-in-all-code-instead-of-deprecated-as-interpolation-syntax-for-国际化

我试过版本为0.4.1,0.4.0和0.4.0-beta1的i18n gem没有运气

任何的想法?

ruby-on-rails internationalization

6
推荐指数
1
解决办法
3374
查看次数

如何在Ruby中使用OpenID访问Google通讯录

我正在使用devise登录omniauth,authid.当用户登录时,我得到了

user_info: 
name: Riccardo Tacconi
last_name: Tacconi
email: email@gmail.com
first_name: Riccardo
uid: https://www.google.com/accounts/o8/id?id=xxxxxxxxx
provider: google_apps
Run Code Online (Sandbox Code Playgroud)

我发现了一个插件:http://stakeventures.com/articles/2009/10/06/portable-contacts-in-ruby获取谷歌联系人.我只需要使用这个方法:

@client = PortableContacts::Client.new "http://www-opensocial.googleusercontent.com/api/people", @access_token
Run Code Online (Sandbox Code Playgroud)

但我需要一个令牌.我只有uid.您是否知道如何获取访问令牌?没有关于访问谷歌的任何文档.

ruby openid rubygems oauth

6
推荐指数
1
解决办法
962
查看次数

ERROR 1005(HY000)第244行:无法创建表'./intranet2/dept.frm'(错误号:150)

我从生产中丢弃了一个DB:

mysqldump -u user_name -p intranet2> intranet2.sql

进入开发服务器:

mysql -u user_name -p intranet2 <intranet2.sql

我明白了

ERROR 1005(HY000)第244行:无法创建表'./intranet2/dept.frm'(错误号:150)

我试着把它放在sql文件的开头:

SET FOREIGN_KEY_CHECKS = 0;

但我仍然得到同样的信息.mysqldump应该能够重新创建一个数据库,否则谁能相信我的备份?

mysql mysqldump mysql-error-1005

5
推荐指数
1
解决办法
2128
查看次数

如何在PHP中将curl作为shell命令行运行

如果我尝试在脚本中运行它:

<?php exec("curl http://ww.google.com") ?>
Run Code Online (Sandbox Code Playgroud)

我明白了:

-bash-3.2$ php test.php 
sh: /curl: No such file or directory
Run Code Online (Sandbox Code Playgroud)

使用shell_exec:

PHP Warning:  shell_exec(): Cannot execute using backquotes in Safe Mode...
Run Code Online (Sandbox Code Playgroud)

如何将curl作为shell命令行运行?

这些错误发生在Linux上,在我的Mac上.

php curl

5
推荐指数
1
解决办法
4万
查看次数