Web Creole

54
October 2008 Web Creole 1 Stephen Taylor with big thanks to Morten Kromberg and Stefano Lanzavecchia Dyalog User Conference 2008 Elsinore, Denmark Web Creole

description

Web Creole. Stephen Taylor with big thanks to Morten Kromberg and Stefano Lanzavecchia Dyalog User Conference 2008 Elsinore, Denmark. Agenda. Creolisation and the Web Handling webspace: FTP, IIS, Apache Structure content with HTML Style with CSS Static site from a DWS - PowerPoint PPT Presentation

Transcript of Web Creole

Page 1: Web Creole

October 2008 Web Creole1

Stephen Taylor

with big thanks to

Morten Kromberg and Stefano Lanzavecchia

Dyalog User Conference 2008

Elsinore, Denmark

Web Creole

Page 2: Web Creole

Agenda

• Creolisation and the Web

• Handling webspace: FTP, IIS, Apache

• Structure content with HTML

• Style with CSS

• Static site from a DWS

• Dynamic site from a Dyalog script

October 2008 Web Creole2

Page 3: Web Creole

CREOLISATION AND THE WEB

October 2008 Web Creole3

Page 4: Web Creole

4

Browsers are a key interface

Web CreoleOctober 2008

Page 5: Web Creole

5

But most web pages are code-heavy

Web CreoleOctober 2008

Page 6: Web Creole

6

Creolised technology

• software stays soft, modifiable

• code must be readable

• use minimal technology

• know it well

Web CreoleOctober 2008

Page 7: Web Creole

7

Creole methods buy us

• fast, readable web pages

• good relationships with search engines

• simple generation of such pages from APL

• lightly adding a web to an application

Web CreoleOctober 2008

Page 8: Web Creole

8

Creolisation costs us

• learning

• careful writing

Web Creole

Page 9: Web Creole

9

Simplifying the problem space

(staying out of the mud)

Web CreoleOctober 2008

Page 10: Web Creole

10

Six mud patches

• ‘slice and dice’ – beware Photoshop

• Frames

• Pixel perfection

• Old browsers

• Not encoding in UTF-8

• Invalid markup

Web CreoleOctober 2008

Page 11: Web Creole

11

Writing lucid web pages

• Encode in UTF-8

• Use minimal, valid markup

• Abstract the presentation rules

Web CreoleOctober 2008

Page 12: Web Creole

12

Some UTF-8 editors

Windows • Notepad• Notepad2 from Flo's Freeware• UltraEdit from IDMMacOS• TextWrangler or BBEdit from Bare Bones

Software

Web CreoleOctober 2008

Page 13: Web Creole

HANDLING WEBSPACE

October 2008 Web Creole13

Page 14: Web Creole

14

Creole 101: do nothing

• Copy your existing output to the webspace

• For common file types (eg .doc, .pdf, .xls)

• Server will serve it

• Browser will display it

• Duh

Web CreoleOctober 2008

Page 15: Web Creole

FTP

• Use FTP client such as WS_FTP

• or Windows Explorer

• Drag and drop…

October 2008 Web Creole15

Page 16: Web Creole

16

Creole 102: write plain text

• Your app can write text files

• Browsers can display them• Eg http://www.hixie.ch/advocacy/xhtml

Web CreoleOctober 2008

Page 17: Web Creole

17

Good enough?

• If this is all you need, stop here

• examples\ex101.txt

Web CreoleOctober 2008

Page 18: Web Creole

STRUCTURE CONTENT WITH HTML

October 2008 Web Creole18

Page 19: Web Creole

19

Creole 103: HTML

Use HTML to add:• Structure (paras,

headers)• Images• Links• examples\ex103.htm

Web CreoleOctober 2008

Page 20: Web Creole

Validation is free

October 2008 Web Creole20

http://validator.w3.org

Page 21: Web Creole

STYLE WITH CSS

October 2008 Web Creole21

Page 22: Web Creole

22

Separate content and style

Web CreoleOctober 2008

Page 23: Web Creole

23

Cascading Style Sheets

• W3C on Cascading Style Sheets, http://www.w3.org/Style/CSS/

• CSS Zen Garden, http://www.csszengarden.com/

• A List Apart, http://www.alistapart.com/

• Various books, eg The Zen of CSS Design

Web CreoleOctober 2008

Page 24: Web Creole

24

Power of CSS

Web CreoleOctober 2008

Page 25: Web Creole

25

Same document, new style

Web CreoleOctober 2008

Page 26: Web Creole

26

And another style…

Web CreoleOctober 2008

Page 27: Web Creole

27

KISS: keep it sharp & simple

Web CreoleOctober 2008

Page 28: Web Creole

28

And keep the markup simple

Web CreoleOctober 2008

examples\apc

Page 29: Web Creole

Where to rule on style

• In the CSS stylesheet for rules used across multiple pages

• In the STYLE element for rules used only on one page

• In the style attribute for rules used on only one element

October 2008 Web Creole29

Page 30: Web Creole

30

Now we’ve simplified the problem space

and we’re ready for a creole solution

Web CreoleOctober 2008

Page 31: Web Creole

STATIC SITE FROM A DWS

October 2008 Web Creole31

Page 32: Web Creole

32

Creole 201

Generate a static web site

• from content organised in a .DWS

• in English

• (oh, and Japanese too, why not)• pook\pook.dws

Web CreoleOctober 2008

Page 33: Web Creole

33

Simple tag function

Web CreoleOctober 2008

Page 34: Web Creole

34

Array tag (1) lines←'The quick brown fox' 'jumps over the lazy dog.' 'p'tag⊃lines<p>The quick brown fox</p> ↑'p'tag¨lines<p>The quick brown fox</p> <p>jumps over the lazy dog.</p>

↑'body'tag'p'tag¨lines<body> <p>The quick brown fox</p> <p>jumps over the lazy dog.</p></body>

Web CreoleOctober 2008

Page 35: Web Creole

35

Array tag (2)

↑⊃tag/'html' 'body' 'p' lines<html> <body> <p> The quick brown fox jumps over the lazy dog. </p> </body> </html>

Web CreoleOctober 2008

Page 36: Web Creole

Array tag (3) +tbl←↑('cat' 'mammal')('gecko' 'reptile')('dog' 'mammal') cat mammal gecko reptile dog mammal

'td'∘tag¨tbl <td>cat</td> <td>mammal</td> <td>gecko</td> <td>reptile</td> <td>dog</td> <td>mammal</td>

↑bdy←'tr'∘tag¨,/'td'∘tag¨tbl<tr><td>cat</td><td>mammal</td></tr> <tr><td>gecko</td><td>reptile</td></tr><tr><td>dog</td><td>mammal</td></tr>

October 2008 Web Creole36

Page 37: Web Creole

Array tag (4) ↑⊃tag/'table' 'tbody' bdy<table> <tbody> <tr><td>cat</td><td>mammal</td></tr> <tr><td>gecko</td><td>reptile</td></tr> <tr><td>dog</td><td>mammal</td></tr> </tbody> </table> ↑⊃tag/'table' 'tbody',⊂'tr'∘tag¨,/'td'∘tag¨tbl<table> <tbody> <tr><td>cat</td><td>mammal</td></tr> <tr><td>gecko</td><td>reptile</td></tr> <tr><td>dog</td><td>mammal</td></tr> </tbody> </table>

October 2008 Web Creole37

Page 38: Web Creole

38

A page fn to write pages

Web CreoleOctober 2008

Page 39: Web Creole

39

MakeAt to write the site

Web CreoleOctober 2008

Page 40: Web Creole

40

And the site’s written

language bar

Web CreoleOctober 2008

Page 41: Web Creole

41

In two languages

Web CreoleOctober 2008

Page 42: Web Creole

42

Content organised in .DWS

Web CreoleOctober 2008

Page 43: Web Creole

43

In Unicode

Web CreoleOctober 2008

Page 44: Web Creole

DYNAMIC SITE FROM A DYALOG SCRIPT

October 2008 Web Creole44

Page 45: Web Creole

45

Creole 301

Use the WildServer to generate pages on request

Web CreoleOctober 2008

Page 46: Web Creole

46

Research project

• Stripped content of dyalog.com to a folder of text files marked up in HTML

• Wrote a SiteMap object to relate files to sections, pages and page positions

• Site’s content map now describable in 11 lines of code

• And served from a single .apls file

Web CreoleOctober 2008

Page 47: Web Creole

Content mapping (1)

October 2008 Web Creole47

Page 48: Web Creole

48

Content mapping (2)

Web CreoleOctober 2008

Page 49: Web Creole

Creole content mapping (1)

October 2008 Web Creole49

Page 50: Web Creole

50

Creole content mapping (2)

Web CreoleOctober 2008

Page 51: Web Creole

Creole content mapping (3)

dyalog\default.apls contains

• site structure

• HTML template

wildserver\WServer32.dws contains

• apls_tools.SiteMap class

October 2008 Web Creole51

Page 52: Web Creole

SUMMARY

October 2008 Web Creole52

Page 53: Web Creole

53

Creole web development

• Simplify the problem space using CSS and light, structural markup

• Cling to your validator

• Use Dyalog to write static pages from the workspace (Unicode!)

• Explore the WildServer for creating pages dynamically

Web CreoleOctober 2008

Page 54: Web Creole

October 2008 54

.DWS

Dyalog web site

Web Creole