Squeak SmalltalkJoker Squeak Smalltalk : Network : prevnext Wiki Web Application Needed Modules

Ehrm, are we talking about a web app? Or some custom socket stuff? Or 
a wiki implementation? Swiki itself (the original implementation) is a 
bit cryptic and if you aren't specifically interested in building a 
wiki-wiki, then I would not start looking there.

If you want to start doing simple web stuff and get going quickly 
without needing to understand the Magic of Seaside then I think 
HttpView2 is very simple to get started and play with. It has a few 
small examples and "Hello world" as a web app is a *single method* in 
*a single class* started as a server with *a single line*.

We who build web apps typically use 3.8 (or even 3.7) today. Note: If 
you use 3.7/3.8 you could also install FastSocketStream (a new 
implementation of class SocketStream) from SM and change the 
references to use it instead of the standard SocketStream class. In 
3.9 that implementation of class SocketStream is default.

I always run it in the same image as you develop in, no problem. The 
best way to *get started really quickly* if you want to grok the 
basics is IMHO to:

1. Get Squeak 3.8, install these using the SqueakMap Package Loader 
   under the open... menu: - DynamicBindings   (this is a "thread 
   locals" implementation by Stephen Pair, it is used in KomHttpServer 
   but is generally useful) - KomServices    (a services framework, 
   mainly Tcp, but also other stuff, is used by other packages too) - 
   KomHttpServer    (the web server itself, has competition these days 
   and will eventually probably be merged with Swazoo but time, 
   time...) - HTMLBuilder    (a HTML generation library derived from 
   Seaside and HttpView. Seaside has now a newer model so it is only 
   used in HttpView2 AFAIK) - HttpView2      (a very small simple web 
   "framework" which simply maps URL directories into methods in a 
   neat way, used by SqueakMap for example)

  ...and if you want to use the "newest" SocketStream now used in 3.9, 
  install FastSocketStream and change the reference in class 
  HttpAdaptor to use it.

2. Look in category HV-examples, read the class comments and methods. 
   Use the debugger - put a self halt in there, use your Firefox, and 
   examine the call stack inside the debugger all the way up to the 
   Socket communication.

Then, if HV2 doesn't fit your bill - it is best in simple apps or apps 
where you want total control over URLs and state management (since it 
is so much hands on and hackable) - Seaside is the way to go for more 
advanced apps, but it adds quite a bit of magic so it is not as easy 
to see how things work IMHO. But for advanced web apps Seaside blows 
HV2 out of the water. It also builds HTML using Smalltalk etc but uses 
continuations etc to maintain all state on the server side - so you 
don't need to muck about with URL parameters and all the other tricks 
to keep track of your state. It also uses a better HTML rendering 
model these days (the WACanvas classes).

regards, Göran

---

For SWIKI a good place to start may be the Comanche Swiki (current 
release is called "OneOfTheseDays"). The code + instructions how to 
set up an own swiki is available from:

       http://minnow.cc.gatech.edu/swiki/39

If you just want to use the swiki without digging in code you can use 
the predefined images from:

       http://minnow.cc.gatech.edu/swiki/15

Swiki runs on Squeak3.6#5429. Havent tried it in anything newer. Dont 
know about the quality of the code - at least it runs very stable.

For any other kind of HTML based web application I would recommend 
SEASIDE.

3.8 is a safe place for it - but I also use 3.9 already with Seaside 
  and Kom Http Server. You may want to use FastSocketStream with 3.8, 
  it's already built in into 3.9.

--------------------------------------------------------------

Here is a short guide on how to start with SEASIDE:

 1. Get Squeak (here I use 3.9b#7035)
 2. Load a webserver using SqueakMap package loader

     - load "Dynamic Bindings 1.2"
     - load "KomServices 1.1.2"
     - load "KomHttpServer 7.0.3"

 3. Open Monticello Browse and add the following HTTP repository:

   MCHttpRepository location: 'http://www.squeaksource.com/Seaside' 
   user: '' password: ''

 4. Open the repository and load the latest MCZ from Seaside2.6a3 
    (which is currently Seaside2.6a3-pmm.71.mcz) You can also download 
    the file using a browser and install via file list 
    (http://www.squeaksource.com/Seaside/Seaside2.6a3-pmm.71.mcz)

 5. create a class "Foo" as a subclass of WAComponent

 6. Implement the rendering method on the instance side:

     renderContentOn: html html text: Time now asString

 7. Registering the component as a webserver context root

        Foo registerAsApplication: 'bar'

 8. Start the webserver on a local port

        WAKom startOn: 9092

 9. Point your browser to

         http://localhost:9092/seaside/bar

Note that most WAComponent subclasses now use the new canvas rendering 
API by returning WARenderCanvas in the #rendererClass method. Have a 
look at the store demo http://localhost:9092/seaside/store. It starts 
in class WAStore.

You can administrate seaside using the webbrowser: 
http://localhost:9092/seaside/config

Visit http://www.seaside.st to get some more informations.

http://www.seasidehosting.st now offers free seaside hosting - you can 
upload and run images.

Some seaside applications/examples: http://offerte.prolife.ch 
(Insurance app developed by www.netstyle.ch) http://www.dabbledb.com 
(Avi Bryants startup, implemented using Seaside 
http://scriptaculous.seasidehosting.st (Seaside+AJAX examples) 
http://seachart.seasidehosting.st 
http://http://shorecomponents.seaside.st

-----------------------------------------------------------------------

There is also a Swiki implementation based on Seaside. Called 
SmallWiki2 and now renamed to "Pier". See 
http://smallwiki.unibe.ch/smallwiki/pier This one is used for 
http://www.squeak.org.

If you want a more lightweight framework for HTML generation  have a 
look at "HttpView" package from Göran. It's used for SqueakMap 
(http://map.squeakfoundation.org).

> >(If it isn't obvious from (1)) Hum a few bars about how you can
> >run the server on the same machine as you use it from

That's no problem with two images. For instance I run a local 
SqueakSource server which hosts all my code. I prepared a predefined 
image which is accessible from: 
http://astares.blogspot.com/2005/12/squeaksource-server-image.html

So I can start up a (client) development image and connect to this 
local SqueakSource using Monticello HTTP repositories and the 
webbrowser. Never tried to run server and clients in the same image.

Bye Torsten