在我的mac OSX 10.6 32位,我可以很容易地安装mysql2 gem,但不能在mini mac 10.6 64bit服务器上安装.
我在麻烦的服务器上安装了MySQL 5.5.11,而在我的家里mac MySQL 5.5.0.m2不知何故当我运行bundle install时,在服务器中它试图在家里安装mysql2.0.3.2 mysql2.0.2.6
请不要告诉我
env ARCHFLAGS =" - arch x86_64"sudo gem install mysql2 --version'= 0.2.6' - --with-mysql-config =/usr/local/mysql/bin/mysql_config
我试过了,不行.
$ PATH中包含的/ usr/local/mysql/bin也没有帮助.
错误代码:
Installing mysql2 (0.3.2) with native extensions /Users/administrator/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/administrator/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql and try …Run Code Online (Sandbox Code Playgroud) 在终端窗口中我运行:
export PATH = $ PATH:/ usr/local/mysql/bin >>〜/ .bash_profile
然后,当我回显$ PATH时,新路径显示正常.
但如果我关闭那个窗口,打开另一个窗口,路径就会消失!
如何更改PATH变量?
在" 使用Rails的敏捷Web开发 "(第三版)第537-541页中,它具有"自定义表单构建器"代码,如下所示:
class TaggedBuilder < ActionView::Helpers::FormBuilder
# <p> # <label for="product_description">Description</label><br/> # <%= form.text_area 'description' %> #</p>
def self.create_tagged_field(method_name)
define_method(method_name) do |label, *args|
@template.content_tag("p" , @template.content_tag("label" , label.to_s.humanize,
:for => "#{@object_name}_#{label}") + "<br/>" + super)
end
end
field_helpers.each do |name|
create_tagged_field(name)
end
end
Run Code Online (Sandbox Code Playgroud)
此代码不适用于Ruby 1.9.1.它返回错误如下:
implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly. (ActionView::TemplateError)
我的问题是:我应该在代码中更改什么来解决这个问题?
在chrome打印预览中,在"选项"选项卡下,默认情况下打开了页眉和页脚.是否无法通过javascript/chrome扩展/设置用户手动执行的任何操作将其默认设置为off?
或者是否可以删除那里显示的日期?

让我好奇的是,当你右键单击RStudio上的任何地方时,它有"inspect element"选项.我怀疑它与Javascript有关,但不确定.
我试图做这个页面中显示的ruby示例:http://tomayko.com/writingings/unicorn-is-unix
但我得到的只是
echo.rb:9:in `bind': Address family not supported by protocol family - bind(2) (Errno::EAFNOSUPPORT)
from echo.rb:9:in `<main>'
Run Code Online (Sandbox Code Playgroud)
任何的想法?
让我们使用一个真实世界的例子.
我想修补一下WillPaginate :: LinkRenderer.to_html方法.
到目前为止,我尝试过:
Ë
module Monkeys::WillPaginateNohtml
def to_html
debugger
super
end
end
WillPaginate::LinkRenderer.send(:include, Monkeys::WillPaginateNohtml)
Run Code Online (Sandbox Code Playgroud)
但不知何故,调试器无法通过.看起来修补失败了.
任何帮助将不胜感激,谢谢!
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from ipywidgets import interact, FloatSlider, RadioButtons
amplitude_slider = FloatSlider(min=0.1, max=1.0, step=0.1, value=0.2)
color_buttons = RadioButtons(options=['blue', 'green', 'red'])
# decorate the plot function with an environment from the UIs:
@interact(amplitude=amplitude_slider, color=color_buttons)
def plot(amplitude, color):
fig, ax = plt.subplots(figsize=(4, 3),
subplot_kw={'axisbg':'#EEEEEE',
'axisbelow':True})
ax.grid(color='w', linewidth=2, linestyle='solid')
x = np.linspace(0, 10, 1000)
ax.plot(x, amplitude * np.sin(x), color=color,
lw=5, alpha=0.4)
ax.set_xlim(0, 10)
ax.set_ylim(-1.1, 1.1)
Run Code Online (Sandbox Code Playgroud)
多次使用该小部件给了我多个输出:
我需要在代码中更新什么,以便每次使用小部件时都会清除绘图?
我现在正在尝试学习ruby-debug gem,但是有很多术语我无法赶上.想知道是否有人可以帮助解释?
我在http://bashdb.sourceforge.net/ruby-debug.html中找不到它们.作者假设我们已经理解了它们(无论如何我在哪里可以了解它们?).
例如,这是help frame在rdb 中调用的结果.我无助地理解我加粗的所有项目.
将当前帧移动到指定的帧编号.
负数表示另一端的位置.因此'frame -1'移动到最旧的帧,'frame 0'移动到最新的帧.
如果没有参数,该命令将打印当前堆栈帧.由于当前位置再次显示,它可能触发再同步,如果有一个前端也守护着的东西.
如果给出了一个线程号,那么我们设置上下文来 计算该线程的那个帧的表达式.
ruby ×3
boot2docker ×1
bundler ×1
formbuilder ×1
ipywidgets ×1
javascript ×1
macos ×1
matplotlib ×1
mysql2 ×1
path ×1
rstudio ×1
ruby-1.9 ×1
ruby-debug ×1
unicorn ×1
windows ×1