我刚刚完成了xcode安装,mac osx lion.完成后,我尝试使用pip,easy_install和home brew在虚拟环境中安装PIL.这三个人都错了.pip install会出现以下错误:
pip`
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)
`
easy_install的 unable to execute gcc-4.0: No such file or directory
error: Setup script exited with error: command 'gcc-4.0' failed with exit status 1
家酿 Error: Failed executing: python setup.py build_ext
我不确定从哪里开始.
谢谢,CG
我正在尝试设置一个选择菜单以将 ImageGallery 与产品相关联。ImageGallery 是多态的,因为它在几个模型之间共享。Formtastic 似乎对要做什么感到非常困惑。它试图调用一个名为 Galleryable 的方法,这是我的多态关联的名称,产品模型上的 _id (galleryable_id)。
产品
class Product < ActiveRecord::Base
has_one :image_gallery, as: :galleryable, dependent: :destroy
accepts_nested_attributes_for :image_gallery, :allow_destroy => true
end
Run Code Online (Sandbox Code Playgroud)
画廊
class ImageGallery < ActiveRecord::Base
belongs_to :galleryable, polymorphic: true
validates :title, presence: true
has_many :images, as: :imageable, dependent: :destroy
accepts_nested_attributes_for :images, :allow_destroy => true, reject_if: lambda { |t| t['file'].nil? }
end
Run Code Online (Sandbox Code Playgroud)
主动管理表单
form do |f|
f.inputs "Details" do
f.input :name
f.input :category
f.input :price
f.input :purchase_path
f.input :video_panels
f.input :image_panels
f.input :image_gallery, :as => …Run Code Online (Sandbox Code Playgroud) ruby-on-rails polymorphic-associations formtastic activeadmin
我正在开发一个小javascript库,需要一些ajax功能,json,jsonp和一些xml.我非常喜欢jQuery ajax方法的工作方式,但不需要所有其他jQuery工具.有没有人知道实现大部分或全部jquery功能的小型跨浏览器ajax脚本?
谢谢!
我有一个Doctrine mongodb文档,我已经变成了一个表单.该文档有两个emebedOne文档,这些文档也在表单中.主文档正在验证,但嵌入文档不是.我正在使用自定义断言,但我认为这不重要.
文献
class AccountRecord{
/**
* @MongoDB\Id
*/
private $id;
/**
* @MongoDB\Field(type="BimcoreEmail")
* @Assert\Email
* @Assert\NotNull
* @CustomAssert\BimcoreEmail
*/
private $email;
/**
* Access Admin
*
* @MongoDB\Boolean
*/
private $access_admin = 0;
/** @MongoDB\EmbedOne(targetDocument="vidAccountSettings") */
private $vid;
}
嵌入式类从不调用自定义断言.
/** @MongoDB\EmbeddedDocument */
class vidAccountSettings {
/**
* Share section path
*
*
* @MongoDB\Field(type="Url")
* @CustomAssert\Url
*/
private $sharePath;
}
形成
class AccountEditFormType extends AbstractType
{
/**
* Builds the embedded form representing the user.
*
* … 我已经在本地设置了carrierwave背景资源以及sidekiq和sidekiq网站.我可以看到作业被添加到sidekiq Enqueued但它们永远不会运行.什么会妨碍他们执行?
设置:Rails 3.2.11 Unicorn 4.6.1 Sidekiq 2.7.5 carrierwave 0.8.0 carrierwave_backgrounder 0.2.0
配置背景.
CarrierWave::Backgrounder.configure do |c|
c.backend :sidekiq, queue: :carrierwave
end
Run Code Online (Sandbox Code Playgroud)
模型
class EntryImage < ActiveRecord::Base
attr_accessible :alt, :image_path
belongs_to :imageable, :polymorphic => true
validates :image_path, presence: true
mount_uploader :image_path, ImageUploader
process_in_background :image_path
end
Run Code Online (Sandbox Code Playgroud)
上传
# encoding: utf-8
class ImageUploader < CarrierWave::Uploader::Base
include ::CarrierWave::Backgrounder::Delay
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
include CarrierWave::MiniMagick
# Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
# include Sprockets::Helpers::RailsHelper
# …Run Code Online (Sandbox Code Playgroud) 我正在使用ex_admin并遇到启动Phoenix服务器的问题.我正在与Hound建立集成测试.ex_admin在测试/支持框架中有一个Phoenix端点.当我将端点服务器的配置设置为true时,我收到一个错误:
** (EXIT from #PID<0.70.0>) shutdown: failed to start child: Phoenix.Endpoint.Server
** (EXIT) shutdown: failed to start child: {:ranch_listener_sup, TestExAdmin.Endpoint.HTTP}
** (EXIT) exited in: :gen_server.call(:ranch_server, {:set_new_listener_opts, TestExAdmin.Endpoint.HTTP, 16384, [env: [dispatch: [{:_, [], [{:_, [], Plug.Adapters.Cowboy.Handler, {TestExAdmin.Endpoint, []}}]}]]]})
** (EXIT) no process
Run Code Online (Sandbox Code Playgroud)
你可以在这里看到代码:https://github.com/gwincr11/ex_admin
谢谢你的帮助!
我运行以下代码
db = create_engine('sqlite:///tracking_test.db')
db.echo= True
metadata = MetaData(db)
session = create_session(bind=db)
#define tables, if they exist sqlalchemly will find them and sycn otherwise they will be created
delivered= Table('delivered', metadata,
Column('delivered_id',Integer,primary_key=True),
Column('domain',String(200)),
Column('path',String(500)),
)
class Delivered(object):
def __init__(self,obj):
self.domain=u'%s' % obj.get("dm","")
self.path=u'%s' % obj.get("pth","")
report1t = Table('clicked', metadata,
Column('clicked_id',Integer,primary_key=True),
Column('domain',String(200)),
Column('path',String(500)),
)
class report1(object):
def __init__(self,obj):
self.domain=u'%s' % obj.get("dm","")
self.path=u'%s' % obj.get("pth","")
metadata.create_all()
mapper(report1, report1t)
mapper(Delivered,delivered)
result= {}#some dict
newT = Delivered(result)
if newT:
session.add(newT)
session.commit()
session.flush()
Run Code Online (Sandbox Code Playgroud)
我收到此错误sqlalchemy.exc.InvalidRequestError:没有开始事务.
会议词典说: …
我正在迁移到同时从雪豹到狮子的新计算机.phpunit似乎没有进行迁移,所以我重新安装了它.然而,与梨的标准安装似乎不适用于我的家庭brew安装的PHP.这是错误:
phpunit PHP Warning: require(/usr/lib/php/PHPUnit/Autoload.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 43 Warning: require(/usr/lib/php/PHPUnit/Autoload.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 43 PHP Fatal error: require(): Failed opening required '/usr/lib/php/PHPUnit/Autoload.php' (include_path='.:/Users/bimemployee/pear/share/pear:/usr/lib/php') in /usr/bin/phpunit on line 43 Fatal error: require(): Failed opening required '/usr/lib/php/PHPUnit/Autoload.php' (include_path='.:/Users/bimemployee/pear/share/pear:/usr/lib/php') in /usr/bin/phpunit on line 43
我的计算机设置我的主/etc/php.ini文件作为/usr/local/etc/php.ini中的home brew php.ini文件的符号链接,这包含我的包含路径,它似乎正在工作.
php -r 'foreach (explode(":", get_include_path()) as $path) echo $path . PHP_EOL;'
No log handling enabled … 我试图第一次设置Spree.一切顺利,直到我上传图片.我在Mac OSX Mountain Lion上使用自制软件安装了Imageamgick.上传任何图像会给我以下错误.
Paperclip::NotIdentifiedByImageMagickError in Spree::Admin::ImagesController#create
Command :: identify -format %wx%h :file
[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError: /var/folders/fq/9g_6hmg513g6137rb6sbghw00000gn/T/stream20121005-26943-16883d4.png is not recognized by the 'identify' command.>
Paperclip::NotIdentifiedByImageMagickError (/var/folders/fq/9g_6hmg513g6137rb6sbghw00000gn/T/stream20121005-26943-16883d4.png is not recognized by the 'identify' command.):
paperclip (2.7.1) lib/paperclip/geometry.rb:29:in `from_file'
spree_core (1.2.0) app/models/spree/image.rb:35:in `find_dimensions'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `_run__1794851703999987262__post_process__1580526166879208018__callbacks'
Run Code Online (Sandbox Code Playgroud)
当我从命令行运行识别时,我得到以下输出
Image Settings:
-alpha option on, activate, off, deactivate, set, opaque, copy
transparent, extract, background, or shape
-antialias remove pixel-aliasing
-authenticate password
decipher image with this password
-channel type apply …Run Code Online (Sandbox Code Playgroud) 我有一个递归JSON爬虫函数,它查找指定的函数然后返回它.但是,它返回undefined,我不知道为什么.
这是脚本:
function get(what, where){
where = typeof(where) != 'undefined' ? where : user.object;
for(entry in where){
if(typeof(where[entry]) =="string"){
if (entry == what) {
result = where[entry];
console.log(result)
return result;
}
}else if(typeof(where[entry]) =="object"){
get(what, where[entry]);
}
}
}
Run Code Online (Sandbox Code Playgroud)
在console.log正确的回报,但return语句下面失败.
javascript ×2
python ×2
activeadmin ×1
ajax ×1
carrierwave ×1
django ×1
doctrine-orm ×1
elixir ×1
formtastic ×1
imagemagick ×1
macos ×1
odm ×1
osx-lion ×1
paperclip ×1
pear ×1
phpunit ×1
sidekiq ×1
spree ×1
sqlalchemy ×1
symfony ×1