这是为了使用嵌入式ruby代码开发postgres函数,但我无法构建它.
根据http://www.robbyonrails.com/articles/2005/08/22/installing-untrusted-pl-ruby-for-postgresql的建议
我试图建立从最新的版本(plruby-0.5.3.tar.gz)所需的plruby.so在提供 ftp://moulon.inra.fr/pub/ruby/
我已经整理了我的本地postgres设置的位置,并将调用调整为:
ruby extconf.rb --with-pgsql-include=/usr/postgresql-8.3.4/include/server --enable-shared --disable-conversion --with-pgsql-version=83
Run Code Online (Sandbox Code Playgroud)
我已经尝试了很多变种,但它似乎无法成功制作'conftest.c'文件
它说:
checking for catalog/pg_proc.h... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Run Code Online (Sandbox Code Playgroud)
以下是我在mkmf.log中的最终结果
have_header: checking for catalog/pg_proc.h... -------------------- yes
"gcc -E -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -I/usr/postgresql-8.3.4/include/server -g -O2 -fPIC conftest.c -o conftest.i"
checked program was:
/* begin */
1: …Run Code Online (Sandbox Code Playgroud) 我正在使用Apache Proxy balancer指令来连接一组瘦服务器(用于Rails).
像这样:
<Proxy balancer://thinservers>
BalancerMember http://127.0.0.1:5000 route=thin0
BalancerMember http://127.0.0.1:5001 route=thin1
BalancerMember http://127.0.0.1:5002 route=thin2
</Proxy>
Run Code Online (Sandbox Code Playgroud)
但是,thin也可以配置为使用unix域套接字.
所以我希望能够做到这样的事情:
<Proxy balancer://thinservers>
BalancerMember unix://tmp/thin.0.sock route=thin0
BalancerMember unix://tmp/thin.1.sock route=thin1
BalancerMember unix://tmp/thin.2.sock route=thin2
</Proxy>
Run Code Online (Sandbox Code Playgroud)
但Apache没有接受它.显然nginx可以做到,但我真的想使用Apache.
有办法吗?
我经常将预配置的lambdas插入可枚举的方法,如'map','select'等,但'inject'的行为似乎有所不同.例如
mult4 = lambda {|item| item * 4 }
Run Code Online (Sandbox Code Playgroud)
然后
(5..10).map &mult4
Run Code Online (Sandbox Code Playgroud)
给我
[20, 24, 28, 32, 36, 40]
Run Code Online (Sandbox Code Playgroud)
但是,如果我将一个2参数lambda用于这样的注入,
multL = lambda {|product, n| product * n }
Run Code Online (Sandbox Code Playgroud)
我希望能够说出来
(5..10).inject(2) &multL
Run Code Online (Sandbox Code Playgroud)
因为'inject'有一个可选的单个参数作为初始值,但这给了我...
irb(main):027:0> (5..10).inject(2) &multL
LocalJumpError: no block given
from (irb):27:in `inject'
from (irb):27
Run Code Online (Sandbox Code Playgroud)
但是,如果我将'&multL'填充到第二个参数中以进行注入,那么它可以工作.
irb(main):028:0> (5..10).inject(2, &multL)
=> 302400
Run Code Online (Sandbox Code Playgroud)
我的问题是"为什么这样做而不是之前的尝试?"
一个C程序将它认为是64位无符号整数的东西放入Postgres数据库中的一个列,该数据库被输入为int8.对于Postgres,int8总是'signed int8'(没有像'unsigned int8'那样).因此,我所使用的Ruby程序显示从该空间的上半部分中的Postgres检索到的数字为负数.
在Ruby中,采用-ve整数并将其转换为C程序员所期望的64位无符号整数的正确方法是什么?
我真的应该升级到Firefox 3,但我非常依赖Firebug正常工作.
我知道有一个版本的Firebug可以与Firefox 3一起使用,但是上次我看,它似乎有问题.
那么,对于那些已经取得成功的人来说,Firefox 3上的Firebug是否准备好迎接黄金时段?