I'm using a template that I bought and I'm having this issue:
Uncaught TypeError: Object #<Object> has no method 'peity' in unicorn.dashboard.js:11
and this is line 11:
unicorn.peity();
On my manifest file I got this:
//= require admins/cms/excanvas.min
//= require admins/cms/jquery.min
//= require admins/cms/jquery.ui.custom
//= require admins/cms/jquery.uniform
//= require admins/cms/jquery.flot.min
//= require admins/cms/jquery.flot.resize.min
//= require admins/cms/jquery.dataTables.min
//= require admins/cms/jquery.gritter.min
//= require admins/cms/jquery.validate
//= require admins/cms/jquery.peity
//= require admins/cms/jquery.wizard
//= require admins/cms/select2.min
//= require admins/cms/fullcalendar.min
//= require admins/cms/bootstrap.min
//= require admins/cms/bootstrap-colorpicker
//= require admins/cms/bootstrap-datepicker
//= require admins/cms/unicorn
//= require admins/cms/unicorn.dashboard
//= require admins/cms/unicorn.form_common
//= require admins/cms/unicorn.form_validation
//= require admins/cms/unicorn.wizard
//= require admins/cms/unicorn.interface
//= require admins/cms/unicorn.tables
//= require admins/cms/unicorn.charts
//= require admins/cms/unicorn.calendar
This is how the scripts are loaded in the static index.html that came with the template:
<script src="js/jquery.min.js"></script>
<script src="js/jquery.ui.custom.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrap-colorpicker.js"></script>
<script src="js/bootstrap-datepicker.js"></script>
<script src="js/jquery.uniform.js"></script>
<script src="js/select2.min.js"></script>
<script src="js/unicorn.js"></script>
<script src="js/unicorn.form_common.js"></script>
And this is how my dashboard index scripts are loaded:
<script src="/assets/admins/cms/excanvas.min.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/jquery.min.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/jquery.ui.custom.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/jquery.uniform.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/jquery.flot.min.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/jquery.flot.resize.min.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/jquery.dataTables.min.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/jquery.gritter.min.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/jquery.validate.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/jquery.peity.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/jquery.wizard.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/select2.min.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/fullcalendar.min.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/bootstrap.min.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/bootstrap-colorpicker.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/bootstrap-datepicker.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/unicorn.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/unicorn.dashboard.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/unicorn.form_common.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/unicorn.form_validation.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/unicorn.wizard.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/unicorn.interface.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/unicorn.tables.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/unicorn.charts.js?body=1" type="text/javascript"></script>
<script src="/assets/admins/cms/unicorn.calendar.js?body=1" type="text/javascript"></script>
The weird thing is that unicorn.dashboard is getting loaded after jquery.peity. Another extrange thing is that when I open the index.html that came with the template it doesn't get this error at all. I'm not sure what the problem could be. I been trying for hours to figure this out but I had no luck at all.
It would be so helpful if someone could help me out with this. Thanks in advance.
I'm not sure whether this will help clarify things, because I'm not sure what you consider to be the problem.
Here is a test program that uses BigDecimal, as previously suggested, to display the values of the intermediate answers. At the final step, adding the third copy of 1.0/3 to the sum of two copies, the exact answer is half way between 1.0 and the next double lower than it. In that situation the round-to-even rounding rule picks 1.0.
Given that, I think it should round to 1.0, contradicting the question title.
Test program:
import java.math.BigDecimal;
public class Test {
public static void main(String[] args) {
final double oneThirdD = 1.0/3;
final BigDecimal oneThirdBD = new BigDecimal(oneThirdD);
final double twoThirdsD = oneThirdD + oneThirdD;
final BigDecimal twoThirdsBD = new BigDecimal(twoThirdsD);
final BigDecimal exact = twoThirdsBD.add(oneThirdBD);
final double nextLowerD = Math.nextAfter(1.0, 0);
final BigDecimal nextLowerBD = new BigDecimal(nextLowerD);
System.out.println("1.0/3: "+oneThirdBD);
System.out.println("1.0/3+1.0/3: "+twoThirdsBD);
System.out.println("Exact sum: "+exact);
System.out.println("Rounding error rounding up to 1.0: "+BigDecimal.ONE.subtract(exact));
System.out.println("Largest double that is less than 1.0: "+nextLowerBD);
System.out.println("Rounding error rounding down to next lower double: "+exact.subtract(nextLowerBD));
}
}
Output:
1.0/3: 0.333333333333333314829616256247390992939472198486328125
1.0/3+1.0/3: 0.66666666666666662965923251249478198587894439697265625
Exact sum: 0.999999999999999944488848768742172978818416595458984375
Rounding error rounding up to 1.0: 5.5511151231257827021181583404541015625E-17
Largest double that is less than 1.0: 0.99999999999999988897769753748434595763683319091796875
Rounding error rounding down to next lower double: 5.5511151231257827021181583404541015625E-17