在完成Ruby on Rails教程第3章的RVM设置,rspec和保护部分之后,每当我运行时,bundle install我都会得到以下错误转储:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:5:in `<main>'
Gem files will remain installed in /home/dan/.bundler/tmp/17577/gems/nokogiri-1.5.2 for inspection.
Results logged to /home/dan/.bundler/tmp/17577/gems/nokogiri-1.5.2/ext/nokogiri/gem_make.out
An error occured while installing nokogiri (1.5.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.5.2'` succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)
在gem_make.out中:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in …Run Code Online (Sandbox Code Playgroud) 根据以下描述我必须CASE...END在SQL服务器中构建一个语句,帮助我构造一个复杂的CASE...END语句来满足以下条件.
if PAT_ENT.SCR_DT is not null and PAT_ENTRY.ELIGIBILITY is null then display display 'Favor'
if PAT_ENT.SCR_DT is not null and PAT_ENTRY.EL is equal to No, display 'Error'
if PAT_ENTRY.EL is Yes and DS.DES is equal to null or OFF, display 'Active'
if DS.DES is equal to N, display 'Early Term'
if DS.DES is equal to Y, display 'Complete'
Run Code Online (Sandbox Code Playgroud)
提前致谢.
我已经尝试了一个多星期的不同选择,似乎没有任何效果.更复杂的是,我在页面上有多个表单,所有表单都需要绑定到同一个提交函数.它们都有不同的ID.
以下是我的jQuery的简化版本:
$('form').on('submit', function(form){
var data = $(this).serialize();
$.ajax({
type: 'POST',
cache: false,
url: 'inc/process.php',
data: data,
success: function(){
// The following fires on first AND second submit
console.log("Updates have successfully been ajaxed");
}
});
return false;
});
Run Code Online (Sandbox Code Playgroud)
我也试过使用$('form').submit()相同的结果.
process.php的相关部分:
$query = 'UPDATE pop_contents
SET ';
$id = $_POST['content_id'];
/* to avoid including in MySQL query later */
unset($_POST['content_id']);
$length = count($_POST);
$count = 0;
foreach($_POST as $col => $value){
$value = trim($value);
$query .= $col."='".escapeString($value);
// don't …Run Code Online (Sandbox Code Playgroud) 我正在创建一个网站的组织有一个Facebook粉丝页面,我想直接从粉丝页面创建或参加的活动中提供网站上的活动标签.问题是我无法看到,查看FB提供的oauth文档,如何检索访问令牌而不强迫网站用户处理auth对话框(用户不应该处理).是的,粉丝页面图需要身份验证才能访问事件.
这应该很简单,但我只是没有看到如何做到这一点.任何帮助将不胜感激!
PS-我不想强迫用户登录网站以访问任何内容(我想应该澄清一下).
我可以找到大量有关使用time()Perl版本5.004之前的问题的文档,但没有任何内容.
对于家庭作业,我们被要求根据默认Perl srand()在默认播种中仍有缺陷的假设对程序的结果进行逆向工程.perl 5.004版本的更改日志声明srand()默认种子现在基于"难以预测的系统相关值的大量混合".
是这样吗,如果是这样,这些价值观是什么,他们是否有任何固有的弱点?
我已经实现了一个多级缓存模拟器,需要存储模拟器中当前的值.使用当前配置,存储的所有值的最大大小可以达到2G.显然,我不会假设这种最糟糕的情况,并预先分配所有内存.相反,我将程序设置为根据需要在块中分配内存.当我在calloc先前在指定位置没有发生写入时,为了提供0值这一事实加剧了这种分配的费用.
我的问题是,每次需要多少内存应该分配多少内存?目前我正在使用一个任意值,我考虑了一些解决方案,它将使用整个系统内存的一些比例(我认为可以在编译和/或运行时动态检测它),但即使使用后者,我也使用了任意比率仍然不适合我.
任何洞察这种情况的最佳实践将不胜感激!
实例:
当我查看源网页一切正常,但是当我通过AJAX请求负载,在验证码的地方应该是,我看到...
<noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?k=6LfwkccSAAAAALr_z6vDBqkySowo5KIiR0mVM1BX" height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>
Run Code Online (Sandbox Code Playgroud)
显然,除非我的用户已禁用JS,否则这不起作用.在此过程中不会抛出任何错误.
以非AJAX请求的速度查看代码,我看到......
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=6LfwkccSAAAAALr_z6vDBqkySowo5KIiR0mVM1BX"></script>
<noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?k=6LfwkccSAAAAALr_z6vDBqkySowo5KIiR0mVM1BX" height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>
Run Code Online (Sandbox Code Playgroud)
请注意脚本顶部的附加行,用于解决启用了JS的用户的问题.
所以我想问题是双重的.WTF正在发生,我该如何解决?
我发现了一些含糊的提到这个问题,但没有得到正确的答案.我发现了一些使用reCAPTCHA API的提法document.write,但我不知道这是否有效.如果我忽略了一些明显的东西,请随时指出.
根据请求,AJAX调用是......
$(document).ready(function() {
$.get('/inc/email.php',
function(data){
console.log('Get success!');
$('#email-form').html(data);
console.log('Get added to #email-form!');
$('#email-form form').submit( function(){
$.ajax({
type: "POST",
url: "/inc/email.php",
data: $('#email-form form').serialize(),
success: function() {
console.log('Submit success!');
$('#email-form').html(data);
}
});
return false; …Run Code Online (Sandbox Code Playgroud) 我刚刚开始玩CarrierWave并且无法让它表现得很好.
按照Rails Casts中的描述设置了所有内容后,我收到以下错误:No such file or directory - identify -quiet -ping /tmp/mini_magick20130519-13712-lxhans.jpg
注意:我知道Rails Cast中的拼写错误,并且我的代码中不存在该问题.
在我的开发环境中,我已经安装了libmagickwand-dev包,运行Rails 3.2.9,以及Ruby 1.9.3p194其他一些东西.我的Gemfile包括mini_magick.
传递给服务器的请求是这样的:
{"utf8"=>"?",
"authenticity_token"=>"8ugcdkjOy/5yeodhuTgMXYdrXlcu2xPjxWTvvRwKnWM=",
"organization"=>{"logo"=>#<ActionDispatch::Http::UploadedFile:0x0000000426c3d0 @original_filename="leather-tshirt-weird-square.jpg",
@content_type="image/jpeg",
@headers="Content-Disposition: form-data; name=\"organization[logo]\"; filename=\"leather-tshirt-weird-square.jpg\"\r\nContent-Type: image/jpeg\r\n",
@tempfile=#<File:/tmp/RackMultipart20130519-13712-1uvmtem>>,
"name"=>"Test Org",
"description"=>"blah",
"timezone"=>"1"},
"commit"=>"Create Organization"}
Run Code Online (Sandbox Code Playgroud)
完整的跟踪位于:http://pastebin.com/dW5j9NLt
在最初尝试了一些更高级的功能之后,我将代码缩减为以下内容并且仍然没有运气:
class LogoUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
storage :file
version :thumb do
process :resize_to_limit => [100, 100]
end
def extension_white_list
%w(jpg jpeg gif png) …Run Code Online (Sandbox Code Playgroud) 这是我目前看到的:

请注意,第二行未正确包装.代码如下:
<div class="container-fluid">
<div class="row clearfix">
<div class="col-md-2 bit clearfix">
<div class="clearfix">
<div class="image-preview">
<a href=""><img src="" class="img-rounded img-responsive"/></a>
</div>
<h6><a href="">Some text</a></h6>
</div>
</div>
</div>
.... repeat ....
</div>
Run Code Online (Sandbox Code Playgroud)
知道为什么包装不正确吗?
我准备用这个撕掉我的头发了.
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 3.
The error occurred in [WITHHELD]: line 19
17 : WHERE FNAME = #FORM.first#
18 : AND LNAME = #FORM.last#
19 : AND PASS = #FORM.pass#
20 : </cfquery>
21 :
SQLSTATE 07002
SQL SELECT * FROM JUDGES WHERE FNAME = [WITHHELD] AND LNAME = [WITHHELD] AND PASS = [WITHHELD]
VENDORERRORCODE -3010
DATASOURCE honors
Run Code Online (Sandbox Code Playgroud)
我已经阅读了一些类似的问题,其中有一些拼写错误,但我已经检查并重新检查拼写,甚至更改了列和表名,并再次尝试.
我有两个表格单元格.第一个包含链接和图像("CollegiateLink").第二个包含一个带有提交按钮图像的表单("支付会费"):

在Firefox和IE中,单元格具有不需要的填充,如上所示.在Chrome中他们显得很好.为什么是这样?
这是表格行的来源:
<tr>
<td>
<a href="https://utsa.collegiatelink.net/organization/sigmakappaupsilonhonorsociety">
<img src="http://a6.sphotos.ak.fbcdn.net/hphotos-ak-ash4/396010_343796938973248_154024167950527_1347540_1267421848_n.jpg" onMouseOver="this.src='http://a4.sphotos.ak.fbcdn.net/hphotos-ak-snc7/404415_343796945639914_154024167950527_1347541_548420198_n.jpg'"
alt="CollegiateLink" onMouseOut="this.src='http://a6.sphotos.ak.fbcdn.net/hphotos-ak-ash4/396010_343796938973248_154024167950527_1347540_1267421848_n.jpg'" />
</a>
</td>
<td>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="UVBXKLNNGX8GL">
<input type="image" src="http://a2.sphotos.ak.fbcdn.net/hphotos-ak-ash4/382615_343796955639913_154024167950527_1347542_331738916_n.jpg" onMouseOver="this.src='http://a8.sphotos.ak.fbcdn.net/hphotos-ak-snc7/396479_343796968973245_154024167950527_1347543_1793145374_n.jpg'"
onMouseOut="this.src='http://a2.sphotos.ak.fbcdn.net/hphotos-ak-ash4/382615_343796955639913_154024167950527_1347542_331738916_n.jpg'" border="0" name="submit"
alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1" style="position: absolute; bottom: 0; right: 0;">
</form>
</td>
</tr>
Run Code Online (Sandbox Code Playgroud)
可以在此处找到问题的(非)工作示例:http://www.facebook.com/sky.utsa
我不能使用图像地图,因为"支付会费"图像是表单元素,而不是锚标记.我已经尝试明确设置td高度没有成功.有任何想法吗?
在以下代码块中,num_insts重新分配给0循环的第一次迭代.
inst_t buf[5] = {0};
num_insts = 10;
int i = 5;
for( ; i > 0; i-- )
{
buf[i] = buf[i-1];
}
buf[0] = next;
Run Code Online (Sandbox Code Playgroud)
我想不出这种行为可能有任何正当理由,但我也被剥夺了睡眠,所以第二意见将不胜感激.
为buf shift执行的程序集是这样的:
004017ed: mov 0x90(%esp),%eax
004017f4: lea -0x1(%eax),%ecx
004017f7: mov 0x90(%esp),%edx
004017fe: mov %edx,%eax
00401800: shl $0x2,%eax
00401803: add %edx,%eax
00401805: shl $0x2,%eax
00401808: lea 0xa0(%esp),%edi
0040180f: lea (%edi,%eax,1),%eax
00401812: lea -0x7c(%eax),%edx
00401815: mov %ecx,%eax
00401817: shl $0x2,%eax
0040181a: add %ecx,%eax
0040181c: shl $0x2,%eax
0040181f: lea 0xa0(%esp),%ecx
Run Code Online (Sandbox Code Playgroud)
并且在执行上面的第一个汇编指令之前的寄存器内容是: …
我一直在我的桌子上敲我的头几个小时,试图弄清楚为什么下面的代码停滞不前while(chars = read(fd, buff, BUFF_SZ)) > 0).在printf上线直接以下不会被调用和一个正上方是.文件描述符返回0,是一个有效值.
char *infile = argv[1];
int fd,chars;
if ((fd = open(infile, O_RDONLY) < 0)) {
perror("open()");
exit(1);
}
printf("%s - opened (fp: %d)\n", infile, fd);
while((chars = read(fd, buff, BUFF_SZ)) > 0){
printf("%d\n", chars);
for(i = 0; i < chars; i++){
c = buff[i];
total++;
count[c]++;
}
}
Run Code Online (Sandbox Code Playgroud)
我甚至不知道如何调试这个,因为在该行之后没有触发任何内容,并且在此行之前一切正常.
完整的,可编辑的代码:
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#define BUFF_SZ 4096
int …Run Code Online (Sandbox Code Playgroud) c ×3
css ×2
jquery ×2
php ×2
api ×1
assembly ×1
carrierwave ×1
coldfusion ×1
cygwin ×1
facebook ×1
firefox ×1
forms ×1
gcc ×1
html-table ×1
html5 ×1
io ×1
low-level-io ×1
malloc ×1
ms-access ×1
nokogiri ×1
perl ×1
random ×1
recaptcha ×1
rubygems ×1
security ×1
sql-server ×1
srand ×1
tinymce ×1