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.
10996
Web Server - Ask For Help / Re: Page Reloads question/suggestion
« on: September 24, 2007, 11:32:53 PM »
Hi Chris,
I think the original issue is your hide condition:
you had
>> DataType=''
should be
p_web.GSV('Datatype') = ''
Cheers
Bruce
I think the original issue is your hide condition:
you had
>> DataType=''
should be
p_web.GSV('Datatype') = ''
Cheers
Bruce
10997
FTP - Share Knowledge / Deciphering Custom FTP Directory Listings
« on: September 20, 2007, 12:09:22 AM »
Preamble:
When using FTP a common command is to get a directory listing. Unfortunately the FTP spec does not specify the format of this listing. In theory each serer can return it in a different way, in practice there are a handful of common formats.
However every now and then you may interact with a server that has a completely obscure format. These are typically custom FTP servers used in specific companies and may be running on an obscure operating system. And in this situation you will need to add code to your program to correctly decipher the directory listing.
To do this is a 2 step process. Firstly you need to come up with a technique that identifies the format, and secondly you need to add code that deciphers the format into the internal nettalk fields.
Step 1
To identify the format, add code to the _FigureOutDirFormat method, which is a method of the NetFTPClientData class. You can add code to methods in your procedure, by clicking on the procedure in the application tree, and then searching for the method name.
After the parent call do a test to see if the test was successful, and if it wasn't then you can add additional code of your own to detect the format. For example
PARENT._FigureOutDirFormat(p_Data)
If self._DirFormatSet = 1 and self._DirListingFormat = 0
! do your check here, and set self._DirListingFormat to some number > 200 and < 250.
End
In the _FigureOutDirFormat method your goal is to determine the format, and give it a number (between 200 and 250). This format number is stored in the property _DirListingFormat. Reading the code in the NetSimp.Clw file, for the _FigureOutDirFormat method can be helpful in showing you how you might try and detect your format.
In this example I'll assume you do detect your format, and you assign this format to number 201. We'll use this number in step 2.
Step 2
Now that you know the format, you need to use this knowledge to populate the ControlConnection.DirListingQ Queue property.
The format of the Queue looks like this
Name string(FILE:MAXFILENAME)
Shortname string(13) ! Never used - just here because of the DirListing structure
Date long
Time long
Size long
Attrib byte
NoOfLinks long
Owner string(50)
GroupOwnership string(50)
AccessPermissions string(50)
You won't necessarily have all the information in your listing, and hence you won't necessarily be able to fill in all the fields. Apart from the Name though the fields are optional.
Find the _FillDirListingQ_FormatCustom method in your procedure by right-clicking on your ftp procedure in your application tree, and choosing Source. Then search for _FillDirListingQ_FormatCustom. Again, after the parent call, add the code to dechiper the listing.
For example
ReturnValue = PARENT._FillDirListingQ_FormatCustom(p_Line)
If self._DirListingFormat = 201 ! The number we set in step 1
! decipher the string into the queue here. For example if the name is
! always in the string from position 1 to position 20
self.ControlConnection.DirListingQ.Name =
! or, if the line contains dir in the first column then the file is a directory name
if sub(p_line,1,4) = 'dir '
self.ControlConnection.DirListingQ.Attrib = ff_:DIRECTORY
end
End
You will find the code that deciphers the known formats in the methods
_FillDirListingQ_Format01 etc. Having a look at these can be helpful in seeing what approaches you can take to filling the queue fields.
Cheers
Bruce
When using FTP a common command is to get a directory listing. Unfortunately the FTP spec does not specify the format of this listing. In theory each serer can return it in a different way, in practice there are a handful of common formats.
However every now and then you may interact with a server that has a completely obscure format. These are typically custom FTP servers used in specific companies and may be running on an obscure operating system. And in this situation you will need to add code to your program to correctly decipher the directory listing.
To do this is a 2 step process. Firstly you need to come up with a technique that identifies the format, and secondly you need to add code that deciphers the format into the internal nettalk fields.
Step 1
To identify the format, add code to the _FigureOutDirFormat method, which is a method of the NetFTPClientData class. You can add code to methods in your procedure, by clicking on the procedure in the application tree, and then searching for the method name.
After the parent call do a test to see if the test was successful, and if it wasn't then you can add additional code of your own to detect the format. For example
PARENT._FigureOutDirFormat(p_Data)
If self._DirFormatSet = 1 and self._DirListingFormat = 0
! do your check here, and set self._DirListingFormat to some number > 200 and < 250.
End
In the _FigureOutDirFormat method your goal is to determine the format, and give it a number (between 200 and 250). This format number is stored in the property _DirListingFormat. Reading the code in the NetSimp.Clw file, for the _FigureOutDirFormat method can be helpful in showing you how you might try and detect your format.
In this example I'll assume you do detect your format, and you assign this format to number 201. We'll use this number in step 2.
Step 2
Now that you know the format, you need to use this knowledge to populate the ControlConnection.DirListingQ Queue property.
The format of the Queue looks like this
Name string(FILE:MAXFILENAME)
Shortname string(13) ! Never used - just here because of the DirListing structure
Date long
Time long
Size long
Attrib byte
NoOfLinks long
Owner string(50)
GroupOwnership string(50)
AccessPermissions string(50)
You won't necessarily have all the information in your listing, and hence you won't necessarily be able to fill in all the fields. Apart from the Name though the fields are optional.
Find the _FillDirListingQ_FormatCustom method in your procedure by right-clicking on your ftp procedure in your application tree, and choosing Source. Then search for _FillDirListingQ_FormatCustom. Again, after the parent call, add the code to dechiper the listing.
For example
ReturnValue = PARENT._FillDirListingQ_FormatCustom(p_Line)
If self._DirListingFormat = 201 ! The number we set in step 1
! decipher the string into the queue here. For example if the name is
! always in the string from position 1 to position 20
self.ControlConnection.DirListingQ.Name =
! or, if the line contains dir in the first column then the file is a directory name
if sub(p_line,1,4) = 'dir '
self.ControlConnection.DirListingQ.Attrib = ff_:DIRECTORY
end
End
You will find the code that deciphers the known formats in the methods
_FillDirListingQ_Format01 etc. Having a look at these can be helpful in seeing what approaches you can take to filling the queue fields.
Cheers
Bruce
10998
Web Server - Ask For Help / Re: How can I send and receive a file to and from a website
« on: September 10, 2007, 03:19:20 AM »
Hi Gary,
You have a number of options, but the technique you use will depend on what the server is wanting. How does the server want you to upload the file?
Typically you might use FTP, but a common alternative is via a HTTP POST.
Knowing what the server wants will help to point you in the right direction.
Cheers
Bruce
You have a number of options, but the technique you use will depend on what the server is wanting. How does the server want you to upload the file?
Typically you might use FTP, but a common alternative is via a HTTP POST.
Knowing what the server wants will help to point you in the right direction.
Cheers
Bruce
10999
Web Server - Ask For Help / Re: Nettalk VS CodeChargeStudio
« on: September 10, 2007, 03:16:45 AM »
Hi Edy,
The most likely cause of the problem is the key in MySql. I haven't done a lot of testing with MySQL, but I know in MsSQL the presence (or absence) of a key on the column field can make a big difference.
Bear in mind that if the column is a string, then ideally the key should be case insensitive, as this is the sort order that clicking on the column header will trigger.
That said, I suspect this is an area that can, and will, get faster as more options are exposed via the template.
Cheers
Bruce
The most likely cause of the problem is the key in MySql. I haven't done a lot of testing with MySQL, but I know in MsSQL the presence (or absence) of a key on the column field can make a big difference.
Bear in mind that if the column is a string, then ideally the key should be case insensitive, as this is the sort order that clicking on the column header will trigger.
That said, I suspect this is an area that can, and will, get faster as more options are exposed via the template.
Cheers
Bruce
11000
Web Server - Ask For Help / Re: Confused about Styles
« on: September 10, 2007, 03:13:23 AM »
Hi Jim,
>> I'm confused as to why the class change from PageBody to PBody is not inherited by subsequent pages
I'm not sure that "inheritance" is a good way to think of web pages. The web browser model (which is a stateless, disconnected, client server model) doesn't really lend itself to "inheritance". Each page is an entity unto itself.
>> and if there is a place where this can be modified.
For all "NetWebPage" procedures you'd need to set it on each procedure. However for browses and forms (which are called as pages) you can set it in one place in the code.
When a "control" (such as a browse or form) is called as a "page" then a property in the WebHandler, called .BodyClass, is used.
Right-Click on the WebHandler procedure and click on "Source".
Search for the .MakePage method.
_Before_ the parent.MakePage call add code to set self.site.bodyclass. For example
self.site.bodyclass = 'PBody'
Cheers
Bruce
>> I'm confused as to why the class change from PageBody to PBody is not inherited by subsequent pages
I'm not sure that "inheritance" is a good way to think of web pages. The web browser model (which is a stateless, disconnected, client server model) doesn't really lend itself to "inheritance". Each page is an entity unto itself.
>> and if there is a place where this can be modified.
For all "NetWebPage" procedures you'd need to set it on each procedure. However for browses and forms (which are called as pages) you can set it in one place in the code.
When a "control" (such as a browse or form) is called as a "page" then a property in the WebHandler, called .BodyClass, is used.
Right-Click on the WebHandler procedure and click on "Source".
Search for the .MakePage method.
_Before_ the parent.MakePage call add code to set self.site.bodyclass. For example
self.site.bodyclass = 'PBody'
Cheers
Bruce
11001
News And Views / NetTalk 4.29 Released
« on: September 07, 2007, 05:28:37 AM »
NetTalk 4.29 has been released.
This looks like a pretty good build, so grab it and let me know.
http://www.capesoft.com/accessories/downloads.htm#nettalk
Cheers
Bruce
Release Notes:
---------------------
NOTE: Pictures now apply to Display fields. If you have used long display fields, you may need to set the picture to '' to suppress it clipping the string.
* Add: Support for GlobalErrors class (for those who use the Procedure name from there)
* Add: new example 39 - integrating with CapeSoft MessageBox
* Add: new example 40 - demonstrates serving static files from BLOB's. Also demonstrates serving static files from folders other than the web folder.
* Add: read-only option to Drop controls.
* Add: property for "required" comment, p_web.Site.requiredText.
* Add: Support for Insight Graphs in Legacy web servers added.
* Add: Support for "Send new value to server" added to "Display" Form fields (Buttons, Images and Hyperlinks) even if the form field also has a URL.
* Add: Auto-Complete option added to String and Date Form fields. Auto-Complete is automatically disabled if the field is dynamic, or is a password. Auto-Complete is optional to the end user, who can turn it off in his browser.
* Add: Report procedures can be called as functionname.pdf as well as just functionname.
* Add: Dictionary validation (on the whole record) has been added to the ValidateRecord routine.
* Add: Before doing an Insert, or Update, Non-Autonumbering Keys are checked to see if a Duplicate will be triggered.Change: Ability to set CSS class for Display fields on form (without having to fill in Display Text).
* Change: Client-Side tab simplified a bit. Move "refresh: Prompt Value Server" into "Reset" list. Once done the options to specifically reset itself disappear.
* Change: When the browse is called as a lookup, it's a lot smarter about what record it jumps to.
* Change: All form elements (prompts, values, comments) are wrapped in a DIV which seems to solve some of the layout issues. In the past only dynamic form elements were enclosed in a DIV.
* Change: Forms (containing a browse) can now be used as a Lookup URL. This allows for complex filtering on lookup browses. However note that none of the form fields on this lookup page should be a STRING with LOOKUP of it's own. In other words a lookup inside a lookup is not allowed.
* Change: Hand-code HTML tabs changed to XHtml, since that's what it needs.
* Added parameter to .RenameFile method, makes moving incoming files easier.
* Fix: Browse Delete button could get invalid "Action" in some cases.
* Fix: Add D06 and D02 to supported date pics (in addition to D2 and D6)
* Fix: If a form field spans the prompt/value/comment columns then the prompt is top-aligned, not bottom-alligned.
* Fix: Text fields can now be used dynamically (ie Send new value to server).
* Fix: Before Div and After Div html embed points
* Fix: Setting the Comments Class blank on a form could cause a compile error.
* Fix: Headings, and Sub-headings can have special chars (eg <)
* Fix: Translation added to Sub-heading on Browse.
* Fix: If Allow Unfilled is on, then disabling of Next & Last buttons failed at end of file.
* Fix: Disabling of buttons under IE just hid the graphic.
* Fix: Blank, unfilled, lines did not take conditional columns into account.
* Regression: fix use of %nFieldFile
* Regression: automatically format Display fields if picture set in dictionary.
* Regression: a few examples needed a "touch" to compile correctly.
This looks like a pretty good build, so grab it and let me know.
http://www.capesoft.com/accessories/downloads.htm#nettalk
Cheers
Bruce
Release Notes:
---------------------
NOTE: Pictures now apply to Display fields. If you have used long display fields, you may need to set the picture to '' to suppress it clipping the string.
* Add: Support for GlobalErrors class (for those who use the Procedure name from there)
* Add: new example 39 - integrating with CapeSoft MessageBox
* Add: new example 40 - demonstrates serving static files from BLOB's. Also demonstrates serving static files from folders other than the web folder.
* Add: read-only option to Drop controls.
* Add: property for "required" comment, p_web.Site.requiredText.
* Add: Support for Insight Graphs in Legacy web servers added.
* Add: Support for "Send new value to server" added to "Display" Form fields (Buttons, Images and Hyperlinks) even if the form field also has a URL.
* Add: Auto-Complete option added to String and Date Form fields. Auto-Complete is automatically disabled if the field is dynamic, or is a password. Auto-Complete is optional to the end user, who can turn it off in his browser.
* Add: Report procedures can be called as functionname.pdf as well as just functionname.
* Add: Dictionary validation (on the whole record) has been added to the ValidateRecord routine.
* Add: Before doing an Insert, or Update, Non-Autonumbering Keys are checked to see if a Duplicate will be triggered.Change: Ability to set CSS class for Display fields on form (without having to fill in Display Text).
* Change: Client-Side tab simplified a bit. Move "refresh: Prompt Value Server" into "Reset" list. Once done the options to specifically reset itself disappear.
* Change: When the browse is called as a lookup, it's a lot smarter about what record it jumps to.
* Change: All form elements (prompts, values, comments) are wrapped in a DIV which seems to solve some of the layout issues. In the past only dynamic form elements were enclosed in a DIV.
* Change: Forms (containing a browse) can now be used as a Lookup URL. This allows for complex filtering on lookup browses. However note that none of the form fields on this lookup page should be a STRING with LOOKUP of it's own. In other words a lookup inside a lookup is not allowed.
* Change: Hand-code HTML tabs changed to XHtml, since that's what it needs.
* Added parameter to .RenameFile method, makes moving incoming files easier.
* Fix: Browse Delete button could get invalid "Action" in some cases.
* Fix: Add D06 and D02 to supported date pics (in addition to D2 and D6)
* Fix: If a form field spans the prompt/value/comment columns then the prompt is top-aligned, not bottom-alligned.
* Fix: Text fields can now be used dynamically (ie Send new value to server).
* Fix: Before Div and After Div html embed points
* Fix: Setting the Comments Class blank on a form could cause a compile error.
* Fix: Headings, and Sub-headings can have special chars (eg <)
* Fix: Translation added to Sub-heading on Browse.
* Fix: If Allow Unfilled is on, then disabling of Next & Last buttons failed at end of file.
* Fix: Disabling of buttons under IE just hid the graphic.
* Fix: Blank, unfilled, lines did not take conditional columns into account.
* Regression: fix use of %nFieldFile
* Regression: automatically format Display fields if picture set in dictionary.
* Regression: a few examples needed a "touch" to compile correctly.
11002
Web Server - Share Knowledge / Server refuses to deliver Exe, Com and Pif files
« on: September 04, 2007, 07:03:38 AM »
There are many techniques that malicious programs use to try and get your web server to do something it's not supposed to do. NetTalk on the other hand employs several techniques to try and prevent both known, and unknown attacks.
One of these techniques is the ValidateFileName method which is part of the WebHandler class (NetWebServerWorker). Inside this method is code that expressly prevents the server from serving (or indeed running) Exe, Com and Pif files.
This can result in 2 problems however.
Firstly, if you change the name of your web folder to something including these extensions, then all files in that folder will be suppressed. For example, if you named your folder
www.capesoft.com
then the ".com part will trigger this method and any files in that folder will be suppressed.
Secondly you may want to serve EXE files directly from your site. (Be aware that some users will be unable to download EXE files directly because of restrictions on their end). If the file has a .EXE extension (or indeed even just .EXE in the name) then the file will not be served.
An obvious solution to the first problem is simply to rename your folder. However a more generic solution to both problems is to modify the behavior in the ValidateFileName method.
You can do this by going to your WebHandler procedure, right click on the procedure name, and choose "Source". Then do a search for ValidateFileName.
The code currently inside that method (inside the class) looks like this;
if clip(p_FileName) = ''
return (-1) ! blank file name
elsif instring('..', p_FileName, 1, 1)
return (-2) ! prevents hacking
elsif instring('.exe', lower(p_FileName), 1, 1) ! may possibly mean .exe files can not be served? probably a good thing.
return (-2) ! prevents hacking
elsif instring('.com', lower(p_FileName), 1, 1)
return (-2) ! prevents hacking
elsif instring('.pif', lower(p_FileName), 1, 1)
return (-2) ! prevents hacking
end
return (0)
Using this code as a starting point, write your own code in the WebHandler, before the call to Parent.ValidateFileName. If you do a RETURN before the parent call, then the code in the main class will not run at all.
By editing the code above you can tweak this security behavior to suit your needs.
Cheers
Bruce
One of these techniques is the ValidateFileName method which is part of the WebHandler class (NetWebServerWorker). Inside this method is code that expressly prevents the server from serving (or indeed running) Exe, Com and Pif files.
This can result in 2 problems however.
Firstly, if you change the name of your web folder to something including these extensions, then all files in that folder will be suppressed. For example, if you named your folder
www.capesoft.com
then the ".com part will trigger this method and any files in that folder will be suppressed.
Secondly you may want to serve EXE files directly from your site. (Be aware that some users will be unable to download EXE files directly because of restrictions on their end). If the file has a .EXE extension (or indeed even just .EXE in the name) then the file will not be served.
An obvious solution to the first problem is simply to rename your folder. However a more generic solution to both problems is to modify the behavior in the ValidateFileName method.
You can do this by going to your WebHandler procedure, right click on the procedure name, and choose "Source". Then do a search for ValidateFileName.
The code currently inside that method (inside the class) looks like this;
if clip(p_FileName) = ''
return (-1) ! blank file name
elsif instring('..', p_FileName, 1, 1)
return (-2) ! prevents hacking
elsif instring('.exe', lower(p_FileName), 1, 1) ! may possibly mean .exe files can not be served? probably a good thing.
return (-2) ! prevents hacking
elsif instring('.com', lower(p_FileName), 1, 1)
return (-2) ! prevents hacking
elsif instring('.pif', lower(p_FileName), 1, 1)
return (-2) ! prevents hacking
end
return (0)
Using this code as a starting point, write your own code in the WebHandler, before the call to Parent.ValidateFileName. If you do a RETURN before the parent call, then the code in the main class will not run at all.
By editing the code above you can tweak this security behavior to suit your needs.
Cheers
Bruce
11003
Web Server - Ask For Help / Re: Page loaded browses on form
« on: September 04, 2007, 02:17:57 AM »
Hi Casey,
I presume you're using 4.28 or 4.29?
Can you send me an example?
Cheers
Bruce
I presume you're using 4.28 or 4.29?
Can you send me an example?
Cheers
Bruce
11004
Web Server - Ask For Help / Re: Website Certified by an Unknown Authority
« on: September 03, 2007, 01:50:41 AM »
Hi Greg,
I'm wondering if you are "getting" the right certificate.
On the extension in the web server procedure you set the "name" of the certificate.
Is this set correctly?
If you ask the browser for "more info" does it look like the certificate you bought? ie does it have your name it it etc?
Cheers
Bruce
I'm wondering if you are "getting" the right certificate.
On the extension in the web server procedure you set the "name" of the certificate.
Is this set correctly?
If you ask the browser for "more info" does it look like the certificate you bought? ie does it have your name it it etc?
Cheers
Bruce
11005
Web Server - Ask For Help / Re: Child Browses - What's the magic?
« on: September 03, 2007, 01:44:39 AM »
Hi Chris,
sounds like you have invalid XHTML in your html somewhere.
see here for details;
http://www.nettalkcentral.com/index.php?option=com_smf&Itemid=36&topic=119.0
Cheers
Bruce
sounds like you have invalid XHTML in your html somewhere.
see here for details;
http://www.nettalkcentral.com/index.php?option=com_smf&Itemid=36&topic=119.0
Cheers
Bruce
11006
Web Server - Ask For Help / Re: Display Customer Name & ID on Page After Login
« on: September 03, 2007, 01:40:52 AM »
Hi Dave,
use sessionValues in your filter.
ie Instead of
'XTP:Status = 'C' AND Loc:CompanyNum = XTPCustomerNum'
put
'XTP:Status = ''C'' AND XTPCustomerNum' = ' & p_web.GetSessionValue('whatever')
(notice also the 2 single quotes on both sides of the C)
Cheers
Bruce
use sessionValues in your filter.
ie Instead of
'XTP:Status = 'C' AND Loc:CompanyNum = XTPCustomerNum'
put
'XTP:Status = ''C'' AND XTPCustomerNum' = ' & p_web.GetSessionValue('whatever')
(notice also the 2 single quotes on both sides of the C)
Cheers
Bruce
11007
Web Server - Ask For Help / Re: Server time on login window
« on: August 30, 2007, 11:41:50 PM »
Hi Robert,
Inside the page find an appropriate place, and add some HTML into the page.
ie
packet = clip(packet) & 'Server Time: ' & format (clock(),@t4) & p_web.br
do SendPacket
Cheers
Bruce
Inside the page find an appropriate place, and add some HTML into the page.
ie
packet = clip(packet) & 'Server Time: ' & format (clock(),@t4) & p_web.br
do SendPacket
Cheers
Bruce
11008
Web Server - Ask For Help / Re: How to pass e text-field to a session-value
« on: August 30, 2007, 11:23:37 PM »
Hi Bram,
The best place to do it is inside the ValidateUpdate routine.
This is called just after the "Save" button is pressed.
if the local variable is called say loc:whatever, then in this routine do a
p_web.StoreValue('loc:whatever')
This copies loc:whatever from the Value queue to the SessionValue queue.
Also you could just "Send new value to server" for the text field - that seems to be working in version 4.29
Cheers
Bruce
The best place to do it is inside the ValidateUpdate routine.
This is called just after the "Save" button is pressed.
if the local variable is called say loc:whatever, then in this routine do a
p_web.StoreValue('loc:whatever')
This copies loc:whatever from the Value queue to the SessionValue queue.
Also you could just "Send new value to server" for the text field - that seems to be working in version 4.29
Cheers
Bruce
11009
Web Server - Ask For Help / Re: How to pass e text-field to a session-value
« on: August 30, 2007, 11:01:29 PM »
Hi Chris,
>> When you say Text type, do you mean a very long string?
>> Currently, session value can be up to 256 characters.
This is inaccurate. Session Values can be any size. This changed quite a few versions back.
Cheers
Bruce
>> When you say Text type, do you mean a very long string?
>> Currently, session value can be up to 256 characters.
This is inaccurate. Session Values can be any size. This changed quite a few versions back.
Cheers
Bruce
11010
Web Server - Ask For Help / Re: Child Browses - What's the magic?
« on: August 30, 2007, 10:45:20 PM »
try coding it as a "filter" rather than a "range".
There are sites using mssql where it works fine, so I don't think it's that.
Cheers
Bruce
There are sites using mssql where it works fine, so I don't think it's that.
Cheers
Bruce