Re: [Pharo-users] can I divide a string into part of exactly n length

2020-04-27 Thread Richard O'Keefe
|s1 s2| s1 := 'abcdefghijk'. s2 := String streamContents: [:s | s1 keysAndValuesDo: [:index :each | (index \\ 3 = 1 and: [1 < index]) ifTrue: [s space]. s nextPut: each]]. is perhaps a little simpler. I generally prefer to have Smalltalk do the counting for me. On Tue, 28 Apr 202

Re: [Pharo-users] how can I test this

2020-04-27 Thread Richard O'Keefe
You wrote "I want to test if the response back to the sending node is the same string as the sending node is but then all uppercased." What is wrong with received = sent asUppercase ? If for some reason you don't like that, then received class = sent class and: [ received size = sent s

Re: [Pharo-users] how can I test this

2020-04-27 Thread Roelof Wobben via Pharo-users
--- Begin Message --- Op 27-4-2020 om 19:50 schreef Roelof Wobben via Pharo-users: This seems to be working testKaNetWorkServer     | srcNode destNode link packet link2 packet2 recievedPackage |     srcNode := KANetworkNode withAddress: #src.     destNode := KANetworkServer withAddress: #dest.

Re: [Pharo-users] can I divide a string into part of exactly n length

2020-04-27 Thread Todd Blanchard via Pharo-users
--- Begin Message --- This works | s1 s2 | s1 := 'abcdefghijk'. s2 := String streamContents: [:s || in len | in := ReadStream on: s1. len := 0. [in atEnd] whileFalse: [ s nextPut: in next. len := len + 1. (in atEnd not and: [ (len \\ 3) = 0]) ifTrue: [ s space ] ] ] >

Re: [Pharo-users] how can I test this

2020-04-27 Thread Roelof Wobben via Pharo-users
--- Begin Message --- Op 27-4-2020 om 19:16 schreef Richard Sargent: On Mon, Apr 27, 2020 at 9:30 AM Roelof Wobben wrote: Op 27-4-2020 om 18:28 schreef Richard

Re: [Pharo-users] how can I test this

2020-04-27 Thread Richard Sargent
On Mon, Apr 27, 2020 at 9:30 AM Roelof Wobben wrote: > Op 27-4-2020 om 18:28 schreef Richard Sargent: > > On Mon, Apr 27, 2020 at 1:56 AM Roelof Wobben via Pharo-users < > pharo-users@lists.pharo.org> wrote: > >> Hello, >> >> I have to test the server which should return the string but then in >>

Re: [Pharo-users] can I divide a string into part of exactly n length

2020-04-27 Thread Roelof Wobben via Pharo-users
--- Begin Message --- Op 27-4-2020 om 19:05 schreef Richard Sargent: On Mon, Apr 27, 2020 at 9:27 AM Roelof Wobben via Pharo-users wrote: Hello,

Re: [Pharo-users] can I divide a string into part of exactly n length

2020-04-27 Thread Richard Sargent
On Mon, Apr 27, 2020 at 9:27 AM Roelof Wobben via Pharo-users < pharo-users@lists.pharo.org> wrote: > Hello, > > I wonder if it is possible in Pharo to divide a string in lets say part > of 3. > so this : 'abcdefgh' > > would be 'abc def gh` > Do you really want a single string with spaces inse

Re: [Pharo-users] mentor question 2.

2020-04-27 Thread Richard Sargent
On Sun, Apr 26, 2020 at 10:11 AM Roelof Wobben via Pharo-users < pharo-users@lists.pharo.org> wrote: > Hello, > > I have to make some code that convert a binary to a decimal and im not > allowed to use the convert methods that Pharo has. > > So I have written this : > > > decimalFromBinary: aStrin

Re: [Pharo-users] Non-blocking IO

2020-04-27 Thread Daniel Turczański
Thanks Sven! Looks good to me. -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Re: [Pharo-users] how can I test this

2020-04-27 Thread Roelof Wobben via Pharo-users
--- Begin Message --- Op 27-4-2020 om 18:28 schreef Richard Sargent: On Mon, Apr 27, 2020 at 1:56 AM Roelof Wobben via Pharo-users wrote: Hello,

Re: [Pharo-users] how can I test this

2020-04-27 Thread Richard Sargent
On Mon, Apr 27, 2020 at 1:56 AM Roelof Wobben via Pharo-users < pharo-users@lists.pharo.org> wrote: > Hello, > > I have to test the server which should return the string but then in > uppercase. > > So far I have this : > > https://github.com/RoelofWobben/Network-simulator/blob/master/src/NetworkS

[Pharo-users] can I divide a string into part of exactly n length

2020-04-27 Thread Roelof Wobben via Pharo-users
--- Begin Message --- Hello, I wonder if it is possible in Pharo to divide a string in lets say part of 3. so this :  'abcdefgh' would be  'abc def gh` Regards, Roelof --- End Message ---

Re: [Pharo-users] mentor question 2.

2020-04-27 Thread Roelof Wobben via Pharo-users
--- Begin Message --- Not any problems. I take the points out of it and forget the things I do not understand. Roelof Op 27-4-2020 om 13:50 schreef PBKResearch: Roelof   Sorry if I

Re: [Pharo-users] mentor question 2.

2020-04-27 Thread PBKResearch
Roelof Sorry if I introduced unnecessary technicalities. Your solution to the problem was in fact using a polynomial explicitly; that's what all the powers of 2 were doing. But as long as you can follow how my version works, that's all that matters. Peter From: Pharo-users On Behalf Of

Re: [Pharo-users] mentor question 2.

2020-04-27 Thread Roelof Wobben via Pharo-users
--- Begin Message --- Op 27-4-2020 om 13:16 schreef PBKResearch: Roelof   You maybe have enough mentors already, but there are some important features of this problem which can be of use in future. Yo

Re: [Pharo-users] mentor question 2.

2020-04-27 Thread PBKResearch
Roelof You maybe have enough mentors already, but there are some important features of this problem which can be of use in future. Your code solves the problem, but it could be improved in two ways, which make it simpler and clearer. 1. What is the purpose of the local variable 'isVali

[Pharo-users] how can I test this

2020-04-27 Thread Roelof Wobben via Pharo-users
--- Begin Message --- Hello, I have to test the server which should return the string but then in uppercase. So far I have this : https://github.com/RoelofWobben/Network-simulator/blob/master/src/NetworkSimulator-Tests/KANetworkTest.class.st#L79 but I fail to see how I can test that the pac