Re: [rkward-devel] Plugin development: New JS-functions getString()/getBoolean()/getList()

2013-02-26 Thread Thomas Friedrichsmeier
Hi,

On Monday 25 February 2013, meik michalke wrote:
 but i was wondering if there's already an nice way to turn the columnwise
 approach into rowwise results? i've just implemented my first optionset in
 the skeleton plugin of rkwarddev (only in the script version, as of now,
 i'm just testing), and noticed i'd rather have the values row by row. if
 there's nothing yet, i'll maybe try to add some function to rkwarddev that
 takes a full optionset and turns its values into a data.frame. or
 something similar...

it's all column-based, so far, as that turned out to be the only sane way to 
organize the data, internally. But when accessing the data from JS, row-based 
access may make a lot of sense, in many cases, and beyond rkwarddev.

Consider whether (some of) this can be implemented in plain JS. In theory we 
can include simple and useful JS functionality in common.js (which is included 
in all plugins). I'm not quite sure what exactly should go in there, and so 
I've been rather reluctant about adding anything, there, but it's an option to 
keep in mind. (Or we could provide JS libraries for plugins to include, 
manually).

BTW, my own experience with using optionsets is not exactly extensive, either. 
I've only created a single real optionset myself so far (Data-Sort data; if 
you are mostly interested in the xml-side of things, there are some more 
examples in under_development.pluginmap, though: Analysis-Optionset test).

Regards
Thomas


signature.asc
Description: This is a digitally signed message part.
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb___
RKWard-devel mailing list
RKWard-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rkward-devel


Re: [rkward-devel] Plugin development: New JS-functions getString()/getBoolean()/getList()

2013-02-26 Thread meik michalke
hi,

Am Dienstag, 26. Februar 2013, 13:26:06 schrieb Thomas Friedrichsmeier:
 Consider whether (some of) this can be implemented in plain JS.

it would all need to be plain JS anyway, as it would have to work in a plugin
in the end ;-) any rkwarddev solution would actually only generate JS code
(like rk.JS.options(), for example).

i need some time to come up with a solution. in my case,

col1  col2  col3
  1  x y z
  2  a   c

needs to come out as

  list(
c(col1=x, col2=y, col3=z),
c(col1=a, col3=c)
  )

i'm not sure yet this can be done with static JS code and still be flexible
enough to take any number of columns, without a generator function producing
the JS code.

 BTW, my own experience with using optionsets is not exactly extensive,
 either.

well, it's fun to have something new to play with ;-)


viele grüße :: m.eik

--
dipl. psych. meik michalke
institut fur experimentelle psychologie
abt. fur diagnostik und differentielle psychologie
heinrich-heine-universitat d-40204 dusseldorf

signature.asc
Description: This is a digitally signed message part.
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb___
RKWard-devel mailing list
RKWard-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rkward-devel


Re: [rkward-devel] Plugin development: New JS-functions getString()/getBoolean()/getList()

2013-02-25 Thread meik michalke
hi,

Am Dienstag, 4. Dezember 2012, 19:11:49 schrieb Thomas Friedrichsmeier:
 - getList()
 getList() is an entirely new function, which will return an Array of
 strings  (if possible). There are only a few use-cases of this, so far. The
 first is getting a list of objects from varslots with multi=true.
 Another is the fetching columns from the new matrix-element, that is new
 in the development version. A third is the new optionset-element, which I
 will write about, soon. The advantages of getList() over using getValue()
 (or getString()), and then splitting by newlines, should be obvious.

i've managed to get to the point where rkwarddev detects optionsets and
automatically adds JavaScript variables for each optionscolumn accordingly. i
also just added some more magic to be able to .join() the arrays into
something useful, by the new function join().

but i was wondering if there's already an nice way to turn the columnwise
approach into rowwise results? i've just implemented my first optionset in the
skeleton plugin of rkwarddev (only in the script version, as of now, i'm just
testing), and noticed i'd rather have the values row by row. if there's
nothing yet, i'll maybe try to add some function to rkwarddev that takes a
full optionset and turns its values into a data.frame. or something similar...


viele grüße :: m.eik

--
dipl. psych. meik michalke
institut fur experimentelle psychologie
abt. fur diagnostik und differentielle psychologie
heinrich-heine-universitat d-40204 dusseldorf

signature.asc
Description: This is a digitally signed message part.
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb___
RKWard-devel mailing list
RKWard-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rkward-devel


[rkward-devel] Plugin development: New JS-functions getString()/getBoolean()/getList()

2012-12-04 Thread Thomas Friedrichsmeier
Hi!

I just wanted to let you know about three new functions for use in plugins' JS 
code (both code generation and gui scripting). These are replacements for the 
old getValue()-call.

Don't worry: getValue() is not going away. But for new plugins, or when 
reworking existing plugins, you should use these, instead.

- First things first: What's wrong with getValue()?
Not much. But this does have a certain peculiarity: getValue() will always 
return the value as a string, *except* when the value to get is 0, it will 
return numeric 0, instead of a string(*). This was a hack to keep plugins 
working after the conversion from PHP(*) However, this can cause problems in a 
corner case: In a free-field input, the user might want to enter 0. This 
can cause the plugin to bail out with an error, if it tries to use string 
methods on the value (e.g. replace()).

- getString() and getBoolean()
getString() is almost identical to getValue(), and in fact it is the function 
you will use most often. The only difference is that it will always return a 
string, even if that is 0. For use in if()-switches or other logic, there is 
now a new function getBoolean(). This will try hard to convert the value in 
question to a logical, even handling the strings true and false.

Of course getBoolean() can't do magic, but in contrast to getValue(), if 
getBoolean() cannot meaningfully convert a value to a logical, it will produce 
a warning. Speaking of which: There is a new tool window to view RKWard 
internal debug messages. Activate it from the Windows-menu, or by right-
clicking on one of the tool docks. Use it to check your plugins for problems!

- getList()
getList() is an entirely new function, which will return an Array of strings 
(if possible). There are only a few use-cases of this, so far. The first is 
getting a list of objects from varslots with multi=true. Another is the 
fetching columns from the new matrix-element, that is new in the development 
version. A third is the new optionset-element, which I will write about, 
soon. The advantages of getList() over using getValue() (or getString()), and 
then splitting by newlines, should be obvious.

Backwards compatibility note: getString() was added in RKWard 0.6.0, already. 
getBoolean() and getList() are available in the development version, only.

Regards
Thomas



(*): In PHP,
   if (0) echo (yes);
will not generate anything (0 evaluates to false). In JS,
   if (0) echo (yes);
will generate yes (0 evaluates to true). Returning 0 as a numeric value 
kept plugins working after the conversion from PHP. And in most - but not all 
- cases, JS is smart enough to convert the numeric representation back to a 
string, if needed.


signature.asc
Description: This is a digitally signed message part.
--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d___
RKWard-devel mailing list
RKWard-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rkward-devel