Tip of the week header Home
Home
     

You can also view these tips on the 3rdParty Newsgroup.

button small Draw: Adding functionality to your program
button small Two Tips for Editing Templates
button small Smoothwall Experience
button small Tips for new (and not so new) Clarion Users
button small Tips for Multi-Proj: Adapting your application for different backends and a Batch Compiler Tip
button small Client side, or Server side, filtering
button small CapeSoft's Refund Policy
button small Calling CHM Help Files from Ezhelp
button small Optimizing Clarion Applications for speed
button small Showing & hiding your windows from the task-tray icon
 

Draw: Adding Functionality to your Program (23 April 2004)

People often ask us what sort of functions they can add to their program using our Draw template. As you probably know Draw is a high performance drawing engine that gives you complete control over 2D and 3D drawings.
 
While high speed, low-level drawing commands are desirable in themselves, Draw is also an engine on which we are going to be basing future products. The existing CapeSoft Progress product is an example of this, leveraging the power of Draw.
 
But Draw is also useful by itself. A recent addition to the Draw package is an example of using Draw to create window headers. For a screenshot of this example visit: Window Header Example Screenshot

Two Tips for Editing Templates (22 December 2003)

Being a Clarion 3rdparty developer, I [that's Geoff this week - ed] get to edit templates virtually as much as anything else. I still prefer editing templates inside the Clarion IDE (OK, OK - I know I'm pretty old - fashioned, but who needs the Undo button anyway <g> - after all Clarion programmers don't make mistakes do they?).

Tip 1
One day I got really tired of selecting All files and entering *.tpl when looking using the file dialog box to select a template to edit. I did a look around in the IDE as to where to setup the Clarion Source limits and couldn't find anything. I thought: "No way - surely they haven't hard coded this in". Did a source search on my drive and found the option is in the c55ee.ini file (c55pe.ini if you're using Clarion55 professional - or replace c55 with c60 if you're using Clarion6) which is located in your clarion\bin directory. Edited the line, and hey presto - now it sees tpl and tpw files as Clarion Source.

It's really simple:

  1. Open up your c55ee.ini (c55pe.ini, c60ee.ini or c60pe.ini) file in a text editor.
  2. Do a search on 'Clarion Source' and you should get a line something like:
    4=Clarion source (*.clw,*.inc,*.trn)=*.clw;*.inc;*.trn|CWedt
    Change to:
    4=Clarion source (*.clw,*.inc,*.trn,*.tpl,*.tpw)=*.clw;*.inc;*.trn;*.tpl;*.tpw|CWedt

Tip 2
If you're working on a template and you're checking code generation into an application, then load the application and close it. From there on, every time you make changes to your template, just click the compile button, and the application will compile with the template changes. This saves you opening and closing the application every time you want to test your changes to the template.

Note: You must have the Re-Register when changed and the Update Template chain when edited checkboxes checked (Clarion IDE - Setup | Application Options - on the Registry tab).

Smoothwall Experience (11 December 2003)

A bit off-topic this week, but I [that's Bruce writing -ed] just had a rather good experience that I thought I'd share. We've been on the lookout for a new proxy/firewall program recently and in this spirit I downloaded Smoothwall Express 2.0 (http://smoothwall.org) . (This is an unsolicited review, and we don't get anything for it.)

This is a free (GPL) program version of a commercial package. It's based on a stripped-down, custom, version of Linux and turns an old (or new) machine into an "appliance".  Minimum spec is Pentium 75, 600 Meg hard drive (2 Gig recommended for proxy cache & log files) and 32 megs of Ram. (More ram
though is recommended - I used 128 Megs).  While a screen & keyboard are used during the install, they're not needed later as the maintenance is done through a web browser.

This box then sits between your LAN and your internet connection. Doesn't matter if you have analogue modems, ISDN, USB/ADSL or Ethernet ADSL (and maybe more).  Smoothwall acts as a very strong firewall, a proxy server, a DHCP server (if you want), it supports dynamic DNS (so you can be a
server- even if you don't have a permanent IP address) plus some other bits and pieces. The proxy supports a whole range of protocols including all the common stuff like web & ftp etc.

Documentation is nothing short of superb.  Given that I was pretty sure I didn't know what I was doing (I have no experience with Firewalls, and very little with proxies) I actually read the docs before I started.  They were well written, very clear, and didn't pre-suppose any information. (Well at least if they did, I didn't notice.) I was never left guessing, and I was confident all the way through that things were "going right".

Client machine setup ranges from the non-existent (if you're using DHCP) to the trivial (if like me you have fixed IP information).

I've only been running it a couple hours now but I'm hooked. We'll be moving our office over cautiously - I'll keep you posted if we hit any snags.

I summary, if I had to, I'd pay for software like this. Smooth Wall Ltd (www.smoothwall.net) do a commercial version for bigger sites that need more features. The fact that Softwall Express does what I need, and is free, is a bonus. Pricing aside, all software should be this slick.

Tips for New (and not so new) Clarion Users. (24 October 2003)

This week's Tip of the Week focuses on where to start if you are a new Clarion User, but there may well be some tips here, that even folk who are not so new to Clarion may benefit from. There are a number of really useful resources out there, and we hope this article will help you to discover some of them.

Websites:

www.clarionmag.com - this site focuses on Clarion articles. They also include recent Clarion news. ClarionMag runs on a subscription basis (i.e. you pay to read entire articles). There are also some free articles and some free downloads. It officially updates 48 times a year.

www.outsidetrains.com - Tom Ruby's Clarion Connection. This site keeps you updated with recent news about all sorts of Clarion related topics.

www.clarionshop.com - This is the premier place on the Web to buy Clarion 3rd Party Applications, and boasts the world's largest Clarion Accessory store.

www.capesoft.com - This is our website. We've got loads of really useful 3rd Party Accessory products for Clarion as well as our Opinion articles.

www.par2.com - Steve Parkers Place - Tips, FAQ, Knowledge Base, Clarion Corner and more.

www.encouragersoftware.com/profile/clarlinks.html - Clarion 3rdParty Profile Exchange.

www.clarionpublisher.com - The Clarion Foundry. Clarion Technical References & Utilities.

www.sterlingdata.com/gallery2.htm - Clarion Developers Photo Gallery

www.icetips.com & www.icetips.net - Clarion News Source. Include Susan's legendary Clarion Bio's and many articles.

www.artofprogramming.net - Clarion Development information

www.clarionpost.com - Clarion News and Information

Definitions:

3rd Party Accessory: Basically this means someone else (a 3rd party) does some really hard work and wraps it up using Clarion templates and objects. You add their template to your application, and hey presto, your application is doing some really cool things, that you didn't need to spend large quantities of  time having to learn or implement whatever the product offers. One of Clarion's strengths is that you are able to easily re-use code. Many of the 3rd Party products piggy-back off this strength, further strengthening the Rapid Application Development nature of Clarion.

Books:

This is what Chet Sapino has to say about Clarion books:

"Here are two very good books I would recommend to any Clarion programmer who would like to gain serious knowledge on ABCs.

1. Russ Eggen's book on"Programming Objects" is excellent. I would highly recommend it if you want to gain some insight on the inner workings of ABC's and programming the various objects. I enjoyed it very much. More Info

2. Bruce Johnson's book on "Programming in Clarion ABC" is also very good. An eye opener on the various templates. Makes it easy to understand the ABCs. It will cause you to rethink your various embed strategies from a very practical standpoint. More Info / Review "

Bruce's "Programming in Clarion ABC" is available from:
  ClarionShop: Printed Registered Mail ($60) or Printed Courier ($75)

Newsgroup:

Many Clarion users have benefited greatly from the advice of others on the Clarion Newsgroup. This is a forum where you can ask questions, and also learn from others.

As a new Clarion user we would suggest the following newsgroups (there are more, but these are good ones to start with):

comp.lang.clarion
softvelocity.clarion.third_party

How to use the newgroups:
Click here news://news.softvelocity.com, this should open up the newsgroup in your Outlook Express. Then choose the comp.lang.clarion and the softvelocity.clarion.third_party groups.

comp.lang.clarion is also available via Google (or other newsgroup services) at: Google Groups

3rd Party Accessories:

There are a lot of really good 3rd Party Accessories out there. You'll find many at www.clarionshop.com

However one needs mentioning up front:

File Manager 3: When you change your data dictionary in Clarion, and then recompile your application, your data dictionary is now different to what how your data has been stored, the last time your ran your application. So when you run your application you get an Error 47. You can get around this by using File Manager 3. It's an absolute must for $249. (Read what users say about it here)

We hope the above resources spur you on in your Clarion programming.


Tips for Multi-Proj: Adapting your application for different backends and a Batch Compiler Tip (19 September 2003)

1) Using Multi-Proj to Adapt your Applications for Multiple Backends

Lesley Dean recently posted an informative article on the newsgroup, which has been used here to make this tip.

This tip will be of interest to you if you are thinking of implementing your application in multiple backends. For example you may want a TPS and a MS SQL version of your application. Or you may want a TPS, MS SQL and an Oracle implementation of your application.

Here's how it works:
New in Multi-Proj is Driver Substitution. Driver Substitution can be used to generate multiple database support from one app and one dct. In other words, take your TPS dictionary, and your TPS app file, and add Multi-Proj Driver Substitution to generate a MSSQL exe, Oracle exe, etc, and of course your original TPS exe.
i.e. 1 app, 1 dct = many exe's

Maintain your tps file structure in the dictionary, and let Multi-Proj handle the rest!

Tip: Use FM3 to automatically upgrade the various file structures in the backend!
Tip: FM3 can also be used initially to copy the data from your original TPS files to your new backends!

Note: Driver Substitution handles file declarations only. Use conditional compiles to handle driver specific code in your app.

2) Tips for using Multi-Proj's Manager (Batch Compiler):

The Multi-Proj Manager (Batch Compiler) uses DDE to tell Clarion to Generate or Compile a list of Applications or Projects. Unfortunately DDE is not that stable and so here are two tips that seem to improve the stability of DDE.

a) If you are using Multi-Proj, then create a shortcut to the MP.exe program on your desktop. Running it from a shortcut (on the desktop or in a start menu) seems to improve DDE reliability a lot.  Launching it from inside the IDE (From the accessories menu) seems to be at least 1 culprit in the unreliability-under-NT sweepstakes...

b) To increase stability try not to use the Make button, rather use the Smart button. The Smart button will generate Applications (app) files and compile Project (prj) files.

Links to more information:
Driver Substitution: www.capesoft.com/docs/multiproj/multiproj.htm
Multi-Proj: www.capesoft.com/docs/multiproj/multiproj.htm
File Manager 3: www.capesoft.com/accessories/fm3sp.htm
SQL Tips & Tricks: www.capesoft.com/docs/fm3/fm3sql.htm


Client side, or Server side, filtering. (5 August 2003)

A Clarion Browse has support for 2 features. One is called a Range and the other is called a Filter. Long-time Clarion programmers know that the most important thing to making high-speed browses is to use a range whenever possible. They also know that it's important to fill in the Filter template option rather than hand-code the necessary filters. After all, filters coded here will be passed to the View engine, which in turn means it's passed to the back-end. And that in turn means better performance. Right? Well, not always.

If you subscribe to these tried, and tested, rules, then you might be hurting performance more than you think. In order to understand why, you need to understand 2 things.

a) A View doesn't treat a Range different from a filter.
What happens internally is that the range is amalgamated with your filter statement into a single expression, and this is passed to the View engine.

b) If the backend is unable to process your filter, then it hands it back to the View engine for automatic processing on the client side.

If you put these 2 items together then you'll see that it's possible for a small part of your filter to cause the whole filter (and this includes the range) to be processed locally.

For example;
You want to isolate the invoices that belong to a specific customer.
So you set your range such that Inv:CustomerNumber = Cus:CustomerNumber

You also want to filter out Null invoices (i.e. invoices generated with a Zero amount)
So you create a filter Inv:Total > 0

And lastly you only want to show invoices where the viewer has access rights. The access rights code is a bit complicated, so correctly you make a function HasAccess(), and you add this to the filter. So the combined filter is
Inv:Total > 0 and HasAccess() = 1

Cunningly you know about binding, so you go ahead and Bind the HasAccess function.

Now let's apply this example to a dataset. Let's say you have 10,000 customers, and 1,000,000 invoices.

When you apply the range the filter for the view becomes something like this;
Inv:CustomerNumber = Cus:CustomerNumber

After applying the total filter the view filter becomes
Inv:CustomerNumber = Cus:CustomerNumber and Inv:Total > 0

At this point the filter can be done by the backend, and you've got screaming performance.

But then you add the last part of the filter;

Inv:CustomerNumber = Cus:CustomerNumber and Inv:Total > 0 and HasAccess() = 1

Because the Range and Filter parts are combined, and because the backend is unable to process your HasAccess() function (binding it won't make it work on the backend) the entire filter fails on the backend, and invisibly it's passed back to the View engine, along with all 1,000,000 records to process. Your filter still works but it's very slow.

But hang on, only the filter bit needs to be passed back, the range still applies right? Wrong. Because the View filter is a single statement it stands and falls by itself. And even though only one part is failing, this causes it all to fail.

So what is the solution?

The important thing to remember here is only to put items in your filter that can be processed by the backend. Perhaps that template entry should more accurately be described as a Server-Side filter.

The part of the filter that needs to be processed on the Client side, should be hand-coded into the ValidateRecord embed point, after the parent call. for example

If HasAccess() = 0 then return record:filtered.

The part that can be done by the server, in this case the range, and the inv:total > 0 should be entered onto the template as normal and passed to the backend as always.

It should be noted that you will not see any difference when using this technique against an ISAM file system (like Topspeed) since this has no Server side functionality, and hence all your filtering has to be done on the client side. But if you ever move your application to SQL you'll appreciate having done it right the first time, and this will be one less place for things to go wrong.


CapeSoft's Refund Policy. (28 July 2003)

(Apologies that there was not a Tip of the Week for last week, but our ISP mangled our Internet connection and by the time it came up again, there were so many emails to process I ran out of time).

CapeSoft offers a 30 day money back refund policy. (In fact for purchases longer than 30 days we normally will issue refunds anyway).

We do this for a number of reasons:

  • We want people to buy with confidence.
  • We know our products are great, but we are also aware that they may not do everything that everyone wants. So if you aren't satisfied, we want them back and we will refund you the money.
  • We believe this leads to happy customers. And we like happy customers.
  • In fact we also like to help unhappy customers and so we offer these policies to help customers at least get their money back if our products don't do the job.

CapeSoft's Refund Policy Page: www.capesoft.com/policy.htm
Read an article about Refunds: To Refund or Not - by Bruce Johnson


Calling CHM Help Files from Ezhelp. (15 July 2003)

Did you know that you can call CHM files from Ezhelp?

There are two ways to do this:

1) You can create a tip with additional links to a CHM Help file.

Example Tip Text:
Alternatively you can look at the
<s"Product Documentation"YourProduct.chm>
In the above example, the <s tag is used to specify a displayname.

or to look at a bookmark in the CHM file use:
For more help please view the:
<s"Product Documentation"YourProduct.chm::/YourProduct.htm#BookMark>

How to access help screenshot

2) You make the Ezhelp tip link directly to the CHM Help file, so that no Ezhelp tip is displayed:

Example Tip Text:
<EmailServer.chm::/CapeSoftEmailServer.htm#EmailClient>

Ezhelp is available for $179 at: www.capesoft.com\accessories\ezhelpsp.htm


Optimizing Clarion Applications for speed. (8 July 2003)

Here's a tip when your application loops through some work and you are either displaying the progress on the screen using a Progress control, a prompt with a percentage of work done, or a prompt with some sort of indication (e.g. 1 of 50000 records processed).

This is particularly useful when:
• sending emails through NetTalk
• processing a whole bunch of records

(This will only apply to hand-coded parts of your application. The Clarion Process template will already have this kind of code optimized.)

1) Avoid auto display. It will either be very slow (causing a display() for every time you enter the window. TakeEvent() method - or in some circumstances you may find it doesn't display your changes)

2) Use some piece of code that will only update your screen say every 100 records, or every few hundredths of a second (every 3 hundredths of a second works for me). Each strategy is different, and depending on what you are doing some will work better, than others, but make sure you are using an optimization strategy. For example:

if ((RecordsProcessed%100) = 0) or |
    (RecordsProcessed >= TotalRecords)
  Do UpdateScreen
end

3) When using a progress bar, it's better to have the progress bar range say 0 to 100, and then only update the progress bar when the number changes. For example:
Y     Long
L     Long

Y = (RecordsProcessed * 100) / TotalRecords
if L <> Y
  L = Y
  ?Progress{prop:progress} = L
end


(L needs to keep it's value so make it sure it's either defined in your procedure, or static, or in some scope that it will not be destroyed).

4) Rather do a display(?Variable) than a display()

5) You don't need to display(?MyProgressBar) it will get automatically displayed.

At the end of the day point (2) will optimize your application the most.


Showing & hiding your windows from the task-tray icon. (30 June 2003)

If you are using WinEvent to minimize your application to the Task Tray, then the following code can be used to Show and Hide your window.

There are three routines listed below:

WindowHide (will hide your application to the task tray - you must be using the WinEvent extension template "Add Icon to the Intray")

WindowShow (will show your application with the focus)

WindowShow_NoFocus
(will show your application (i.e. Bring to front), but it will not have the focus. This is really useful if you want to popup a message or note, but don't want to irritate users by grabbing the focus)

! -------------------------------------
! Hides Window (opposite of WindowShow)
! Useful for use with the TaskBar icon code

WindowHide Routine
  window{prop:iconize} = true
  window{prop:hide} = true
 
! -------------------------------------
! Shows Window (opposite of WindowHide)

! Useful for use with the TaskBar icon code
WindowShow Routine
  if window{prop:iconize} = false
    window{prop:iconize} = true
  end
  window{prop:hide} = false
  window{prop:iconize} = false

! -------------------------------------
! Shows Window (opposite of WindowHide)

! Useful for use with the TaskBar icon code
! No Focus is gained

WindowShow_NoFocus Routine
  window{prop:iconize} = false
  window{prop:hide} = false
  WinOnTop()
  WinNotOnTop()

WinEvent is available for $149 at www.capesoft.com


You can also view these tips on the 3rdParty Newsgroup.
 

© 2012 CapeSoft Software CC