NetTalk Training Day 1

Bruce started the training off with an overview of what web apps are, including a warning that he would be lying to us. Not to be alarmed - this is lying in the sense of making some things simpler than they really are so they're understandable. 

Key things to know about web apps and specifically NetTalk apps:

  • server and browser are disconnected
  • one EXE, multiple users
  • server is written in Clarion
  • client is written in JavaScript
  • appearance is handled by CSS
  • uses HTML/HTML5 (HTML5 isn't an accepted spec yet but many browsers have implemented many of the HTML5 features)
  • the app you ship is the web server - there is no external web server requirement (e.g. IIS, Apache)
  • the visual designer is gone 
    • deciding what the app looks like comes at the end, and you can style the whole app at once, e.g. make all browses look the same way 
    • this freaks a lot of people out
    • it's actually much much better to do the visual design at the end - it's less work
  • main 4(5) browsers supported
    • IE
    • Firefox
    • Chrome
    • Safari
    • Opera too
  • start thinking about procedures in a NetTalk app as event handlers
  • you can't have local variables (but there's a way to get around that)

Bruce then whipped up a new app using the NetTalk wizard.

You can use localhost. Bruce also mentioned setting up your own names for IP addresses - the file you need for this is found under %SystemRoot%\system32\drivers\etc\hosts 

Setting a limit of 100 threads is a good place to start. That will probably translate to about 1000 requests per second, and chances are your IO will be the limiting factor before you get to that many requests anyway. 

Bruce explained the basic structure of an HTML page. So there are controls (HTML for browses, forms etc which can be called as you would call a browse) and snippets of HTML or NetWebSource procedures which just dump in the requested HTML and can not be called directly by the user.  

Example of HTML you when you request a control:

<body>
	<!-- Net:PageHeaderTag -->
	Control
	<!-- Net:PageFooterTag -->
</body>

The menu is added to the page header procedure as an extension. Want another menu? Add another extension.

Bruce explained the important differences in the ways you can navigate using the different menu options: Link, Content (using the Content div, which must be enabled in global settings) and Popup. 

Popups will give you a very Windowsy (Bruce actually compared it more to CPD) experience. Not search engine friendly, however.

IMG_4576.CR2

SPAs - single page applications

You can create SPAs with NetTalk. Bruce talked a bit about future directions. Front loading also works well with SPAs; you dump all of the unchanging HTML into the initial page load so all you need to do is load up the changing data. The static page can be on a CDN (content delivery network). You can even offload the static page delivery to a CDN or different server. And what if that server were a JavaScript server using the browser's local store? Then you could use PhoneGap to create pseudo-native mobile apps. Not there yet, but clearly lots of interesting stuff to come from CapeSoft. 

Template expressions

Most fields in NetTalk are expressions - you can type in anything you like. There are a few exceptions. 

Scalability

You can have your web app quickly (thin client, maybe 20 users per server) or you can do the work and make an app that can scale up to thousands of users per server. 

Browse settings

There are a whole lot of browse settings, and a whole lot of settings for each field in a browse. For display, there are really only four types: text (string), date, button and procedure. The latter means you can embed controls in browses, such as a browse of browses.  

The book

Okay, I didn't rotate the image. But the text is at a 45 degree angle anyway. No, just on the cover, not inside. 

250 pages of NetTalk goodness! Only available to those taking the training. 

Some good explanation of session variables and their importance.

Bruce spent some time on Monday afternoon talking about Cascading Style Sheets, which you use to style your HTML page markup. Firebug is a great tool not just for seeing what's going on in the page but also for modifying CSS and seeing the results instantly. NetTalk supports JQuery's ThemeRoller

Bruce went to the ThemeRoller site, picked a theme, made some changes, saved it, and added it to his app.

You can serve up static pages with NetTalk, and you can insert static content through the use of Net: tags. You can also add dynamic code to static pages but that's harder work for the server and generally doesn't work out well. 

More good discussion on serving text files, including the great risks in allowing the user to pass in anything more than alphanumeric characters and periods when requesting files. You could be exposing every file on your system to download.

Bruce showed a nifty trick for determining the content type used for a given file extension.

Often you'll want to send email from your web server. You can do this synchronously or asynchronously. 

Biggest thing you can do to speed up your site is probably to enable the Combine all files setting. Second best option is to pre-compress files or compress on the fly. 

As usual, tons more information was presented.