Hopbot log for 2007-08-14 - Helma IRC channel: #helma on irc.freenode.net

2007-08-14:

[9:26] <mho_> hey guy's, do any body know how i change the type from ah request string "-2" into a variable from type Number?
[9:27] <zumbrunn> new Number("-2") should work
[9:27] <zumbrunn> or "-2"-0
[9:28] <zumbrunn> or "-2"+0 etc
[9:28] <mho_> thx!
[9:28] <mho_> youre my hero ;)
[11:51] <jsp> with time zones I'm not sure how long ago this discussion was, but "-2"+0 == "-20", not -2. You want an unambiguous operator, i.e., one that can't apply to strings, when you're forcing type conversions. So "-2"-0 works, but I prefer 1*"-2", b/c I think putting the number first makes it read more clearly as a type conversion. Analogous to the way you'd write ""+37 to convert to a string (or at least I would--maybe you'd write 37+"" :-
[11:52] <jsp> (ah, 'twas 2.5 hours ago. better late than never.)
[13:18] <mho_> thx, var lTemp = Number("-2") works fine
[13:19] <mho_> var lTemp = Number(req.data.numberAsString);
[13:23] <zumbrunn> be careful... calling constructors without the "new" keyword can get messy
[13:23] <zumbrunn> I wouldn't get used to doing that
[13:23] <mho_> when im typin new Number it doesen't work... strange...
[13:24] <zumbrunn> var lTemp = new Number(req.data.numberAsString); doesn't work?
[13:34] <mho_> i use a switch()
[13:35] <mho_> and switch(lTemp) case -2 doenst work
[13:35] <mho_> without new it works
[13:35] <mho_> i dont understand ;)
[13:35] <zumbrunn> scary
[13:36] <jsp> can you post the code in the pastebin? that shouldn't be happening and almost certainly indicates an error in your code or a bug
[13:37] <mho_> the code that works or that dont work?
[13:37] <jsp> that doesn't
[13:38] <mho_> k, where i should post?
[13:38] <zumbrunn> http://helma.pastebin.com/
[13:39] <mho_> uuuh i forgot somthing
[13:39] <mho_> var lRegStatus = (req.data.regStatus && session.user.regStatus == -8) ? new Number(req.data.regStatus) : session.user.regStatus; --> doenst work
[13:39] <mho_> var lRegStatus = (req.data.regStatus && session.user.regStatus == -8) ? Number(req.data.regStatus) : session.user.regStatus;
[13:39] <mho_> work!
[13:41] <zumbrunn> try (new Number(req.data.regStatus))
[13:41] <zumbrunn> wrapped in ()
[13:43] <jsp> yup
[13:45] <jsp> ternary operator often binds counter-intuitively.
[13:46] <mho_> okey ill try
[13:48] <mho_> yeah it works! thx!
[18:44] <rjb> where/how is Object.dontEnum() implemented?
[18:45] <jsp> Java
[18:45] <zumbrunn> it's in the Helma core
[18:46] <zumbrunn> (not in Rhino and not in the javascript libs)
[18:48] <rjb> ok, thx
[21:42] <jsp> looks like cron jobs disappear when the app restarts?
[23:37] <ismith> halo
[23:44] <jsp> hi

 

 

In the channel now:

Logs by date: