草庐IT

time-grunt

全部标签

asp.net - 为什么 Time.strptime() 返回当前日期?

向私有(private)(无公开文档)API发出GET请求会返回JSON格式的数据。我感兴趣的值是日期。它以ASP.NETJSON日期格式返回日期。这是它的样子:AanmeldDatum:"/Date(1406675114000+0200)/"还有另一个名为AangebodenSindsTekst的变量,表示OfferedSinceText,其值为“8augustus2014”。因此,应该将未知的日期格式解析为该特定值。我已经试过了:require'time'foo=Time.strptime('1406675114000+0200','%N')#=>2014-08-1213:38:4

ruby-on-rails - TinyTds 错误 : Adaptive Server connection timed out

我们正在使用当前的tinyTDSgem0.6.2在rails3.2.12(ruby1.9.3)上运行ruby​​onrails应用程序。我们使用MSSQL2012或2014并面临比平常更多的以下错误消息:TinyTds::Error:AdaptiveServerconnectiontimedout:EXECsp_executesql[...]数据库自动关闭已关闭。TCP套接字超时是默认的Windows系统。应用程序服务器在机器#1(windowsserver)上,SQL服务器在机器#2(windowsserver)上。当我检查连接(netstat)时,我为大约20-30个用户打开了大约

ruby-on-rails - ActiveRecord::Migration.say_with_time() 做

当我们应该在种子文件中使用它时。在rails框架事件记录中。ActiveRecord::Migration.say_with_time()do 最佳答案 此方法获取一个block并对其进行基准测试。打印出花费的时间和受影响的行数。例如来自文档:say_with_time"Revertingallserviceratestonil."doService.update_all(:rate,nil)end#Output--Revertingallserviceratestonil.->0.3451s->2233rows

ruby-on-rails - Google Cloud Ruby : Error Response: [13] Timed out when starting VMs. 应用程序代码可能不健康。

我有一个Rails应用程序正在尝试部署到谷歌云平台。它到达某个点然后超时。我运行了几次,但每次都出现相同的错误。Thepushreferstoarepository[us.gcr.io/site-1286/appengine/default.20160504t151124](len:1)a12739e07554:Preparinga12739e07554:Pushinga12739e07554:Pushed6caf2d2e404b:Preparing6caf2d2e404b:Pushing6caf2d2e404b:Pushed9ae35a0da566:Preparing9ae35a0d

ruby-on-rails - Ruby:将 "US/Eastern"时区名称转换为 "Central Time (US & Canada)"

我有一个旧数据库,时区格式如下:US/EasternAustralia/Melbourne在我的新Rails应用程序中,我将它们保存为:EasternTime(US&Canada)Melbourne如何将旧的转换为新的?我一直在摆弄ActiveSupport::TimeZone,但无法找出从一个到另一个的正确组合。我希望我可以创建一个新对象,然后返回新格式化的名称,但它只返回我给它的名称。示例:>tz=ActiveSupport::TimeZone.new("US/Eastern")=>(GMT-05:00)US/Eastern>tz.name=>"US/Eastern"提前致谢!

ruby - 如何告诉 grunt 在本地 node_modules 中寻找模块?

我尝试运行compass任务:»gruntcompass:distRunning"compass:dist"(compass)taskrbenv:compass:commandnotfoundThe`compass'commandexistsintheseRubyversions:1.9.3-p448Warning:YouneedtohaveRubyandCompassinstalledandinyoursystemPATHforthistasktowork.Moreinfo:https://github.com/gruntjs/grunt-contrib-compassUse--fo

ruby - 这看起来像 ruby​​ Time equality bug 吗?

为什么第二次比较中的false?我没有加载任何库。putsRUBY_DESCRIPTIONt=Time.nowt1=Time.at(t.to_f)t2=Time.at(t.to_f)puts(t1==t2)puts(t==t1)puts(t.to_f==t1.to_f)printf"%.64f\n%.64f\n%.64f\n",t,t1,t2输出:ruby1.9.3p194(2012-04-20revision35410)[x86_64-darwin11.4.0]truefalsetrue1347661545.43484401702880859375000000000000000000

ruby 鞋子 : counting the amount of times a value occurs in an Array

我正在使用Shoes在Ruby中制作Yahtzee游戏当我点击按钮“Two”时,代码应该计算值2出现在数组中。对于出现的值2的每个实例,分数增加2。此代码适用于特定数量的案例,但适用于其他情况,例如@array=[2,1,2,2,3]#数组中有三个2所以分数应该是6,但我的代码却返回4...为什么?button"twos"do@array.each_with_indexdo|value,index|if(@array[index]==2)@score=@score+2@points=@score+2end#ifend#loopend#button 最佳答案

ruby - Time.now 与从 Time.parse 或 Time.at 生成的时间不匹配

在测试一些Ruby代码时,我遇到了一些奇怪的行为。有人可以解释为什么Time.now与从Time.at创建的时间或从Time.parse解析的时间不匹配吗?[1]pry(main)>require'time'=>true[2]pry(main)>t=Time.now=>2013-04-0419:46:49-0400[3]pry(main)>i=Time.att.to_i=>2013-04-0419:46:49-0400[4]pry(main)>t==i=>false[5]pry(main)>t.to_i==i.to_i=>true[6]pry(main)>p=Time.parset.t

ruby - Ruby Time 中纳秒级组件的精度

我有一个以毫秒为单位的持续时间,420.854(420秒和854毫秒)。我想将其格式化为(分钟):(秒)。(毫秒)所以我尝试了这个:Time.at(421.854).utc.strftime('%M:%S.%L')结果:"07:01.853"如您所见,它偏移了一毫秒。所以我进一步研究:Time.at(421.854).nsec#Output:853999999(expected854000000)我相信上面的意外输出是问题的原因。有些数字按预期工作,例如:Time.at(421.855).nsec#Output855000000asexpected有没有人对解决这个问题有任何建议,我能