[OpenAjaxIDE] Multiselect properties - must have datatype of array

Aaron Reed aaronr at us.ibm.com
Thu Aug 7 11:41:00 PDT 2008


I'm sorry, I probably didn't explain myself well.  I didn't mean that the
usage scenario was a 'special case', I meant that the example markup that
Jon suggested to use to express it felt (to me) very 'special case' -> an
attribute that  that seemed to only apply to datatype Number and when the
attribute is set the values in the options would have to be power of two.
So I was trying to encourage a more generalized feel that could be applied
to other datatypes and other use cases.  Afterall, if we are going to ask
the implementations to actually process the data prior to setting the
value, we should make it apply as broadly as possible.

Just brainstorming here, but perhaps instead of @format, maybe have
@operator where &, &&, |, ||, ^,+, * are the possible values.  Of course,
not all of these make sense in all datatypes so there would probably have
to be some kind of matrix of which operators apply to which datatypes and
what the expected processing would be.

--Aaron
IBM Corporation
Internal Zip: 9022D016
11501 Burnet Road
Austin, TX 78758
(512)838-9948
inet: aaronr at us.ibm.com
  _
 (} @
 |=     Volleyball Rules!!!
/\




                                                                           
             Bertrand Le Roy                                               
             <Bertrand.Le.Roy@                                             
             microsoft.com>                                             To 
                                       Jon Ferraiolo/Menlo Park/IBM at IBMUS, 
             08/07/2008 12:21          Aaron Reed/Austin/IBM at IBMUS         
             PM                                                         cc 
                                       "ide at openajax.org"                  
                                       <ide at openajax.org>                  
                                                                   Subject 
                                       RE: [OpenAjaxIDE] Multiselect       
                                       properties - must have datatype  of 
                                       array                               
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




It may be a special case to you, but it’s the general case to us. Actually,
most languages implement enums and flags exactly that way.

The additive process you describe doesn’t work because there may be values
that are predefined combinations of simple values (in, out, inOut).

So far, the metadata specification has done great efforts never to impose
any patterns on library implementations beyond obvious bad practice. It
seems like here the specification would at least favor (and probably
impose) an implementation pattern.

I reiterate my question: apart from us, who else is using enums and flags,
and what is the pattern they are applying?

Bertrand

From: ide-bounces at openajax.org [mailto:ide-bounces at openajax.org] On Behalf
Of Jon Ferraiolo
Sent: Thursday, August 07, 2008 10:13 AM
To: Aaron Reed
Cc: ide at openajax.org
Subject: Re: [OpenAjaxIDE] Multiselect properties - must have datatype of
array



Hi Aaron,
I like this approach much better than format="bitfield"

Jon


Inactive hide details for Aaron Reed/Austin/IBMAaron Reed/Austin/IBM



                                                                           
 Aaron Reed/Austin/IBM                                                     
                                                                           
                                                                           
 08/07/2008 10:04 AM                                                       
                                                                        To 
                                                                           
                                  Jon Ferraiolo/Menlo Park/IBM at IBMUS       
                                                                           
                                                                        cc 
                                                                           
                                  "ide at openajax.org" <ide at openajax.org>,   
                                  ide-bounces at openajax.org, Wayne          
                                  Vicknair/Austin/IBM at ibmus                
                                                                           
                                                                   Subject 
                                                                           
                                  Re: [OpenAjaxIDE] Multiselect properties 
                                  - must have datatype of arrayJon         
                                  Ferraiolo                                
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




@format="bitwise" has a very 'special case' feel to it. Why not just say
that if the datatype is an array, then the selected options will be
returned in an array and that if the datatype is not an array, then the
values will go through an additive process (if appropriate) based on the
datatype. For example, string values would be concatenated (in document
order, values separated by a single space), arrays could be merged into a
single array and number values would be added (author could certainly
choose to make the values 'unique powers of 2' to cover the bitflag
scenario). Even if the other examples I noted aren't found to be useful,
I'd think the additive capability with multiply selectable numbers could be
useful beyond the world of bit flags.

--Aaron
IBM Corporation
Internal Zip: 9022D016
11501 Burnet Road
Austin, TX 78758
(512)838-9948
inet: aaronr at us.ibm.com
_
(} @
|= Volleyball Rules!!!
/\


Inactive hide details for Jon Ferraiolo/Menlo Park/IBM at IBMUSJon
Ferraiolo/Menlo Park/IBM at IBMUS



                                                                           
                         Jon                                               
                         Ferraiolo/M                                       
                         enlo                                              
                         Park/IBM at IB                                       
                         MUS                                            To 
                         Sent by:                                          
                         ide-bounces          Wayne                        
                         @openajax.o          Vicknair/Austin/IBM at IBMUS    
                         rg                                                
                                                                        cc 
                                                                           
                         08/07/2008           "ide at openajax.org"           
                         10:49 AM             <ide at openajax.org>           
                                                                           
                                                                   Subject 
                                                                           
                                              Re: [OpenAjaxIDE]            
                                              Multiselect properties -     
                                              must have datatype of array  
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           





There are lots of ways to address this requirement. Here are two that come
to mind:

Option 1: Do nothing special in the metadata spec to address Bertrand's
performance concern. Microsoft's property manager logic would recognize
that it is working with its own widgets somehow and provide a more
efficient code path that uses bitfields instead of arrays. (Bertrand would
have to say whether this option is feasible for MS's products)

Option 2: Add a new 'bitfield' type for the 'format' attribute, so you
would have <options datatype="Number" format="bitfield">. We explain that
if format="bitfield", then the 'value' attributes on the <option> element
must be unique powers of 2, such as <option value="1">, <option value="2">,
<option value="4">, etc, and require that tools save a Number (more
specifically, an integer) into the property storage system.

There are other options. I'm willing to go along with most everything so
long as we make a reasonable attempt to avoid unnecessary vendor-specific
features.

Jon


Inactive hide details for Wayne Vicknair/Austin/IBMWayne
Vicknair/Austin/IBM


                                                                           
            Wayne Vicknair/Austin/IBM                                      
                                                                           
                                                                           
            08/07/2008 07:56 AM                                            
                                                                        To 
                                                                           
                                              Bertrand Le Roy              
                                              <Bertrand.Le.Roy at microsoft.c 
                                              om>                          
                                                                           
                                                                        cc 
                                                                           
                                              "ide at openajax.org"           
                                              <ide at openajax.org>,          
                                              ide-bounces at openajax.org,    
                                              Jon Ferraiolo/Menlo          
                                              Park/IBM at IBMUS               
                                                                           
                                                                   Subject 
                                                                           
                                              Re: [OpenAjaxIDE]            
                                              Multiselect properties -     
                                              must have datatype of array  
                                              Jon Ferraiolo                
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




I believe that the <options> and <option> element combination do indeed
express a constrained, multiple-value parameter. HTML DOM and Dojo's
dijit.form.MultiSelect both happen to implement that concept with an,
admittedly inefficient, array return value. That implementation does not
diminish the expressiveness of the <options> construct. An implementation
could choose to iterate over the array values converting them to numbers
and bitwise or-ing them together.

Cheers,
Wayne
Wayne E. Vicknair
Consulting Product Design Professional
IBM SWG Emerging Internet Technologies
Office: 512.838.0707 Email: waynev at us.ibm.com


Inactive hide details for Bertrand Le Roy ---08/06/2008 07:59:54 PM---Same
thing that happens in C. Never been a problem as youBertrand Le Roy
---08/06/2008 07:59:54 PM---Same thing that happens in C. Never been a
problem as you rarely have the many flag values. Storing a list of
countries or stat


                                                                           
    Bertrand Le Roy                                                        
    <Bertrand.Le.Roy at microsoft.com>                                        
    Sent by: ide-bounces at openajax.org                                      
                                                                           
                                                                        To 
    08/06/08 07:50 PM                                                      
                                                      Jon Ferraiolo/Menlo  
                                                      Park/IBM at IBMUS       
                                                                           
                                                                        cc 
                                                                           
                                                      "ide at openajax.org"   
                                                      <ide at openajax.org>   
                                                                           
                                                                   Subject 
                                                                           
                                                      Re: [OpenAjaxIDE]    
                                                      Multiselect          
                                                      properties - must    
                                                      have datatype of     
                                                      array                
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           





Same thing that happens in C. Never been a problem as you rarely have the
many flag values. Storing a list of countries or states would be more
efficiently stored in more elaborate data structures. The use we have of
flags is typically stuff like read/write/readwrite or left, right, top,
bottom and combinations. You get the idea. Bit structures are way more
efficient for this type of situation.
Sure, HTML options are different but I’m not sure I see your point.
Anyway, that’s the design we have in our APIs and it would be nice if it
was possible to express it.

From: Jon Ferraiolo [mailto:jferrai at us.ibm.com.]
Sent:: Wednesday, August 06, 2008 5:32 PM
To: Bertrand Le Roy
Cc: ide at openajax.org
Subject: RE: [OpenAjaxIDE] Multiselect properties - must have datatype of
array


What happens if you are doing multi-select with more than (4bytes) 32
alternatives (e.g., # states in US) or more than (8bytes) 64 alternatives
(e.g., # countries in the world)?

HTML's OPTION element doesn't require the use of bit flags (i.e., values
which are powers of 2), and that's what our <option> element will be mapped
into for a large number of cases.


Inactive hide details for Bertrand Le Roy <Bertrand.Le.Roy at microsoft.com>
Bertrand Le Roy <Bertrand.Le.Roy at microsoft.com>


Options are for enums, right? If so, that is completely different from our
usage. Multiple value enums (or flags) have integer values (like in C) and
are combined through the | or operator. Testing for a specific value is
done with the & and operator.
So for example, you’d have:
<property name="FavoriteAnimals">
__<options multiple="true">
____<option value="1"><label locid="animal_panda">Panda</label></option>
____<option value="2"><label locid="animal_tiger">Tiger</label></option>
____<option value="4"><label locid="animal_cat">House cat</label></option>
____<option value="8"><label locid="animal_dog">Man's best
friend</label></option>
__</options>
</property>

And if the user picks Tiger and House Cat, that gives 6.

From: ide-bounces at openajax.org [mailto:ide-bounces at openajax.org.] On Behalf
Of Jon Ferraiolo
Sent: Wednesday, August 06, 2008 10:14 AM
To: ide at openajax.org
Subject: [OpenAjaxIDE] Multiselect properties - must have datatype of array


Aaron Reed of IBM is implementing the <property><options multiple="true">
feature in the open source reference implementation and the question can up
about how to represent the multiple choices when the property value is
persisted into the property storage area. Here is an example:

<property name="FavoriteAnimals">
__<options multiple="true">
____<option value="panda"><label
locid="animal_panda">Panda</label></option>
____<option value="tiger"><label
locid="animal_tiger">Tiger</label></option>
____<option value="cat"><label locid="animal_cat">House
cat</label></option>
____<option value="dog"><label locid="animal_dog">Man's best
friend</label></option>
__</options>
</property>

Let's suppose the user picked "Tiger" and "House cat".

Given that we are focused on JavaScript, our proposal is that the natural
way to store a multi-select option would be as a JavaScript array. In this
case, the array would be ["tiger","cat"].

Does this make sense to people?

If so, then should we change the spec to say that if a <property> uses
<options> with multiple="true", then the <property> element must have
datatype="[]".

A follow on question is whether we should require an array of Strings, or
is it OK to have an array of anything, such as Number? Is the array could
contain things other than String, then implementations would need to a
string-to-whatever conversion at some point (e.g., string-to-number). I
would thing that array-of-Strings is the way to go.

Jon _______________________________________________
IDE mailing list
IDE at openajax.org
http://openajax.org/mailman/listinfo/ide
_______________________________________________
IDE mailing list
IDE at openajax.org
http://openajax.org/mailman/listinfo/ide

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openajax.org/pipermail/ide/attachments/20080807/32118670/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
Url : http://openajax.org/pipermail/ide/attachments/20080807/32118670/attachment-0007.gif 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic09667.gif
Type: image/gif
Size: 1255 bytes
Desc: not available
Url : http://openajax.org/pipermail/ide/attachments/20080807/32118670/attachment-0008.gif 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecblank.gif
Type: image/gif
Size: 45 bytes
Desc: not available
Url : http://openajax.org/pipermail/ide/attachments/20080807/32118670/attachment-0009.gif 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 28485138.gif
Type: image/gif
Size: 149 bytes
Desc: not available
Url : http://openajax.org/pipermail/ide/attachments/20080807/32118670/attachment-0010.gif 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 28995278.gif
Type: image/gif
Size: 2342 bytes
Desc: not available
Url : http://openajax.org/pipermail/ide/attachments/20080807/32118670/attachment-0011.gif 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 28277459.gif
Type: image/gif
Size: 960 bytes
Desc: not available
Url : http://openajax.org/pipermail/ide/attachments/20080807/32118670/attachment-0012.gif 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 28956567.gif
Type: image/gif
Size: 1255 bytes
Desc: not available
Url : http://openajax.org/pipermail/ide/attachments/20080807/32118670/attachment-0013.gif 


More information about the IDE mailing list