NetTalk Central

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Bruce

Pages: 1 2 3 [4] 5 6 ... 9
46
Web Server - Share Knowledge / Getting started with Mobile
« on: December 14, 2011, 02:32:54 AM »
The Mobile support is in it's infancy, and there are some very specific parameters you need to adhere to for now. the text below was taken from an earlier thread, and is repeated here so it can be found more easily. I'll update this thread as circumstances change.

--------------------------------------
From http://www.nettalkcentral.com/index.php?option=com_smf&Itemid=36&topic=2901.0
--------------------------------------
Joe writes:
>> I took the example 3 (simple with login), and set it to "Mobile" in the Webhandler procedure.

Probably an excellent one to work through as example 3 has not had any special attention to make it "mobile". the steps below probably apply to your own app as well. (As mentioned in the webinar the mobile stuff is in alpha, meaning that there are an uncommon number of restrictions at the moment.) To make example 3 work in mobile;

a) set it to "page" mode not popup mode.
(Global extensions, Activate Web Server extension, Advanced Tab, "popups" = NO.

update : 6.13 : This restriction is removed. Apps can behave in popup mode on the desktop, they'll switch to "page mode" when run in mobile mode.

b) If it doesn't auto-detect your mobile device, or if you want to test mobile on the desktop, go to Webhandler, Actions, Set mode to "mobile".

c) WebServer - Set "Tab type" to "Rounded" or "Plain".
(WebServer procedure, NetTalk extension, Settings, Styles, Form, "Form Type".

update: 6.14 - you shouldn't need to do this, it should change the tab type automatically. At the moment "tab" changes to "wizard", the round, plain or none stay "as-is".

d) Header procedure needs work - specifically lose the Border extension, and simplify the xHtml. Using a wizard generated Header, and Footer, is a good idea here - however doing it by hand is straightforward (especially the header, which probably already contains your menu that you _don't_ want to trash.

the mobile version of the header should contain something like
<h1>Example 3</h1>
you can make the desktop one different if you like.

note that both header, and footer, have "This is a HEADER" and "This is a Footer" set respectively.

e) Global buttons need refreshing - go to WebServer brocedure, Settings, buttons, and "delete" all the buttons (they're re-appear as you delete them).

f) The LoginForm procedure needs a "heading" - at the moment it's blank.
update : 6.13 : Forms with blank headers are allowed.

g) the login form overrides the text on the "save" button using the following line of embed code;
  p_web.site.SaveButton.TextValue = 'Login'
to override the same text, on mobile, use
  p_web.site.SaveButton.MobileText = 'Login'
in the same place.

h) For both Browse procedures; Goto Settings
Go to FORM tab, Show Buttons/Close tab, "Include Close Button" - tick this on.

update : 6.13 : Close buttons are automatically generated on Browses in mobile mode.

i) PageHeaderTag procedure, go to the Extensions, Menu, Browse menu, both Items - remove the IMAGE setting there.

j) then - as mentioned in the webinar, you'll want to tweak the browses to make them "look better" in Mobile mode. Fewer columns, inline Change & delete buttons and so on.

k) In the WebServer procedure, Extensions, Advanced tab, untick the options to Compress and Combine the .js and .css files.
update : 6.13 : mobile now supports combined and compressed

Of course some of these restrictions - will be lifted in the near future - but this should help get you going for now.

cheers
Bruce

47
The notes from the 2010 WebShop are available as a PDF Book (187 pages). While I understand the natural conflict between being both the product writer, and the writer of the book, the overwhelming feedback I get is that the book is valuable for developers new to the web, and new to NetTalk.

You don't have to have the book to learn NetTalk, many people on this site managed before the book was available. That said, it shortens the learning curve a lot, so it depends a bit on how much your time is worth.

John Welch, a new NetTalk user puts it like this;

>>  I also bought the NetTalk book. I have to say that I was thinking that the book should be included with the software as I was paying for it. Now that I am reading it I have to say that it is worth every penny. I can see the care and effort you put into it.

>> I appreciate the whole “hold the beginners hand” approach because that is exactly what I needed to confront this topic at all. The internet is to me a very broad generality and you have distilled the aspects that are important to getting a web app up and running.

>> You have put web applications well within reach of even us old time programmers and I am grateful.

Of course if you attended the webshop in 2010, in any of the locations we did it in, you'll have a printed copy of the book already - but you also have access to the PDF (which got updated along the way). If you don't have that yet you can order it, and put "free - webshop attendee" in the comments field when ordering.

The book has been part of our Capevember specials and is currently available at ClarionShop
https://www.clarionshop.com/secure/checkout.cfm?pid=1329&q=1&PC=NetTalkBook
It is on special until November 30 (today) at $80 off. So well worth a look.

Cheers
Bruce

PS - If you do have the book feel free to write a comment below. It's safe to say I have a credibility problem when it comes to prompting the book, and so your comments (good or bad) will help other users determine if it's worth their money or not.

48
Web Server - Share Knowledge / Clarion 8 SQL update
« on: October 26, 2011, 09:18:13 PM »
the following appears in the release notes for Clarion 8 build 8740:

>> WORKAROUND: MSSQL 2008;R2 and earlier, could cause application lockups and potential data loss when you enabled the MARS feature of MSSQL, and did not wrap ADD statements in transaction frames, and you had post auto-increment statements and had one user browsing a table at the same time another user adds a record to that table. This workaround will only effect MSSQL files /MULTIPLEACTIVERESULTSETS=TRUE driver string and the "IsIdentity" user option on a field and the EMULATEAUTONUMKEY user option on the file.

I'm thinking those using MsSql may encounter this a fair bit, so an update is probably recommended. Also;

>> PTSS 38548: MSSQL Driver bug causes data loss

which further suggests an update is recommended.

cheers
Bruce

49
News And Views / NetTalk 6 Release Schedule
« on: September 13, 2011, 08:34:47 PM »
Morning All,

As you probably know Geoff, Rob and I will be attending the CIDC 2011 Devcon in Orlando Florida later this month. On Monday Sept 26, at around 5pm Orlando time, we will be presenting a session "Fun with CapeSoft" which is mostly just having fun and showing off some of the things we've been working on. During this session we will show some of the new features in NetTalk 6.

We have arranged with Devcon organizers John and Arnold that this session may be freely available streamed live as well as soon afterwards in a recorded format. (There are some technical issues which may occur from having a "free" stream inside a "paid for" stream, but if we don't resolve those we will upload the recording of the event within a day or so.) I will post more information on watching the stream here when I have it.

While NetTalk 6 will become available for general purchase on September 26, I wish to stress that we will only be back in the office on October 5. Support before October 5 will be extremely limited (read "most likely none") outside of the actual Devcon event. We will also be unable to update the build while we are away, so I recommend waiting until at least October 5 before installing NetTalk 6. While every effort has been made to preserve perfect backwards compatibility there may well be errors in execution which will need addressing.

As always with a new release there are one or two juicy tidbits included with NetTalk 6 with several more planned for the weeks after the first release. I'm not going to jump the gun by announcing those yet, but suffice to say that I think you'll appreciate them.

Two folk have indicated they would like to pre-purchase an upgrade to take advantage of current exchange rates outside the US. So I've added a product to ClarionShop to allow you to do this, https://www.clarionshop.com/checkout.cfm?pid=1376&q=1& HOWEVER and I want to stress this somewhat, even if you take advantage of this the product will not be available to you before September 26, and possibly not before October 5.

Cheers
Bruce

50
Web Server - Share Knowledge / Monitor mem usage - and act upon it
« on: August 23, 2011, 10:18:30 PM »
This thread comes up a fair bit, so I thought I'd make a link to it here;

Summary:
how to count the number of threads currently running, and reject the creation of more threads if some arbitrary limit has been reached.

http://www.nettalkcentral.com/index.php?option=com_smf&Itemid=36&topic=2021.0

Cheers
Bruce

51
News And Views / 5.30 uploaded
« on: July 15, 2011, 09:39:25 PM »
I've uploaded the 5.30 build.

Cheers
Bruce

52
Background:

Up to build 5.04 it was possible to set the Unique key of a browse to be from a table other then the browse table. This was done in Example 23, "Browse To another Form" and was intended for use when the Browse and Form were working on different tables.

Recent reports though have indicated that this technique no longer works, and causes a GPF in the server when the form is opened. Investigation has shown that this is indeed the case, and it's caused specifically by the browse key not being from the browse table.

Change:

As from 5.30 it will no longer be allowed for the key to not belong to the table. Accordingly a template Error will be generated for any browse that has this mismatch.

If you do wish to "prime" a form from a parent-table record (in other words you are coming to a form from the browse of a related table) then use the new setting on the ADVANCED tab of the form called Prime Key From Parent

If you wish to prime the form record by hand, then the following code should be done in the INITFORM routine in the form;

Code: [Select]

for each key field of the form's unique key
  p_web.SetValue('FieldName','FieldValue')
end


At this point, if you did come from a browse, then the browse unique key fields are already in the value queue. So for example;
Code: [Select]

p_web.SetValue('Mor:Id',p_web.GetValue('Cus:Id'))

is what the template generates in example 23.


53
TinyMce supports a variety of options when the control is initialized. This post serves to show you how to apply those options. Specifically, this post will show how to use the language option to set the language to spanish.

Before applying the option, download the appropriate language pack from http://tinymce.moxiecode.com/i18n/index.php?ctrl=lang&act=download&pr_id=1. In this case I'm going to assume the language downloaded was Spanish (es) - replace es with your language in the code below.
the language files belong in the \web\tiny_mce_jq\ folder.

In the WebHandler procedure, _TinyMCEInit method create a local variable, called say loc:options.

loc:options  string(Net:MaxBinData)

then override the parent call with some code, something like the following;

  loc:options = clip(p_manual) & 'language : "es",'  ! es = spanish
  ReturnValue = PARENT._TinyMceInit(p_FieldId,p_Flags,loc:options)
  RETURN ReturnValue

The 'language : "es",' part is the TinMCE setting - note the trailing comma which is important.

cheers
Bruce




54
News And Views / Version 5.27 ships.
« on: June 01, 2011, 06:54:13 AM »
Build 5.27 is available.
Contains a few outstanding bug fixes, and some work on the Planner control - although work on that is on-going.

Cheers
Bruce

55
Web Server - Share Knowledge / Row ID's
« on: May 03, 2011, 05:54:24 AM »
Robert reminded me today of a question that's come up before. It seemed of general interest so I'll post the question here, with the answer. Please feel free to post follow-up questions on this thread below.

Required

Much of the information below has been true for quite some time, however the section on creating a direct link to a form requires version 5.24 or later.

Question

I am moving from a Frames based site to a non-Frames based site. Some of my menu items call a form directly, as per FAQ W4. So I'm seeing the Row Id passed as part of the URL. This is especially true when I go directly to a form, without going via a browse. Is there some way of hiding, or encrypting this id?

Background

In a browse, or a form, some way of identifying the row, or record is required so that when you press a button, or save a form, it knows which bit of data is being used. If this identifier is a simple integer then it's possible to "guess" other possible correct values of the integer, and thus edit records which normally you wouldn't have access to.

In NetTalk 4 the row identifier is the component of the unique key. This is one of the reason I've recommended GUID style ID's rather than auto-incrementing integers for ID's. (And GUID style Id's are still recommended in NetTalk 5, although perhaps not quite as important).

In NT5 a "hash-row-id" system is used.  When a row id is required, an entry in an internal queue is created. In this queue the actual row id is stored, and also a random "hash" value - typically an 8 character random string. When the row id is passed back from the browser, it is the hash-value which comes in - this is automatically translated into the real value and the code progresses as if the real value was entered.

A hash value is created by calling

Code: [Select]
p_web.AddBrowseValue (string proc, string filename, key filekey, <field1Value>, <field2Value>, <field3Value>, <field4Value>, <field5Value>)

If the Fields are omitted, then the value in the current record is used. For example, let's say a record in the customer table is loaded. And the unique key for the customer table is cus:idkey. Then the call to get the hash would be;

Code: [Select]
str   string(Net:HashSize)
  code
  str = p_web.AddBrowseValue('browsecustomers','customers',cus:idkey)

On the other hand if the customer record was not loaded, but you wanted to get a hash for where cus:id = 2 then the code might look like this;

Code: [Select]
str   string(Net:HashSize)
  code
  str = p_web.AddBrowseValue('browsecustomers','customers',cus:idkey,2)

As you can see from the prototype, the method allows for the key to have up to five components.

Note that the "customers" parameter is in quotes - it's the _name_ of the table the procedure needs, whereas the key parameter has no quotes, it's the actual unique key that is required. The procedure name is an internal optimizer.

If you click on a browse row you'll see this identifier is sent to the server as

Code: [Select]
_bidv_=something.

Internally this is translated using the queue, and the actual Row Id values are stored in the session queue.
If you right-click and view-source of a browse, you'll see the values set for each row, in html, like this;

Code: [Select]
<tr data-nt-id="rcEOaCZA">

[aside: this technique is very compact, and one reason NT5 pages are smaller, and hence faster, than NT4 pages]

If the CHANGE button under the browse is clicked, then the url to the form looks like this;

Code: [Select]
http://127.0.0.1:88/UpdateCustomers

The Post Data contains the ID, in _bidv_ format - ie

Code: [Select]
_bidv_=9FsBSx2l

Thus the _bidv_ system is compact, secure and largely invisible to the programmer.

Now to the Form. When the form is called a FORMSTATE is created. This is similar to the hash in some ways, but has some important (internal) differences in other ways. If you do a right-click / view-source on a web page then you'll see the FormState as a hidden form field;

Code: [Select]
<input type="hidden" name="FormState" id="FormState" value="QFODAJKCSD"></input>
You may notice that in many cases it's he only hidden field on the form, replacing the 3 or 4 hidden fields required by NT4. Again the text in the form state is meaningless - it's used only as an index into the queue on the server. Changing the FormState has no ability to change other records, because only records in the FormSettings queue can be changed by the form.  Because the actual record id is stored on the server, and is not sent by the browser, it's impossible for the row id to be changed.

Answer

Using the p_web.AddBrowseValue method, a URL can be constructed containing a unique hash value. The URL will look something like this;

Code: [Select]
'SomeForm?change_btn=change&_bidv_=' & p_web.AddBrowseValue('pageheadertag','mailboxes',MAI:PrimaryKey,2)

In the above example 'pageheadertag' is the name of the procedure, 'mailboxes is the name of the file', mai:primaryKey is the key, and 2 is the value to be used in the key (in other words, mai:MailboxNumber=2).

Where a Procedure and parameters can be specified separately the procedure would be set to SomeForm and the parameters set to
Code: [Select]
'change_btn=change&_bidv_=' & p_web.AddBrowseValue('pageheadertag','mailboxes',MAI:PrimaryKey,2)

Example

As from build 5.24 I have updated example 24 (FormToForm) with two examples of this approach.
First, a menu item called "Direct!" has been added. This calls the form directly, with an ID value of 2.
Secondly, in the URL On Save, for the FirstForm is;
Code: [Select]
'SecondForm?change_btn=change&_bidv_=' & p_web.AddBrowseValue('firstform','mailboxes',MAI:PrimaryKey)

As you can see, in this URL the value is left off, so the current record value is used.

Where to From Here

At the moment (at at version 5.24 and earlier) the old system, as documented in FAQ W4 is still valid, and still works. This is necessary for a period at least to preserve backward compatibility. However if the ID of a record is known then this can be used to carefully construct a POST which could alter the record. So in a future build this method will be deprecated completely. therefore it is recommended that any "direct links" of the type created in W4 be converted to the new style at the earliest opportunity.

Using non-sequential-id fields can also be useful in making unknown Id's harder to "guess" - however I understand this is often not a choice you may be able to implement at this stage.

I expect this post is at least slightly confusing, so please post questions below if any of it is unclear. I will edit this post as required.

Cheers
Bruce



56
Brian asked this question in this thread;
http://www.nettalkcentral.com/index.php?option=com_smf&Itemid=36&topic=1963.msg7389#new

================
I have a chap who is pretty good at style sheets. Infinitely better than I am. I thought that the Browser would automatically download the style sheets onto his local machine with Nettalk 5 Web server and use the local ones. Did I misunderstand this process?

In effect I was hoping that he could modify the local css sheets and he could see his changes, but it appears that the Nettalk webserver always goes back to the server for the css when a page is refreshed. Is there something I can do that would enable him to experiment with the CSS without giving him full access to my Server directories?
================

The answer there explains some of Brian's misconceptions, but the actual solution is general enough for me to move the answer here.

Ok, so what we want is for the designer to be able to edit the CSS for the site, but those changes only apply to his machine. When he's done he can submit the changes back to you for inclusion on the site proper. The designer has no access to the sites' actual web folder.

There are a couple of browser extensions that _almost_ do this, but which fall down at a crucial step. Most notably the extensions work on a "per page" rather than "per site" basis, and the local style sheet is not re-applied between page refreshes.

The next best solution is to install a small web server on the designer's computer. This server needs to do nothing except serve the style file he's editing, so it doesn't even need a web folder. I've made a new example LocalSite (66), which is a good place to start. This example is;

a) bound to IP address 127.0.0.1, so it won't expose the computer to any security issues.

b) is on port 9871, so it won't interfere with any other web server already on the machine.

c) Is "installed" in your web examples folder with it's own "web" folder, but doesn't need a web folder to be shipped to the designer. It will create its own "web" folder the first time you run it, and the designer should place his custom style in the created \web\styles folder.

d) Then in your application, you go to the WebServer Procedure, NetTalk Extension, Styles, Files tab.
You add the following file to the files list (at the bottom of the list if you've already got files there.)
'http://127.0.0.1:9871/styles/custom.css'
note the direction of the slashes.
the name, "custom.css" is any name you want - the designer will create a file of the _same name_ in his \web\styles folder. Notice the URL is using the local machine, and the port is set the same as the LocalStatic server, 9871

I have added this line to the example BasicWithMenu (2).

Other thoughts;

Once your designer has finished it's probably a good idea to remove this line. It won't do any harm (and thus your site can remain live during the design process), but in the long run it may cause somone some concern if they examine your source and see your site trying to fetch a file from a local server.

This whole technique is an excellent way to allow multiple people to edit the css for a site, at the same time, and yet only see the results of their own changes. This opens the door to things like design competitions, teaching situations, and so on.

The LocalSite example app could be extended a bit if you wanted to make this more formal. Some ideas are;
a) hide the usual web-log stuff

b) Load the css file into a text box, so the user can edit it there, in the app itself.

c) add a web client object on a procedure to upload the css file to your server. You could add code to the server to copy the file from the uploads folder to the styles folder as it arrives - in that way your designer can make changes, but only to that file in a real-time way.

(*) The new example, and mod to example 2 are included in build 5.21 and later.

57
Hi Gordon and others,

I can't find the thread which introduced this idea, but suffice to say that the next build (5.19) has the ability to popup a form from an "other" button, which is on a form or on a browse row.

Cheers
Bruce

58
Your Views and Comments / Ping: Kevin
« on: March 18, 2011, 10:19:46 PM »
Hi Kevin,

my emails to you are not getting through. I'm getting an error;
No DNS MX entries for [tphglobal.com] could be found.

Can you maybe send me a different email address for you?

regarding the date issue - run the page under firebug and see if there are any javascript errors.

cheers
Bruce

59
News And Views / Lessons from the coal-face
« on: February 14, 2011, 12:42:54 AM »
As many of you know, on Friday our main web-serving machine in Denver lost all it's magic smoke, turned over, and after some brief twitching, died.

The timing wasn't great (is it ever?) but it was the incentive we needed to re-organize a bunch of things and also make a number of small tweaks and improvements.

We've migrated all the sites (there are about 15 distinct sites, with around 40 URL's) to a new RackSpace server. As many of you know we've been experimenting with RackSpace for a while now with the Mirror site (mirror.capesoft.com) and we've been happy so far, so we took the plunge.
http://www.rackspacecloud.com/1220.html

What's interesting is the the old machine ("Pluto") was a fairly powerful, physical server, with oodles of disk and ram and so on, whereas the Rackspace machine is a Virtual-Server, and has limited ram and disk. It will be interesting to see how performance on this platform compares.

The change has lead to some tweaks in NetTalk - especially to the Multi-Host example. While we were running most sites on Pluto on the Multi-Host, we're running only the Multi-Host on the new machine, so there were a couple of cosmetic changes to make usability better.

I've also added some support for SSL to the Multi-Host - NOT that it can support multiple SSL sites, but that it can serve a single SSL site. This allows us to have a consistent mechanism for logging, service registration, management interface and so on. Plus, because it holds the sessions it allows us to work on the DLL, without bringing the site down.

So where is NetTalk 5.16? this was supposed to go out last week, but not surprisingly the web server crash has pushed us back a few days. There should be a release later this week after I've cleared the backlog of bug reports etc.

thanks for your patience, and my apologies for the inconvenience.

Cheers
Bruce


60
News And Views / Build 5.15 is available
« on: February 01, 2011, 07:35:48 AM »
fixes, fixes, more fixes....

Pages: 1 2 3 [4] 5 6 ... 9