我决定在 RubyMine 7.1.4 中使用远程 Ruby SDK。
Vagrant 机器 ( hashicorp/precise32) 已设置,RVM、Ruby 2.2.1p85(2015-02-26 修订版 49769)、Rails 4.2.4 和其他必需的 gem 已安装,并且我的应用程序在通过rails server命令启动时运行。
远程 Ruby 解释器已按以下方式配置:
Settings> Languages & Frameworks> > Ruby SDK and gems>AddNew remote...
/home/vagrant/.rvm/rubies/ruby-2.2.1/bin/ruby的输出which ruby)RubyMine 中列出的远程解释器的 gem 太少了:
bundler (1.8.4)
bundler-unload (1.0.2)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
minitest (5.4.3)
power_assert (0.2.2)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
test-unit (3.0.8)
Run Code Online (Sandbox Code Playgroud)
gem listSSH 控制台中打印的实际列表:
actionmailer (4.2.4)
actionpack (4.2.4)
actionview (4.2.4) …Run Code Online (Sandbox Code Playgroud) 如何在TChart上直接使用GDI +旋转和绘制transperent PNG图像?
目前我将PNG图像加载到位图并使用两个位图进行GDI +旋转(它工作得非常快)然后使目标位图透明并在TChart的画布上绘制(当透明度打开时它会很慢).
procedure TPitchDisplay._chartAfterDraw(Sender: TObject);
var
c: TCanvas3D;
pw, ph: Integer;
r: TRect;
bmp: TBitmap;
rotAngle: Integer;
begin
_setKnobBounds();
c := _chart.Canvas;
_drawCircle(c, _knob.CenterPoint.X, _knob.CenterPoint.Y, Round(_knob.YRadius * 0.9));
c.StretchDrawQuality := sqHigh;
pw := 450;
ph := Round((pw / _shipBitmap.Width) * _shipBitmap.Height);
r.Left := _chart.ChartXCenter - pw div 2;
r.Top := Round(_chart.Height / 3);
r.Width := pw;
r.Height := ph;
//Draw water
c.StretchDraw(Rect(0, r.Top + Round(ph / 1.5), _chart.Width, _chart.Height), _waterBitmap);
//Draw rotated ship over it
bmp := …Run Code Online (Sandbox Code Playgroud) 我使用"invalidHandler"选项制作了常见的验证消息("您在页面上有错误").现在我正在寻找一种方法来删除此消息(在休假控制上)所有字段将变为有效.
我正在使用Rails的Devise身份验证gem.
如何显示devise.en.yml中的消息:
send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes'
Run Code Online (Sandbox Code Playgroud)
密码恢复电子邮件发送后,而不是重定向到网站的根目录?
更新:
我在devise_controller.rb中找到了一段有趣的代码:
def successfully_sent?(resource)
notice = if Devise.paranoid
resource.errors.clear
:send_paranoid_instructions
elsif resource.errors.empty?
:send_instructions
end
if notice
set_flash_message :notice, notice if is_navigational_format?
true
end
end
Run Code Online (Sandbox Code Playgroud)
设置断点显示正在调用右边的行:send_instructions被分配给notice,调用set_flash_message,但我看不到所有这些的结果,因为我立即被重定向到根路径.
我知道从Bootstrap网站下载Twitter Bootstrap时可能会对其进行自定义。bootstrap-sass gem怎么样?它总是包含所有功能吗?
你能解释一下这段代码的作用:
App.config(['$httpProvider', function ($httpProvider) {
$httpProvider.responseInterceptors.push('HttpSpinnerInterceptor');
$httpProvider.defaults.transformRequest.push(function (data, headersGetter) {
angular.element('.brand img').attr("src","<%= asset_path('brand/brand.gif') %>");
return data;
});
}]);
App.factory('HttpSpinnerInterceptor', function ($q, $window) {
return function (promise) {
return promise.then(function (response) {
angular.element('.brand img').attr("src","<%= asset_path('brand/brand.png') %>");
return response;
}, function (response) {
angular.element('.brand img').attr("src","<%= asset_path('brand/brand.png') %>");
return $q.reject(response);
});
};
});
Run Code Online (Sandbox Code Playgroud)
我完全没有理解,除了一些猜测,它拦截了一些响应并注入了图像的src属性.
我不明白HttpSpinnerInterceptor是如何以及何时被调用的以及"promise"参数是什么.
我可以在一个指令中查看一个对象的属性(实际上是clientHeight).但是如何根据这个高度更改其他对象的填充顶部?我知道如何使用jQuery,但我正在寻找一种Angular方式.
在Angular中,可以使用指令访问某些页面元素.好的,但是如何访问同一指令中的其他页面元素?
在这种情况下,我无法将元素状态设置为可见:
<html>
<head>
<style type="text/css">
#elem {display:none}
</style>
</head>
<body>
<div id="elem">.......</div>
<script type="text/javascript">
document.getElementById("elem").style.display="";
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
仅当我将显示设置为“阻止”时它才起作用。
在这种情况下它有效:
<html>
<head>
</head>
<body>
<div id="elem" style="display:none">.......</div>
<script type="text/javascript">
document.getElementById("elem").style.display="";
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我的兴趣是让它在第一种情况下工作而不设置“阻止”。
我无法影响协议的网站向我发送 POST 请求,其中多个参数具有相同的名称“t”。
这是我的request.raw_post:
--===13978193024621189109088990673===
Content-Disposition: form-data; name="t"
Content-Type: text/plain; charset=UTF-8
thevalue1
--===13978193024621189109088990673===
Content-Disposition: form-data; name="t"
Content-Type: text/plain; charset=UTF-8
thevalue2
--===13978193024621189109088990673===
Content-Disposition: form-data; name="t"
Content-Type: text/plain; charset=UTF-8
thevalue3
--===13978193024621189109088990673===
Content-Disposition: form-data; name="t"
Content-Type: text/plain; charset=UTF-8
thevalue4
--===13978193024621189109088990673===
Content-Disposition: form-data; name="t"
Content-Type: text/plain; charset=UTF-8
thevalue5
--===13978193024621189109088990673===
Content-Disposition: form-data; name="t"
Content-Type: text/plain; charset=UTF-8
thevalue6
Run Code Online (Sandbox Code Playgroud)
标准params集合只列出最后一个参数。
如何获取所有值?
重现此请求的方法是:
<form action="/updateinfo" method="post" enctype="multipart/form-data">
<input type="text" name="t" value="thevalue1"><br>
<input type="text" name="t" value="thevalue2"><br>
<input type="text" name="t" value="thevalue3"><br>
<input type="text" name="t" value="thevalue4"><br>
<input …Run Code Online (Sandbox Code Playgroud) 我知道可以使用silencergem为整个控制器抑制 Rails 日志记录。但是可以通过将某些 ActiveRecord 请求的 SQL 输出包装到某些语句中来单独抑制它吗?
angularjs ×2
activerecord ×1
confirmation ×1
css ×1
delphi ×1
devise ×1
events ×1
gdi+ ×1
html ×1
http-post ×1
httpresponse ×1
interceptor ×1
javascript ×1
jquery ×1
logging ×1
parameters ×1
parsing ×1
promise ×1
resize ×1
rubygems ×1
rubymine-7 ×1
teechart ×1
vagrant ×1
validation ×1