|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
glicko system, anyone heard of it....
well anyhow im using it in a project im doing to calculate points...
i got the equation down but i get a java.lang.String error. as i am guessing i think kitless will be the only one to answer this question ![]() here is my calculation code below. Code:
<cfset f = 0> <cfset p = 0> <cfset r1 = 0> <cfset r2 = 0> <cfset E = 0> <cfset q = 0> <cfset K = 0> <cfset RD_new = 0> <cfset RD = #unit_members_alias.RD#> <!--=========== BEGIN MATH ============--> <!-- /////// STEP 1 /////// Calculate the new RD value --> <cfset RD_new = Sqr(#RD# + 50)> <!-- /////// STEP 2 /////// Calculate attenuating factor --> <cfset p = (30 * 30)/((Pi() * Pi()) * (400 * 400))> <cfset f = 1/Sqr(1 + #p# * (#RD# * #RD#))> <!-- /////// STEP 3 /////// Calculate r1 and r2 --> <cfset r1 = #aliasdetails.RD#> <cfset r2 = #RD#> <cfset E = 1/(-(#r1# - #r2#) * (#f#/400))> <!-- /////// STEP 4 /////// Calculate K and q --> <cfset q = (50)/400> <cfset K = (#q# * #f#)/((1/(#RD# * #RD#)) + (#q# * #q#) * (#f# * #f#) * #E# * (1 - #E#))> <cfif #K# lt 16> <cfset K = 16> </cfif> <!-- /////// STEP 5 /////// Calculate new rating --> <cfset RD_new = 1/Sqr( (1/(#RD# * #RD#)) + (#q# * #q#) * (#f# * #f#) * #E# * (1 - #E#))> <!--=========== END MATH ============--> and my error which is really bugin me out.... You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members. |
|
#2
|
||||
|
||||
|
CF is really picky about variables. If you assign them a certain way, you have to keep them that way unless you convert them. This error has to do with that, and is pretty common. It would be nice if CF would give you something a little more logical, but that's the best that it can do, I guess.
Point out the line number where you're receiving the error and that will help, but it will definitely have to do with you trying to use a variable as an integer when it wants to be a string or array or fairy princess. |
|
#3
|
|||
|
|||
|
what is this variable?
#unit_members_alias.RD# |
|
#4
|
||||
|
||||
|
its this one: <cfset RD_new = Sqr(#RD# + 50)>
|
|
#5
|
|||
|
|||
|
You don't need all those pound signs...you only need pound signs when outputting a variable inside a cfoutput block...within function calls or sets you only need them if you are outputting them as a string (inside quote marks or something).
What line is the error happening at?
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#6
|
||||
|
||||
|
i said its happening when it does that sqare root equation.
|
|
#7
|
|||
|
|||
|
i guess i couldnt explain myself.
i am trying to run the code you posted to see where the errors are . so i asked you what are the values for #unit_members_alias.RD#, #aliasdetails.RD# ? a square root of a negative number is not defined unless you use complex numbers. so, cold fusion is going to give you an error every single time it sees something like SQR(-25) first make sure that <cfset RD_new = Sqr(#RD# + 50)> RD + 50 >= 0 |
|
#8
|
||||
|
||||
|
its not negative RD is suppost to be 1720 and and same thing for the other RD it could be that i have the columb set in the db as a memo columb maybe.....
|
|
#9
|
|||
|
|||
|
what does CF say? also, here
<cfset E = 1/(-(#r1# - #r2#) * (#f#/400))> this may produce a -E <cfset RD_new = 1/Sqr( (1/(RD * RD)) + (q * q) * (f * f) * E * (1 - E))> then you will run into SQR(-number) problem again. so you might consider taking absolute values of these numbers or use complex numbers square root -1 = i |
|
#10
|
||||
|
||||
|
it tells me that java error in my first post when it runs that cfset tag.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > glicko system, anyone heard of it.... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|