## Technical notes for HAT

 all platforms: Passwords Compression Page/Printer Setup Links Turnover Web-HAT: Options for hat.cgi Template Options Enabling CGI interface for IIS Web Server under OS X 10.8 Search engine robots Windows: 3 GB support under 32-bit Windows

Passwords in HAT data files are not case sensitive. This means, for example, that "dog", "DOG" and "Dog" are all equal passwords.

Special characters (non US-ASCII characters, upper half of the 8-bit ASCII table) can be used in passowrds. Starting from version 5.6 HAT uses UTF-8 encoding internally, which ensures equal handling of special characters on all platforms.

On earlier versions (HAT 5.5 and earlier) using special characters in passowrds may cause portability problems.

#### Compression

HAT database files are normally compressed. The built-in compression method provides a moderate compression rate and very fast decompression.

It is possible to speed up file saving by turning off the compression. This can be done in the "File/Save Special/New Save Setup/Format" by unchecking the "Compression" checkbox.

Note that the uncompressed binary files may not compress well by other compression utilities like Zip or Stuffit.

To reach best compression rate, save your database as a HAT-text file and use a compression utility like Zip or Stuffit on it.

Note however that you will need an HAT-operator license to open the text file.

Note also that the text files are not encrypted and they can reveal your password as clear text.

#### Page/Printer Setup

Analysis templates and analysis defaults may include page setup or printer setup data. This information is printer specific: it is only valid for a given printer. Operating systems usually can ensure this by ignoring the setup when it detects incompatible records. However, sometimes the systems fail in this, and it becomes desirable to manually clear the stored page/printer setup.

Clearing the page/printer setup can be done by installing a template and unchecking the checkbox "Page Setup" or "Printer Setup". Similar checkbox is available for analysis defaults starting from HAT 5.3. In earlier HAT versions, the defaults must be cleared completely to get rid of the page/printer setup data.

When composing HAT-files it is possible to accidentally include page/printer setup for analysis defaults. This happens if at least one of imported files contains analysis defaults with page/printer setup.

It is possible to clear page/printer setups in analysis defaults by importing the following HAT-Text file. Other settings remain unchanged.

 ##HAT-Text 051004 ##Defaults #K xLw xLm #C xLw xLm #L xLw xLm #P xLw xLm #T xLw xLm #R xLw xLm ##End 

Starting in HAT 5.4 both external and internal links are supported. Links behave like hyperlinks in web-pages and can refer to web URLs, local files and directories, cards and lines, macros and analysis templates.

Links are stored in various text fields in a HAT database. Links can be edited as text, and become available when the text is not in focus.

Text fields that can contain links:

• Cards: card title, line text, card notes
• Dimensions: component text and host code
• Templates: analysis notes, column titles
• Time scales: period text

There three types of links supported in HAT. Complete URLs with known protocol specifiers are automatically turned to links. Second form is a common attr="value" syntax. Third is a html-style <a>-link which allows for a separate title text for the link.

• http://www.macrosoft.fi/index.html

Complete URLs are automatically turned into links. Supported protocols are http, https, shttp, and file. A web address without the protocol is not turned into a link.
An URL can be dragged directly from a web browser address field to a text field in HAT to form a link.

• file="C:\hat\foobar.txt"
file="\\server\hat\data\foobar.txt"
file="/users/joe/desktop/foobar.txt"

Files and folders in the local filesystem can be referred using pathname syntax that is compatible with current operating system.
Files and folders can be dragged and dropped into text fields in HAT to form links.
The filename must be enclosed in double quote marks (").

• card="081231-029"
card="081231-029#12"

Cards and lines can be referred by its card ID and line number. A #-character separates the card ID and line number parts. Line number is optional.
The card/line reference must be enclosed in double quote marks (").

• template="Results:Current Year:Result by Market"

Analysis templates are referred by their pathname. A group of templates can be referred by specifying a parent name.
The template name must be enclosed in double quote marks (").

Macros can be referred by their name.
The macro name must be enclosed in double quote marks (").

• <a href="www.macrosoft.fi"> link title </a>

Alternative form for web links allowing a separate title specification.
The URL must be enclosed in double quote marks (") if it includes spaces.

• <a file=/users/joe/foo.txt> joe's story </a>

Alternative form for file and folder links allowing a separate title specification.
The filename must be enclosed in double quote marks (") if it includes spaces.

• <a card=081231-029> joe's story </a>

Alternative form for card/line links allowing a separate title specification.

• <a template="Results:Result 2008"> Result by Market '08 </a>

Alternative form for template links allowing a separate title specification.
The template pathname must be enclosed in double quote marks (") if it includes spaces.

Alternative form for macro links allowing a separate title specification.
The macro name must be enclosed in double quote marks (") if it includes spaces.

• <a template="[datafile.hat]Results:Result 2008"> Result by Market '08 </a>

A filename can be placed inside []-parenthesis in front of a template, a card or a macro link.
The filename can be full or partial filename. Starting point for a partial filename is the current file.
Filenames in links are supported in HAT 5.5 and later.

Web-HAT: URL, card and template links are available to web clients. Links that refer to the local filesystem (file links) or may alter the current database (macro links) are not available.

Note: Some characters are not allowed in links to prevent misinterpretation. Any character can be specified using %hex encoding. Speficically following characters must be encoded:

 < %3C > %3E " %22

#### Turnover Rate and Time

Starting in HAT 5.7 turnover rate and time is calculated slightly differently.

Previously if transactions were not fully balansing, ie sum of positive and sum of negative transactions differed, the turnover rate was calculated using the average of these sums.

Starting in HAT 5.7 the larger of the sums, either positive or negative transactions, is used in the calculation. This gives more relevant results in most cases.

#### Options for hat.cgi

The gateway application "hat.cgi" passes information between a web server (Apache, IIS etc) and HAT. There are a number of options to alter the normal hat.cgi operation. These options can be set by writing a textfile named "hat.conf" and placing it in the same directory where "hat.cgi" resides.

Example of the "hat.conf" file
 hat-server="10.1.1.10" ip address or domain name of the HAT-server port="7412" ip port used to communicate with HAT-server document-root="../webhat/" path to document files on the server # gateway="hat.cgi" CGI-gateway name, needed for hyperlinks # stylesheet="hat.css" stylesheet name # images="images/" images folder relative to document-root 

By default, hat.cgi tries to communicate with HAT on localhost (127.0.0.1). Use "hat-server" option to use another ip-address. HAT application and hat.cgi need not be running the same operating system, for example, a Linux web-server can talk to a windows HAT.

By default, hat.cgi and HAT use ip port 7412 for their communication. If you change this, remember to make a corresponding change in Preferences dialog in HAT.

The option "document-root" is used to tell HAT were the Web-HAT support files are. Typically in UNIX environments, all cgi-applications are collected into a separate directory and the rest of the files (images, stylesheets etc) reside elsewhere. Starting point for the document root is the current hat.cgi location.

The gateway program "hat.cgi" can be renamed, but you need to tell its name. Otherwise the hyperlinks provided by HAT do not work.

Options can be out-commented by inserting a '#' as the first character on a line.

Note: Earlier versions of HAT.cgi do not work properly under Windows Vista. Because of a change in IIS 7.0, HAT.conf file is only searched in wwwroot folder even when HAT.cgi is located in its subfolder. HAT.cgi 081216 and later versions fix this.

#### Web-HAT Template Options

Normally Web-HAT publishes on the web all the templates as they are installed. It is, however, possible to modify their contents by placing extra options on the URL. These parameters work by limiting the initial data contents temporarily. Any number of options can be appended to an URL.

Possible options for limiting selections are

  &dim[dn]=[expr]          [dn] is a dimension field number (1 to 32)
&value[vn]=[expr]        [vn] is a value field number (1 to 24)
&cardtitle=[expr]
&linetext=[expr]
&cardfrom=[expr]
&cardto=[expr]
&notes=[text]


[expr]is an expression using the same format as corresponding edit boxes in HAT. Operators can be used as well as various codes. For example, dimension expressions may use HAT-codes, host codes or component texts.

These options control the time axis limits. They are available for Time Functions only.

  &axisfrom=[expr]
&axisto=[expr]


These options change how data is presented

  &lang=[country]       currently valid country codes: US, SE and FI
&format=[country]
&page=single          HAT 5.2.1 and later
&title=[text]         HAT 5.2.1 and later
&notestext=[text]     HAT 5.5 and later


Some characters cannot be used in a URL, they need to be encoded this way

  & must be entered as %26
< must be entered as %3C
> must be entered as %3E
+ must be entered as %2B
space must be entered as %20 or +
OR  operator may be entered as %7C or |
NOT operator may be entered as %AC or --


Some examples of valid options

  &dim4=23040
&value1=%3E1000
&cardtitle=bank--bankrupt


#### Enabling CGI interface for IIS

The Internet Information Server (IIS) by default does not allow CGI applications to execute. You need to enable this in order to get Web-HAT working under Windows.

IIS 6.0 (Windows 2000 and XP):

1. Open IIS configuration

Selecct "Internet Information Services" or "Internet Services Manager" in your start menu.

2. Open Properties for default web site

On the left panel open your computer name and right-click on "Default Web Site". Select "Properties".

3. Select "Home Directory" settings

4. Set "Execute Permissions" = "Scripts and Executables"

5. Accept changes

Close the dialog by clicking the "OK" button. A couple of dialogs may come up, select OK in them.

IIS 7.0 (Windows Vista):

1. Turn on CGI support in IIS
1. Open "Programs and Features" in Control Panel
2. Click "Turn Windows features on or off"
3. Select "Internet Information Services"
4. Expand "Internet Information Services"
5. Expand "World Wide Web Services"
6. Expand "Application Development Features"
7. Select "CGI"

2. Configure Windows Firewall
1. Open "Security Center" in Control Panel
2. Click "Windows Firewall"
3. Click "Allow a program through Windows Firewall"
4. Enable "World Wide Web Services (HTTP)" in the list
5. Click "OK"

3. Add CGI module mapping in IIS
1. open "IIS Manager" in Start >> "Administrative Tools"
2. double-click "Handler Mappings" icon
• Request path: *.cgi
• Module: CgiModule
• Name: CGI gateway
• click "OK"
4. click "OK"

4. Enable hat.cgi to execute in IIS
1. open "IIS Manager" in Start >> "Administrative Tools"
2. double-click "ISAPI and CGI Restrictions" icon
• ISAPI or CGI path: C:\Inetpub\wwwroot\webhat\hat.cgi
• Description: Web-HAT
• Allow extension path to execute: yes
• click "OK"
4. alternatively you may allow all cgi-programs to execute:
• click "Edit Feature Settings.." on right panel
• check "Allow unspecified CGI modules"
• click "OK"
5. click "OK"

#### Web Server under OS X 10.8

Apple has removed the "Web Sharing" option from System Preferences. The underlying Apache web server is still there, all you have to do is to turn it on.

There are many ways to turn the web server on.

This Web Sharing preference pane from ClickOnTyler makes it really easy. Unpack it and copy the enclosed Web Sharing.prefPane to /Library/PreferencePanes folder. Then open System Preferences and look for "Web Sharing" pane to turn the web server on.

#### Search engine robots

Search engine robots (i.e. Googlebot) look through all sites on the web and index them. It is necessary to prevent them going through Web-HAT sites, because indexing would increase network traffic considerably. Robots look behind every link in all web pages causing a huge number of pages to be calculated and downloaded.

All that needs to be done is placing a simple "robots.txt" file using UNIX line encoding in the root of the web server. An example of such a file for a UNIX web server is:

 User-agent: * Disallow: /cgi-bin/ Disallow: /webhat/ 

#### 3 GB support under 32-bit Windows

Windows normally allows only 2 GB of memory to be allocated for 32-bit processes. This limit exists even when a system is loaded with more that 2 GB of RAM. The reason for this limitation is application compatibility. Many applications cannot deal with the upper half of 32-bit address space.

HAT can handle these negative addresses and is thus declared to be large memory aware. Depending on your Windows version, you may turn on support for 3 GB memory allocation. For more information, see /3GB startup switch in Windows

This feature is available in HAT 5.2.1 and later.

back