[ANN] A first port to Cuis of Sport and Swazoo

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

[ANN] A first port to Cuis of Sport and Swazoo

garduino
Hi:

The first versions of Sport and Swazoo working in Cuis 4.1 with all
tests green are ready to install.

The changes I did in Swazoo are:


- Avoid Unicode support that don't exist in Cuis


WebSocketConnection:

fromUtf8: aString
"Squeak specific"

"gsa 14/01/2013 for Cuis port"
"^[aString convertFromEncoding: #utf8] on: Error do: [:ex | aString ]
^ aString


toUtf8: aString
"Squeak specific"
"
| converter in out |
converter := UTF8TextConverter new.
in := aString readStream.
out := WriteStream on: ''.
[in atEnd] whileFalse:
[converter nextPut: in next toStream: out].
^out contents
"
^ aString.


SwazooBuffer >>closeChunkTo: aSocket

        " gsa 18/01/2013 used String instead ByteString for Cuis"
        "chunk := ByteString new: 5."


- Avoid #fork and #forkAt: calling #newProcess instead:

HTTPServer >>start

start
        | swazooProcess |
        self loop isNil ifTrue: [
                self socket:
                        (SwazooSocket
                                serverOnIP: self ipCorrected
                                port: self port).
                self socket listenFor: 128.
                self loop: (swazooProcess _ [ [ self acceptConnection ] repeat ] newProcess).
                swazooProcess name: 'Swazoo ' , DateAndTime now asString.
                swazooProcess priority: Processor userBackgroundPriority.
                swazooProcess resume ].

instead of the original code:

start
        self loop isNil ifTrue: [
                self socket:
                        (SwazooSocket
                                serverOnIP: self ipCorrected
                                port: self port).
                self socket listenFor: 128.
                self loop: ([ [ self acceptConnection ] repeat ] forkAt: Processor
userBackgroundPriority) ].



HTTPServer >>setUp

setUp
        | socket swazooProcess |
        (Delay forMilliseconds: 100) wait.
        server _ HTTPServer new.
        swazooProcess _ [
        server
                 ip: 'localhost';
                 port: 8123.
        server start ] newProcess.
        swazooProcess name: 'Swazoo HTTPServer Test'.
        swazooProcess resume.
        (Delay forMilliseconds: 100) wait.
        " stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
                                readAppendStream"
        socket _ SpSocket
                connectToServerOnHost: 'localhost'
                port: 8123.
        stream _ SwazooStream socket: socket.

instead of the original code:

setUp
        | socket |
        (Delay forMilliseconds: 100) wait.
        server := HTTPServer new.
        [server ip: 'localhost'; port: 8123.
        server start]
                fork.
        (Delay forMilliseconds: 100) wait.
" stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
                                readAppendStream"
        socket := SpSocket connectToServerOnHost:  'localhost' port: 8123.
        stream := SwazooStream socket: socket


Other considerations:

SpFilename >>underlyingFilename (This method do not exist, but do not
exist neither in the original one click aida/pharo image)

Security class don't exist neither in the pharo one click image.

#trimSeparators, is named in SwazooMD5 but do not seems implemented.




To install Sport and Swazoo, follow the next steps:

1. Take a new Cuis 4.1 image.

2. From GitHub / garduino clone in your computer the repos
Cuis-Cryptography
Cuis-CompatibilityWithOtherSmalltalks
Cuis-Pharo14CompatibilityLayer
Cuis-Sport
Cuis-Swazoo

3. In a workspace run the next script:

| slash repo |
slash _ FileDirectory slash.
repo := '/Users/Shared/YOURCODEREPOSITORYPATH/'.
{
repo, slash, 'Cuis-Cryptography', slash, 'Cuis-System-Hashing.pck.st' .
repo, slash, 'Cuis-CompatibilityWithOtherSmalltalks', slash,
'Cuis-CompatibilityWithOtherSmalltalks.pck.st' .
repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
'Cuis-Network-Protocols.pck.st' .
repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
'Cuis-Network-Url.pck.st' .
repo, slash, 'Cuis-Sport', slash, 'Sport.pck.st' .
repo, slash, 'Cuis-Swazoo', slash, 'Swazoo.pck.st' .
}
do:
[ :fileName | CodePackageFile installPackageStream:
(FileStream concreteStream readOnlyFileNamed: fileName)
].


4. You will notice some warnings in the Transcript regarding some
Network-* classes, it is because I'm installing here only the minimum
code that I need for Swazoo and I must still end to polish the delta
between the Network protocol in Cuis vs Pharo/Squeak

5. I did also an early port of TimeStamp, not existing in Cuis, and I
have still 1 failing test.


But Swazoo seems to work ok, all the test pass and the tests I did in
the workspace seems to work, but as I'm not in expert in Swazoo, I
will be more than happy of receive corrections, suggestion, etc, to
leave the port in a stable state.



--
Sincerely,
Germán Arduino
about.me/garduino

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

Captura de pantalla 2013-01-20 a la(s) 12.05.11.png (372K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] [ANN] A first port to Cuis of Sport and Swazoo

Hannes Hirzel
Hello Germán

Thank you for porting Sport and Swazoo.


Regarding Unicode support I think we can say that Cuis has limited
Unicode support

1) It reads and writes files in UTF8
2) The clipboard is UTF8

The limitation is that only certain code points are supported
internally -- actually only 256 of them. Internally the characters are
8 bit.

We have the utility method
Character class>>iso8859s15CodeForUnicodeCodePoint: codePoint

which maps a Unicode code point to the internal coding system

And
String>>iso8859s15ToUtf8
        "Convert the given string to UTF-8 from the internal encoding: ISO
Latin 9 (ISO 8859-15)"


To ease porting I suggest to have a Cuis specific

    UTF8TextConverter


version in the Compabilitiy layer package.

It will convert the 8859-15 properly. The other Unicode points should
be replaced with the
\unnnn notation (JavaScript / Java) or HTML entities ( &#nnn; ).



Kind regards

Hannes



On 1/20/13, Germán Arduino <[hidden email]> wrote:

> Hi:
>
> The first versions of Sport and Swazoo working in Cuis 4.1 with all
> tests green are ready to install.
>
> The changes I did in Swazoo are:
>
>
> - Avoid Unicode support that don't exist in Cuis
>
>
> WebSocketConnection:
>
> fromUtf8: aString
> "Squeak specific"
>
> "gsa 14/01/2013 for Cuis port"
> "^[aString convertFromEncoding: #utf8] on: Error do: [:ex | aString ]
> ^ aString
>
>
> toUtf8: aString
> "Squeak specific"
> "
> | converter in out |
> converter := UTF8TextConverter new.
> in := aString readStream.
> out := WriteStream on: ''.
> [in atEnd] whileFalse:
> [converter nextPut: in next toStream: out].
> ^out contents
> "
> ^ aString.
>
>
> SwazooBuffer >>closeChunkTo: aSocket
>
> " gsa 18/01/2013 used String instead ByteString for Cuis"
> "chunk := ByteString new: 5."
>
>
> - Avoid #fork and #forkAt: calling #newProcess instead:
>
> HTTPServer >>start
>
> start
> | swazooProcess |
> self loop isNil ifTrue: [
> self socket:
> (SwazooSocket
> serverOnIP: self ipCorrected
> port: self port).
> self socket listenFor: 128.
> self loop: (swazooProcess _ [ [ self acceptConnection ] repeat ]
> newProcess).
> swazooProcess name: 'Swazoo ' , DateAndTime now asString.
> swazooProcess priority: Processor userBackgroundPriority.
> swazooProcess resume ].
>
> instead of the original code:
>
> start
> self loop isNil ifTrue: [
> self socket:
> (SwazooSocket
> serverOnIP: self ipCorrected
> port: self port).
> self socket listenFor: 128.
> self loop: ([ [ self acceptConnection ] repeat ] forkAt: Processor
> userBackgroundPriority) ].
>
>
>
> HTTPServer >>setUp
>
> setUp
> | socket swazooProcess |
> (Delay forMilliseconds: 100) wait.
> server _ HTTPServer new.
> swazooProcess _ [
> server
> ip: 'localhost';
> port: 8123.
> server start ] newProcess.
> swazooProcess name: 'Swazoo HTTPServer Test'.
> swazooProcess resume.
> (Delay forMilliseconds: 100) wait.
> " stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
> readAppendStream"
> socket _ SpSocket
> connectToServerOnHost: 'localhost'
> port: 8123.
> stream _ SwazooStream socket: socket.
>
> instead of the original code:
>
> setUp
> | socket |
> (Delay forMilliseconds: 100) wait.
> server := HTTPServer new.
> [server ip: 'localhost'; port: 8123.
> server start]
> fork.
> (Delay forMilliseconds: 100) wait.
> " stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
> readAppendStream"
> socket := SpSocket connectToServerOnHost:  'localhost' port: 8123.
> stream := SwazooStream socket: socket
>
>
> Other considerations:
>
> SpFilename >>underlyingFilename (This method do not exist, but do not
> exist neither in the original one click aida/pharo image)
>
> Security class don't exist neither in the pharo one click image.
>
> #trimSeparators, is named in SwazooMD5 but do not seems implemented.
>
>
>
>
> To install Sport and Swazoo, follow the next steps:
>
> 1. Take a new Cuis 4.1 image.
>
> 2. From GitHub / garduino clone in your computer the repos
> Cuis-Cryptography
> Cuis-CompatibilityWithOtherSmalltalks
> Cuis-Pharo14CompatibilityLayer
> Cuis-Sport
> Cuis-Swazoo
>
> 3. In a workspace run the next script:
>
> | slash repo |
> slash _ FileDirectory slash.
> repo := '/Users/Shared/YOURCODEREPOSITORYPATH/'.
> {
> repo, slash, 'Cuis-Cryptography', slash, 'Cuis-System-Hashing.pck.st' .
> repo, slash, 'Cuis-CompatibilityWithOtherSmalltalks', slash,
> 'Cuis-CompatibilityWithOtherSmalltalks.pck.st' .
> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
> 'Cuis-Network-Protocols.pck.st' .
> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
> 'Cuis-Network-Url.pck.st' .
> repo, slash, 'Cuis-Sport', slash, 'Sport.pck.st' .
> repo, slash, 'Cuis-Swazoo', slash, 'Swazoo.pck.st' .
> }
> do:
> [ :fileName | CodePackageFile installPackageStream:
> (FileStream concreteStream readOnlyFileNamed: fileName)
> ].
>
>
> 4. You will notice some warnings in the Transcript regarding some
> Network-* classes, it is because I'm installing here only the minimum
> code that I need for Swazoo and I must still end to polish the delta
> between the Network protocol in Cuis vs Pharo/Squeak
>
> 5. I did also an early port of TimeStamp, not existing in Cuis, and I
> have still 1 failing test.
>
>
> But Swazoo seems to work ok, all the test pass and the tests I did in
> the workspace seems to work, but as I'm not in expert in Swazoo, I
> will be more than happy of receive corrections, suggestion, etc, to
> leave the port in a stable state.
>
>
>
> --
> Sincerely,
> Germán Arduino
> about.me/garduino
>
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] [ANN] A first port to Cuis of Sport and Swazoo

Hannes Hirzel
In reply to this post by garduino
Another feedback,

Could you please mark changes with

    self flag: #adaptedForCuis

instead of just with a comment

    "Squeak specific"

example see below. That way it is easier to review the changes.

--Hannes

On 1/20/13, Germán Arduino <[hidden email]> wrote:

> Hi:
>
> The first versions of Sport and Swazoo working in Cuis 4.1 with all
> tests green are ready to install.
>
> The changes I did in Swazoo are:
>
>
> - Avoid Unicode support that don't exist in Cuis
>
>
> WebSocketConnection:
>
> fromUtf8: aString
> "Squeak specific"
>
> "gsa 14/01/2013 for Cuis port"
> "^[aString convertFromEncoding: #utf8] on: Error do: [:ex | aString ]
> ^ aString
>
>


> toUtf8: aString
> "Squeak specific"
> "

> | converter in out |
self flag: #adaptedForCuis

> converter := UTF8TextConverter new.
> in := aString readStream.
> out := WriteStream on: ''.
> [in atEnd] whileFalse:
> [converter nextPut: in next toStream: out].
> ^out contents
> "
> ^ aString.
>
>
> SwazooBuffer >>closeChunkTo: aSocket
>
> " gsa 18/01/2013 used String instead ByteString for Cuis"
> "chunk := ByteString new: 5."
>
>
> - Avoid #fork and #forkAt: calling #newProcess instead:
>
> HTTPServer >>start
>
> start
> | swazooProcess |
> self loop isNil ifTrue: [
> self socket:
> (SwazooSocket
> serverOnIP: self ipCorrected
> port: self port).
> self socket listenFor: 128.
> self loop: (swazooProcess _ [ [ self acceptConnection ] repeat ]
> newProcess).
> swazooProcess name: 'Swazoo ' , DateAndTime now asString.
> swazooProcess priority: Processor userBackgroundPriority.
> swazooProcess resume ].
>
> instead of the original code:
>
> start
> self loop isNil ifTrue: [
> self socket:
> (SwazooSocket
> serverOnIP: self ipCorrected
> port: self port).
> self socket listenFor: 128.
> self loop: ([ [ self acceptConnection ] repeat ] forkAt: Processor
> userBackgroundPriority) ].
>
>
>
> HTTPServer >>setUp
>
> setUp
> | socket swazooProcess |
> (Delay forMilliseconds: 100) wait.
> server _ HTTPServer new.
> swazooProcess _ [
> server
> ip: 'localhost';
> port: 8123.
> server start ] newProcess.
> swazooProcess name: 'Swazoo HTTPServer Test'.
> swazooProcess resume.
> (Delay forMilliseconds: 100) wait.
> " stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
> readAppendStream"
> socket _ SpSocket
> connectToServerOnHost: 'localhost'
> port: 8123.
> stream _ SwazooStream socket: socket.
>
> instead of the original code:
>
> setUp
> | socket |
> (Delay forMilliseconds: 100) wait.
> server := HTTPServer new.
> [server ip: 'localhost'; port: 8123.
> server start]
> fork.
> (Delay forMilliseconds: 100) wait.
> " stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
> readAppendStream"
> socket := SpSocket connectToServerOnHost:  'localhost' port: 8123.
> stream := SwazooStream socket: socket
>
>
> Other considerations:
>
> SpFilename >>underlyingFilename (This method do not exist, but do not
> exist neither in the original one click aida/pharo image)
>
> Security class don't exist neither in the pharo one click image.
>
> #trimSeparators, is named in SwazooMD5 but do not seems implemented.
>
>
>
>
> To install Sport and Swazoo, follow the next steps:
>
> 1. Take a new Cuis 4.1 image.
>
> 2. From GitHub / garduino clone in your computer the repos
> Cuis-Cryptography
> Cuis-CompatibilityWithOtherSmalltalks
> Cuis-Pharo14CompatibilityLayer
> Cuis-Sport
> Cuis-Swazoo
>
> 3. In a workspace run the next script:
>
> | slash repo |
> slash _ FileDirectory slash.
> repo := '/Users/Shared/YOURCODEREPOSITORYPATH/'.
> {
> repo, slash, 'Cuis-Cryptography', slash, 'Cuis-System-Hashing.pck.st' .
> repo, slash, 'Cuis-CompatibilityWithOtherSmalltalks', slash,
> 'Cuis-CompatibilityWithOtherSmalltalks.pck.st' .
> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
> 'Cuis-Network-Protocols.pck.st' .
> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
> 'Cuis-Network-Url.pck.st' .
> repo, slash, 'Cuis-Sport', slash, 'Sport.pck.st' .
> repo, slash, 'Cuis-Swazoo', slash, 'Swazoo.pck.st' .
> }
> do:
> [ :fileName | CodePackageFile installPackageStream:
> (FileStream concreteStream readOnlyFileNamed: fileName)
> ].
>
>
> 4. You will notice some warnings in the Transcript regarding some
> Network-* classes, it is because I'm installing here only the minimum
> code that I need for Swazoo and I must still end to polish the delta
> between the Network protocol in Cuis vs Pharo/Squeak
>
> 5. I did also an early port of TimeStamp, not existing in Cuis, and I
> have still 1 failing test.
>
>
> But Swazoo seems to work ok, all the test pass and the tests I did in
> the workspace seems to work, but as I'm not in expert in Swazoo, I
> will be more than happy of receive corrections, suggestion, etc, to
> leave the port in a stable state.
>
>
>
> --
> Sincerely,
> Germán Arduino
> about.me/garduino
>
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] A first port to Cuis of Sport and Swazoo

Janko Mivšek
In reply to this post by garduino
Hi Germán,

Very nice, thanks a lot!. Can you prepare a Cuis image and publish it
somewhere so that we can download it?

Also, for methods which are now Cuis specific, put "Cuis specific" in a
method comment.

Use := consistently everywhere instead of _

Those process specific changes are worth spread to Swazoos on other
dialects as "least common denominator" too, I'll try to do that today on VW.

Best regards
Janko


Dne 20. 01. 2013 16:59, piše Germán Arduino:

> Hi:
>
> The first versions of Sport and Swazoo working in Cuis 4.1 with all
> tests green are ready to install.
>
> The changes I did in Swazoo are:
>
>
> - Avoid Unicode support that don't exist in Cuis
>
>
> WebSocketConnection:
>
> fromUtf8: aString
> "Squeak specific"
>
> "gsa 14/01/2013 for Cuis port"
> "^[aString convertFromEncoding: #utf8] on: Error do: [:ex | aString ]
> ^ aString
>
>
> toUtf8: aString
> "Squeak specific"
> "
> | converter in out |
> converter := UTF8TextConverter new.
> in := aString readStream.
> out := WriteStream on: ''.
> [in atEnd] whileFalse:
> [converter nextPut: in next toStream: out].
> ^out contents
> "
> ^ aString.
>
>
> SwazooBuffer >>closeChunkTo: aSocket
>
> " gsa 18/01/2013 used String instead ByteString for Cuis"
> "chunk := ByteString new: 5."
>
>
> - Avoid #fork and #forkAt: calling #newProcess instead:
>
> HTTPServer >>start
>
> start
> | swazooProcess |
> self loop isNil ifTrue: [
> self socket:
> (SwazooSocket
> serverOnIP: self ipCorrected
> port: self port).
> self socket listenFor: 128.
> self loop: (swazooProcess _ [ [ self acceptConnection ] repeat ] newProcess).
> swazooProcess name: 'Swazoo ' , DateAndTime now asString.
> swazooProcess priority: Processor userBackgroundPriority.
> swazooProcess resume ].
>
> instead of the original code:
>
> start
> self loop isNil ifTrue: [
> self socket:
> (SwazooSocket
> serverOnIP: self ipCorrected
> port: self port).
> self socket listenFor: 128.
> self loop: ([ [ self acceptConnection ] repeat ] forkAt: Processor
> userBackgroundPriority) ].
>
>
>
> HTTPServer >>setUp
>
> setUp
> | socket swazooProcess |
> (Delay forMilliseconds: 100) wait.
> server _ HTTPServer new.
> swazooProcess _ [
> server
> ip: 'localhost';
> port: 8123.
> server start ] newProcess.
> swazooProcess name: 'Swazoo HTTPServer Test'.
> swazooProcess resume.
> (Delay forMilliseconds: 100) wait.
> " stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
> readAppendStream"
> socket _ SpSocket
> connectToServerOnHost: 'localhost'
> port: 8123.
> stream _ SwazooStream socket: socket.
>
> instead of the original code:
>
> setUp
> | socket |
> (Delay forMilliseconds: 100) wait.
> server := HTTPServer new.
> [server ip: 'localhost'; port: 8123.
> server start]
> fork.
> (Delay forMilliseconds: 100) wait.
> " stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
> readAppendStream"
> socket := SpSocket connectToServerOnHost:  'localhost' port: 8123.
> stream := SwazooStream socket: socket
>
>
> Other considerations:
>
> SpFilename >>underlyingFilename (This method do not exist, but do not
> exist neither in the original one click aida/pharo image)
>
> Security class don't exist neither in the pharo one click image.
>
> #trimSeparators, is named in SwazooMD5 but do not seems implemented.
>
>
>
>
> To install Sport and Swazoo, follow the next steps:
>
> 1. Take a new Cuis 4.1 image.
>
> 2. From GitHub / garduino clone in your computer the repos
> Cuis-Cryptography
> Cuis-CompatibilityWithOtherSmalltalks
> Cuis-Pharo14CompatibilityLayer
> Cuis-Sport
> Cuis-Swazoo
>
> 3. In a workspace run the next script:
>
> | slash repo |
> slash _ FileDirectory slash.
> repo := '/Users/Shared/YOURCODEREPOSITORYPATH/'.
> {
> repo, slash, 'Cuis-Cryptography', slash, 'Cuis-System-Hashing.pck.st' .
> repo, slash, 'Cuis-CompatibilityWithOtherSmalltalks', slash,
> 'Cuis-CompatibilityWithOtherSmalltalks.pck.st' .
> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
> 'Cuis-Network-Protocols.pck.st' .
> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
> 'Cuis-Network-Url.pck.st' .
> repo, slash, 'Cuis-Sport', slash, 'Sport.pck.st' .
> repo, slash, 'Cuis-Swazoo', slash, 'Swazoo.pck.st' .
> }
> do:
> [ :fileName | CodePackageFile installPackageStream:
> (FileStream concreteStream readOnlyFileNamed: fileName)
> ].
>
>
> 4. You will notice some warnings in the Transcript regarding some
> Network-* classes, it is because I'm installing here only the minimum
> code that I need for Swazoo and I must still end to polish the delta
> between the Network protocol in Cuis vs Pharo/Squeak
>
> 5. I did also an early port of TimeStamp, not existing in Cuis, and I
> have still 1 failing test.
>
>
> But Swazoo seems to work ok, all the test pass and the tests I did in
> the workspace seems to work, but as I'm not in expert in Swazoo, I
> will be more than happy of receive corrections, suggestion, etc, to
> leave the port in a stable state.
>
>
>
> --
> Sincerely,
> Germán Arduino
> about.me/garduino


--
Janko Mivšek
Aida/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] A first port to Cuis of Sport and Swazoo

Janko Mivšek
In reply to this post by garduino
Hi Germán,

Very nice, thanks a lot!. Can you prepare a Cuis image and publish it
somewhere so that we can download it?

Also, for methods which are now Cuis specific, put "Cuis specific" in a
method comment.

Use := consistently everywhere instead of _

Those process specific changes are worth spread to Swazoos on other
dialects as "least common denominator" too, I'll try to do that today on VW.

Best regards
Janko


Dne 20. 01. 2013 16:59, piše Germán Arduino:

> Hi:
>
> The first versions of Sport and Swazoo working in Cuis 4.1 with all
> tests green are ready to install.
>
> The changes I did in Swazoo are:
>
>
> - Avoid Unicode support that don't exist in Cuis
>
>
> WebSocketConnection:
>
> fromUtf8: aString
> "Squeak specific"
>
> "gsa 14/01/2013 for Cuis port"
> "^[aString convertFromEncoding: #utf8] on: Error do: [:ex | aString ]
> ^ aString
>
>
> toUtf8: aString
> "Squeak specific"
> "
> | converter in out |
> converter := UTF8TextConverter new.
> in := aString readStream.
> out := WriteStream on: ''.
> [in atEnd] whileFalse:
> [converter nextPut: in next toStream: out].
> ^out contents
> "
> ^ aString.
>
>
> SwazooBuffer >>closeChunkTo: aSocket
>
> " gsa 18/01/2013 used String instead ByteString for Cuis"
> "chunk := ByteString new: 5."
>
>
> - Avoid #fork and #forkAt: calling #newProcess instead:
>
> HTTPServer >>start
>
> start
> | swazooProcess |
> self loop isNil ifTrue: [
> self socket:
> (SwazooSocket
> serverOnIP: self ipCorrected
> port: self port).
> self socket listenFor: 128.
> self loop: (swazooProcess _ [ [ self acceptConnection ] repeat ] newProcess).
> swazooProcess name: 'Swazoo ' , DateAndTime now asString.
> swazooProcess priority: Processor userBackgroundPriority.
> swazooProcess resume ].
>
> instead of the original code:
>
> start
> self loop isNil ifTrue: [
> self socket:
> (SwazooSocket
> serverOnIP: self ipCorrected
> port: self port).
> self socket listenFor: 128.
> self loop: ([ [ self acceptConnection ] repeat ] forkAt: Processor
> userBackgroundPriority) ].
>
>
>
> HTTPServer >>setUp
>
> setUp
> | socket swazooProcess |
> (Delay forMilliseconds: 100) wait.
> server _ HTTPServer new.
> swazooProcess _ [
> server
> ip: 'localhost';
> port: 8123.
> server start ] newProcess.
> swazooProcess name: 'Swazoo HTTPServer Test'.
> swazooProcess resume.
> (Delay forMilliseconds: 100) wait.
> " stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
> readAppendStream"
> socket _ SpSocket
> connectToServerOnHost: 'localhost'
> port: 8123.
> stream _ SwazooStream socket: socket.
>
> instead of the original code:
>
> setUp
> | socket |
> (Delay forMilliseconds: 100) wait.
> server := HTTPServer new.
> [server ip: 'localhost'; port: 8123.
> server start]
> fork.
> (Delay forMilliseconds: 100) wait.
> " stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
> readAppendStream"
> socket := SpSocket connectToServerOnHost:  'localhost' port: 8123.
> stream := SwazooStream socket: socket
>
>
> Other considerations:
>
> SpFilename >>underlyingFilename (This method do not exist, but do not
> exist neither in the original one click aida/pharo image)
>
> Security class don't exist neither in the pharo one click image.
>
> #trimSeparators, is named in SwazooMD5 but do not seems implemented.
>
>
>
>
> To install Sport and Swazoo, follow the next steps:
>
> 1. Take a new Cuis 4.1 image.
>
> 2. From GitHub / garduino clone in your computer the repos
> Cuis-Cryptography
> Cuis-CompatibilityWithOtherSmalltalks
> Cuis-Pharo14CompatibilityLayer
> Cuis-Sport
> Cuis-Swazoo
>
> 3. In a workspace run the next script:
>
> | slash repo |
> slash _ FileDirectory slash.
> repo := '/Users/Shared/YOURCODEREPOSITORYPATH/'.
> {
> repo, slash, 'Cuis-Cryptography', slash, 'Cuis-System-Hashing.pck.st' .
> repo, slash, 'Cuis-CompatibilityWithOtherSmalltalks', slash,
> 'Cuis-CompatibilityWithOtherSmalltalks.pck.st' .
> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
> 'Cuis-Network-Protocols.pck.st' .
> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
> 'Cuis-Network-Url.pck.st' .
> repo, slash, 'Cuis-Sport', slash, 'Sport.pck.st' .
> repo, slash, 'Cuis-Swazoo', slash, 'Swazoo.pck.st' .
> }
> do:
> [ :fileName | CodePackageFile installPackageStream:
> (FileStream concreteStream readOnlyFileNamed: fileName)
> ].
>
>
> 4. You will notice some warnings in the Transcript regarding some
> Network-* classes, it is because I'm installing here only the minimum
> code that I need for Swazoo and I must still end to polish the delta
> between the Network protocol in Cuis vs Pharo/Squeak
>
> 5. I did also an early port of TimeStamp, not existing in Cuis, and I
> have still 1 failing test.
>
>
> But Swazoo seems to work ok, all the test pass and the tests I did in
> the workspace seems to work, but as I'm not in expert in Swazoo, I
> will be more than happy of receive corrections, suggestion, etc, to
> leave the port in a stable state.
>
>
>
> --
> Sincerely,
> Germán Arduino
> about.me/garduino


--
Janko Mivšek
Aida/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] [ANN] A first port to Cuis of Sport and Swazoo

Janko Mivšek
In reply to this post by Hannes Hirzel
Dne 21. 01. 2013 09:42, piše H. Hirzel:

> Regarding Unicode support I think we can say that Cuis has limited
> Unicode support
>
> 1) It reads and writes files in UTF8
> 2) The clipboard is UTF8
>
> The limitation is that only certain code points are supported
> internally -- actually only 256 of them. Internally the characters are
> 8 bit.

Would be introducing a WideString and a Character supporting >256 code
points too hard to achieve?

Just for storing Unicode internally, which is enough for web apps, where
an UI is not part of Cuis.

Best regards
Janko


>
> We have the utility method
> Character class>>iso8859s15CodeForUnicodeCodePoint: codePoint
>
> which maps a Unicode code point to the internal coding system
>
> And
> String>>iso8859s15ToUtf8
> "Convert the given string to UTF-8 from the internal encoding: ISO
> Latin 9 (ISO 8859-15)"
>
>
> To ease porting I suggest to have a Cuis specific
>
>     UTF8TextConverter
>
>
> version in the Compabilitiy layer package.
>
> It will convert the 8859-15 properly. The other Unicode points should
> be replaced with the
> \unnnn notation (JavaScript / Java) or HTML entities ( &#nnn; ).
>
>
>
> Kind regards
>
> Hannes
>
>
>
> On 1/20/13, Germán Arduino <[hidden email]> wrote:
>> Hi:
>>
>> The first versions of Sport and Swazoo working in Cuis 4.1 with all
>> tests green are ready to install.
>>
>> The changes I did in Swazoo are:
>>
>>
>> - Avoid Unicode support that don't exist in Cuis
>>
>>
>> WebSocketConnection:
>>
>> fromUtf8: aString
>> "Squeak specific"
>>
>> "gsa 14/01/2013 for Cuis port"
>> "^[aString convertFromEncoding: #utf8] on: Error do: [:ex | aString ]
>> ^ aString
>>
>>
>> toUtf8: aString
>> "Squeak specific"
>> "
>> | converter in out |
>> converter := UTF8TextConverter new.
>> in := aString readStream.
>> out := WriteStream on: ''.
>> [in atEnd] whileFalse:
>> [converter nextPut: in next toStream: out].
>> ^out contents
>> "
>> ^ aString.
>>
>>
>> SwazooBuffer >>closeChunkTo: aSocket
>>
>> " gsa 18/01/2013 used String instead ByteString for Cuis"
>> "chunk := ByteString new: 5."
>>
>>
>> - Avoid #fork and #forkAt: calling #newProcess instead:
>>
>> HTTPServer >>start
>>
>> start
>> | swazooProcess |
>> self loop isNil ifTrue: [
>> self socket:
>> (SwazooSocket
>> serverOnIP: self ipCorrected
>> port: self port).
>> self socket listenFor: 128.
>> self loop: (swazooProcess _ [ [ self acceptConnection ] repeat ]
>> newProcess).
>> swazooProcess name: 'Swazoo ' , DateAndTime now asString.
>> swazooProcess priority: Processor userBackgroundPriority.
>> swazooProcess resume ].
>>
>> instead of the original code:
>>
>> start
>> self loop isNil ifTrue: [
>> self socket:
>> (SwazooSocket
>> serverOnIP: self ipCorrected
>> port: self port).
>> self socket listenFor: 128.
>> self loop: ([ [ self acceptConnection ] repeat ] forkAt: Processor
>> userBackgroundPriority) ].
>>
>>
>>
>> HTTPServer >>setUp
>>
>> setUp
>> | socket swazooProcess |
>> (Delay forMilliseconds: 100) wait.
>> server _ HTTPServer new.
>> swazooProcess _ [
>> server
>> ip: 'localhost';
>> port: 8123.
>> server start ] newProcess.
>> swazooProcess name: 'Swazoo HTTPServer Test'.
>> swazooProcess resume.
>> (Delay forMilliseconds: 100) wait.
>> " stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
>> readAppendStream"
>> socket _ SpSocket
>> connectToServerOnHost: 'localhost'
>> port: 8123.
>> stream _ SwazooStream socket: socket.
>>
>> instead of the original code:
>>
>> setUp
>> | socket |
>> (Delay forMilliseconds: 100) wait.
>> server := HTTPServer new.
>> [server ip: 'localhost'; port: 8123.
>> server start]
>> fork.
>> (Delay forMilliseconds: 100) wait.
>> " stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
>> readAppendStream"
>> socket := SpSocket connectToServerOnHost:  'localhost' port: 8123.
>> stream := SwazooStream socket: socket
>>
>>
>> Other considerations:
>>
>> SpFilename >>underlyingFilename (This method do not exist, but do not
>> exist neither in the original one click aida/pharo image)
>>
>> Security class don't exist neither in the pharo one click image.
>>
>> #trimSeparators, is named in SwazooMD5 but do not seems implemented.
>>
>>
>>
>>
>> To install Sport and Swazoo, follow the next steps:
>>
>> 1. Take a new Cuis 4.1 image.
>>
>> 2. From GitHub / garduino clone in your computer the repos
>> Cuis-Cryptography
>> Cuis-CompatibilityWithOtherSmalltalks
>> Cuis-Pharo14CompatibilityLayer
>> Cuis-Sport
>> Cuis-Swazoo
>>
>> 3. In a workspace run the next script:
>>
>> | slash repo |
>> slash _ FileDirectory slash.
>> repo := '/Users/Shared/YOURCODEREPOSITORYPATH/'.
>> {
>> repo, slash, 'Cuis-Cryptography', slash, 'Cuis-System-Hashing.pck.st' .
>> repo, slash, 'Cuis-CompatibilityWithOtherSmalltalks', slash,
>> 'Cuis-CompatibilityWithOtherSmalltalks.pck.st' .
>> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
>> 'Cuis-Network-Protocols.pck.st' .
>> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
>> 'Cuis-Network-Url.pck.st' .
>> repo, slash, 'Cuis-Sport', slash, 'Sport.pck.st' .
>> repo, slash, 'Cuis-Swazoo', slash, 'Swazoo.pck.st' .
>> }
>> do:
>> [ :fileName | CodePackageFile installPackageStream:
>> (FileStream concreteStream readOnlyFileNamed: fileName)
>> ].
>>
>>
>> 4. You will notice some warnings in the Transcript regarding some
>> Network-* classes, it is because I'm installing here only the minimum
>> code that I need for Swazoo and I must still end to polish the delta
>> between the Network protocol in Cuis vs Pharo/Squeak
>>
>> 5. I did also an early port of TimeStamp, not existing in Cuis, and I
>> have still 1 failing test.
>>
>>
>> But Swazoo seems to work ok, all the test pass and the tests I did in
>> the workspace seems to work, but as I'm not in expert in Swazoo, I
>> will be more than happy of receive corrections, suggestion, etc, to
>> leave the port in a stable state.
>>
>>
>>
>> --
>> Sincerely,
>> Germán Arduino
>> about.me/garduino
>>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>

--
Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] A first port to Cuis of Sport and Swazoo

garduino
In reply to this post by Janko Mivšek
Hi Janko:

2013/1/21 Janko Mivšek <[hidden email]>:
> Hi Germán,
>
> Very nice, thanks a lot!. Can you prepare a Cuis image and publish it
> somewhere so that we can download it?
>

Yes, no problem, but I invested the remaining of yesterday doing the
initial filein of Aida as you asked.

May be I can publish all together when have all finished?


> Also, for methods which are now Cuis specific, put "Cuis specific" in a
> method comment.
>

Yes, or self flag: #adaptedForCuis as Hannes suggested?


> Use := consistently everywhere instead of _
>

I never use _, it's a resulting of copy / paste from the code to the
mail client :)


> Those process specific changes are worth spread to Swazoos on other
> dialects as "least common denominator" too, I'll try to do that today on VW.
>

ok! And count me to maintain Sport / Swazoo in Cuis.

> Best regards
> Janko
>

--
Sincerely,
Germán Arduino
about.me/garduino
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] A first port to Cuis of Sport and Swazoo

Janko Mivšek


Dne 21. 01. 2013 11:28, piše Germán Arduino:

> Hi Janko:
>
> 2013/1/21 Janko Mivšek <[hidden email]>:
>> Hi Germán,
>>
>> Very nice, thanks a lot!. Can you prepare a Cuis image and publish it
>> somewhere so that we can download it?
>>
>
> Yes, no problem, but I invested the remaining of yesterday doing the
> initial filein of Aida as you asked.
>
> May be I can publish all together when have all finished?

Even better, yes!

>> Also, for methods which are now Cuis specific, put "Cuis specific" in a
>> method comment.
>>
>
> Yes, or self flag: #adaptedForCuis as Hannes suggested?

#flag: is Squeak and friends specific, not supported on VW. Let we stay
with proven "* specific" comments instead.

>> Use := consistently everywhere instead of _
>>
>
> I never use _, it's a resulting of copy / paste from the code to the
> mail client :)

Ah :)

>
>> Those process specific changes are worth spread to Swazoos on other
>> dialects as "least common denominator" too, I'll try to do that today on VW.
>>
>
> ok! And count me to maintain Sport / Swazoo in Cuis.

Perfect!

Janko


--
Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] A first port to Cuis of Sport and Swazoo

Hannes Hirzel
On 1/21/13, Janko Mivšek <[hidden email]> wrote:

>
>
> Dne 21. 01. 2013 11:28, piše Germán Arduino:
>> Hi Janko:
>>
>> 2013/1/21 Janko Mivšek <[hidden email]>:
>>> Hi Germán,
>>>
>>> Very nice, thanks a lot!. Can you prepare a Cuis image and publish it
>>> somewhere so that we can download it?
>>>
>>
>> Yes, no problem, but I invested the remaining of yesterday doing the
>> initial filein of Aida as you asked.
>>
>> May be I can publish all together when have all finished?
>
> Even better, yes!
>
>>> Also, for methods which are now Cuis specific, put "Cuis specific" in a
>>> method comment.
>>>
>>
>> Yes, or self flag: #adaptedForCuis as Hannes suggested?
>
> #flag: is Squeak and friends specific, not supported on VW. Let we stay
> with proven "* specific" comments instead.

How do you browse methods marked with a comment
            "* specific"

in Squeak and Cuis?

--Hannes

>
>>> Use := consistently everywhere instead of _
>>>
>>
>> I never use _, it's a resulting of copy / paste from the code to the
>> mail client :)
>
> Ah :)
>
>>
>>> Those process specific changes are worth spread to Swazoos on other
>>> dialects as "least common denominator" too, I'll try to do that today on
>>> VW.
>>>
>>
>> ok! And count me to maintain Sport / Swazoo in Cuis.
>
> Perfect!
>
> Janko
>
>
> --
> Janko Mivšek
> Svetovalec za informatiko
> Eranova d.o.o.
> Ljubljana, Slovenija
> www.eranova.si
> tel:  01 514 22 55
> faks: 01 514 22 56
> gsm: 031 674 565
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Marking a dialect specific code (was: A first port to Cuis of Sport and Swazoo)

Janko Mivšek
Hi Hannes,

Dne 21. 01. 2013 12:28, piše H. Hirzel:

>>>> Also, for methods which are now Cuis specific, put "Cuis specific" in a
>>>> method comment.

>>> Yes, or self flag: #adaptedForCuis as Hannes suggested?

>> #flag: is Squeak and friends specific, not supported on VW. Let we stay
>> with proven "* specific" comments instead.

> How do you browse methods marked with a comment
>             "* specific"
>
> in Squeak and Cuis?

Such browsing could probably be portable from VW. One of the tricks is
also to put dialect specific methods in separate, as stable as possible
methods, so that they probably won't change for a long time. That way
you avoid overriding them accidentally. Even if you do that, you can
find such error with dialect specific code browser easily.

Of course a first preventive is to avoid dialect specific code at all
and rather try to find a code which works on all dialects, a "least
common denominator" therefore. As we are just doing with process forking
code.

In any case, this pragmatic way of dealing with dialect specific code
serves me well for Aida last 6 years after the first Squeak port, so I
propose to continue for Cuis port as well.

Best regards
Janko






_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Marking a dialect specific code (was: A first port to Cuis of Sport and Swazoo)

Hannes Hirzel
Hello Janko


On 1/21/13, Janko Mivšek <[hidden email]> wrote:

> Hi Hannes,
>
> Dne 21. 01. 2013 12:28, piše H. Hirzel:
>
>>>>> Also, for methods which are now Cuis specific, put "Cuis specific" in a
>>>>> method comment.
>
>>>> Yes, or self flag: #adaptedForCuis as Hannes suggested?
>
>>> #flag: is Squeak and friends specific, not supported on VW. Let we stay
>>> with proven "* specific" comments instead.
>
>> How do you browse methods marked with a comment
>>             "* specific"
>>
>> in Squeak and Cuis?
>
> Such browsing could probably be portable from VW. One of the tricks is
> also to put dialect specific methods in separate, as stable as possible
> methods, so that they probably won't change for a long time. That way
> you avoid overriding them accidentally. Even if you do that, you can
> find such error with dialect specific code browser easily.

Sounds good, but is a bit abstract.

Could you give an example, please?






>
> Of course a first preventive is to avoid dialect specific code at all
> and rather try to find a code which works on all dialects, a "least
> common denominator" therefore. As we are just doing with process forking
> code.

Sure

> In any case, this pragmatic way of dealing with dialect specific code
> serves me well for Aida last 6 years after the first Squeak port, so I
> propose to continue for Cuis port as well.

I assume you have a package which implements such a layer.

Could you give a reference please?

Kind regards
Hannes
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Marking a dialect specific code

Janko Mivšek
Dne 21. 01. 2013 14:29, piše H. Hirzel:

>>>>>> Also, for methods which are now Cuis specific, put "Cuis specific" in a
>>>>>> method comment.
>>
>>>>> Yes, or self flag: #adaptedForCuis as Hannes suggested?
>>
>>>> #flag: is Squeak and friends specific, not supported on VW. Let we stay
>>>> with proven "* specific" comments instead.
>>
>>> How do you browse methods marked with a comment
>>>             "* specific"
>>>
>>> in Squeak and Cuis?
>>
>> Such browsing could probably be portable from VW. One of the tricks is
>> also to put dialect specific methods in separate, as stable as possible
>> methods, so that they probably won't change for a long time. That way
>> you avoid overriding them accidentally. Even if you do that, you can
>> find such error with dialect specific code browser easily.
>
> Sounds good, but is a bit abstract.
>
> Could you give an example, please?

See the recent example while introducing WebSockets to Swazoo and making
it as portable as possible. Base64 encoding is very dialect specific, so
it is good to introduce a separate, the only dialect specific method:

SwazooWebSocket>>base64From: aByteArray
  "VW specific"
  ^Base64EncodingStream encodeBytesWithoutLineBreaks: aByteArray

Now the method using Base64 encoding is not dialect specific anymore:

SwazooWebSocket>>calculateAcceptValueFrom:  aHTTPRequest
  | key string hash |
  key := (aHTTPRequest headerAt:'Sec-WebSocket-Key' ifAbsent:[]) value.
  key = nil ifTrue: [^nil].
  string := key, '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'.
  hash := self shaHashFrom: string.
  ^self base64From: hash

>> Of course a first preventive is to avoid dialect specific code at all
>> and rather try to find a code which works on all dialects, a "least
>> common denominator" therefore. As we are just doing with process forking
>> code.
>
> Sure
>
>> In any case, this pragmatic way of dealing with dialect specific code
>> serves me well for Aida last 6 years after the first Squeak port, so I
>> propose to continue for Cuis port as well.
>
> I assume you have a package which implements such a layer.
>
> Could you give a reference please?

On VW Aida there are two methods to find and browse dialect specific
methods:

AIDASite class>>platformSpecificMethods
  "find all methods which have '* specific' (like 'VW specific')
   in method comments"

AIDASite class>>browsePlatformSpecificMethods
  "open a code browser with all platform specific methods having like
   'VW specific' in method comments"

It would be really nice if someone helps here a bit and port at least
first method to other dialects too.

Best regards
Janko




_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] A first port to Cuis of Sport and Swazoo

Janko Mivšek
In reply to this post by garduino
Germán,

I put your process changes on VW Swazoo and here is the result, which is
probably least common denominator to all dialects:


HTTPServer>>start
 self loop isNil ifTrue:
   [self socket:
      (SwazooSocket serverOnIP: self ipCorrected port: self port).
   self socket listenFor: 128.
   self loop:
      [ [self acceptConnection] repeat]
           newProcess.
   self loop
      priority: Processor userBackgroundPriority;
      resume
   ]


Additionally:

HTTPConnection>>interact

  ...

  self server isMultiThreading
    ifTrue:
      [self loop: interactionBlock newProcess.
       self loop
         priority: Processor userBackgroundPriority;
         resume]
    ifFalse: [interactionBlock value].
  ^self


ServerTest>>setUp doesn't seem to have the process problem (process is
not stored in any variable, so I propose to leave this method unchanged.

Best regards
Janko


Dne 20. 01. 2013 16:59, piše Germán Arduino:

> Hi:
>
> The first versions of Sport and Swazoo working in Cuis 4.1 with all
> tests green are ready to install.
>
> The changes I did in Swazoo are:
>
>
> - Avoid Unicode support that don't exist in Cuis
>
>
> WebSocketConnection:
>
> fromUtf8: aString
> "Squeak specific"
>
> "gsa 14/01/2013 for Cuis port"
> "^[aString convertFromEncoding: #utf8] on: Error do: [:ex | aString ]
> ^ aString
>
>
> toUtf8: aString
> "Squeak specific"
> "
> | converter in out |
> converter := UTF8TextConverter new.
> in := aString readStream.
> out := WriteStream on: ''.
> [in atEnd] whileFalse:
> [converter nextPut: in next toStream: out].
> ^out contents
> "
> ^ aString.
>
>
> SwazooBuffer >>closeChunkTo: aSocket
>
> " gsa 18/01/2013 used String instead ByteString for Cuis"
> "chunk := ByteString new: 5."
>
>
> - Avoid #fork and #forkAt: calling #newProcess instead:
>
> HTTPServer >>start
>
> start
> | swazooProcess |
> self loop isNil ifTrue: [
> self socket:
> (SwazooSocket
> serverOnIP: self ipCorrected
> port: self port).
> self socket listenFor: 128.
> self loop: (swazooProcess _ [ [ self acceptConnection ] repeat ] newProcess).
> swazooProcess name: 'Swazoo ' , DateAndTime now asString.
> swazooProcess priority: Processor userBackgroundPriority.
> swazooProcess resume ].
>
> instead of the original code:
>
> start
> self loop isNil ifTrue: [
> self socket:
> (SwazooSocket
> serverOnIP: self ipCorrected
> port: self port).
> self socket listenFor: 128.
> self loop: ([ [ self acceptConnection ] repeat ] forkAt: Processor
> userBackgroundPriority) ].
>
>
>
> HTTPServer >>setUp
>
> setUp
> | socket swazooProcess |
> (Delay forMilliseconds: 100) wait.
> server _ HTTPServer new.
> swazooProcess _ [
> server
> ip: 'localhost';
> port: 8123.
> server start ] newProcess.
> swazooProcess name: 'Swazoo HTTPServer Test'.
> swazooProcess resume.
> (Delay forMilliseconds: 100) wait.
> " stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
> readAppendStream"
> socket _ SpSocket
> connectToServerOnHost: 'localhost'
> port: 8123.
> stream _ SwazooStream socket: socket.
>
> instead of the original code:
>
> setUp
> | socket |
> (Delay forMilliseconds: 100) wait.
> server := HTTPServer new.
> [server ip: 'localhost'; port: 8123.
> server start]
> fork.
> (Delay forMilliseconds: 100) wait.
> " stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
> readAppendStream"
> socket := SpSocket connectToServerOnHost:  'localhost' port: 8123.
> stream := SwazooStream socket: socket
>
>
> Other considerations:
>
> SpFilename >>underlyingFilename (This method do not exist, but do not
> exist neither in the original one click aida/pharo image)
>
> Security class don't exist neither in the pharo one click image.
>
> #trimSeparators, is named in SwazooMD5 but do not seems implemented.
>
>
>
>
> To install Sport and Swazoo, follow the next steps:
>
> 1. Take a new Cuis 4.1 image.
>
> 2. From GitHub / garduino clone in your computer the repos
> Cuis-Cryptography
> Cuis-CompatibilityWithOtherSmalltalks
> Cuis-Pharo14CompatibilityLayer
> Cuis-Sport
> Cuis-Swazoo
>
> 3. In a workspace run the next script:
>
> | slash repo |
> slash _ FileDirectory slash.
> repo := '/Users/Shared/YOURCODEREPOSITORYPATH/'.
> {
> repo, slash, 'Cuis-Cryptography', slash, 'Cuis-System-Hashing.pck.st' .
> repo, slash, 'Cuis-CompatibilityWithOtherSmalltalks', slash,
> 'Cuis-CompatibilityWithOtherSmalltalks.pck.st' .
> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
> 'Cuis-Network-Protocols.pck.st' .
> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
> 'Cuis-Network-Url.pck.st' .
> repo, slash, 'Cuis-Sport', slash, 'Sport.pck.st' .
> repo, slash, 'Cuis-Swazoo', slash, 'Swazoo.pck.st' .
> }
> do:
> [ :fileName | CodePackageFile installPackageStream:
> (FileStream concreteStream readOnlyFileNamed: fileName)
> ].
>
>
> 4. You will notice some warnings in the Transcript regarding some
> Network-* classes, it is because I'm installing here only the minimum
> code that I need for Swazoo and I must still end to polish the delta
> between the Network protocol in Cuis vs Pharo/Squeak
>
> 5. I did also an early port of TimeStamp, not existing in Cuis, and I
> have still 1 failing test.
>
>
> But Swazoo seems to work ok, all the test pass and the tests I did in
> the workspace seems to work, but as I'm not in expert in Swazoo, I
> will be more than happy of receive corrections, suggestion, etc, to
> leave the port in a stable state.

--
Janko Mivšek
Aida/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] [ANN] A first port to Cuis of Sport and Swazoo

Hannes Hirzel
Janko, a question

On 1/21/13, Janko Mivšek <[hidden email]> wrote:
> Germán,
>
> I put your process changes on VW Swazoo


where is it?

   http://www.swazoo.org/download.html
does not have an entry for VW Swazoo alone.

--Hannes

> and here is the result, which is
> probably least common denominator to all dialects:
>
>
> HTTPServer>>start
>  self loop isNil ifTrue:
>    [self socket:
>       (SwazooSocket serverOnIP: self ipCorrected port: self port).
>    self socket listenFor: 128.
>    self loop:
>       [ [self acceptConnection] repeat]
>            newProcess.
>    self loop
>       priority: Processor userBackgroundPriority;
>       resume
>    ]
>
>
> Additionally:
>
> HTTPConnection>>interact
>
>   ...
>
>   self server isMultiThreading
>     ifTrue:
>       [self loop: interactionBlock newProcess.
>        self loop
>          priority: Processor userBackgroundPriority;
>          resume]
>     ifFalse: [interactionBlock value].
>   ^self
>
>
> ServerTest>>setUp doesn't seem to have the process problem (process is
> not stored in any variable, so I propose to leave this method unchanged.
>
> Best regards
> Janko
>
>
> Dne 20. 01. 2013 16:59, piše Germán Arduino:
>> Hi:
>>
>> The first versions of Sport and Swazoo working in Cuis 4.1 with all
>> tests green are ready to install.
>>
>> The changes I did in Swazoo are:
>>
>>
>> - Avoid Unicode support that don't exist in Cuis
>>
>>
>> WebSocketConnection:
>>
>> fromUtf8: aString
>> "Squeak specific"
>>
>> "gsa 14/01/2013 for Cuis port"
>> "^[aString convertFromEncoding: #utf8] on: Error do: [:ex | aString ]
>> ^ aString
>>
>>
>> toUtf8: aString
>> "Squeak specific"
>> "
>> | converter in out |
>> converter := UTF8TextConverter new.
>> in := aString readStream.
>> out := WriteStream on: ''.
>> [in atEnd] whileFalse:
>> [converter nextPut: in next toStream: out].
>> ^out contents
>> "
>> ^ aString.
>>
>>
>> SwazooBuffer >>closeChunkTo: aSocket
>>
>> " gsa 18/01/2013 used String instead ByteString for Cuis"
>> "chunk := ByteString new: 5."
>>
>>
>> - Avoid #fork and #forkAt: calling #newProcess instead:
>>
>> HTTPServer >>start
>>
>> start
>> | swazooProcess |
>> self loop isNil ifTrue: [
>> self socket:
>> (SwazooSocket
>> serverOnIP: self ipCorrected
>> port: self port).
>> self socket listenFor: 128.
>> self loop: (swazooProcess _ [ [ self acceptConnection ] repeat ]
>> newProcess).
>> swazooProcess name: 'Swazoo ' , DateAndTime now asString.
>> swazooProcess priority: Processor userBackgroundPriority.
>> swazooProcess resume ].
>>
>> instead of the original code:
>>
>> start
>> self loop isNil ifTrue: [
>> self socket:
>> (SwazooSocket
>> serverOnIP: self ipCorrected
>> port: self port).
>> self socket listenFor: 128.
>> self loop: ([ [ self acceptConnection ] repeat ] forkAt: Processor
>> userBackgroundPriority) ].
>>
>>
>>
>> HTTPServer >>setUp
>>
>> setUp
>> | socket swazooProcess |
>> (Delay forMilliseconds: 100) wait.
>> server _ HTTPServer new.
>> swazooProcess _ [
>> server
>> ip: 'localhost';
>> port: 8123.
>> server start ] newProcess.
>> swazooProcess name: 'Swazoo HTTPServer Test'.
>> swazooProcess resume.
>> (Delay forMilliseconds: 100) wait.
>> " stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
>> readAppendStream"
>> socket _ SpSocket
>> connectToServerOnHost: 'localhost'
>> port: 8123.
>> stream _ SwazooStream socket: socket.
>>
>> instead of the original code:
>>
>> setUp
>> | socket |
>> (Delay forMilliseconds: 100) wait.
>> server := HTTPServer new.
>> [server ip: 'localhost'; port: 8123.
>> server start]
>> fork.
>> (Delay forMilliseconds: 100) wait.
>> " stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
>> readAppendStream"
>> socket := SpSocket connectToServerOnHost:  'localhost' port: 8123.
>> stream := SwazooStream socket: socket
>>
>>
>> Other considerations:
>>
>> SpFilename >>underlyingFilename (This method do not exist, but do not
>> exist neither in the original one click aida/pharo image)
>>
>> Security class don't exist neither in the pharo one click image.
>>
>> #trimSeparators, is named in SwazooMD5 but do not seems implemented.
>>
>>
>>
>>
>> To install Sport and Swazoo, follow the next steps:
>>
>> 1. Take a new Cuis 4.1 image.
>>
>> 2. From GitHub / garduino clone in your computer the repos
>> Cuis-Cryptography
>> Cuis-CompatibilityWithOtherSmalltalks
>> Cuis-Pharo14CompatibilityLayer
>> Cuis-Sport
>> Cuis-Swazoo
>>
>> 3. In a workspace run the next script:
>>
>> | slash repo |
>> slash _ FileDirectory slash.
>> repo := '/Users/Shared/YOURCODEREPOSITORYPATH/'.
>> {
>> repo, slash, 'Cuis-Cryptography', slash, 'Cuis-System-Hashing.pck.st' .
>> repo, slash, 'Cuis-CompatibilityWithOtherSmalltalks', slash,
>> 'Cuis-CompatibilityWithOtherSmalltalks.pck.st' .
>> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
>> 'Cuis-Network-Protocols.pck.st' .
>> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
>> 'Cuis-Network-Url.pck.st' .
>> repo, slash, 'Cuis-Sport', slash, 'Sport.pck.st' .
>> repo, slash, 'Cuis-Swazoo', slash, 'Swazoo.pck.st' .
>> }
>> do:
>> [ :fileName | CodePackageFile installPackageStream:
>> (FileStream concreteStream readOnlyFileNamed: fileName)
>> ].
>>
>>
>> 4. You will notice some warnings in the Transcript regarding some
>> Network-* classes, it is because I'm installing here only the minimum
>> code that I need for Swazoo and I must still end to polish the delta
>> between the Network protocol in Cuis vs Pharo/Squeak
>>
>> 5. I did also an early port of TimeStamp, not existing in Cuis, and I
>> have still 1 failing test.
>>
>>
>> But Swazoo seems to work ok, all the test pass and the tests I did in
>> the workspace seems to work, but as I'm not in expert in Swazoo, I
>> will be more than happy of receive corrections, suggestion, etc, to
>> leave the port in a stable state.
>
> --
> Janko Mivšek
> Aida/Web
> Smalltalk Web Application Server
> http://www.aidaweb.si
>
> _______________________________________________
> Cuis mailing list
> [hidden email]
> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] [ANN] A first port to Cuis of Sport and Swazoo

Janko Mivšek
In reply to this post by Janko Mivšek
Hi Juan,

Dne 22. 01. 2013 03:34, piše Juan Vuletich:

> Hi Janko,
>
> Please note that the decision to answer nil in #fork and friends is not
> arbitrary. Using the result in Squeak and other derivatives is not
> reliable. This was discussed a loong time ago in squeak-dev, and folks
> there thought that having back compatibility was more important that
> preventing some bugs...
>
> What I mean is, not using the object returned from #fork, and calling
> #newProcess is safer in Squeak and Pharo too.

Yes, the patch below will be now part of all Swazoos on all supported
dialects. On VW first to production test it, because VW is stil my first
development and deployment environment for commercial work.

Thanks for further clarification
Janko


>
> Cheers,
> Juan Vuletich
>
> Janko Mivšek wrote:
>> Germán,
>>
>> I put your process changes on VW Swazoo and here is the result, which is
>> probably least common denominator to all dialects:
>>
>>
>> HTTPServer>>start
>>  self loop isNil ifTrue:
>>    [self socket:
>>       (SwazooSocket serverOnIP: self ipCorrected port: self port).
>>    self socket listenFor: 128.
>>    self loop:
>>       [ [self acceptConnection] repeat]
>>            newProcess.
>>    self loop
>>       priority: Processor userBackgroundPriority;
>>       resume
>>    ]
>>
>>
>> Additionally:
>>
>> HTTPConnection>>interact
>>
>>   ...
>>
>>   self server isMultiThreading
>>     ifTrue:
>>       [self loop: interactionBlock newProcess.
>>        self loop
>>          priority: Processor userBackgroundPriority;
>>          resume]
>>     ifFalse: [interactionBlock value].
>>   ^self
>>
>>
>> ServerTest>>setUp doesn't seem to have the process problem (process is
>> not stored in any variable, so I propose to leave this method unchanged.
>>
>> Best regards
>> Janko
>>
>>
>> Dne 20. 01. 2013 16:59, piše Germán Arduino:
>>  
>>> Hi:
>>>
>>> The first versions of Sport and Swazoo working in Cuis 4.1 with all
>>> tests green are ready to install.
>>>
>>> The changes I did in Swazoo are:
>>>
>>>
>>> - Avoid Unicode support that don't exist in Cuis
>>>
>>>
>>> WebSocketConnection:
>>>
>>> fromUtf8: aString
>>> "Squeak specific"
>>>
>>> "gsa 14/01/2013 for Cuis port"
>>> "^[aString convertFromEncoding: #utf8] on: Error do: [:ex | aString ]
>>> ^ aString
>>>
>>>
>>> toUtf8: aString
>>> "Squeak specific"
>>> "
>>> | converter in out |
>>> converter := UTF8TextConverter new.
>>> in := aString readStream.
>>> out := WriteStream on: ''.
>>> [in atEnd] whileFalse:
>>> [converter nextPut: in next toStream: out].
>>> ^out contents
>>> "
>>> ^ aString.
>>>
>>>
>>> SwazooBuffer >>closeChunkTo: aSocket
>>>
>>>     " gsa 18/01/2013 used String instead ByteString for Cuis"
>>>     "chunk := ByteString new: 5."
>>>
>>>
>>> - Avoid #fork and #forkAt: calling #newProcess instead:
>>>
>>> HTTPServer >>start
>>>
>>> start
>>>     | swazooProcess |
>>>     self loop isNil ifTrue: [
>>>         self socket:
>>>             (SwazooSocket
>>>                 serverOnIP: self ipCorrected
>>>                 port: self port).
>>>         self socket listenFor: 128.
>>>         self loop: (swazooProcess _ [ [ self acceptConnection ]
>>> repeat ] newProcess).
>>>         swazooProcess name: 'Swazoo ' , DateAndTime now asString.
>>>         swazooProcess priority: Processor userBackgroundPriority.
>>>         swazooProcess resume ].
>>>
>>> instead of the original code:
>>>
>>> start
>>>     self loop isNil ifTrue: [
>>>         self socket:
>>>             (SwazooSocket
>>>                 serverOnIP: self ipCorrected
>>>                 port: self port).
>>>         self socket listenFor: 128.
>>>         self loop: ([ [ self acceptConnection ] repeat ] forkAt:
>>> Processor
>>> userBackgroundPriority) ].
>>>
>>>
>>>
>>> HTTPServer >>setUp
>>>
>>> setUp
>>>     | socket swazooProcess |
>>>     (Delay forMilliseconds: 100) wait.
>>>     server _ HTTPServer new.
>>>     swazooProcess _ [
>>>     server
>>>          ip: 'localhost';
>>>          port: 8123.
>>>     server start ] newProcess.
>>>     swazooProcess name: 'Swazoo HTTPServer Test'.
>>>     swazooProcess resume.
>>>     (Delay forMilliseconds: 100) wait.
>>>     "     stream := (SocketAccessor newTCPclientToHost: 'localhost'
>>> port: 8123)
>>>                 readAppendStream"
>>>     socket _ SpSocket
>>>         connectToServerOnHost: 'localhost'
>>>         port: 8123.
>>>     stream _ SwazooStream socket: socket.
>>>
>>> instead of the original code:
>>>
>>> setUp
>>>     | socket |
>>>     (Delay forMilliseconds: 100) wait.
>>>     server := HTTPServer new.
>>>     [server ip: 'localhost'; port: 8123.
>>>     server start]
>>>         fork.
>>>     (Delay forMilliseconds: 100) wait.
>>> "     stream := (SocketAccessor newTCPclientToHost: 'localhost' port:
>>> 8123)
>>>                 readAppendStream"
>>>     socket := SpSocket connectToServerOnHost:  'localhost' port: 8123.
>>>     stream := SwazooStream socket: socket
>>>
>>>
>>> Other considerations:
>>>
>>> SpFilename >>underlyingFilename (This method do not exist, but do not
>>> exist neither in the original one click aida/pharo image)
>>>
>>> Security class don't exist neither in the pharo one click image.
>>>
>>> #trimSeparators, is named in SwazooMD5 but do not seems implemented.
>>>
>>>
>>>
>>>
>>> To install Sport and Swazoo, follow the next steps:
>>>
>>> 1. Take a new Cuis 4.1 image.
>>>
>>> 2. From GitHub / garduino clone in your computer the repos
>>> Cuis-Cryptography
>>> Cuis-CompatibilityWithOtherSmalltalks
>>> Cuis-Pharo14CompatibilityLayer
>>> Cuis-Sport
>>> Cuis-Swazoo
>>>
>>> 3. In a workspace run the next script:
>>>
>>> | slash repo |
>>> slash _ FileDirectory slash.
>>> repo := '/Users/Shared/YOURCODEREPOSITORYPATH/'.
>>> {
>>> repo, slash, 'Cuis-Cryptography', slash, 'Cuis-System-Hashing.pck.st' .
>>> repo, slash, 'Cuis-CompatibilityWithOtherSmalltalks', slash,
>>> 'Cuis-CompatibilityWithOtherSmalltalks.pck.st' .
>>> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
>>> 'Cuis-Network-Protocols.pck.st' .
>>> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
>>> 'Cuis-Network-Url.pck.st' .
>>> repo, slash, 'Cuis-Sport', slash, 'Sport.pck.st' .
>>> repo, slash, 'Cuis-Swazoo', slash, 'Swazoo.pck.st' .
>>> }
>>> do:
>>> [ :fileName | CodePackageFile installPackageStream:
>>> (FileStream concreteStream readOnlyFileNamed: fileName)
>>> ].
>>>
>>>
>>> 4. You will notice some warnings in the Transcript regarding some
>>> Network-* classes, it is because I'm installing here only the minimum
>>> code that I need for Swazoo and I must still end to polish the delta
>>> between the Network protocol in Cuis vs Pharo/Squeak
>>>
>>> 5. I did also an early port of TimeStamp, not existing in Cuis, and I
>>> have still 1 failing test.
>>>
>>>
>>> But Swazoo seems to work ok, all the test pass and the tests I did in
>>> the workspace seems to work, but as I'm not in expert in Swazoo, I
>>> will be more than happy of receive corrections, suggestion, etc, to
>>> leave the port in a stable state.
>>>    
>>
>>  
>
>
> _______________________________________________
> Cuis mailing list
> [hidden email]
> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org

--
Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Fwd: [Cuis] [ANN] A first port to Cuis of Sport and Swazoo

garduino
In reply to this post by Janko Mivšek
Sorry, I forgot to make Reply All


---------- Forwarded message ----------
From: Germán Arduino <[hidden email]>
Date: 2013/1/22
Subject: Re: [Cuis] [aida] [ANN] A first port to Cuis of Sport and Swazoo
To: Discussion of Cuis Smalltalk <[hidden email]>


Hi Janko:

Ok! Fixed at this way, tested and commited!

Germán.


2013/1/21 Janko Mivšek <[hidden email]>:

> Germán,
>
> I put your process changes on VW Swazoo and here is the result, which is
> probably least common denominator to all dialects:
>
>
> HTTPServer>>start
>  self loop isNil ifTrue:
>    [self socket:
>       (SwazooSocket serverOnIP: self ipCorrected port: self port).
>    self socket listenFor: 128.
>    self loop:
>       [ [self acceptConnection] repeat]
>            newProcess.
>    self loop
>       priority: Processor userBackgroundPriority;
>       resume
>    ]
>
>
> Additionally:
>
> HTTPConnection>>interact
>
>   ...
>
>   self server isMultiThreading
>     ifTrue:
>       [self loop: interactionBlock newProcess.
>        self loop
>          priority: Processor userBackgroundPriority;
>          resume]
>     ifFalse: [interactionBlock value].
>   ^self
>
>
> ServerTest>>setUp doesn't seem to have the process problem (process is
> not stored in any variable, so I propose to leave this method unchanged.
>
> Best regards
> Janko
>


--
Sincerely,
Germán Arduino
about.me/garduino
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] [ANN] A first port to Cuis of Sport and Swazoo

garduino
In reply to this post by garduino
Sorry, I forgot to make Reply All

2013/1/22 Germán Arduino <[hidden email]>:

> Thanks for the comments Hannes / Juan:
>
> I will look into it when have time, or if you prefer Hannes and want
> to help I will integrate it when finish with Aida.
>
> Germán.
>
>
>
> 2013/1/21 Juan Vuletich <[hidden email]>:
>> Hi Germán,
>>
>> Cool! Just a remark: Cuis does include conversion to/from utf-8 for the
>> charset it supports (ISO-8859-15, covering nearly all the latin alphabets).
>>
>> Cheers,
>> Juan Vuletich
>>
>> Germán Arduino wrote:
>>>
>>> Hi:
>>>
>>> The first versions of Sport and Swazoo working in Cuis 4.1 with all
>>> tests green are ready to install.
>>>
>>> The changes I did in Swazoo are:
>>>
>>>
>>> - Avoid Unicode support that don't exist in Cuis
>>>
>>>
>>> WebSocketConnection:
>>>
>>> fromUtf8: aString
>>> "Squeak specific"
>>>
>>> "gsa 14/01/2013 for Cuis port"
>>> "^[aString convertFromEncoding: #utf8] on: Error do: [:ex | aString ]
>>> ^ aString
>>>
>>>
>>> toUtf8: aString
>>> "Squeak specific"
>>> "
>>> | converter in out |
>>> converter := UTF8TextConverter new.
>>> in := aString readStream.
>>> out := WriteStream on: ''.
>>> [in atEnd] whileFalse:
>>> [converter nextPut: in next toStream: out].
>>> ^out contents
>>> "
>>> ^ aString.
>>>
>>>
>>> SwazooBuffer >>closeChunkTo: aSocket
>>>
>>>         " gsa 18/01/2013 used String instead ByteString for Cuis"
>>>         "chunk := ByteString new: 5."
>>>
>>>
>>> - Avoid #fork and #forkAt: calling #newProcess instead:
>>>
>>> HTTPServer >>start
>>>
>>> start
>>>         | swazooProcess |
>>>         self loop isNil ifTrue: [
>>>                 self socket:
>>>                         (SwazooSocket
>>>                                 serverOnIP: self ipCorrected
>>>                                 port: self port).
>>>                 self socket listenFor: 128.
>>>                 self loop: (swazooProcess _ [ [ self acceptConnection ]
>>> repeat ] newProcess).
>>>                 swazooProcess name: 'Swazoo ' , DateAndTime now asString.
>>>                 swazooProcess priority: Processor userBackgroundPriority.
>>>                 swazooProcess resume ].
>>>
>>> instead of the original code:
>>>
>>> start
>>>         self loop isNil ifTrue: [
>>>                 self socket:
>>>                         (SwazooSocket
>>>                                 serverOnIP: self ipCorrected
>>>                                 port: self port).
>>>                 self socket listenFor: 128.
>>>                 self loop: ([ [ self acceptConnection ] repeat ] forkAt:
>>> Processor
>>> userBackgroundPriority) ].
>>>
>>>
>>>
>>> HTTPServer >>setUp
>>>
>>> setUp
>>>         | socket swazooProcess |
>>>         (Delay forMilliseconds: 100) wait.
>>>         server _ HTTPServer new.
>>>         swazooProcess _ [
>>>         server
>>>                  ip: 'localhost';
>>>                  port: 8123.
>>>         server start ] newProcess.
>>>         swazooProcess name: 'Swazoo HTTPServer Test'.
>>>         swazooProcess resume.
>>>         (Delay forMilliseconds: 100) wait.
>>>         "       stream := (SocketAccessor newTCPclientToHost: 'localhost'
>>> port: 8123)
>>>                                 readAppendStream"
>>>         socket _ SpSocket
>>>                 connectToServerOnHost: 'localhost'
>>>                 port: 8123.
>>>         stream _ SwazooStream socket: socket.
>>>
>>> instead of the original code:
>>>
>>> setUp
>>>         | socket |
>>>         (Delay forMilliseconds: 100) wait.
>>>         server := HTTPServer new.
>>>         [server ip: 'localhost'; port: 8123.
>>>         server start]
>>>                 fork.
>>>         (Delay forMilliseconds: 100) wait.
>>> "       stream := (SocketAccessor newTCPclientToHost: 'localhost' port:
>>> 8123)
>>>                                 readAppendStream"
>>>         socket := SpSocket connectToServerOnHost:  'localhost' port: 8123.
>>>         stream := SwazooStream socket: socket
>>>
>>>
>>> Other considerations:
>>>
>>> SpFilename >>underlyingFilename (This method do not exist, but do not
>>> exist neither in the original one click aida/pharo image)
>>>
>>> Security class don't exist neither in the pharo one click image.
>>>
>>> #trimSeparators, is named in SwazooMD5 but do not seems implemented.
>>>
>>>
>>>
>>>
>>> To install Sport and Swazoo, follow the next steps:
>>>
>>> 1. Take a new Cuis 4.1 image.
>>>
>>> 2. From GitHub / garduino clone in your computer the repos
>>> Cuis-Cryptography
>>> Cuis-CompatibilityWithOtherSmalltalks
>>> Cuis-Pharo14CompatibilityLayer
>>> Cuis-Sport
>>> Cuis-Swazoo
>>>
>>> 3. In a workspace run the next script:
>>>
>>> | slash repo |
>>> slash _ FileDirectory slash.
>>> repo := '/Users/Shared/YOURCODEREPOSITORYPATH/'.
>>> {
>>> repo, slash, 'Cuis-Cryptography', slash, 'Cuis-System-Hashing.pck.st' .
>>> repo, slash, 'Cuis-CompatibilityWithOtherSmalltalks', slash,
>>> 'Cuis-CompatibilityWithOtherSmalltalks.pck.st' .
>>> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
>>> 'Cuis-Network-Protocols.pck.st' .
>>> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
>>> 'Cuis-Network-Url.pck.st' .
>>> repo, slash, 'Cuis-Sport', slash, 'Sport.pck.st' .
>>> repo, slash, 'Cuis-Swazoo', slash, 'Swazoo.pck.st' .
>>> }
>>> do:
>>> [ :fileName | CodePackageFile installPackageStream:
>>> (FileStream concreteStream readOnlyFileNamed: fileName)
>>> ].
>>>
>>>
>>> 4. You will notice some warnings in the Transcript regarding some
>>> Network-* classes, it is because I'm installing here only the minimum
>>> code that I need for Swazoo and I must still end to polish the delta
>>> between the Network protocol in Cuis vs Pharo/Squeak
>>>
>>> 5. I did also an early port of TimeStamp, not existing in Cuis, and I
>>> have still 1 failing test.
>>>
>>>
>>> But Swazoo seems to work ok, all the test pass and the tests I did in
>>> the workspace seems to work, but as I'm not in expert in Swazoo, I
>>> will be more than happy of receive corrections, suggestion, etc, to
>>> leave the port in a stable state.
>>>
>>>
>>>
>>> --
>>> Sincerely,
>>> Germán Arduino
>>> about.me/garduino
>>>
>>> ------------------------------------------------------------------------
>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>> _______________________________________________
>>> Cuis mailing list
>>> [hidden email]
>>> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>>>
>>
>>
>>
>> _______________________________________________
>> Cuis mailing list
>> [hidden email]
>> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>
>
>
> --
> Sincerely,
> Germán Arduino
> about.me/garduino



--
Sincerely,
Germán Arduino
about.me/garduino
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] [ANN] A first port to Cuis of Sport and Swazoo

Hannes Hirzel
In reply to this post by garduino
On 1/22/13, Germán Arduino <[hidden email]> wrote:
> Thanks for the comments Hannes / Juan:
>
> I will look into it when have time, or if you prefer Hannes and want
> to help I will integrate it when finish with Aida.
>
> Germán.
>

Hello Germán

I did an installation test of https://github.com/garduino/Cuis-Swazoo

 I followed the instructions in my fork of your work. I had updated
the README.md

 https://github.com/hhzl/Cuis-Swazoo

The file in gave the Transcript error messages copied in below.

Then I run all the tests which start with 'Swazoo'

57 of 57 pass

Is this the full number?

From http://www.swazoo.org/documentation.html
I take the following test snippet

"Here is the simplest recipe possible to make your Swazoo site
running. "Doit" from a workspace:"

    |site|
    site := Site new name: 'test'. "name is just for convinience"
    site host: 'localhost' ip: '127.0.0.1' port: 8888.
    SwazooServer singleton addSite: site.
    site start.

RESULT: Class #Site is not known, FAILURE


BTW 'convinience' should be 'convenience'

Could you please include an updated version of the simple example on
http://www.swazoo.org/documentation.html in your README.md

https://github.com/garduino/Cuis-Swazoo




Thank you for your work on porting a web server to Cuis.

Kind regards
Hannes


....
----SNAPSHOT----#(21 January 2013 10:50:35 pm) Cuis4.1-1572.image
priorSource: 2904356
Installed ChangeSet:
1573-ReloadStandardFileMenu-JuanVuletich-2013Jan21-22h58m-jmv.1.cs.st
Installed ChangeSet:
1574-utf8ConversionEnh-HannesHirzel-2013Jan22-15h09m-hjh.1.cs.st
Installed ChangeSet:
1575-AddHannesAsKnownAuthor-JuanVuletich-2013Jan22-15h10m-jmv.1.cs.st
Installed ChangeSet:
1576-MorphDragAndDropDoc-JuanVuletich-2013Jan22-15h11m-jmv.1.cs.st

----SNAPSHOT----#(23 January 2013 12:06:20 am) Cuis4.1-1576.image
priorSource: 2952114
=============

Package Cuis-System-Hashing successfully installed
=============

ScaledDecimal class>>readFrom: (SqNumberParser is Undeclared)
Package Cuis-CompatibilityWithOtherSmalltalks successfully installed
Undeclared: a Dictionary(#SqNumberParser->nil )
=============

HTTPSocket class>>httpGetDocument:args:accept:request: (Url is Undeclared)
HTTPSocketSqueak class>>fetchExternalSettingsIn: (ExternalSettings is
Undeclared)
HTTPSocketSqueak class>>httpGetDocument:args:accept:request: (Url is
Undeclared)
HTTPSocketSqueak class>>httpGif: (GIFReadWriter is Undeclared)
HTTPSocketSqueak class>>httpJpeg: (JPEGReadWriter is Undeclared)
HTTPSocketSqueak class>>httpPost:content:type:accept:request: (Url is
Undeclared)
HTTPSocketSqueak class>>httpPut:to:user:passwd: (Url is Undeclared)
HTTPSocketSqueak class>>httpRequest:url:headers:content:response:
(MIMEDocument is Undeclared)
HTTPSocketSqueak class>>httpShowChunk: (StringHolder is Undeclared)
HTTPSocketSqueak class>>httpShowPage: (StringHolder is Undeclared)
HTTPSocketSqueak class>>initialize (ExternalSettings is Undeclared)
HTTPSocketSqueak class>>showImage:named: (Project is Undeclared)
SMTPClient>>mailFrom: (MailAddressParser is Undeclared)
MessageNotUnderstood: UndefinedObject>>registerClient:
while evaluating: HTTPSocketSqueak initialize
MessageNotUnderstood: Preferences class>>valueOfPreference:
while evaluating: HTTPSocketSqueak initialize
MessageNotUnderstood: Preferences class>>valueOfPreference:
while evaluating: HTTPSocketSqueak initialize
MessageNotUnderstood: Preferences class>>valueOfPreference:
while evaluating: HTTPSocketSqueak initialize
MessageNotUnderstood: Preferences class>>valueOfPreference:
while evaluating: HTTPSocketSqueak initialize

Package Cuis-Network-Protocols successfully installed
Undeclared: a Dictionary(#ExternalSettings->nil #GIFReadWriter->nil
#JPEGReadWriter->nil #MIMEDocument->nil #MailAddressParser->nil
#Project->nil #SqNumberParser->nil #StringHolder->nil #Url->nil )
=============

FileUrl>>retrieveContents (MIMEDocument is Undeclared)
FileUrl>>retrieveContents (MIMELocalFileDocument is Undeclared)
FileUrl>>retrieveContents (MIMEDocument is Undeclared)
FtpUrl>>retrieveContents(password is shadowed)
FtpUrl>>retrieveContents (ServerDirectory is Undeclared)
FtpUrl>>retrieveContents (ServerDirectory is Undeclared)
FtpUrl>>retrieveContents (MIMEDocument is Undeclared)
FtpUrl>>retrieveContents (MIMEDocument is Undeclared)
FtpUrl>>retrieveContents (MIMEDocument is Undeclared)
HttpUrl>>normalizeContents: (MIMEDocument is Undeclared)
HttpUrl>>normalizeContents: (MIMEDocument is Undeclared)
HttpUrl>>normalizeContents: (MIMEDocument is Undeclared)
HttpUrl>>normalizeContents: (MIMEDocument is Undeclared)
MailtoUrl>>activate (MailSender is Undeclared)
MailtoUrl>>activate (MailMessage is Undeclared)
MailtoUrl>>composeText (MailSender is Undeclared)
Package Cuis-Network-Url successfully installed
Undeclared: a Dictionary(#ExternalSettings->nil #GIFReadWriter->nil
#JPEGReadWriter->nil #MIMEDocument->nil #MIMELocalFileDocument->nil
#MailAddressParser->nil #MailMessage->nil #MailSender->nil
#Project->nil #ServerDirectory->nil #SqNumberParser->nil
#StringHolder->nil )
=============

SpFilename>>underlyingFilename (underlyingFilename is Undeclared)
Package Sport successfully installed
Undeclared: a Dictionary(#ExternalSettings->nil #GIFReadWriter->nil
#JPEGReadWriter->nil #MIMEDocument->nil #MIMELocalFileDocument->nil
#MailAddressParser->nil #MailMessage->nil #MailSender->nil
#Project->nil #ServerDirectory->nil #SqNumberParser->nil
#StringHolder->nil #underlyingFilename->nil )
=============

SwazooMD5Digest class>>hash: (Security is Undeclared)
Package Swazoo successfully installed
Undeclared: a Dictionary(#ExternalSettings->nil #GIFReadWriter->nil
#JPEGReadWriter->nil #MIMEDocument->nil #MIMELocalFileDocument->nil
#MailAddressParser->nil #MailMessage->nil #MailSender->nil
#Project->nil #Security->nil #ServerDirectory->nil
#SqNumberParser->nil #StringHolder->nil #underlyingFilename->nil )
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] [ANN] A first port to Cuis of Sport and Swazoo

garduino
HI Hannes:

2013/1/24 H. Hirzel <[hidden email]>:

> On 1/22/13, Germán Arduino <[hidden email]> wrote:
>> Thanks for the comments Hannes / Juan:
>>
>> I will look into it when have time, or if you prefer Hannes and want
>> to help I will integrate it when finish with Aida.
>>
>> Germán.
>>
>
> Hello Germán
>
> I did an installation test of https://github.com/garduino/Cuis-Swazoo
>
>  I followed the instructions in my fork of your work. I had updated
> the README.md
>
>  https://github.com/hhzl/Cuis-Swazoo
>
> The file in gave the Transcript error messages copied in below.
>
> Then I run all the tests which start with 'Swazoo'
>
> 57 of 57 pass
>
> Is this the full number?
>
No, the full number is 143 and the detail is in the attached pdf
(exported from a Google spreadsheet that I normally use to work in
ports).


> From http://www.swazoo.org/documentation.html
> I take the following test snippet
>
> "Here is the simplest recipe possible to make your Swazoo site
> running. "Doit" from a workspace:"
>
>     |site|
>     site := Site new name: 'test'. "name is just for convinience"
>     site host: 'localhost' ip: '127.0.0.1' port: 8888.
>     SwazooServer singleton addSite: site.
>     site start.
>
> RESULT: Class #Site is not known, FAILURE
>
Currently you should use SwazooSite instead Site.

(I'm not trying in an image now, only responding of memory)

For easier handling of the sites I developed (in the past) a sort of
console in differente variations (for Aida, Iliad (screenshot
attached)), I think that I should revamp now for Cuis and add the code
to Swazoo, what do you think?


>
> BTW 'convinience' should be 'convenience'
>

Sorry, but I do not have access to the swazoo site.

>
> Could you please include an updated version of the simple example on
> http://www.swazoo.org/documentation.html in your README.md
>
> https://github.com/garduino/Cuis-Swazoo
>
>

Annotated on my to-do list.


>
>
> Thank you for your work on porting a web server to Cuis.
>

Thank you for the encouragement!

> Kind regards
> Hannes
>

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

Swazoo%20Port%20to%20Cuis%204.1%20-%20Hoja%201.pdf (56K) Download Attachment
AidaScribo Console.jpeg (31K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] [ANN] A first port to Cuis of Sport and Swazoo

Janko Mivšek
In reply to this post by Hannes Hirzel
Hi Hannes,

Dne 21. 01. 2013 16:12, piše H. Hirzel:

> Janko, a question
>
> On 1/21/13, Janko Mivšek <[hidden email]> wrote:
>> Germán,
>>
>> I put your process changes on VW Swazoo
>
>
> where is it?
>
>    http://www.swazoo.org/download.html
> does not have an entry for VW Swazoo alone.

I'm just upgrading download/install instructions. Thanks for notifying
on really ancient Swazoo docs :(

Best regards
Janko



> --Hannes
>
>> and here is the result, which is
>> probably least common denominator to all dialects:
>>
>>
>> HTTPServer>>start
>>  self loop isNil ifTrue:
>>    [self socket:
>>       (SwazooSocket serverOnIP: self ipCorrected port: self port).
>>    self socket listenFor: 128.
>>    self loop:
>>       [ [self acceptConnection] repeat]
>>            newProcess.
>>    self loop
>>       priority: Processor userBackgroundPriority;
>>       resume
>>    ]
>>
>>
>> Additionally:
>>
>> HTTPConnection>>interact
>>
>>   ...
>>
>>   self server isMultiThreading
>>     ifTrue:
>>       [self loop: interactionBlock newProcess.
>>        self loop
>>          priority: Processor userBackgroundPriority;
>>          resume]
>>     ifFalse: [interactionBlock value].
>>   ^self
>>
>>
>> ServerTest>>setUp doesn't seem to have the process problem (process is
>> not stored in any variable, so I propose to leave this method unchanged.
>>
>> Best regards
>> Janko
>>
>>
>> Dne 20. 01. 2013 16:59, piše Germán Arduino:
>>> Hi:
>>>
>>> The first versions of Sport and Swazoo working in Cuis 4.1 with all
>>> tests green are ready to install.
>>>
>>> The changes I did in Swazoo are:
>>>
>>>
>>> - Avoid Unicode support that don't exist in Cuis
>>>
>>>
>>> WebSocketConnection:
>>>
>>> fromUtf8: aString
>>> "Squeak specific"
>>>
>>> "gsa 14/01/2013 for Cuis port"
>>> "^[aString convertFromEncoding: #utf8] on: Error do: [:ex | aString ]
>>> ^ aString
>>>
>>>
>>> toUtf8: aString
>>> "Squeak specific"
>>> "
>>> | converter in out |
>>> converter := UTF8TextConverter new.
>>> in := aString readStream.
>>> out := WriteStream on: ''.
>>> [in atEnd] whileFalse:
>>> [converter nextPut: in next toStream: out].
>>> ^out contents
>>> "
>>> ^ aString.
>>>
>>>
>>> SwazooBuffer >>closeChunkTo: aSocket
>>>
>>> " gsa 18/01/2013 used String instead ByteString for Cuis"
>>> "chunk := ByteString new: 5."
>>>
>>>
>>> - Avoid #fork and #forkAt: calling #newProcess instead:
>>>
>>> HTTPServer >>start
>>>
>>> start
>>> | swazooProcess |
>>> self loop isNil ifTrue: [
>>> self socket:
>>> (SwazooSocket
>>> serverOnIP: self ipCorrected
>>> port: self port).
>>> self socket listenFor: 128.
>>> self loop: (swazooProcess _ [ [ self acceptConnection ] repeat ]
>>> newProcess).
>>> swazooProcess name: 'Swazoo ' , DateAndTime now asString.
>>> swazooProcess priority: Processor userBackgroundPriority.
>>> swazooProcess resume ].
>>>
>>> instead of the original code:
>>>
>>> start
>>> self loop isNil ifTrue: [
>>> self socket:
>>> (SwazooSocket
>>> serverOnIP: self ipCorrected
>>> port: self port).
>>> self socket listenFor: 128.
>>> self loop: ([ [ self acceptConnection ] repeat ] forkAt: Processor
>>> userBackgroundPriority) ].
>>>
>>>
>>>
>>> HTTPServer >>setUp
>>>
>>> setUp
>>> | socket swazooProcess |
>>> (Delay forMilliseconds: 100) wait.
>>> server _ HTTPServer new.
>>> swazooProcess _ [
>>> server
>>> ip: 'localhost';
>>> port: 8123.
>>> server start ] newProcess.
>>> swazooProcess name: 'Swazoo HTTPServer Test'.
>>> swazooProcess resume.
>>> (Delay forMilliseconds: 100) wait.
>>> " stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
>>> readAppendStream"
>>> socket _ SpSocket
>>> connectToServerOnHost: 'localhost'
>>> port: 8123.
>>> stream _ SwazooStream socket: socket.
>>>
>>> instead of the original code:
>>>
>>> setUp
>>> | socket |
>>> (Delay forMilliseconds: 100) wait.
>>> server := HTTPServer new.
>>> [server ip: 'localhost'; port: 8123.
>>> server start]
>>> fork.
>>> (Delay forMilliseconds: 100) wait.
>>> " stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
>>> readAppendStream"
>>> socket := SpSocket connectToServerOnHost:  'localhost' port: 8123.
>>> stream := SwazooStream socket: socket
>>>
>>>
>>> Other considerations:
>>>
>>> SpFilename >>underlyingFilename (This method do not exist, but do not
>>> exist neither in the original one click aida/pharo image)
>>>
>>> Security class don't exist neither in the pharo one click image.
>>>
>>> #trimSeparators, is named in SwazooMD5 but do not seems implemented.
>>>
>>>
>>>
>>>
>>> To install Sport and Swazoo, follow the next steps:
>>>
>>> 1. Take a new Cuis 4.1 image.
>>>
>>> 2. From GitHub / garduino clone in your computer the repos
>>> Cuis-Cryptography
>>> Cuis-CompatibilityWithOtherSmalltalks
>>> Cuis-Pharo14CompatibilityLayer
>>> Cuis-Sport
>>> Cuis-Swazoo
>>>
>>> 3. In a workspace run the next script:
>>>
>>> | slash repo |
>>> slash _ FileDirectory slash.
>>> repo := '/Users/Shared/YOURCODEREPOSITORYPATH/'.
>>> {
>>> repo, slash, 'Cuis-Cryptography', slash, 'Cuis-System-Hashing.pck.st' .
>>> repo, slash, 'Cuis-CompatibilityWithOtherSmalltalks', slash,
>>> 'Cuis-CompatibilityWithOtherSmalltalks.pck.st' .
>>> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
>>> 'Cuis-Network-Protocols.pck.st' .
>>> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
>>> 'Cuis-Network-Url.pck.st' .
>>> repo, slash, 'Cuis-Sport', slash, 'Sport.pck.st' .
>>> repo, slash, 'Cuis-Swazoo', slash, 'Swazoo.pck.st' .
>>> }
>>> do:
>>> [ :fileName | CodePackageFile installPackageStream:
>>> (FileStream concreteStream readOnlyFileNamed: fileName)
>>> ].
>>>
>>>
>>> 4. You will notice some warnings in the Transcript regarding some
>>> Network-* classes, it is because I'm installing here only the minimum
>>> code that I need for Swazoo and I must still end to polish the delta
>>> between the Network protocol in Cuis vs Pharo/Squeak
>>>
>>> 5. I did also an early port of TimeStamp, not existing in Cuis, and I
>>> have still 1 failing test.
>>>
>>>
>>> But Swazoo seems to work ok, all the test pass and the tests I did in
>>> the workspace seems to work, but as I'm not in expert in Swazoo, I
>>> will be more than happy of receive corrections, suggestion, etc, to
>>> leave the port in a stable state.
>>
>> --
>> Janko Mivšek
>> Aida/Web
>> Smalltalk Web Application Server
>> http://www.aidaweb.si
>>
>> _______________________________________________
>> Cuis mailing list
>> [hidden email]
>> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>

--
Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida