Pharo-users
By thread
pharo-users@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
March 2019
- 77 participants
- 476 messages
Re: [Pharo-users] ZnURL and parsing URL with diacritics
by PBKResearch
Sven
That would certainly work, and represents the most liberal possible approach. An equivalent, keeping entirely within Zinc, would be to use a special-purpose instance of ZnPercentEncoder, in which the safe set is defined as all characters between code points 33 and 126 inclusive. (Starting at 33 fixes your space point.)
Using 'bogusUrl' as a variable name seems a bit pejorative. I am looking up French and German words in Wiktionary all the time, and I am building a Pharo app to do it for me. The version of the url with the accented characters will not work in Zinc until I have urlEncoded it, but it works perfectly well in a browser and is much easier to read.
Peter Kenny
-----Original Message-----
From: Pharo-users <pharo-users-bounces(a)lists.pharo.org> On Behalf Of Sven Van Caekenberghe
Sent: 26 March 2019 12:26
To: Any question about pharo is welcome <pharo-users(a)lists.pharo.org>
Subject: Re: [Pharo-users] ZnURL and parsing URL with diacritics
I would use a variant of your original transformation.
The issue (the error in the URL) is that all kinds of non-ASCII characters occur unencoded. We should/could assume that other special/reserved ASCII characters _are_ properly encoded (so we do not need to handle them).
So I would literally patch/fix the problem, like this:
| bogusUrl fixedUrl url |
bogusUrl := 'https://en.wikipedia.org/wiki/Äeská republika'.
fixedUrl := String streamContents: [ :out |
bogusUrl do: [ :each |
(each codePoint < 127 and: [ each ~= $ ])
ifTrue: [ out nextPut: each ]
ifFalse: [ out nextPutAll: each asString urlEncoded ] ] ].
fixedUrl asUrl retrieveContents.
I made and extra case for the space character, it works either way in the example given, but a space cannot occur freely.
> On 26 Mar 2019, at 12:53, PBKResearch <peter(a)pbkresearch.co.uk> wrote:
>
> Sean
>
> I have realized that the method I proposed can be expressed entirely within the Zinc system, which may make it a bit neater and easier to follow. There probably is no completely general solution, but there is a completely general way of finding a solution for your problem domain.
>
> It is important to realize that String>>urlEncoded is defined as:
> ZnPercentEncoder new encode: self.
> ZnPercentEncoder does not attempt to parse the input string as a url. It scans the entire string, and percent encodes any character that is not in its safe set (see the comment to ZnPercentEncoder>>encode:). Sven has given as default a minimum safe set, which does not include slash, but there is a setter method to redefine the safe set.
>
> So the general way to find a solution for your domain is to collect a representative set of the url strings, apply String>>urlEncoded to each, and work out which characters have been percent encoded wrongly for your domain. For any url cases this is likely to include ':/?#', as well as '%' if it includes things already percent encoded, but there may be others specific to your domain. Now construct an instance of ZnPercentEncoder with the safe set extended to include these characters - note that the default safe set is given by the class method ZnPercentEncoder class>> rfc3986UnreservedCharacters. Apply this instance to encode all your test incoming url strings and verify that they work. Iterate, extending the safe set, until everything passes.
>
> If you want to keep the neatness being able to write something like 'incomingString urlEncoded asZnUrl', you can add a method to String; for the case of the common url characters mentioned above:
>
> String>> urlEncodedMyWay
>
> "As urlEncoded, but with the safe set extended to include characters commonly found in a url"
>
> ^ ZnPercentEncoder new safeSet: ':/?#%', (ZnPercentEncoder rfc3986UnreservedCharacters);
> encode: self
>
> This works in much the same way as the snippet I posted originally, because my code simply reproduces the essentials of ZnPercentEncoder>>encode:.
>
> I seem to be trying to monopolize this thread, so I shall shut up now.
>
> HTH
>
> Peter Kenny
>
> -----Original Message-----
> From: Pharo-users <pharo-users-bounces(a)lists.pharo.org> On Behalf Of
> PBKResearch
> Sent: 24 March 2019 15:36
> To: 'Any question about pharo is welcome'
> <pharo-users(a)lists.pharo.org>
> Subject: Re: [Pharo-users] ZnURL and parsing URL with diacritics
>
> Well it didn't take long to find a potential problem in what I wrote, at least as a general solution. If the input string contains something which has already been percent encoded, it will re-encode the percent signs. In this case, decoding will recover the once-encoded version, but we need to decode twice to recover the original text. Any web site receiving this version will almost certainly decode once only, and so will not see the right details.
>
> The solution is simple - just include the percent sign in the list of excluded characters in the third line, so it becomes:
> url asString do: [ :ch|(':/?%' includes: ch )
>
> -----Original Message-----
> From: Pharo-users <pharo-users-bounces(a)lists.pharo.org> On Behalf Of
> PBKResearch
> Sent: 24 March 2019 12:11
> To: 'Any question about pharo is welcome'
> <pharo-users(a)lists.pharo.org>
> Subject: Re: [Pharo-users] ZnURL and parsing URL with diacritics
>
> Sean, Sven
>
> Thinking about this, I have found a simple (maybe too simple) way round it. The obvious first approach is to apply 'urlEncoded' to the received url string, but this fails because it also encodes the slashes and other segment dividers. A simple-minded approach is to scan the received string, copy the slashes and other segment dividers unchanged and percent encode everything else. I cobbled together the following in a playground, but it could easily be turned into a method in String class.
>
> urlEncodedSegments := [ :url||outStream|
> outStream := String new writeStream.
> url asString do: [ :ch|(':/?' includes: ch )
> ifTrue: [ outStream nextPut: ch ]
> ifFalse:[outStream nextPutAll: ch asString urlEncoded ] ].
> outStream contents].
>
> urlEncodedSegments value: 'https://fr.wiktionary.org/wiki/péripétie'
> => https://fr.wiktionary.org/wiki/p%C3%A9rip%C3%A9tie
>
> This may fail if a slash can occur in a url other than as a segment divider. I am not sure if this is possible - could there be some sort of escaped slash within a segment? Anyway, if the received url strings are well-behaved, apart from the diacritics, this approach could be used as a hack for Sean's problem.
>
> HTH
>
> Peter Kenny
>
> Note to Sven: The comment to String>>urlEncoded says: ' This is an encoding where characters that are illegal in a URL are escaped.' Slashes are escaped but are quite legal. Should the comment be changed, or the method?
>
>
>
> -----Original Message-----
> From: Pharo-users <pharo-users-bounces(a)lists.pharo.org> On Behalf Of
> Sven Van Caekenberghe
> Sent: 23 March 2019 20:03
> To: Any question about pharo is welcome <pharo-users(a)lists.pharo.org>
> Subject: Re: [Pharo-users] ZnURL and parsing URL with diacritics
>
>
>
>> On 23 Mar 2019, at 20:53, Sean P. DeNigris <sean(a)clipperadams.com> wrote:
>>
>> Peter Kenny wrote
>>> And when I inspect the result, it is the address of a non-existent
>>> file in my image directory.
>>
>> Ah, no. I see the same result. By "worked" I meant that it created a
>> URL that safari accepted, but I see now it's not the same as
>> correctly parsing it.
>>
>>
>> Peter Kenny wrote
>>> Incidentally, I tried the other trick Sven cites in the same thread.
>>> The same url as above can be written:
>>> 'https://fr.wiktionary.org/wiki' asUrl / 'péripétie'.
>>
>> Yes, this works if you are assembling the URL, but several people
>> presented the use case of processing URLs from elsewhere, leaving one
>> in a chicken-and-egg situation where one can't parse due to the
>> diacritics and can't escape the diacritics (i.e. without incorrectly
>> escaping other things) without parsing :/
>
> Yes, that is pretty close to a catch 22. Strictly speaking, such URLs are incorrect and can't be parsed.
>
> I do understand that sometimes these URLs occur in the wild, but again, strictly speaking they are in error.
>
> The fact that browser search boxes accept them is a service on top of the strict URL syntax, I am not 100% sure how they do it, but it probably involves a lot of heuristics and trial and error.
>
> The parser of ZnUrl is just 3 to 4 methods. There is nothing preventing somebody from making a new ZnLoseUrlParser, but it won't be easy.
>
>> -----
>> Cheers,
>> Sean
>> --
>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>>
>
>
>
>
>
March 26, 2019
Re: [Pharo-users] What oo/modelling books/articles do we recommend these days?
by Sean P. DeNigris
Tim Mackinnon wrote
> Has anyone else got any thoughts?
I think Dan North's Behavior Driven Development stuff is great and covers
both OOP and TDD. The code is in Ruby, but the concepts IMHO are on the
money. For me, the holy grail of OOP books is A Mentoring Course on
Smalltalk, but I definitely wouldn't consider it "lightweight" ha ha. I'm
sure there are others, but that's off the top of my head...
-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
March 26, 2019
Re: [Pharo-users] What oo/modelling books/articles do we recommend these days?
by Christopher Fuhrman
On Tue, 26 Mar 2019 at 10:17, Tim Mackinnon <tim(a)testit.works> wrote:
> Wasnât there something that encouraged you to underline the nouns and
> circle the verbs and then start to identify objects and responsibilities?
> Its that kind of thing I am starting to see as the weak point in people
> approaching problems.
>
That's the Booch method which Larman mentions as the noun-phrase
identification (I actually learned that in 1986 in my first Ada course).
See slide 22 or so at
http://stg-tud.github.io/eise/WS11-EiSE-07-Domain_Modeling.pdf
You could/should cherry-pick Larman's book (there's way too much there even
for one course). There are all the references to Resp-Driven Design and
even a lightweight "domain model" pattern (which doesn't have separate
conceptual classes) from Fowler.
https://martinfowler.com/eaaCatalog/domainModel.html
In my courses I get a lot of mileage from just the two GRASP patterns (that
come from Wirfs-Brock et al if I'm not mistaken): Information Expert
<https://en.wikipedia.org/wiki/GRASP_(object-oriented_design)#Information_ex…>
and Creator, but the latter is easier to apply if you have a domain model
as a separate artifact.
IMO the older approaches to OO design get in to trouble today especially
when 1) most objects use composition (an not inheritance with polymorphism,
although it's very powerful for extending programs) and 2) inheritance is
hard to get right the first time (and is difficult to change). There's real
power in refactoring to patterns (e.g., )
There's the CRC method that Horstmann presents, too (I think that's what
Pharo even recommends in the Class Comment template). Booch and CRC are
mentioned on this page:
http://www.cs.fsu.edu/~myers/cop3331/notes/analysis1.html
Finally - I'm not familiar with exercism exercises (I signed up but saw
that smalltalk is still in alpha). Is there a sneak peak of an example
exercise?
Cris
>
> Tim
>
> On 24 Mar 2019, at 22:47, Christopher Fuhrman <
> christopher.fuhrman(a)gmail.com> wrote:
>
> On Sun, 24 Mar 2019 at 21:26, Tim Mackinnon <tim(a)testit.works> wrote:
>
>> Any good references come to mind? As Iâll build up a list that I can
>> point people to, that hopefully puts them in a better place to solve these
>> more interesting and hopefully rewarding problems.
>>
>
> Since 2003 in one of my courses I've used Craig Larman's Applying UML and
> Patterns because it has an analysis approach (getting from a semi-complex
> problem to a working OO solution in iterations, with UML if you want). It's
> using the Point Of Sale (cash register) problem which is complex yet
> familiar enough for most people to grasp (no pun intended, GRASP are the
> patterns he pushes as underlying responsibility-driven principles).
>
> Otherwise, Cay Horstmann's 3rd edition of OO Design and Patterns (Java,
> but applies to any OO language) should be out soon (I provided feedback on
> a draft copy last year). It has some good coverage of OO qualities and also
> uses a realistic problem (Graphics Editing framework, Violet) as the basis
> of lots of examples.
>
>
>
March 26, 2019
Re: [Pharo-users] ZnURL and parsing URL with diacritics
by Sven Van Caekenberghe
I would use a variant of your original transformation.
The issue (the error in the URL) is that all kinds of non-ASCII characters occur unencoded. We should/could assume that other special/reserved ASCII characters _are_ properly encoded (so we do not need to handle them).
So I would literally patch/fix the problem, like this:
| bogusUrl fixedUrl url |
bogusUrl := 'https://en.wikipedia.org/wiki/Äeská republika'.
fixedUrl := String streamContents: [ :out |
bogusUrl do: [ :each |
(each codePoint < 127 and: [ each ~= $ ])
ifTrue: [ out nextPut: each ]
ifFalse: [ out nextPutAll: each asString urlEncoded ] ] ].
fixedUrl asUrl retrieveContents.
I made and extra case for the space character, it works either way in the example given, but a space cannot occur freely.
> On 26 Mar 2019, at 12:53, PBKResearch <peter(a)pbkresearch.co.uk> wrote:
>
> Sean
>
> I have realized that the method I proposed can be expressed entirely within the Zinc system, which may make it a bit neater and easier to follow. There probably is no completely general solution, but there is a completely general way of finding a solution for your problem domain.
>
> It is important to realize that String>>urlEncoded is defined as:
> ZnPercentEncoder new encode: self.
> ZnPercentEncoder does not attempt to parse the input string as a url. It scans the entire string, and percent encodes any character that is not in its safe set (see the comment to ZnPercentEncoder>>encode:). Sven has given as default a minimum safe set, which does not include slash, but there is a setter method to redefine the safe set.
>
> So the general way to find a solution for your domain is to collect a representative set of the url strings, apply String>>urlEncoded to each, and work out which characters have been percent encoded wrongly for your domain. For any url cases this is likely to include ':/?#', as well as '%' if it includes things already percent encoded, but there may be others specific to your domain. Now construct an instance of ZnPercentEncoder with the safe set extended to include these characters - note that the default safe set is given by the class method ZnPercentEncoder class>> rfc3986UnreservedCharacters. Apply this instance to encode all your test incoming url strings and verify that they work. Iterate, extending the safe set, until everything passes.
>
> If you want to keep the neatness being able to write something like 'incomingString urlEncoded asZnUrl', you can add a method to String; for the case of the common url characters mentioned above:
>
> String>> urlEncodedMyWay
>
> "As urlEncoded, but with the safe set extended to include characters commonly found in a url"
>
> ^ ZnPercentEncoder new safeSet: ':/?#%', (ZnPercentEncoder rfc3986UnreservedCharacters);
> encode: self
>
> This works in much the same way as the snippet I posted originally, because my code simply reproduces the essentials of ZnPercentEncoder>>encode:.
>
> I seem to be trying to monopolize this thread, so I shall shut up now.
>
> HTH
>
> Peter Kenny
>
> -----Original Message-----
> From: Pharo-users <pharo-users-bounces(a)lists.pharo.org> On Behalf Of PBKResearch
> Sent: 24 March 2019 15:36
> To: 'Any question about pharo is welcome' <pharo-users(a)lists.pharo.org>
> Subject: Re: [Pharo-users] ZnURL and parsing URL with diacritics
>
> Well it didn't take long to find a potential problem in what I wrote, at least as a general solution. If the input string contains something which has already been percent encoded, it will re-encode the percent signs. In this case, decoding will recover the once-encoded version, but we need to decode twice to recover the original text. Any web site receiving this version will almost certainly decode once only, and so will not see the right details.
>
> The solution is simple - just include the percent sign in the list of excluded characters in the third line, so it becomes:
> url asString do: [ :ch|(':/?%' includes: ch )
>
> -----Original Message-----
> From: Pharo-users <pharo-users-bounces(a)lists.pharo.org> On Behalf Of PBKResearch
> Sent: 24 March 2019 12:11
> To: 'Any question about pharo is welcome' <pharo-users(a)lists.pharo.org>
> Subject: Re: [Pharo-users] ZnURL and parsing URL with diacritics
>
> Sean, Sven
>
> Thinking about this, I have found a simple (maybe too simple) way round it. The obvious first approach is to apply 'urlEncoded' to the received url string, but this fails because it also encodes the slashes and other segment dividers. A simple-minded approach is to scan the received string, copy the slashes and other segment dividers unchanged and percent encode everything else. I cobbled together the following in a playground, but it could easily be turned into a method in String class.
>
> urlEncodedSegments := [ :url||outStream|
> outStream := String new writeStream.
> url asString do: [ :ch|(':/?' includes: ch )
> ifTrue: [ outStream nextPut: ch ]
> ifFalse:[outStream nextPutAll: ch asString urlEncoded ] ].
> outStream contents].
>
> urlEncodedSegments value: 'https://fr.wiktionary.org/wiki/péripétie'
> => https://fr.wiktionary.org/wiki/p%C3%A9rip%C3%A9tie
>
> This may fail if a slash can occur in a url other than as a segment divider. I am not sure if this is possible - could there be some sort of escaped slash within a segment? Anyway, if the received url strings are well-behaved, apart from the diacritics, this approach could be used as a hack for Sean's problem.
>
> HTH
>
> Peter Kenny
>
> Note to Sven: The comment to String>>urlEncoded says: ' This is an encoding where characters that are illegal in a URL are escaped.' Slashes are escaped but are quite legal. Should the comment be changed, or the method?
>
>
>
> -----Original Message-----
> From: Pharo-users <pharo-users-bounces(a)lists.pharo.org> On Behalf Of Sven Van Caekenberghe
> Sent: 23 March 2019 20:03
> To: Any question about pharo is welcome <pharo-users(a)lists.pharo.org>
> Subject: Re: [Pharo-users] ZnURL and parsing URL with diacritics
>
>
>
>> On 23 Mar 2019, at 20:53, Sean P. DeNigris <sean(a)clipperadams.com> wrote:
>>
>> Peter Kenny wrote
>>> And when I inspect the result, it is the address of a non-existent
>>> file in my image directory.
>>
>> Ah, no. I see the same result. By "worked" I meant that it created a
>> URL that safari accepted, but I see now it's not the same as correctly
>> parsing it.
>>
>>
>> Peter Kenny wrote
>>> Incidentally, I tried the other trick Sven cites in the same thread.
>>> The same url as above can be written:
>>> 'https://fr.wiktionary.org/wiki' asUrl / 'péripétie'.
>>
>> Yes, this works if you are assembling the URL, but several people
>> presented the use case of processing URLs from elsewhere, leaving one
>> in a chicken-and-egg situation where one can't parse due to the
>> diacritics and can't escape the diacritics (i.e. without incorrectly
>> escaping other things) without parsing :/
>
> Yes, that is pretty close to a catch 22. Strictly speaking, such URLs are incorrect and can't be parsed.
>
> I do understand that sometimes these URLs occur in the wild, but again, strictly speaking they are in error.
>
> The fact that browser search boxes accept them is a service on top of the strict URL syntax, I am not 100% sure how they do it, but it probably involves a lot of heuristics and trial and error.
>
> The parser of ZnUrl is just 3 to 4 methods. There is nothing preventing somebody from making a new ZnLoseUrlParser, but it won't be easy.
>
>> -----
>> Cheers,
>> Sean
>> --
>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>>
>
>
>
>
>
March 26, 2019
Re: [Pharo-users] What oo/modelling books/articles do we recommend these days?
by Tim Mackinnon
Thanks, I recall the Wires-Brock books been pretty good, its a shame you canât preview any of them (and mine are in a box in my attic somewhere). Unfortunately I canât imagine that students first staring out will want to invest - but maybe I can find something that might fill the gap leading to those.
Tim
> On 26 Mar 2019, at 11:06, Stephan Eggermont <stephan(a)stack.nl> wrote:
>
> Tim Mackinnon <tim(a)testit.works> wrote:
>> As I see Exercism students grapple with more realistic, I am wondering
>> what we point people towards to learn about OO, identifying objects and
>> more importantly responsibilities these days?
>>
>> There is the early Beck CRC paper - but looking at it again, I wonder if
>> its a bit cursory for people who missed the whole OO discovery years ago,
>> and are now faced with competing advice on how to write good programs
>> (much of which seems to eschew OO these days - rather unfairly I think).
>>
>> Any good references come to mind? As Iâll build up a list that I can
>> point people to, that hopefully puts them in a better place to solve
>> these more interesting and hopefully rewarding problems.
>
> Rebecca Wirfs-Brock and Alan McKean (2002) Object Design, Roles,
> Responsibilities, and Collaborations?
>
> Stephan
>
>
>
>
March 26, 2019
Re: [Pharo-users] ZnURL and parsing URL with diacritics
by PBKResearch
Sean
I have realized that the method I proposed can be expressed entirely within the Zinc system, which may make it a bit neater and easier to follow. There probably is no completely general solution, but there is a completely general way of finding a solution for your problem domain.
It is important to realize that String>>urlEncoded is defined as:
ZnPercentEncoder new encode: self.
ZnPercentEncoder does not attempt to parse the input string as a url. It scans the entire string, and percent encodes any character that is not in its safe set (see the comment to ZnPercentEncoder>>encode:). Sven has given as default a minimum safe set, which does not include slash, but there is a setter method to redefine the safe set.
So the general way to find a solution for your domain is to collect a representative set of the url strings, apply String>>urlEncoded to each, and work out which characters have been percent encoded wrongly for your domain. For any url cases this is likely to include ':/?#', as well as '%' if it includes things already percent encoded, but there may be others specific to your domain. Now construct an instance of ZnPercentEncoder with the safe set extended to include these characters - note that the default safe set is given by the class method ZnPercentEncoder class>> rfc3986UnreservedCharacters. Apply this instance to encode all your test incoming url strings and verify that they work. Iterate, extending the safe set, until everything passes.
If you want to keep the neatness being able to write something like 'incomingString urlEncoded asZnUrl', you can add a method to String; for the case of the common url characters mentioned above:
String>> urlEncodedMyWay
"As urlEncoded, but with the safe set extended to include characters commonly found in a url"
^ ZnPercentEncoder new safeSet: ':/?#%', (ZnPercentEncoder rfc3986UnreservedCharacters);
encode: self
This works in much the same way as the snippet I posted originally, because my code simply reproduces the essentials of ZnPercentEncoder>>encode:.
I seem to be trying to monopolize this thread, so I shall shut up now.
HTH
Peter Kenny
-----Original Message-----
From: Pharo-users <pharo-users-bounces(a)lists.pharo.org> On Behalf Of PBKResearch
Sent: 24 March 2019 15:36
To: 'Any question about pharo is welcome' <pharo-users(a)lists.pharo.org>
Subject: Re: [Pharo-users] ZnURL and parsing URL with diacritics
Well it didn't take long to find a potential problem in what I wrote, at least as a general solution. If the input string contains something which has already been percent encoded, it will re-encode the percent signs. In this case, decoding will recover the once-encoded version, but we need to decode twice to recover the original text. Any web site receiving this version will almost certainly decode once only, and so will not see the right details.
The solution is simple - just include the percent sign in the list of excluded characters in the third line, so it becomes:
url asString do: [ :ch|(':/?%' includes: ch )
-----Original Message-----
From: Pharo-users <pharo-users-bounces(a)lists.pharo.org> On Behalf Of PBKResearch
Sent: 24 March 2019 12:11
To: 'Any question about pharo is welcome' <pharo-users(a)lists.pharo.org>
Subject: Re: [Pharo-users] ZnURL and parsing URL with diacritics
Sean, Sven
Thinking about this, I have found a simple (maybe too simple) way round it. The obvious first approach is to apply 'urlEncoded' to the received url string, but this fails because it also encodes the slashes and other segment dividers. A simple-minded approach is to scan the received string, copy the slashes and other segment dividers unchanged and percent encode everything else. I cobbled together the following in a playground, but it could easily be turned into a method in String class.
urlEncodedSegments := [ :url||outStream|
outStream := String new writeStream.
url asString do: [ :ch|(':/?' includes: ch )
ifTrue: [ outStream nextPut: ch ]
ifFalse:[outStream nextPutAll: ch asString urlEncoded ] ].
outStream contents].
urlEncodedSegments value: 'https://fr.wiktionary.org/wiki/péripétie'
=> https://fr.wiktionary.org/wiki/p%C3%A9rip%C3%A9tie
This may fail if a slash can occur in a url other than as a segment divider. I am not sure if this is possible - could there be some sort of escaped slash within a segment? Anyway, if the received url strings are well-behaved, apart from the diacritics, this approach could be used as a hack for Sean's problem.
HTH
Peter Kenny
Note to Sven: The comment to String>>urlEncoded says: ' This is an encoding where characters that are illegal in a URL are escaped.' Slashes are escaped but are quite legal. Should the comment be changed, or the method?
-----Original Message-----
From: Pharo-users <pharo-users-bounces(a)lists.pharo.org> On Behalf Of Sven Van Caekenberghe
Sent: 23 March 2019 20:03
To: Any question about pharo is welcome <pharo-users(a)lists.pharo.org>
Subject: Re: [Pharo-users] ZnURL and parsing URL with diacritics
> On 23 Mar 2019, at 20:53, Sean P. DeNigris <sean(a)clipperadams.com> wrote:
>
> Peter Kenny wrote
>> And when I inspect the result, it is the address of a non-existent
>> file in my image directory.
>
> Ah, no. I see the same result. By "worked" I meant that it created a
> URL that safari accepted, but I see now it's not the same as correctly
> parsing it.
>
>
> Peter Kenny wrote
>> Incidentally, I tried the other trick Sven cites in the same thread.
>> The same url as above can be written:
>> 'https://fr.wiktionary.org/wiki' asUrl / 'péripétie'.
>
> Yes, this works if you are assembling the URL, but several people
> presented the use case of processing URLs from elsewhere, leaving one
> in a chicken-and-egg situation where one can't parse due to the
> diacritics and can't escape the diacritics (i.e. without incorrectly
> escaping other things) without parsing :/
Yes, that is pretty close to a catch 22. Strictly speaking, such URLs are incorrect and can't be parsed.
I do understand that sometimes these URLs occur in the wild, but again, strictly speaking they are in error.
The fact that browser search boxes accept them is a service on top of the strict URL syntax, I am not 100% sure how they do it, but it probably involves a lot of heuristics and trial and error.
The parser of ZnUrl is just 3 to 4 methods. There is nothing preventing somebody from making a new ZnLoseUrlParser, but it won't be easy.
> -----
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
March 26, 2019
Re: [Pharo-users] What oo/modelling books/articles do we recommend these days?
by Stephan Eggermont
Tim Mackinnon <tim(a)testit.works> wrote:
> As I see Exercism students grapple with more realistic, I am wondering
> what we point people towards to learn about OO, identifying objects and
> more importantly responsibilities these days?
>
> There is the early Beck CRC paper - but looking at it again, I wonder if
> its a bit cursory for people who missed the whole OO discovery years ago,
> and are now faced with competing advice on how to write good programs
> (much of which seems to eschew OO these days - rather unfairly I think).
>
> Any good references come to mind? As Iâll build up a list that I can
> point people to, that hopefully puts them in a better place to solve
> these more interesting and hopefully rewarding problems.
Rebecca Wirfs-Brock and Alan McKean (2002) Object Design, Roles,
Responsibilities, and Collaborations?
Stephan
March 26, 2019
Re: [Pharo-users] What oo/modelling books/articles do we recommend these days?
by Tim Mackinnon
Thanks, I looked at that one - the title is right, but itâs more a tutorial where you type in code and follow along (and nothing wrong with that) - but Iâm looking for something that teaches/helps you translate a problem domain into the sea of objects we are all accustomed to. And also gets to to the point quickly so that users can apply this to a problem they are trying to solve.
Iâm now thinking that maybe Chapter 1 of http://sdmeta.gforge.inria.fr/FreeBooks/InsideST/InsideSmalltalk.pdf <http://sdmeta.gforge.inria.fr/FreeBooks/InsideST/InsideSmalltalk.pdf> is pretty good (using a video game).
Tim
> On 26 Mar 2019, at 10:44, Christophe Demarey <christophe.demarey(a)inria.fr> wrote:
>
> http://books.pharo.org/learning-oop/ <http://books.pharo.org/learning-oop/> ?
>
>> Le 26 mars 2019 à 11:09, Tim Mackinnon <tim(a)testit.works <mailto:tim@testit.works>> a écrit :
>>
>> Looking a bit further - Chapter 3 of: http://sdmeta.gforge.inria.fr/FreeBooks/STandOO/Smalltalk-and-OO.pdf <http://sdmeta.gforge.inria.fr/FreeBooks/STandOO/Smalltalk-and-OO.pdf> (Smalltalk and Object Orientation - Hunt) gets me a bit closer, but still thinking Iâve seen better somewhere.
>>
>> Tim
>>
>>> On 26 Mar 2019, at 09:16, Tim Mackinnon <tim(a)testit.works <mailto:tim@testit.works>> wrote:
>>>
>>> Has anyone else got any thoughts? I checked out the Larman book - but it seems very process heavy (probably excellent for a full blown course), while Iâm looking for something a bit lighter weight to guide students on the right way of thinking/approaching the little problems in Exercism.
>>>
>>> Wasnât there something that encouraged you to underline the nouns and circle the verbs and then start to identify objects and responsibilities? Its that kind of thing I am starting to see as the weak point in people approaching problems.
>>>
>>> Tim
>>>
>>>> On 24 Mar 2019, at 22:47, Christopher Fuhrman <christopher.fuhrman(a)gmail.com <mailto:christopher.fuhrman@gmail.com>> wrote:
>>>>
>>>> On Sun, 24 Mar 2019 at 21:26, Tim Mackinnon <tim(a)testit.works <mailto:tim@testit.works>> wrote:
>>>> Any good references come to mind? As Iâll build up a list that I can point people to, that hopefully puts them in a better place to solve these more interesting and hopefully rewarding problems.
>>>>
>>>> Since 2003 in one of my courses I've used Craig Larman's Applying UML and Patterns because it has an analysis approach (getting from a semi-complex problem to a working OO solution in iterations, with UML if you want). It's using the Point Of Sale (cash register) problem which is complex yet familiar enough for most people to grasp (no pun intended, GRASP are the patterns he pushes as underlying responsibility-driven principles).
>>>>
>>>> Otherwise, Cay Horstmann's 3rd edition of OO Design and Patterns (Java, but applies to any OO language) should be out soon (I provided feedback on a draft copy last year). It has some good coverage of OO qualities and also uses a realistic problem (Graphics Editing framework, Violet) as the basis of lots of examples.
>>>
>>
>
March 26, 2019
Re: [Pharo-users] What oo/modelling books/articles do we recommend these days?
by Christophe Demarey
http://books.pharo.org/learning-oop/ ?
> Le 26 mars 2019 à 11:09, Tim Mackinnon <tim(a)testit.works> a écrit :
>
> Looking a bit further - Chapter 3 of: http://sdmeta.gforge.inria.fr/FreeBooks/STandOO/Smalltalk-and-OO.pdf <http://sdmeta.gforge.inria.fr/FreeBooks/STandOO/Smalltalk-and-OO.pdf> (Smalltalk and Object Orientation - Hunt) gets me a bit closer, but still thinking Iâve seen better somewhere.
>
> Tim
>
>> On 26 Mar 2019, at 09:16, Tim Mackinnon <tim(a)testit.works <mailto:tim@testit.works>> wrote:
>>
>> Has anyone else got any thoughts? I checked out the Larman book - but it seems very process heavy (probably excellent for a full blown course), while Iâm looking for something a bit lighter weight to guide students on the right way of thinking/approaching the little problems in Exercism.
>>
>> Wasnât there something that encouraged you to underline the nouns and circle the verbs and then start to identify objects and responsibilities? Its that kind of thing I am starting to see as the weak point in people approaching problems.
>>
>> Tim
>>
>>> On 24 Mar 2019, at 22:47, Christopher Fuhrman <christopher.fuhrman(a)gmail.com <mailto:christopher.fuhrman@gmail.com>> wrote:
>>>
>>> On Sun, 24 Mar 2019 at 21:26, Tim Mackinnon <tim(a)testit.works <mailto:tim@testit.works>> wrote:
>>> Any good references come to mind? As Iâll build up a list that I can point people to, that hopefully puts them in a better place to solve these more interesting and hopefully rewarding problems.
>>>
>>> Since 2003 in one of my courses I've used Craig Larman's Applying UML and Patterns because it has an analysis approach (getting from a semi-complex problem to a working OO solution in iterations, with UML if you want). It's using the Point Of Sale (cash register) problem which is complex yet familiar enough for most people to grasp (no pun intended, GRASP are the patterns he pushes as underlying responsibility-driven principles).
>>>
>>> Otherwise, Cay Horstmann's 3rd edition of OO Design and Patterns (Java, but applies to any OO language) should be out soon (I provided feedback on a draft copy last year). It has some good coverage of OO qualities and also uses a realistic problem (Graphics Editing framework, Violet) as the basis of lots of examples.
>>
>
March 26, 2019
Special Issue on Smalltalk Technologies
by ducasse
Special Issue on Smalltalk Technologies
https://www.journals.elsevier.com/science-of-computer-programming <https://www.journals.elsevier.com/science-of-computer-programming>
Guest Editors:
Loïc Lagadec (Coordinator)
Ensta Bretagne, Lab-STICC
Anne Etien
Université de Lille, CRIStAL, UMR9189
Jannik Laval
Université Lumière Lyon 2, DISP, EA 4570
Theme
Smalltalk is an exciting objectâoriented language in which even primitive values are uniformly handled as normal objects, described by classes that one can browse, inspect and extend. Smalltalk was born during the seventies, still the ideas behind the currently available implementations are often at the edge of innovation.
Smalltalk benefits from being a highly expressive language in which complex and powerful systems can emerge from the composition of simple building blocks. Thanks to its dynamic nature, fast prototyping and agile software development are made possible. Smalltalk is not only a simple and pure dynamic object-oriented language, but is also a programmable system with processes, its own user interface and a complete Interactive Development Environment (IDE).
Smalltalk is a reflexive system, with all its elements being implemented in Smalltalk, which benefits from powerful metaâprogramming facilities. This means that elements can be extended, customized or adapted according to particular contexts, that the Smalltalk IDE itself can be used to implement, validate and debug the Smalltalk system extensions, and that a program is able to query and to change its own structure and behaviour.
In this context, the research topics that relate to Smalltalk technologies are large, and need to receive more attention and research effort, considering that Smalltalk has established itself as a test bed for software engineering theories and tools.
TOPICS include:
ï§ Aspect-oriented programming,
ï§ Design patterns,
ï§ Experience reports,
ï§ Frameworks,
ï§ Implementation, new dialects or languages implemented in Smalltalk,
ï§ Interaction with other languages,
ï§ Meta-programming and Meta-modelling,
ï§ Tools
Important Dates:
⢠Apr. 30, 2019 Full paper submission due
⢠Aug.31, 2019 Paper acceptance decision
⢠Sep.15, 2019 Camera-ready paper due
March 26, 2019