我有这个jquery代码:
$(document).ready(function(){
//global vars
var searchBoxes = $(".box");
var searchBox = $(".box");
var searchBoxDefault = "Search...";
searchBoxes.focus(function(e){
$(this).addClass("active");
$('#searchoptions').show();
});
searchBoxes.blur(function(e){
$(this).removeClass("active");
});
searchBox.focus(function(){
if($(this).attr("value") == searchBoxDefault) $(this).attr("value", "");
});
searchBox.blur(function(){
if($(this).attr("value") == "") $(this).attr("value", searchBoxDefault);
}); });
Run Code Online (Sandbox Code Playgroud)
和HTML代码:
<div id="search" class="right">
<form method="post" class="clearfix">
<input class="box left" type="text" value="Search..." />
<input class="button right" type="submit" value="" />
</form>
<div id="searchoptions">
Options:<br /><input checked="checked" type="radio"> Option1</label>
<input type="radio"> Option2</label>
<input type="radio"> Option3</label>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
问题是:当我在#search id之外点击时,如何隐藏#searchoptions?
我试着点击身体,但有虫子......并且没有完美运行......
在我的schedule.rb文件中,我有以下几行:
set :output, '/log/cron_log.log'
every 5.minutes do
command 'echo "hello"'
end
Run Code Online (Sandbox Code Playgroud)
我whenever -w按照Rails中的建议运行,在开发中使用gem时,我假设cronfile已编写并正在运行.(我也试过重启Rails服务器.)
当我跑步时,$ crontab -l我看到以下内容:
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /bin/bash
-l -c 'echo "hello" >> /log/cron_log.log 2>&1'
Run Code Online (Sandbox Code Playgroud)
但我找不到日志文件.我检查了rails_project/log,〜/ log和/ log无济于事.在OSX btw.
如何将日志文件写入rails项目日志文件夹?
如果我想添加一个列表,我可以这样做:
- List.foldr (fn (x, y) => x + y) 0 [1, 2, 3]
val it = 6 : int
Run Code Online (Sandbox Code Playgroud)
有没有办法写更多的东西:
List.foldr + 0 [1, 2, 3]
Run Code Online (Sandbox Code Playgroud)
我试过这样的事情:
fun inf2f op = fn (x, y) => x op y;
Run Code Online (Sandbox Code Playgroud) 数据库,用户名和密码组合肯定有效.grafana的以下配置不适用.
datasources: {
influxdb: {
type: 'influxdb',
url: "http://XXX.XXX.XXX.XX:8086/db/dbname",
username: 'username',
password: 'password',
default: true
},
},
Run Code Online (Sandbox Code Playgroud)
我已经尝试删除default参数,更改influxdb为influx,并附/series加到网址,一切都无济于事.有没有人得到这个工作?
对于流式http端点有没有办法避免发送长度?
w.Header().Set("Content-Type", "image/jpeg")
w.Header().Set("Transfer-Encoding", "chunked")
w.Header().Del("Content-Length")
Run Code Online (Sandbox Code Playgroud)
这是我回来的.
HTTP/1.1 200 OK
Content-Length: 0
Content-Type: image/jpeg
Date: Mon, 23 Jun 2014 10:00:59 GMT
Transfer-Encoding: chunked
Transfer-Encoding: chunked
Run Code Online (Sandbox Code Playgroud)
服务器也会打印警告.
2014/06/23 06:04:03 http: WriteHeader called with both Transfer-Encoding of "chunked" and a Content-Length of 0
Run Code Online (Sandbox Code Playgroud) 我似乎无法使用knex迁移数据库.在up命令中,它失败了.
knex.migrate.latest({}).finally(function () {
knex.destroy()
})
Run Code Online (Sandbox Code Playgroud)
我收到一个错误.
Possibly unhandled TypeError: undefined is not a function
at SchemaBuilder_PG.Target.then (cwd/node_modules/knex/lib/interface.js:25:10)
at SchemaBuilder_PG.Target.(anonymous function) [as bind] (cwd/node_modules/knex/lib/interface.js:71:21)
at Migrator_PG.<anonymous> (cwd/node_modules/knex/lib/migrate/index.js:93:6)
at Migrator_PG.<anonymous> (cwd/node_modules/knex/lib/migrate/index.js:138:15)
at Migrator_PG.Migrator._migrationData (cwd/node_modules/knex/lib/migrate/index.js:154:10)
at Migrator_PG.<anonymous> (cwd/node_modules/knex/lib/migrate/index.js:22:15)
From previous event:
at Function.Promise$All [as all] (cwd/node_modules/knex/node_modules/bluebird/js/main/promise.js:198:12)
at Migrator_PG.Migrator._migrationData (cwd/node_modules/knex/lib/migrate/index.js:152:18)
at Migrator_PG.<anonymous> (cwd/node_modules/knex/lib/migrate/index.js:22:15)
Run Code Online (Sandbox Code Playgroud)
我发誓昨天工作了.我尝试删除并重新创建数据库.没运气.怎么了?我怎样才能解决这个问题?
在knex来源中似乎没有任何明显的挖掘.
似乎支持 postgres 数组knex #226。是否有超越原始 sql 的迁移语法?该架构建筑文档不提它。
据推测,使用postgres 数组文档的原始 sql 数据类型是:
table.specificType('arrayfield', 'text[]')
Run Code Online (Sandbox Code Playgroud)
但是有没有类似的东西:
table.string('arrayfield').array()
Run Code Online (Sandbox Code Playgroud) 我想测试一个应用程序中的每个路由,并了解到我应该在集成测试中做到这一点:在轨道上测试Ruby中的路由
但是我收到以下错误:
NoMethodError: undefined method `authenticate?' for nil:NilClass
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/devise-2.1.2/lib/devise/rails/routes.rb:286:in `block in authenticated'
Run Code Online (Sandbox Code Playgroud)
在网上很好地提到你不能在集成测试中使用Devise :: TestHelpers - Devise Google Group, Devise Github page
如何测试以下路线?
# config/routes.rb
devise_for :users
authenticated :user do
root to: 'static#home'
end
root to: 'static#landing'
Run Code Online (Sandbox Code Playgroud)
我正在运行测试单元测试 $ rake test:integration
<table>
<tr>
<td>hello</td>
<td><img src="xyz.png" width="100" height="100"></td>
</tr>
</table>
tabledata.rows.each do |row|
row.cells.each do |cell|
puts cell.text
end
end
puts "end"
Run Code Online (Sandbox Code Playgroud)
得到输出 - >
hello
end
Run Code Online (Sandbox Code Playgroud)
我应该怎么做这样的输出 - >
hello
xyz.png
end
Run Code Online (Sandbox Code Playgroud)
没有使用Nokogiri.
假设我有一个 Stack 定义的开头,如下所示:
signature STACK = sig
type 'a stack
end;
structure Stack :> STACK = struct
type 'a stack = 'a list
end;
Run Code Online (Sandbox Code Playgroud)
显然这不起作用,因为我无法将列表转换为堆栈:
- [5] : int Stack.stack;
stdIn:1.2-1.23 Error: expression doesn't match constraint [tycon mismatch]
expression: int list
constraint: int Stack.stack
in expression:
5 :: nil: int Stack.stack
Run Code Online (Sandbox Code Playgroud)
这意味着如果我创建了一个 Stack.push 或 Stack.pop 函数,我就不能传入 int 列表,因为它需要一个堆栈。
希望我更多地了解标准机器学习来制定一个真正的问题,我只知道这行不通,我不确定如何处理签名和结构。