Pharo-dev
By thread
pharo-dev@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
July 2016
- 477 messages
Re: [Pharo-dev] VTermOutputDriver
by Max Leske
This seems to be a bug in the fix I recently made to ImageWorker (althought the VTerm problem is another thingâ¦). Let me create a fix and Iâll get back to you.
Cheers,
Max
> On 11 Jul 2016, at 10:48, Blondeau Vincent <vincent.blondeau(a)worldline.com <mailto:vincent.blondeau@worldline.com>> wrote:
>
> That is not the point⦠Look at the end:
>
> MessageNotUnderstood: receiver of "nextPutAll:" is nil
> UndefinedObject(Object)>>doesNotUnderstand: #nextPutAll:
> TermInfoCharacter>>print:
> TermInfoCharacter>>set:
> TermInfoCharacter>>color:
> VTermOutputDriver>>color:
> VTermOutputDriver>>yellow:
> ImageWorker>>inform:
>
>
> De : Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org <mailto:pharo-dev-bounces@lists.pharo.org>] De la part de Valentin Ryckewaert
> Envoyé : lundi 11 juillet 2016 10:43
> Ã : Pharo Development List
> Objet : Re: [Pharo-dev] VTermOutputDriver
>
> It looks like it's a problem of deleted methods executed (I deleted the method reset for example)
> I don't really see what i can do to solve this...
>
> 2016-07-11 10:39 GMT+02:00 Blondeau Vincent <vincent.blondeau(a)worldline.com <mailto:vincent.blondeau@worldline.com>>:
> Hi,
>
> You should check the stacktrace : https://ci.inria.fr/pharo/job/Pharo-6.0-Issue-Validator/5662/console <https://ci.inria.fr/pharo/job/Pharo-6.0-Issue-Validator/5662/console>
>
> Cheers,
> Vincent
>
> De : Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org <mailto:pharo-dev-bounces@lists.pharo.org>] De la part de Valentin Ryckewaert
> Envoyé : lundi 11 juillet 2016 10:35
> Ã : Pharo Development List
> Objet : [Pharo-dev] VTermOutputDriver
>
> Hello everyone,
>
> I don't understand why my slice isn't working, could someone help me please? I just need a clue and I could fix the problem :)
>
> https://pharo.fogbugz.com/f/cases/18650 <https://pharo.fogbugz.com/f/cases/18650>
>
> Thanks,
> Valentin
>
> !!!*************************************************************************************
> "Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité de Worldline ne pourra être recherchée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être recherchée pour tout dommage résultant d'un virus transmis.
>
> This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Worldline liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.!!!"
>
>
> !!!*************************************************************************************
> "Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité de Worldline ne pourra être recherchée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être recherchée pour tout dommage résultant d'un virus transmis.
>
> This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Worldline liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.!!!"
July 11, 2016
Re: [Pharo-dev] VTermOutputDriver
by Blondeau Vincent
That is not the point⦠Look at the end:
MessageNotUnderstood: receiver of "nextPutAll:" is nil
UndefinedObject(Object)>>doesNotUnderstand: #nextPutAll:
TermInfoCharacter>>print:
TermInfoCharacter>>set:
TermInfoCharacter>>color:
VTermOutputDriver>>color:
VTermOutputDriver>>yellow:
ImageWorker>>inform:
De : Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org] De la part de Valentin Ryckewaert
Envoyé : lundi 11 juillet 2016 10:43
à : Pharo Development List
Objet : Re: [Pharo-dev] VTermOutputDriver
It looks like it's a problem of deleted methods executed (I deleted the method reset for example)
I don't really see what i can do to solve this...
2016-07-11 10:39 GMT+02:00 Blondeau Vincent <vincent.blondeau(a)worldline.com<mailto:vincent.blondeau@worldline.com>>:
Hi,
You should check the stacktrace : https://ci.inria.fr/pharo/job/Pharo-6.0-Issue-Validator/5662/console
Cheers,
Vincent
De : Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org<mailto:pharo-dev-bounces@lists.pharo.org>] De la part de Valentin Ryckewaert
Envoyé : lundi 11 juillet 2016 10:35
à : Pharo Development List
Objet : [Pharo-dev] VTermOutputDriver
Hello everyone,
I don't understand why my slice isn't working, could someone help me please? I just need a clue and I could fix the problem :)
https://pharo.fogbugz.com/f/cases/18650
Thanks,
Valentin
!!!*************************************************************************************
"Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité de Worldline ne pourra être recherchée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être recherchée pour tout dommage résultant d'un virus transmis.
This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Worldline liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.!!!"
!!!*************************************************************************************
"Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité de Worldline ne pourra être recherchée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être recherchée pour tout dommage résultant d'un virus transmis.
This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Worldline liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.!!!"
July 11, 2016
Re: [Pharo-dev] VTermOutputDriver
by Valentin Ryckewaert
It looks like it's a problem of deleted methods executed (I deleted the
method reset for example)
I don't really see what i can do to solve this...
2016-07-11 10:39 GMT+02:00 Blondeau Vincent <vincent.blondeau(a)worldline.com>
:
> Hi,
>
>
>
> You should check the stacktrace :
> https://ci.inria.fr/pharo/job/Pharo-6.0-Issue-Validator/5662/console
>
>
>
> Cheers,
>
> Vincent
>
>
>
> *De :* Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org] *De la part
> de* Valentin Ryckewaert
> *Envoyé :* lundi 11 juillet 2016 10:35
> *Ã :* Pharo Development List
> *Objet :* [Pharo-dev] VTermOutputDriver
>
>
>
> Hello everyone,
>
>
>
> I don't understand why my slice isn't working, could someone help me
> please? I just need a clue and I could fix the problem :)
>
>
>
> https://pharo.fogbugz.com/f/cases/18650
>
>
>
> Thanks,
>
> Valentin
>
>
> !!!*************************************************************************************
> "Ce message et les pièces jointes sont confidentiels et réservés à l'usage
> exclusif de ses destinataires. Il peut également être protégé par le secret
> professionnel. Si vous recevez ce message par erreur, merci d'en avertir
> immédiatement l'expéditeur et de le détruire. L'intégrité du message ne
> pouvant être assurée sur Internet, la responsabilité de Worldline ne pourra
> être recherchée quant au contenu de ce message. Bien que les meilleurs
> efforts soient faits pour maintenir cette transmission exempte de tout
> virus, l'expéditeur ne donne aucune garantie à cet égard et sa
> responsabilité ne saurait être recherchée pour tout dommage résultant d'un
> virus transmis.
>
> This e-mail and the documents attached are confidential and intended
> solely for the addressee; it may also be privileged. If you receive this
> e-mail in error, please notify the sender immediately and destroy it. As
> its integrity cannot be secured on the Internet, the Worldline liability
> cannot be triggered for the message content. Although the sender endeavours
> to maintain a computer virus-free network, the sender does not warrant that
> this transmission is virus-free and will not be liable for any damages
> resulting from any virus transmitted.!!!"
>
July 11, 2016
Re: [Pharo-dev] VTermOutputDriver
by Blondeau Vincent
Hi,
You should check the stacktrace : https://ci.inria.fr/pharo/job/Pharo-6.0-Issue-Validator/5662/console
Cheers,
Vincent
De : Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org] De la part de Valentin Ryckewaert
Envoyé : lundi 11 juillet 2016 10:35
à : Pharo Development List
Objet : [Pharo-dev] VTermOutputDriver
Hello everyone,
I don't understand why my slice isn't working, could someone help me please? I just need a clue and I could fix the problem :)
https://pharo.fogbugz.com/f/cases/18650
Thanks,
Valentin
!!!*************************************************************************************
"Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité de Worldline ne pourra être recherchée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être recherchée pour tout dommage résultant d'un virus transmis.
This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Worldline liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.!!!"
July 11, 2016
VTermOutputDriver
by Valentin Ryckewaert
Hello everyone,
I don't understand when my slice isn't working, could someone help me
please? I just need a clue and I could fix the problem :)
https://pharo.fogbugz.com/f/cases/18650
Thanks,
Valentin
July 11, 2016
Spec/FastTable context menus
by Nicolai Hess
We had some bugs like
18707
<https://pharo.fogbugz.com/f/cases/18707/Cannot-open-the-context-menu-in-Ver…>
Cannot open the context menu in Versionner
MenuMorph(Object)>>doesNotUnderstand: #addMenuGroup:
I don't think the fix is right. We should not handle morphic objects in
spec without
an adapter.
(and case 18584
<https://pharo.fogbugz.com/f/cases/18584/DNU-on-showing-menu-in-PointerExplo…>
DNU on showing menu in PointerExplorer)
July 11, 2016
Re: [Pharo-dev] SessionManager and SystemSettings?
by Nicolai Hess
2016-07-10 23:49 GMT+02:00 Yuriy Tymchuk <yuriy.tymchuk(a)me.com>:
> Settings should work now
>
>
Yes!
Thanks :-)
> On 26 Jun 2016, at 04:56, Juraj Kubelka <juraj.kubelka(a)icloud.com> wrote:
>
> Thanks Yuriy!
>
> Last time, there was a problem on Jenkins. I do not have access to check
> it or change it.
> It is necessary that cleanUp process is called as a last command on
> Jenkins.
>
> The other thing is to find out another solution. The current solution
> expects that an instance variable is unset in a fresh (downloaded) image.
> And this variable is set when the image is opened.
>
> Cheers,
> Juraj
>
> On Jun 25, 2016, at 17:25, Yuriy Tymchuk <yuriy.tymchuk(a)me.com> wrote:
>
> cc Juraj
>
> On 25 Jun 2016, at 22:28, Nicolai Hess <nicolaihess(a)gmail.com> wrote:
>
>
>
> 2016-06-23 15:32 GMT+02:00 Esteban Lorenzano <estebanlm(a)gmail.com>:
>
>>
>> > On 23 Jun 2016, at 15:29, Cyril Ferlicot Delbecque <
>> cyril.ferlicot(a)gmail.com> wrote:
>> >
>> >
>> >
>> > On 23/06/2016 15:07, Christophe Demarey wrote:
>> >> What happens if you execute
>> >> 'SystemSettingsPersistence resumeSystemSettingsâ in a 60103 image?
>> >> If nothing happens, it could be that 'SystemSettingsPersistence
>> >> instVarNamed: âalreadyResumedââ is true
>> >>
>> >> I checked the startupList and PharoCommandLineHandler>>#runPreferences
>> >> but nothing changed there.
>> >>
>> >>
>> >
>> >
>> > I think I read something about a script esteban added to clear the
>> > ever-growing stack. Couldn't it be that? Maybe it open the image and the
>>
>> > system setting think he already loaded the settings.
>>
>> no it shouldnât⦠and *my* preferences are correctly loaded :)
>>
>
> Can we please fix this.
> I work a lot with fresh images, and now every time a start a new image and
> trying to access a repository I have to remmember
> to set the network proxy settings.
>
>
>>
>> >
>> >>
>> >
>> > --
>> > Cyril Ferlicot
>> >
>> > http://www.synectique.eu
>> >
>> > 165 Avenue Bretagne
>> > Lille 59000 France
>> >
>>
>
>
>
>
July 11, 2016
Re: [Pharo-dev] changing compiled byte arrays
by Tudor Girba
Thanks, indeed!
Doru
> On Jul 10, 2016, at 7:28 PM, stepharo <stepharo(a)free.fr> wrote:
>
> thanks for all the energy you put in getting non mutable objects. I will bring a nicer system.
>
> Stef
>
> Le 10/7/16 à 12:06, Clément Bera a écrit :
>> Allright. But the problem happens for any literal you mutate, not only byte arrays.
>>
>> For example this one:
>>
>> foo
>> #(true nil 10) at: 2 put: 50.
>> ^ #(true nil 10)
>>
>> Answers... #(true 50 10)
>>
>> The most common problems are with Array, not ByteArray.
>>
>> Even worse, it can happen with LargeIntegers, Floats, ScaledDecimal, etc.
>>
>> Hopefully read-only objects will solve most of the problems.
>>
>>
>>
>> On Sun, Jul 10, 2016 at 10:51 AM, Peter Uhnák <i.uhnak(a)gmail.com> wrote:
>> Thanks for the explanation!
>>
>> I've this byte array syntax for the first time and I don't think that I will be making heavy use of it, so it shouldn't be a too big problem â since now I understand the behavior, so I can keep it in mind.
>>
>> Thanks,
>> Peter
>>
>> On Sun, Jul 10, 2016 at 7:43 AM, Clément Bera <bera.clement(a)gmail.com> wrote:
>> This is the normal behavior. You are mutating the method's literal, which becomes different. The instance is per method, so even if you do:
>>
>> foo
>> #[1 2 3] at: 2 put: 50.
>> ^ #[1 2 3]
>>
>> You get #[1 50 3], which is easy to understand in this example, but can be very tricky to understand in some cases.
>>
>> I've introduced recently "read-only" objects (Object>>#isReadOnlyObject and co). I am waiting for the VM repo merge which should happen in the next few weeks to have this feature in the default Pharo VM, then I will be able to compile method literals "read-only" by default. With this feature, the #at:put: store will fail telling you that you cannot store into a read-only object, which will solve the common problem, when one does not mutate a literal on purpose.
>>
>> Now as in Pharo everything is reflective, it will always be possible to mark back the literal as "writable", mutate it, and still have this behavior.
>>
>> Best,
>> Clement
>>
>>
>> On Sat, Jul 9, 2016 at 10:22 PM, Peter Uhnák <i.uhnak(a)gmail.com> wrote:
>> Is this normal behavior?
>>
>> cls := Object subclass: #Something.
>>
>> cls compile: 'array
>> ^ #[1 2 3 4]'.
>>
>> cls new array. "#[1 2 3 4]"
>>
>> cls new array at: 1 put: 55.
>>
>> cls new array. "#[55 2 3 4]"
>>
>> (cls>>#array) sourceCode "'array
>> ^ #[1 2 3 4]'"
>>
>>
>> So I can permanently change the compiled byte array in the method, which is weird.
>>
>> Shouldn't the behavior be either
>>
>> a) don't change the original byte array
>>
>> or
>>
>> b) change the source code
>>
>> Thanks,
>> Peter
>>
>>
>>
>
--
www.tudorgirba.com
www.feenk.com
"We cannot reach the flow of things unless we let go."
July 11, 2016
Re: [Pharo-dev] UDBCSQLite3Statement>>at:putDateTime: and DateAndTime>>readFrom:defaultOffset:
by Sven Van Caekenberghe
Hi,
Regarding the DateAndTime change.
> On 11 Jul 2016, at 07:52, Alistair Grant <akgrant0710(a)gmail.com> wrote:
>
> I've finally got this to the point where I think it can be submitted.
>
> The previous version missed a case (sql between). To keep backward
> compatibility with earlier versions of UDBC SQLite3 I've sacrificed a
> bit of conformaty and made the representation:
>
> YYYY-MM-DD HH:MM:SS.ssssss
>
> (the difference being microseconds instead of millseconds). My limited
> interoperability testing (Python / Django) suggests this shouldn't be a
> problem.
>
> The tricky bit is that it affects four different packages:
>
> 1. UDBC-SQLite-Base (UDBCSQLite3Statement, PierceNg.49)
> 2. Glorp (UDBCSQLite3Platform, AlistairGrant.129)
> 3. Kernel (DateAndTime, TheIntegrator.2293)
> 4. Kernel-Tests (DateAndTimeTest, TheIntegrator.65)
>
> I assume that I can create a fogbugz issue and submit a single slice
> that will contain the changes to DateAndTime and DateAndTimeTest for
> Pharo 6.
Yes, please create a slice. But first for Pharo 6, then back port to 5.
I assume that your change is adding the default timezone parameter ?
A small remark: in your unit tests, don't compare string output, but objects. In the 1st test, compare to Duration zero, in the second to 2 hours.
Sven
> What's the best way to submit this for Pharo 5?
>
> The Glorp changes are dependent on the Kernel changes, and the
> UDBC-SQLite-Base changes are dependent on the Glorp changes.
>
> I guess that for Glorp, the best way is to include the Kernel changes as
> an extension for Pharo 5.
>
> How is a dependency such as that between UDBC-SQLite-Base and Glorp
> normally handled?
>
> Thanks!
> Alistair
>
>
> 'From Pharo5.0 of 16 April 2015 [Latest update: #50760] on 10 July 2016 at 10:29:14.682983 am'!
>
> !DateAndTime class methodsFor: 'input' stamp: 'AlistairGrant 6/25/2016 22:55'!
> readFrom: aStream defaultOffset: defaultOffset
> "Parse and return a new DateAndTime instance from stream,
> as a Date, an optional Time and an optional TimeZone offset.
> The time defaults to midnight, the timezone to defaultOffset"
> "self readFrom: '2013-03-04T23:47:52.876+01:00' readStream"
>
> | date time offset |
> date := Date readFrom: aStream.
> [ aStream atEnd or: [ '0123456789Z+-' includes: aStream peek ] ]
> whileFalse: [ aStream next ].
> ('0123456789' includes: aStream peek)
> ifTrue: [ time := Time readFrom: aStream ]
> ifFalse: [ time := Time midnight ].
> aStream skipSeparators.
> offset := self readTimezoneOffsetFrom: aStream default: defaultOffset.
> ^ self
> year: date year
> month: date monthIndex
> day: date dayOfMonth
> hour: time hour
> minute: time minute
> second: time second
> nanoSecond: time nanoSecond
> offset: offset! !
>
> !DateAndTime class methodsFor: 'input' stamp: 'AlistairGrant 6/25/2016 22:55'!
> readFrom: aStream
> "Parse and return a new DateAndTime instance from stream,
> as a Date, an optional Time and an optional TimeZone offset.
> The time defaults to midnight, the timezone to the local offset"
> "self readFrom: '2013-03-04T23:47:52.876+01:00' readStream"
>
> ^self readFrom: aStream defaultOffset: self localOffset.! !
>
> !DateAndTime class methodsFor: 'input' stamp: 'AlistairGrant 6/25/2016 22:47'!
> readTimezoneOffsetFrom: stream default: defaultOffset
> "Read and return an optional timezone offset in the form of
> [+|-]hh[[separator]mm[[separator]ss]] or Z from stream as a duration.
> If there is no offset, return the defaultOffset."
>
> | sign hour minute second |
> (stream peekFor: $Z) ifTrue: [ ^ Duration zero ].
> hour := minute := second := 0.
> ^ ('+-' includes: stream peek)
> ifTrue: [
> sign := stream next = $- ifTrue: [ -1 ] ifFalse: [ 1 ].
> hour := self readTwoDigitIntegerFrom: stream.
> (self readOptionalSeparatorFrom: stream)
> ifNotNil: [
> minute := self readTwoDigitIntegerFrom: stream.
> (self readOptionalSeparatorFrom: stream)
> ifNotNil: [
> second := Integer readFrom: stream ] ].
> Duration seconds: sign * ((hour * 3600) + (minute * 60) + second) ]
> ifFalse: [ defaultOffset ]! !
>
> !DateAndTime class methodsFor: 'input' stamp: 'AlistairGrant 6/25/2016 22:47'!
> readTimezoneOffsetFrom: stream
> "Read and return an optional timezone offset in the form of
> [+|-]hh[[separator]mm[[separator]ss]] or Z from stream as a duration.
> If there is no offset, return the local offset."
>
> ^self readTimezoneOffsetFrom: stream default: self localOffset! !
>
>
> !DateAndTimeTest methodsFor: 'tests - offset' stamp: 'AlistairGrant 7/3/2016 21:18'!
> testReadFromDefaultOffsetNotSpecified
> "self debug: #testReadFromDefaultOffsetSpecified"
>
> self assert: (DateAndTime readFrom: '2016-07-03T21:16:16.708241' readStream defaultOffset: Duration zero) offset printString equals: '0:00:00:00'.
> ! !
>
> !DateAndTimeTest methodsFor: 'tests - offset' stamp: 'AlistairGrant 7/3/2016 21:17'!
> testReadFromDefaultOffsetSpecified
> "self debug: #testReadFromDefaultOffsetSpecified"
>
> self assert: (DateAndTime readFrom: '2016-07-03T21:16:16.708241+02:00' readStream defaultOffset: Duration zero) offset printString equals: '0:02:00:00'.
> ! !
>
>
>
> 'From Pharo5.0 of 16 April 2015 [Latest update: #50760] on 10 July 2016 at 10:29:18.333218 am'!
>
> !UDBCSQLite3Platform methodsFor: 'conversion-times' stamp: 'AlistairGrant 7/3/2016 09:33'!
> toTimestamp: anObject for: aType
> "From DatabasePlatform."
>
> anObject isNil ifTrue: [^nil].
> anObject class = Dialect timestampClass ifTrue: [^anObject asUTC].
> anObject isInteger ifTrue: [^anObject].
> ^anObject asDateAndTime asUTC! !
>
> !UDBCSQLite3Platform methodsFor: 'conversion-times' stamp: 'AlistairGrant 7/3/2016 19:32'!
> printTimestamp: aTimestamp on: stream for: aType
>
> aTimestamp isNil ifTrue: [stream nextPutAll: 'NULL'. ^self].
> stream
> nextPut: $';
> nextPutAll: (self class datetimeToString: aTimestamp);
> nextPut: $'.! !
>
>
> !UDBCSQLite3Platform class methodsFor: 'conversion' stamp: 'AlistairGrant 7/3/2016 19:30'!
> datetimeToString: aDateAndTime
> "Convert the supplied DateAndTime to something close to SQLite3's text timestamp format:
>
> YYYY-MM-DD HH:MM:SS.ssssss
>
> To keep backward compatibility with previous versions, microseconds are supplied instead of milliseconds (what SQLite3 officially supports). Most other applications seem to handle this OK."
> | string |
>
> aDateAndTime class = Dialect timestampClass ifFalse: [ ^aDateAndTime ].
> string := UDBCSQLite3DateTimeString
> streamContents: [ :stream |
> | utc n len |
> utc := aDateAndTime asDateAndTime asUTC.
> utc printYMDOn: stream.
> stream nextPut: Character space.
> utc printHMSOn: stream.
> n := utc nanoSecond.
> n ~= 0
> ifTrue: [ len := 9.
> [ n \\ 10 = 0 ]
> whileTrue: [ n := n / 10.
> len := len - 1 ].
> stream nextPut: $..
> n
> printOn: stream
> base: 10
> length: len
> padded: true ] ].
> ^string! !
>
>
> !UDBCSQLite3Statement methodsFor: 'public - accessing' stamp: 'AlistairGrant 7/2/2016 22:54'!
> dateTimeAt: aColumn
> | utc |
> utc := DateAndTime
> readFrom: (self library stringFrom: handle at: aColumn) readStream
> defaultOffset: Duration zero.
> ^ utc offset: DateAndTime localOffset! !
>
> !UDBCSQLite3Statement methodsFor: 'public - accessing' stamp: 'AlistairGrant 7/3/2016 19:42'!
> at: aColumn putDateTime: aDateTime
> "Put the supplied DateAndTime in column aColumn.
>
> SQLite3 supports three date/time formats: text, real (Julian day), integer (unix seconds).
> We use the ISO8601 text format: YYYY-MM-DD HH:MM:SS.SSS
> See https://www.sqlite.org/datatype3.html"
>
> | s |
> s := UDBCSQLite3Platform datetimeToString: aDateTime asDateAndTime.
> ^ self library with: handle at: aColumn putString: s! !
>
July 11, 2016
Re: [Pharo-dev] UDBCSQLite3Statement>>at:putDateTime: and DateAndTime>>readFrom:defaultOffset:
by Alistair Grant
I've finally got this to the point where I think it can be submitted.
The previous version missed a case (sql between). To keep backward
compatibility with earlier versions of UDBC SQLite3 I've sacrificed a
bit of conformaty and made the representation:
YYYY-MM-DD HH:MM:SS.ssssss
(the difference being microseconds instead of millseconds). My limited
interoperability testing (Python / Django) suggests this shouldn't be a
problem.
The tricky bit is that it affects four different packages:
1. UDBC-SQLite-Base (UDBCSQLite3Statement, PierceNg.49)
2. Glorp (UDBCSQLite3Platform, AlistairGrant.129)
3. Kernel (DateAndTime, TheIntegrator.2293)
4. Kernel-Tests (DateAndTimeTest, TheIntegrator.65)
I assume that I can create a fogbugz issue and submit a single slice
that will contain the changes to DateAndTime and DateAndTimeTest for
Pharo 6.
What's the best way to submit this for Pharo 5?
The Glorp changes are dependent on the Kernel changes, and the
UDBC-SQLite-Base changes are dependent on the Glorp changes.
I guess that for Glorp, the best way is to include the Kernel changes as
an extension for Pharo 5.
How is a dependency such as that between UDBC-SQLite-Base and Glorp
normally handled?
Thanks!
Alistair
'From Pharo5.0 of 16 April 2015 [Latest update: #50760] on 10 July 2016 at 10:29:14.682983 am'!
!DateAndTime class methodsFor: 'input' stamp: 'AlistairGrant 6/25/2016 22:55'!
readFrom: aStream defaultOffset: defaultOffset
"Parse and return a new DateAndTime instance from stream,
as a Date, an optional Time and an optional TimeZone offset.
The time defaults to midnight, the timezone to defaultOffset"
"self readFrom: '2013-03-04T23:47:52.876+01:00' readStream"
| date time offset |
date := Date readFrom: aStream.
[ aStream atEnd or: [ '0123456789Z+-' includes: aStream peek ] ]
whileFalse: [ aStream next ].
('0123456789' includes: aStream peek)
ifTrue: [ time := Time readFrom: aStream ]
ifFalse: [ time := Time midnight ].
aStream skipSeparators.
offset := self readTimezoneOffsetFrom: aStream default: defaultOffset.
^ self
year: date year
month: date monthIndex
day: date dayOfMonth
hour: time hour
minute: time minute
second: time second
nanoSecond: time nanoSecond
offset: offset! !
!DateAndTime class methodsFor: 'input' stamp: 'AlistairGrant 6/25/2016 22:55'!
readFrom: aStream
"Parse and return a new DateAndTime instance from stream,
as a Date, an optional Time and an optional TimeZone offset.
The time defaults to midnight, the timezone to the local offset"
"self readFrom: '2013-03-04T23:47:52.876+01:00' readStream"
^self readFrom: aStream defaultOffset: self localOffset.! !
!DateAndTime class methodsFor: 'input' stamp: 'AlistairGrant 6/25/2016 22:47'!
readTimezoneOffsetFrom: stream default: defaultOffset
"Read and return an optional timezone offset in the form of
[+|-]hh[[separator]mm[[separator]ss]] or Z from stream as a duration.
If there is no offset, return the defaultOffset."
| sign hour minute second |
(stream peekFor: $Z) ifTrue: [ ^ Duration zero ].
hour := minute := second := 0.
^ ('+-' includes: stream peek)
ifTrue: [
sign := stream next = $- ifTrue: [ -1 ] ifFalse: [ 1 ].
hour := self readTwoDigitIntegerFrom: stream.
(self readOptionalSeparatorFrom: stream)
ifNotNil: [
minute := self readTwoDigitIntegerFrom: stream.
(self readOptionalSeparatorFrom: stream)
ifNotNil: [
second := Integer readFrom: stream ] ].
Duration seconds: sign * ((hour * 3600) + (minute * 60) + second) ]
ifFalse: [ defaultOffset ]! !
!DateAndTime class methodsFor: 'input' stamp: 'AlistairGrant 6/25/2016 22:47'!
readTimezoneOffsetFrom: stream
"Read and return an optional timezone offset in the form of
[+|-]hh[[separator]mm[[separator]ss]] or Z from stream as a duration.
If there is no offset, return the local offset."
^self readTimezoneOffsetFrom: stream default: self localOffset! !
!DateAndTimeTest methodsFor: 'tests - offset' stamp: 'AlistairGrant 7/3/2016 21:18'!
testReadFromDefaultOffsetNotSpecified
"self debug: #testReadFromDefaultOffsetSpecified"
self assert: (DateAndTime readFrom: '2016-07-03T21:16:16.708241' readStream defaultOffset: Duration zero) offset printString equals: '0:00:00:00'.
! !
!DateAndTimeTest methodsFor: 'tests - offset' stamp: 'AlistairGrant 7/3/2016 21:17'!
testReadFromDefaultOffsetSpecified
"self debug: #testReadFromDefaultOffsetSpecified"
self assert: (DateAndTime readFrom: '2016-07-03T21:16:16.708241+02:00' readStream defaultOffset: Duration zero) offset printString equals: '0:02:00:00'.
! !
'From Pharo5.0 of 16 April 2015 [Latest update: #50760] on 10 July 2016 at 10:29:18.333218 am'!
!UDBCSQLite3Platform methodsFor: 'conversion-times' stamp: 'AlistairGrant 7/3/2016 09:33'!
toTimestamp: anObject for: aType
"From DatabasePlatform."
anObject isNil ifTrue: [^nil].
anObject class = Dialect timestampClass ifTrue: [^anObject asUTC].
anObject isInteger ifTrue: [^anObject].
^anObject asDateAndTime asUTC! !
!UDBCSQLite3Platform methodsFor: 'conversion-times' stamp: 'AlistairGrant 7/3/2016 19:32'!
printTimestamp: aTimestamp on: stream for: aType
aTimestamp isNil ifTrue: [stream nextPutAll: 'NULL'. ^self].
stream
nextPut: $';
nextPutAll: (self class datetimeToString: aTimestamp);
nextPut: $'.! !
!UDBCSQLite3Platform class methodsFor: 'conversion' stamp: 'AlistairGrant 7/3/2016 19:30'!
datetimeToString: aDateAndTime
"Convert the supplied DateAndTime to something close to SQLite3's text timestamp format:
YYYY-MM-DD HH:MM:SS.ssssss
To keep backward compatibility with previous versions, microseconds are supplied instead of milliseconds (what SQLite3 officially supports). Most other applications seem to handle this OK."
| string |
aDateAndTime class = Dialect timestampClass ifFalse: [ ^aDateAndTime ].
string := UDBCSQLite3DateTimeString
streamContents: [ :stream |
| utc n len |
utc := aDateAndTime asDateAndTime asUTC.
utc printYMDOn: stream.
stream nextPut: Character space.
utc printHMSOn: stream.
n := utc nanoSecond.
n ~= 0
ifTrue: [ len := 9.
[ n \\ 10 = 0 ]
whileTrue: [ n := n / 10.
len := len - 1 ].
stream nextPut: $..
n
printOn: stream
base: 10
length: len
padded: true ] ].
^string! !
!UDBCSQLite3Statement methodsFor: 'public - accessing' stamp: 'AlistairGrant 7/2/2016 22:54'!
dateTimeAt: aColumn
| utc |
utc := DateAndTime
readFrom: (self library stringFrom: handle at: aColumn) readStream
defaultOffset: Duration zero.
^ utc offset: DateAndTime localOffset! !
!UDBCSQLite3Statement methodsFor: 'public - accessing' stamp: 'AlistairGrant 7/3/2016 19:42'!
at: aColumn putDateTime: aDateTime
"Put the supplied DateAndTime in column aColumn.
SQLite3 supports three date/time formats: text, real (Julian day), integer (unix seconds).
We use the ISO8601 text format: YYYY-MM-DD HH:MM:SS.SSS
See https://www.sqlite.org/datatype3.html"
| s |
s := UDBCSQLite3Platform datetimeToString: aDateTime asDateAndTime.
^ self library with: handle at: aColumn putString: s! !
July 11, 2016