Loading ...
Sorry, an error occurred while loading the content.

Webserver in Self

Expand Messages
  • russell.allen23
    Hi anyone who is listening :) I have been a lurker on this list for a very long time (under another email address) and I vaguely remember some mention of a web
    Message 1 of 8 , May 13, 2008
    View Source
    • 0 Attachment
      Hi anyone who is listening :)

      I have been a lurker on this list for a very long time (under another email address) and I
      vaguely remember some mention of a web server written in Self. Does this thing exist
      anywhere or am I misremembering?

      Also, I can't download the earlier versions of the image (4.0, 4.1, 4.2) from the Sun site, so I
      can't get hold of the image with the web browser in it. Is there an alternative archive around
      for this stuff?

      Any help appreciated,

      Russell
    • Jecel Assumpcao Jr
      Russell, ... I don t remember any web server code. Squeak has several and it would be easy to borrow one, but depending on your needs it is probably not worth
      Message 2 of 8 , May 14, 2008
      View Source
      • 0 Attachment
        Russell,

        > I have been a lurker on this list for a very long time (under another email address) and I
        > vaguely remember some mention of a web server written in Self. Does this thing exist
        > anywhere or am I misremembering?

        I don't remember any web server code. Squeak has several and it would be
        easy to borrow one, but depending on your needs it is probably not worth
        the trouble. One of the first examples I coded in Self for my trainees
        (ten years ago) was a trivial web server which always returned a
        constant page, just so they could see some result in an external web
        browser.

        > Also, I can't download the earlier versions of the image (4.0, 4.1, 4.2) from the Sun site, so I
        > can't get hold of the image with the web browser in it. Is there an alternative archive around
        > for this stuff?

        No, but if stuff has gone missing then it would a good idea to set one
        up.

        -- Jecel
      • russell.allen23
        Hi Jecel, ... I guess that means that Self has all the necessary socket primitives etc? Could you share your web server code to give me some help in where to
        Message 3 of 8 , May 14, 2008
        View Source
        • 0 Attachment
          Hi Jecel,

          --- In self-interest@yahoogroups.com, Jecel Assumpcao Jr <jecel@...> wrote:
          > I don't remember any web server code. Squeak has several and it would be
          > easy to borrow one, but depending on your needs it is probably not worth
          > the trouble. One of the first examples I coded in Self for my trainees
          > (ten years ago) was a trivial web server which always returned a
          > constant page, just so they could see some result in an external web
          > browser.

          I guess that means that Self has all the necessary socket primitives etc? Could you share
          your web server code to give me some help in where to start writing my own?

          I'm only playing around for fun, so don't have 'needs' as such :)

          > > Also, I can't download the earlier versions of the image (4.0, 4.1, 4.2) from the Sun
          site, so I
          > > can't get hold of the image with the web browser in it. Is there an alternative archive
          around
          > > for this stuff?
          >
          > No, but if stuff has gone missing then it would a good idea to set one
          > up.

          I'm happy to host an archive, but I don't have the files.

          Russell
        • Jecel Assumpcao Jr
          Russell, ... Sorry, but it was trivial enough that I didn t bother saving it. I was exploring the various socket APIs in Self (I had never looked at them
          Message 4 of 8 , May 16, 2008
          View Source
          • 0 Attachment
            Russell,
            > > [example for trainees]
            >
            > I guess that means that Self has all the necessary socket primitives etc? Could you share
            > your web server code to give me some help in where to start writing my own?

            Sorry, but it was trivial enough that I didn't bother saving it. I was
            exploring the various socket APIs in Self (I had never looked at them
            before) and wrote a code fragment that I would execute directly to see
            what would happen. My idea was to show the students the effect of
            spawning a new thread for each incoming request rather than handling
            them all in a single loop.

            > I'm only playing around for fun, so don't have 'needs' as such :)

            This was about five minutes worth of coding including lots of
            explanations. The code ignored what the browser sent and replied with a
            constant string.

            There might be some other server examples in the normal (Deno) Self
            snapshots.

            > > [should make old versions available]
            >
            > I'm happy to host an archive, but I don't have the files.

            What I have saved locally is a rather random sample of what was
            published. If somebody has a more complete archive it would be a better
            starting point.

            -- Jecel
          • Adam Spitz
            ... I ve just made 4.3, 4.2, and 4.1 available for download from (what I suppose is now) Self s new home on SourceForge: http://self.sourceforge.net (Thanks to
            Message 5 of 8 , May 16, 2008
            View Source
            • 0 Attachment
              Jecel Assumpcao Jr wrote:

              > > > [should make old versions available]
              > >
              > > I'm happy to host an archive, but I don't have the files.
              >
              > What I have saved locally is a rather random sample of what was
              > published. If somebody has a more complete archive it would be a
              > better starting point.

              I've just made 4.3, 4.2, and 4.1 available for download from (what I
              suppose is now) Self's new home on SourceForge:
              http://self.sourceforge.net

              (Thanks to Dave for sending me the 4.1 and 4.2 files.)

              I don't have anything dating further back than that. If anybody has
              older versions lying around, and wants to see them made available, let
              me know and we'll work out a way to get them uploaded.

              Russell, thanks for pointing out that the files are missing from Sun's
              site!


              Adam
            • mwolczko2
              ... It just occurred to me that perhaps you were thinking of the web *browser* that Dave wrote. I don t recall if it was part of a release.
              Message 6 of 8 , May 17, 2008
              View Source
              • 0 Attachment
                > I have been a lurker on this list for a very long time (under another email address) and I
                > vaguely remember some mention of a web server written in Self. Does this thing exist
                > anywhere or am I misremembering?
                >

                It just occurred to me that perhaps you were thinking of the web *browser* that Dave wrote.
                I don't recall if it was part of a release.
              • russell.allen23
                Hi everyone, Thanks for your help. I hacked up a small and extremely simple webserver based on the socketServer code. The transporter code goes in
                Message 7 of 8 , May 18, 2008
                View Source
                • 0 Attachment
                  Hi everyone,

                  Thanks for your help.

                  I hacked up a small and extremely simple webserver based on the socketServer code. The
                  transporter code goes in applications/. I'm not sure if I can attach it to an email so I've put
                  it up on the web at: http://russell-allen.com/self/downloads/files/webserver.self

                  File in with: bootstrap read: 'webserver' From: 'applications'
                  Setup default with: webserver registerServlet: (webserver exampleServlets fileServlet copy)
                  At: ''.
                  Start with: webserver start
                  Go to: http://localhost:8080/

                  I'd appreciate it if anyone has a change to try to file it in and possibly comment on how
                  'selfish' it is in style.

                  Some notes and comments I made while writing it:

                  - although I worked out how to write out a module from the materials, I had more trouble
                  reading it in again. I eventually found a note on Jecel's site with the magic incantation
                  (bootstrap read: 'webserver' From: 'applications'); I couldn't find a suitable way to do it
                  from morphic.
                  - I was pleasantly suprised how nice Self morphic was for *writing* code (the word isn't
                  quite right - it felt more like construction than writing)
                  - On the other hand, the inspectors were hard to *read* code with. My continual question
                  was "What methods does a string understand anyway?" and "How do I open a file?"; it was
                  hard to answer this without opening millions of inspectors all over my nice nebraskan
                  plain (plane?).
                  - I kept on writing stuff like "method: a = (|| a print )" and getting an error because I
                  needed a space between the bars.
                  - syntax differences from Smalltalk I haven't yet internalised: the use of capital letters in
                  message names, block notation; I kept writing: "[:k | k print]", slots between the bars; I
                  kept writing "| var1 var2 | code"
                  - it was most frustrating that the inspectors for arrays/lists/dictionaries showed the
                  normal slots and not a more useful view of what was actually in the collection

                  Cheers,

                  Russell

                  PS: I've just noticed that the Transporter has declared my code to be (c) Sun and Stanford,
                  which it obviously isn't. Is there a way to change this?
                • Jecel Assumpcao Jr
                  Russell, ... I don t think an attachment would have been a problem, but Yahoo probably wouldn t have saved it in the archives (at least not for very long) and
                  Message 8 of 8 , May 19, 2008
                  View Source
                  • 0 Attachment
                    Russell,

                    > I hacked up a small and extremely simple webserver based on the socketServer code. The
                    > transporter code goes in applications/. I'm not sure if I can attach it to an email so I've put
                    > it up on the web at: http://russell-allen.com/self/downloads/files/webserver.self

                    I don't think an attachment would have been a problem, but Yahoo
                    probably wouldn't have saved it in the archives (at least not for very
                    long) and that can be frustrating to people who later find these
                    messages.

                    > I'd appreciate it if anyone has a change to try to file it in and possibly comment on how
                    > 'selfish' it is in style.

                    Your use of C-like variable names (one letter) is certainly very Selfish
                    :-)

                    I didn't try to code, but it looks good. The only think I thought a bit
                    strange was your use of 'deadCopy' for creating new files and sockets.
                    But that might be the proper way to do it. Your use of a privacy
                    "parent" is a very good idea.

                    > - although I worked out how to write out a module from the materials, I had more trouble
                    > reading it in again. I eventually found a note on Jecel's site with the magic incantation
                    > (bootstrap read: 'webserver' From: 'applications'); I couldn't find a suitable way to do it
                    > from morphic.

                    It used to be easier. Before the transporter we just called _RunScript
                    (or something like that) directly on the string with the file name. Now
                    that we have the transporter it would be a good idea to have some kind
                    of GUI. That would probably be something like the File Browser in
                    Smalltalk.

                    > - I was pleasantly suprised how nice Self morphic was for *writing* code (the word isn't
                    > quite right - it felt more like construction than writing)
                    > - On the other hand, the inspectors were hard to *read* code with. My continual question
                    > was "What methods does a string understand anyway?" and "How do I open a file?"; it was
                    > hard to answer this without opening millions of inspectors all over my nice nebraskan
                    > plain (plane?).

                    There are some search tools but they are harder to use at first than
                    senders/implementors in Smalltalk. Searching manually through all the
                    parents takes up a lot of screen space, as you said, but at least it is
                    easy to do.

                    > - I kept on writing stuff like "method: a = (|| a print )" and getting an error because I
                    > needed a space between the bars.

                    That, and the various uses of ".", would be nice to fix.

                    > - syntax differences from Smalltalk I haven't yet internalised: the use of capital letters in
                    > message names, block notation; I kept writing: "[:k | k print]", slots between the bars; I
                    > kept writing "| var1 var2 | code"

                    When I wrote my first real application in Self 4.0, I didn't notice that
                    the snapshot I was using included Mario's Smalltalk stuff. So I kept
                    writting ifTrue:False: instead of ifTrue:IfFalse: but it worked! When I
                    moved the code to a newer Self all these Smalltalkisms broke down and I
                    had to rewrite it.

                    > - it was most frustrating that the inspectors for arrays/lists/dictionaries showed the
                    > normal slots and not a more useful view of what was actually in the collection

                    For small lists you can look at their name to quickly see what is in
                    them. Dictionaries are the worst case, specially since they are based on
                    parallel arrays instead of sets of associations like in Smalltalk. So
                    noting which value goes with which key can be complicated.

                    > PS: I've just noticed that the Transporter has declared my code to be (c) Sun and Stanford,
                    > which it obviously isn't. Is there a way to change this?

                    It should be easy to fix this. The transporter sends the 'copyright'
                    message to the module it is saving and normally all modules have that
                    data slot set to the string you noticed by virtual of being clone of the
                    init module. So you might want to inspect your module object and edit
                    its string.

                    -- Jecel
                  Your message has been successfully submitted and would be delivered to recipients shortly.