SIXX problem with decimalPoint and ScaledDecimal

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

SIXX problem with decimalPoint and ScaledDecimal

dario trussardi
Ciao,  

to conclude the problems i found with  SIXX porting  from Pharo to GLASS i have three questions:

A) the first is relative to Locale decimalPoint  

        In my GLASS environment it's $,

        but the Pharo Sixx  write the Number  element with $.


        Now my first solution is to change the Number method:

        createInstanceOf: aClass withSixxElement: sixxElement
        | x y |
        x:=  (SixxXmlUtil characterDataFrom: sixxElement).
        x:= x collect:[:d| d = $. ifTrue:[$,] ifFalse:[d]].
        y := x asNumber.
        ^ y

        where i change the $.  with $,

        But it's a valid solution  or ????


B) the second question is relative to SIXX ScaledDecimal porting

        Object readSixxFrom: '<sixx.object sixx.id="72" sixx.name="cllOrarioServizioSaturday" sixx.type="SortedCollection" >
                                                <sixx.object sixx.id="76" sixx.type="ScaledDecimal" >30.1</sixx.object>
                                                <sixx.object sixx.id="77" sixx.type="ScaledDecimal" >40</sixx.object>
                                                <sixx.object sixx.id="78" sixx.type="ScaledDecimal" >20</sixx.object>
                                                <sixx.object sixx.id="79" sixx.type="ScaledDecimal" >50</sixx.object>
                                </sixx.object>'

        When execute this code into GLASS the system answer aSortedCollection

        with  Integer or SmallDouble  but don't ScaledDecimal

        The same code into Pharo work fine  ( it's answer collection with aScaledDecimal instance )


C) the last question is relative to the aScaledDecimal asString

        if i defined the decimal it is right displayed

                (ScaledDecimal fromString: '123,12') asString   result '123,12'
       
        If the decimal it's not defined it report  a string with $, as last

        (ScaledDecimal fromString: '123') asString result '123,'

        I think the solution it's remove the last  $, in this case.


Sorry for my questions but if someone gives me some advice / solution I would be very happy.


        Thanks,

                Dario
       
Reply | Threaded
Open this post in threaded view
|

Re: SIXX problem with decimalPoint and ScaledDecimal

dario trussardi
Ciao,


> Ciao,  
>
> to conclude the problems i found with  SIXX porting  from Pharo to GLASS i have three questions:
>
> A) the first is relative to Locale decimalPoint  
>
> In my GLASS environment it's $,
>
> but the Pharo Sixx  write the Number  element with $.
>
>
> Now my first solution is to change the Number method:
>
> createInstanceOf: aClass withSixxElement: sixxElement
> | x y |
> x:=  (SixxXmlUtil characterDataFrom: sixxElement).
> x:= x collect:[:d| d = $. ifTrue:[$,] ifFalse:[d]].
> y := x asNumber.
> ^ y
>
> where i change the $.  with $,
>
> But it's a valid solution  or ????

About the question A :

        today i do some test in Pharo and i found some code into Kernel-Numbers don't reference the Locale decimalPoint .

        The same method decimalPoint is not defined.

        I port it from Gemstone for compatibility :

        decimalPoint
         " by DTR for compatibility with OODB"
         ^self current primDecimalSymbol

        The problem is into Pharo because the data relative to Number is generated / managed with fixed  $. and don't  with reference to Locale decimalPoint.

        I send e-mail about it to Pharo wiki to know some other consideration.

        Dario

>
>
> B) the second question is relative to SIXX ScaledDecimal porting
>
> Object readSixxFrom: '<sixx.object sixx.id="72" sixx.name="cllOrarioServizioSaturday" sixx.type="SortedCollection" >
> <sixx.object sixx.id="76" sixx.type="ScaledDecimal" >30.1</sixx.object>
> <sixx.object sixx.id="77" sixx.type="ScaledDecimal" >40</sixx.object>
> <sixx.object sixx.id="78" sixx.type="ScaledDecimal" >20</sixx.object>
> <sixx.object sixx.id="79" sixx.type="ScaledDecimal" >50</sixx.object>
> </sixx.object>'
>
> When execute this code into GLASS the system answer aSortedCollection
>
> with  Integer or SmallDouble  but don't ScaledDecimal
>
> The same code into Pharo work fine  ( it's answer collection with aScaledDecimal instance )
>
>
> C) the last question is relative to the aScaledDecimal asString
>
> if i defined the decimal it is right displayed
>
> (ScaledDecimal fromString: '123,12') asString   result '123,12'
>
> If the decimal it's not defined it report  a string with $, as last
>
> (ScaledDecimal fromString: '123') asString result '123,'
>
> I think the solution it's remove the last  $, in this case.
>
>
> Sorry for my questions but if someone gives me some advice / solution I would be very happy.
>
>
> Thanks,
>
> Dario
>

Reply | Threaded
Open this post in threaded view
|

Re: SIXX problem with decimalPoint and ScaledDecimal

Paul DeBruicker
In Pharo if you printIt:

Smalltalk listLoadedModules


in a workspace is the LocalePlugin in the list?



On 12/14/2012 09:21 AM, Dario Trussardi wrote:

> Ciao,
>
>
>> Ciao,  
>>
>> to conclude the problems i found with  SIXX porting  from Pharo to GLASS i have three questions:
>>
>> A) the first is relative to Locale decimalPoint  
>>
>> In my GLASS environment it's $,
>>
>> but the Pharo Sixx  write the Number  element with $.
>>
>>
>> Now my first solution is to change the Number method:
>>
>> createInstanceOf: aClass withSixxElement: sixxElement
>> | x y |
>> x:=  (SixxXmlUtil characterDataFrom: sixxElement).
>> x:= x collect:[:d| d = $. ifTrue:[$,] ifFalse:[d]].
>> y := x asNumber.
>> ^ y
>>
>> where i change the $.  with $,
>>
>> But it's a valid solution  or ????
>
> About the question A :
>
> today i do some test in Pharo and i found some code into Kernel-Numbers don't reference the Locale decimalPoint .
>
> The same method decimalPoint is not defined.
>
> I port it from Gemstone for compatibility :
>
> decimalPoint
> " by DTR for compatibility with OODB"
> ^self current primDecimalSymbol
>
> The problem is into Pharo because the data relative to Number is generated / managed with fixed  $. and don't  with reference to Locale decimalPoint.
>
> I send e-mail about it to Pharo wiki to know some other consideration.
>
> Dario
>
>>
>>
>> B) the second question is relative to SIXX ScaledDecimal porting
>>
>> Object readSixxFrom: '<sixx.object sixx.id="72" sixx.name="cllOrarioServizioSaturday" sixx.type="SortedCollection" >
>> <sixx.object sixx.id="76" sixx.type="ScaledDecimal" >30.1</sixx.object>
>> <sixx.object sixx.id="77" sixx.type="ScaledDecimal" >40</sixx.object>
>> <sixx.object sixx.id="78" sixx.type="ScaledDecimal" >20</sixx.object>
>> <sixx.object sixx.id="79" sixx.type="ScaledDecimal" >50</sixx.object>
>> </sixx.object>'
>>
>> When execute this code into GLASS the system answer aSortedCollection
>>
>> with  Integer or SmallDouble  but don't ScaledDecimal
>>
>> The same code into Pharo work fine  ( it's answer collection with aScaledDecimal instance )
>>
>>
>> C) the last question is relative to the aScaledDecimal asString
>>
>> if i defined the decimal it is right displayed
>>
>> (ScaledDecimal fromString: '123,12') asString   result '123,12'
>>
>> If the decimal it's not defined it report  a string with $, as last
>>
>> (ScaledDecimal fromString: '123') asString result '123,'
>>
>> I think the solution it's remove the last  $, in this case.
>>
>>
>> Sorry for my questions but if someone gives me some advice / solution I would be very happy.
>>
>>
>> Thanks,
>>
>> Dario
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: SIXX problem with decimalPoint and ScaledDecimal

dario trussardi

> In Pharo if you printIt:
>
> Smalltalk listLoadedModules
>
>
> in a workspace is the LocalePlugin in the list?
>

The list report : 'LocalePlugin VMMaker-oscog-EstebanLorenzano.160 (e)' '


>
>
> On 12/14/2012 09:21 AM, Dario Trussardi wrote:
>> Ciao,
>>
>>
>>> Ciao,  
>>>
>>> to conclude the problems i found with  SIXX porting  from Pharo to GLASS i have three questions:
>>>
>>> A) the first is relative to Locale decimalPoint  
>>>
>>> In my GLASS environment it's $,
>>>
>>> but the Pharo Sixx  write the Number  element with $.
>>>
>>>
>>> Now my first solution is to change the Number method:
>>>
>>> createInstanceOf: aClass withSixxElement: sixxElement
>>> | x y |
>>> x:=  (SixxXmlUtil characterDataFrom: sixxElement).
>>> x:= x collect:[:d| d = $. ifTrue:[$,] ifFalse:[d]].
>>> y := x asNumber.
>>> ^ y
>>>
>>> where i change the $.  with $,
>>>
>>> But it's a valid solution  or ????
>>
>> About the question A :
>>
>> today i do some test in Pharo and i found some code into Kernel-Numbers don't reference the Locale decimalPoint .
>>
>> The same method decimalPoint is not defined.
>>
>> I port it from Gemstone for compatibility :
>>
>> decimalPoint
>> " by DTR for compatibility with OODB"
>> ^self current primDecimalSymbol
>>
>> The problem is into Pharo because the data relative to Number is generated / managed with fixed  $. and don't  with reference to Locale decimalPoint.
>>
>> I send e-mail about it to Pharo wiki to know some other consideration.
>>
>> Dario
>>
>>>
>>>
>>> B) the second question is relative to SIXX ScaledDecimal porting
>>>
>>> Object readSixxFrom: '<sixx.object sixx.id="72" sixx.name="cllOrarioServizioSaturday" sixx.type="SortedCollection" >
>>> <sixx.object sixx.id="76" sixx.type="ScaledDecimal" >30.1</sixx.object>
>>> <sixx.object sixx.id="77" sixx.type="ScaledDecimal" >40</sixx.object>
>>> <sixx.object sixx.id="78" sixx.type="ScaledDecimal" >20</sixx.object>
>>> <sixx.object sixx.id="79" sixx.type="ScaledDecimal" >50</sixx.object>
>>> </sixx.object>'
>>>
>>> When execute this code into GLASS the system answer aSortedCollection
>>>
>>> with  Integer or SmallDouble  but don't ScaledDecimal
>>>
>>> The same code into Pharo work fine  ( it's answer collection with aScaledDecimal instance )
>>>
>>>
>>> C) the last question is relative to the aScaledDecimal asString
>>>
>>> if i defined the decimal it is right displayed
>>>
>>> (ScaledDecimal fromString: '123,12') asString   result '123,12'
>>>
>>> If the decimal it's not defined it report  a string with $, as last
>>>
>>> (ScaledDecimal fromString: '123') asString result '123,'
>>>
>>> I think the solution it's remove the last  $, in this case.
>>>
>>>
>>> Sorry for my questions but if someone gives me some advice / solution I would be very happy.
>>>
>>>
>>> Thanks,
>>>
>>> Dario
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: SIXX problem with decimalPoint and ScaledDecimal

Paul DeBruicker
On 12/14/2012 09:39 AM, Dario Trussardi wrote:

>> > In Pharo if you printIt:
>> >
>> > Smalltalk listLoadedModules
>> >
>> >
>> > in a workspace is the LocalePlugin in the list?
>> >
> The list report : 'LocalePlugin VMMaker-oscog-EstebanLorenzano.160 (e)' '
>
>


Huh.  Seems like the plugin thats supposed to detect your locale's
specifics is not working properly.

If you put a #halt in the primDecimalSymbol method after the pragma does
it get called if in a workspace you doIt:


Locale current primDecimalSymbol

?


Also I don't know whether or not you can put a #halt in a method with a
pragma/that calls a primitive and have it called if the primitive fails
to run.
Reply | Threaded
Open this post in threaded view
|

Re: SIXX problem with decimalPoint and ScaledDecimal

dario trussardi
Thank Paul,


> On 12/14/2012 09:39 AM, Dario Trussardi wrote:
>>>> In Pharo if you printIt:
>>>>
>>>> Smalltalk listLoadedModules
>>>>
>>>>
>>>> in a workspace is the LocalePlugin in the list?
>>>>
>> The list report : 'LocalePlugin VMMaker-oscog-EstebanLorenzano.160 (e)' '
>>
>>
>
>
> Huh.  Seems like the plugin thats supposed to detect your locale's
> specifics is not working properly.
>
> If you put a #halt in the primDecimalSymbol method after the pragma does
> it get called if in a workspace you doIt:
>
>
> Locale current primDecimalSymbol

 I do it but the when i doIt the code: Locale current primDecimalSymbol

        the halt is not execute.

        If i right think this means the primitive work fine, but it return $. not $,

I checked the MAC operating system setup and the decimal point is $,

I note that  in the Pharo1.4 Latest update: #14445 the Locale  primDecimalSymbol is not sender by any method.

This may be relevant ?

        Ciao,

                Dario
>
> ?
>
>
> Also I don't know whether or not you can put a #halt in a method with a
> pragma/that calls a primitive and have it called if the primitive fails
> to run.

Reply | Threaded
Open this post in threaded view
|

Re: SIXX problem with decimalPoint and ScaledDecimal

dario trussardi
In reply to this post by dario trussardi
About the question B ( see at point B )

> Ciao,
>
>
>> Ciao,  
>>
>> to conclude the problems i found with  SIXX porting  from Pharo to GLASS i have three questions:
>>
>> A) the first is relative to Locale decimalPoint  
>>
>> In my GLASS environment it's $,
>>
>> but the Pharo Sixx  write the Number  element with $.
>>
>>
>> Now my first solution is to change the Number method:
>>
>> createInstanceOf: aClass withSixxElement: sixxElement
>> | x y |
>> x:=  (SixxXmlUtil characterDataFrom: sixxElement).
>> x:= x collect:[:d| d = $. ifTrue:[$,] ifFalse:[d]].
>> y := x asNumber.
>> ^ y
>>
>> where i change the $.  with $,
>>
>> But it's a valid solution  or ????
>
> About the question A :
>
> today i do some test in Pharo and i found some code into Kernel-Numbers don't reference the Locale decimalPoint .
>
> The same method decimalPoint is not defined.
>
> I port it from Gemstone for compatibility :
>
> decimalPoint
> " by DTR for compatibility with OODB"
> ^self current primDecimalSymbol
>
> The problem is into Pharo because the data relative to Number is generated / managed with fixed  $. and don't  with reference to Locale decimalPoint.
>
> I send e-mail about it to Pharo wiki to know some other consideration.
>
> Dario
>
>>
>>
>> B) the second question is relative to SIXX ScaledDecimal porting
>>
>> Object readSixxFrom: '<sixx.object sixx.id="72" sixx.name="cllOrarioServizioSaturday" sixx.type="SortedCollection" >
>> <sixx.object sixx.id="76" sixx.type="ScaledDecimal" >30.1</sixx.object>
>> <sixx.object sixx.id="77" sixx.type="ScaledDecimal" >40</sixx.object>
>> <sixx.object sixx.id="78" sixx.type="ScaledDecimal" >20</sixx.object>
>> <sixx.object sixx.id="79" sixx.type="ScaledDecimal" >50</sixx.object>
>> </sixx.object>'
>>
>> When execute this code into GLASS the system answer aSortedCollection
>>
>> with  Integer or SmallDouble  but don't ScaledDecimal

I solve the problem adding :

        to ScaledDecimal class

        A) createInstanceOf: aClass withSixxElement: sixxElement
               
                ^ self readSixxContentStringFrom: (ReadStream on: (SixxXmlUtil characterDataFrom: sixxElement))
       
       
        B) readSixxContentStringFrom: aStream
       
                ^ self readFrom: aStream contents

Can someone update the relative repository or credit my profile ?

        Ciao,

                Dario
       

>>
>> The same code into Pharo work fine  ( it's answer collection with aScaledDecimal instance )
>>
>>
>> C) the last question is relative to the aScaledDecimal asString
>>
>> if i defined the decimal it is right displayed
>>
>> (ScaledDecimal fromString: '123,12') asString   result '123,12'
>>
>> If the decimal it's not defined it report  a string with $, as last
>>
>> (ScaledDecimal fromString: '123') asString result '123,'
>>
>> I think the solution it's remove the last  $, in this case.
>>
>>
>> Sorry for my questions but if someone gives me some advice / solution I would be very happy.
>>
>>
>> Thanks,
>>
>> Dario
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: SIXX problem with decimalPoint and ScaledDecimal

Dale Henrichs
Dario,

I've added the GLASS_DEVS group to the SIXX repository so that you can include your changes ... please make your updates relative to GsSIXX 0.3-c.1 (which means merging with SIXX.310-dkh.175.mcz) and don't forget to update the Configuration ...

Just making changes to the 3.1 code base is fine for now and when we're done here, I'll port to the 2.4 code base ...

Dale



----- Original Message -----
| From: "Dario Trussardi" <[hidden email]>
| To: "GemStone Seaside beta discussion" <[hidden email]>
| Sent: Monday, December 17, 2012 3:54:56 AM
| Subject: Re: [GS/SS Beta] SIXX problem with decimalPoint and ScaledDecimal
|
| About the question B ( see at point B )
|
| > Ciao,
| >
| >
| >> Ciao,
| >>
| >> to conclude the problems i found with  SIXX porting  from Pharo to
| >> GLASS i have three questions:
| >>
| >> A) the first is relative to Locale decimalPoint
| >>
| >> In my GLASS environment it's $,
| >>
| >> but the Pharo Sixx  write the Number  element with $.
| >>
| >>
| >> Now my first solution is to change the Number method:
| >>
| >> createInstanceOf: aClass withSixxElement: sixxElement
| >> | x y |
| >> x:=  (SixxXmlUtil characterDataFrom: sixxElement).
| >> x:= x collect:[:d| d = $. ifTrue:[$,] ifFalse:[d]].
| >> y := x asNumber.
| >> ^ y
| >>
| >> where i change the $.  with $,
| >>
| >> But it's a valid solution  or ????
| >
| > About the question A :
| >
| > today i do some test in Pharo and i found some code into
| > Kernel-Numbers don't reference the Locale decimalPoint .
| >
| > The same method decimalPoint is not defined.
| >
| > I port it from Gemstone for compatibility :
| >
| > decimalPoint
| > " by DTR for compatibility with OODB"
| > ^self current primDecimalSymbol
| >
| > The problem is into Pharo because the data relative to Number is
| > generated / managed with fixed  $. and don't  with reference to
| > Locale decimalPoint.
| >
| > I send e-mail about it to Pharo wiki to know some other
| > consideration.
| >
| > Dario
| >
| >>
| >>
| >> B) the second question is relative to SIXX ScaledDecimal porting
| >>
| >> Object readSixxFrom: '<sixx.object sixx.id="72"
| >> sixx.name="cllOrarioServizioSaturday"
| >> sixx.type="SortedCollection" >
| >> <sixx.object sixx.id="76" sixx.type="ScaledDecimal"
| >> >30.1</sixx.object>
| >> <sixx.object sixx.id="77" sixx.type="ScaledDecimal"
| >> >40</sixx.object>
| >> <sixx.object sixx.id="78" sixx.type="ScaledDecimal"
| >> >20</sixx.object>
| >> <sixx.object sixx.id="79" sixx.type="ScaledDecimal"
| >> >50</sixx.object>
| >> </sixx.object>'
| >>
| >> When execute this code into GLASS the system answer
| >> aSortedCollection
| >>
| >> with  Integer or SmallDouble  but don't ScaledDecimal
|
| I solve the problem adding :
|
| to ScaledDecimal class
|
| A) createInstanceOf: aClass withSixxElement: sixxElement
|
| ^ self readSixxContentStringFrom: (ReadStream on: (SixxXmlUtil
| characterDataFrom: sixxElement))
|
|
| B) readSixxContentStringFrom: aStream
|
| ^ self readFrom: aStream contents
|
| Can someone update the relative repository or credit my profile ?
|
| Ciao,
|
| Dario
|
| >>
| >> The same code into Pharo work fine  ( it's answer collection with
| >> aScaledDecimal instance )
| >>
| >>
| >> C) the last question is relative to the aScaledDecimal asString
| >>
| >> if i defined the decimal it is right displayed
| >>
| >> (ScaledDecimal fromString: '123,12') asString   result '123,12'
| >>
| >> If the decimal it's not defined it report  a string with $, as
| >> last
| >>
| >> (ScaledDecimal fromString: '123') asString result '123,'
| >>
| >> I think the solution it's remove the last  $, in this case.
| >>
| >>
| >> Sorry for my questions but if someone gives me some advice /
| >> solution I would be very happy.
| >>
| >>
| >> Thanks,
| >>
| >> Dario
| >>
| >
|
|