小编Spy*_*kis的帖子

GWT不加载*.nocache.js

我有一个使用gwt-maven-archetype构建的Maven项目.虽然它与mvn gwt:run目标运行完美,但是当我尝试在tomcat7容器中运行它时,mvn tomcat:run或者mvn gwt:compile && mvn tomcat:run它没有加载GWT动态创建的小部件.

根据谷歌Chrome控制台,它找不到该*.nocache.js文件,即使在/target/文件夹中它确切地位于预期的位置.

我目前正在尝试在入口点模块中显示一个简单的"Hello"标签:

GWT入口点

public class Hello implements EntryPoint {


    public void onModuleLoad() {    
        Label hello = new Label("TESTESTSTSTS");

        RootPanel.get("helloContainer").add(hello);

    }

}
Run Code Online (Sandbox Code Playgroud)

*.html的

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <link type="text/css" rel="stylesheet" href="veltisto.css">
    <title>Web Application Starter Project</title>
    <script type="text/javascript" language="javascript" src="veltisto/veltisto.nocache.js"></script>
  </head>
  <body>
    <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
    <noscript>
      <div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px …
Run Code Online (Sandbox Code Playgroud)

gwt maven tomcat7 gwt-maven-plugin

7
推荐指数
1
解决办法
6543
查看次数

如何防止Ruby钱浮点错误

我正在使用带有money-rails gem的Rails来处理钱列.

有没有办法防止出现浮点错误?(即使是黑客也会这样做,我只是想确保没有这样的错误呈现给最终用户)

Rspec示例案例:

  it "correctly manipulates simple money calculations" do
    # Money.infinite_precision = false or true i've tried both 
    start_val = Money.new("1000", "EUR")
    expect(start_val / 30 * 30).to eq start_val
  end
Run Code Online (Sandbox Code Playgroud)

结果

Failure/Error: expect(start_val / 30 * 30).to eq start_val

   expected: #<Money fractional:1000.0 currency:EUR>
        got: #<Money fractional:999.99999999999999999 currency:EUR>

   (compared using ==)

   Diff:
   @@ -1,2 +1,2 @@
   -#<Money fractional:1000.0 currency:EUR>
   +#<Money fractional:999.99999999999999999 currency:EUR>
Run Code Online (Sandbox Code Playgroud)

ruby currency ruby-on-rails money-rails

2
推荐指数
1
解决办法
693
查看次数