On Smalltalk

thoughts on Smalltalk and programming in general…
  • Home
  • About
  • Good Books
  • My Squeak Image
  • Popular Posts

Small Reddit, A Seaside Sample Application

By Ramon Leon - April 20, 2007 under Seaside, Smalltalk

I just uploaded a simple reddit clone sample Seaside application to SqueakSource. It’s meant be a very simple reference application to learn from, it’s only about 4 hours work total. There are comments throughout, and various techniques are used to demonstrate different ways of doing things. Some forms are generated directly via Seaside and some other by Magritte. Persistence is implement in image using dictionaries and collections.

Features include login, register, add entry, vote on entry, comment on entry, comment on comment. There are probably a few bugs. I’m not making any claims of best practice, only showing various ways I accomplish things to suite my needs.

Hopefully such an application will make Seaside more approachable for the newbie and help ease the lack of documentation available. I know when I first started learning, I was far more interested in actual samples than outdated documents. Enjoy!

UPDATE: Loading this code requires that you create a repository in Monticello. Just create a new HTTP repository with the following template using the +Repository button.

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

Once done, you can open the repository, select the package, and load it. It will create an application on localhost at /seaside/smallReddit, on whatever port you’re running Seaside on. You could also just download the mcz file directly and drag and drop it into your squeak image, at which point you’ll be prompted and asked what you’d like to do.

See my previous screencast about using Monticello for a quick visual on using Monticello.

Tags: Magritte, Programming, Seaside, Smalltalk

Related posts
    at: "Popular Posts";
    at: "Rails vs Seaside";
    at: "Aha! Moments in Lisp";

12 Comments so far

  1. Stephan Eggermont on April 23rd, 2007

    It needs a new image, where TimeStamp responds to -

  2. Ramon Leon on April 23rd, 2007

    Where TimeStamp responds to what?

  3. Ramon Leon on April 23rd, 2007

    Try DateAndTime, in 3.9 TimeStamp subclasses it, which is where the #- implementation is.

  4. Mike Stramba on May 21st, 2007

    Thanks for sharing this example ! I need all the examples I can find at this point :)

    Is it called “Small Reddit” because the textareas are so small ? :)

    Seriously, I’m new to Seaside and Squeak/Smalltalk programming and I’m looking through the docs, but haven’t found where the textarea sizes are set. Can you give me a hint ?

    Mike

  5. Ramon Leon on May 21st, 2007

    The text sizes aren’t set anywhere, that kind of stuff belongs in CSS. Style it however you like. It’s called Small Reddit as in Smalltalk Reddit.

  6. Mike Stramba on May 21st, 2007

    Ramon,

    So much for my humour ;)

    Do know what the syntax is for what I need to put in the style selector to change the textarea size ?

    I’ve googled for ‘css textarea’ .. ‘texarea css’ and other variations / tutorials, but haven’t found the right ‘magic’ words. There is not much documentatoin on the Seaside site either. I’m digging through the Pier application to see how the textareas have been setup but haven’t found it yet either.

    If not … I’ll keep looking :)

    Mike

  7. Ramon Leon on May 21st, 2007

    Oh, my bad, CSS is pretty simple. To style all tags of a type, just use the tag name

    textarea {width:200px;}

    to style a specific tag by name, use its id

    #notesField {width:200px;}

    to style it by class, assign a class to the tag, and create a CSS class for it

    .bigTextAreas {width:200px;}

    I just take it for granted that anyone getting into programming in Seaside, already has a decent knowledge of basic CSS. I can’t imagine learning Seaside before learning CSS, it wouldn’t make sense.

  8. Anonymous on May 21st, 2007

    Thanks very much for that info, it will help me a lot.

    Mike

  9. Tom Wilkinson on June 4th, 2007

    I am a bit like some of these other guys and finding it a bit hard to figure out where and what methods are the best to do things with.

    I am using Magritte to handle the generic input form that we have which has about 20 fields. They are basically a pulldown menu and then a possible comment on the result. (this is for a safety application) By default Margritte lays them down one after the other in a list style. We want to have it displayed in 2-3 columns across so that it all fits on one screen. Is this something that magritte can do or do we need to a totally custom screen? I keep finding references in the magritte area that says just set a custom rendering together and override the defaults but can’t find any descriptions or examples of what this might look like and am just not bright enough to figure it out on my own. Any pointing in the right direction would be appreciated. Nice work.

  10. Ramon Leon on June 4th, 2007

    On the class side of your model, or your model base class, just do this…

    descriptionContainer
        ^super descriptionContainer
          componentRenderer: YourCustomRenderer;
          yourself
    

    Have a look at MATableRenderer and MACssRenderer to see how to write a renderer.

  11. Kevin Driedger on September 29th, 2007

    Using SmallReddit with the latest squeak-web image from damien.cassou and the 3.10 vm, I get a walkback:
    MessageNotUnderstood: WAMessageDecoration>>onAnswer:

    * WAMessageDecoration(Object)>>doesNotUnderstand: #onAnswer:

    self a WAMessageDecoration
    temps
    aMessage onAnswer: [] in SRSmallRedditHome(WAComponent)>>show:onAnswer:delegation: {[:value | aDelegation re…etc…
    inst vars
    next a WAStateHolder(a MAValidationDecoration)
    message ‘Submit New Article’

    * SRSmallRedditHome(WAComponent)>>show:onAnswer:delegation:

    self a SRSmallRedditHome
    temps
    aComponent a WAMessageDecoration
    aBlock an AnswerContinuation
    aDelegation a WADelegation
    event nil
    value nil
    inst vars
    decoration a WAStateHolder(a WAAnswerHandler)
    errors nil
    pagedEntries a WABatchedList

    * SRSmallRedditHome(WAComponent)>>show:onAnswer:

    self a SRSmallRedditHome
    temps
    aComponent a WAMessageDecoration
    aBlock an AnswerContinuation
    inst vars
    decoration a WAStateHolder(a WAAnswerHandler)
    errors nil
    pagedEntries a WABatchedList

  12. Ramon Leon on September 30th, 2007

    Ah, OK, fixed, it’ll run in Seaside 2.8 now, SqueakSource updated.

Posting your comment.


  • Sponsors

  • Tags

    Databases General Linux Lisp Magritte Performance Profiling Programming Ruby Seaside Smalltalk Sql Squeak Updates
  • Categories

    • .Net (5)
    • Databases (9)
    • General (5)
    • Linux (2)
    • Lisp (3)
    • Magritte (2)
    • Programming (62)
    • Ruby (6)
    • Seaside (43)
    • Smalltalk (72)
    • Sql (2)
    • Stuff I Just Like (7)
    • Updates (7)
  • Blogs

    • (gem)Stone Soup
    • Avi Bryant
    • Boris Popov
    • defmacro
    • Goran Krampe
    • James Robertson
    • Lukas Renggli
    • Martin Fowler
    • Paul Graham
    • Ralph Johnson
    • Randal Schwartz
    • Vassili Bykov
    • Weekly Squeak
  • Favorite Tools

    • Apache
    • Cygwin
    • FireFox
    • Scriptaculous
    • Seaside
    • Squeak
    • Squeak Dev Image
    • Ubuntu Linux
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org

Copyright © 2008 On Smalltalk