<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2607884204445547877</id><updated>2011-12-25T18:55:47.114Z</updated><category term='UDH'/><category term='OIPI'/><category term='Compiler'/><category term='Virtual PC'/><category term='Close'/><category term='UTF8'/><category term='Performance'/><category term='BASE64DECODE'/><category term='EditTable'/><category term='ZZ_SMTP'/><category term='Initialize'/><category term='registry'/><category term='SENL'/><category term='DLL Prototyping'/><category term='btree'/><category term='ZZ_IDE_BP_PUBLISHER'/><category term='sort file'/><category term='GETMAIL'/><category term='sizelock'/><category term='resolved'/><category term='cursor'/><category term='timer'/><category term='consultancy'/><category term='mashup'/><category term='atStation'/><category term='humor'/><category term='SYSPROCNAMES'/><category term='select'/><category term='PDF'/><category term='nsis'/><category term='Boiler Room'/><category term='DLL'/><category term='LH'/><category term='Popup'/><category term='humour'/><category term='9.11'/><category term='latent'/><category term='CloseTable'/><category term='Dim Sum'/><category term='Basic+'/><category term='Station Id'/><category term='Universal Driver Heavy'/><category term='Unicode'/><category term='Perform'/><category term='Popups'/><category term='SlickRun'/><category term='citrix'/><category term='Bugs'/><category term='XP Mode'/><category term='Set_Property'/><category term='cross reference'/><category term='Linear Hash'/><category term='v119'/><category term='Humanity'/><category term='run_report'/><category term='color_by_pos'/><category term='xref'/><category term='9.2'/><category term='Repository'/><category term='OeProfile'/><category term='AREV Behaviour'/><category term='Windows API'/><category term='conference'/><category term='http'/><category term='Atrbt 3.12 2.12'/><category term='Universal Driver'/><category term='Case Complete'/><category term='Logs'/><category term='chicago'/><category term='Popup_Sub'/><category term='RTP50'/><category term='BFS'/><category term='new york'/><category term='Windows 7'/><category term='share'/><category term='Menu'/><category term='Execute'/><category term='revparam'/><category term='MIME'/><category term='transaction'/><category term='relational'/><category term='reduce'/><category term='sftp'/><category term='bang file'/><category term='OI910'/><category term='Stack'/><category term='indexing'/><category term='freeware'/><category term='RTP27'/><category term='options'/><category term='-   OpenInsight'/><category term='OpenInsight'/><category term='JoinMap'/><category term='EditTable Cookbook'/><category term='index'/><category term='https'/><category term='Mail Client'/><category term='MFS'/><category term='Window Common'/><category term='Form Designer'/><category term='engine farm'/><category term='OIWin_GetKey'/><category term='progress'/><category term='bang code'/><category term='ftp'/><category term='SYS1000'/><category term='Utilities'/><category term='profile'/><title type='text'>Sprezzatura :: Making Databases Happen</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Mat O'Marah</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DldxMaatKcM/Sa65hI3l5hI/AAAAAAAAAG0/DrOQ0Pm-uFM/S220/H1.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>77</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-2676276217614194997</id><published>2011-12-25T18:55:00.001Z</published><updated>2011-12-25T18:55:47.141Z</updated><title type='text'>You want to do WHAT with Popups - Part 2</title><content type='html'>Following on from our last post on colouring individual popup lines we move onto one of the holy grails of developers - the ability to add a button to a popup and launch our own program from it - interrogating the popup to display more information about the current row for example. Using the example we showed last time - note that we now have a button on the popup called "Display"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-roCOJtN2dXI/TvdxQPqlNpI/AAAAAAAAAEM/Rgau3-4LCo4/s1600/deleteme.png" imageanchor="1"&gt;&lt;img border="0" height="154" src="http://3.bp.blogspot.com/-roCOJtN2dXI/TvdxQPqlNpI/AAAAAAAAAEM/Rgau3-4LCo4/s400/deleteme.png" width="242" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Clicking the button results in this&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-U-NYZEJDiQ8/TvY1hmoPczI/AAAAAAAAADc/qB3RyB38l5E/s1600/deleteme.png" imageanchor="1"&gt;&lt;img border="0" height="219" src="http://2.bp.blogspot.com/-U-NYZEJDiQ8/TvY1hmoPczI/AAAAAAAAADc/qB3RyB38l5E/s400/deleteme.png" width="263" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;To accomplish this we need to be familiar with&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The TIMER tecnique we discussed in the last blog posting&lt;/li&gt;&lt;li&gt; The fully qualified entity ids of the individual popup controls&lt;/li&gt;&lt;li&gt;The use of Window Common&lt;/li&gt;&lt;li&gt;The structure of the Window Common used for quick events&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;b&gt;The TIMER technique we discussed in the last blog posting &lt;/b&gt;&lt;br /&gt;If you haven't yet read &lt;a href="http://sprezzblog.blogspot.com/2011/12/you-want-to-do-what-with-popup-oh-ok.html" target="_blank"&gt;the last blog entry&lt;/a&gt; then you might like to before continuing.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The fully qualified entity ids of the individual popup controls&lt;/b&gt;&lt;br /&gt;To add a display buttton to the popup we &lt;i&gt;could&lt;/i&gt; add a new control to the popup on the fly but that is a lot more complicated than taking over a control that already exists. So the trick that we are going to use is to add a button on to the popup that we're not going to use for its stated purpose and change its display text to "Display" and its action to something more suited to our use.&lt;br /&gt;&lt;br /&gt;For this example I'm going to hijack the "Print" button so we need to add that to the popup definition.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-fQzRjeeLVfw/TvY4Wroj4SI/AAAAAAAAADo/Zs1x7S86a5Q/s1600/deleteme.png" imageanchor="1"&gt;&lt;img border="0" height="219" src="http://2.bp.blogspot.com/-fQzRjeeLVfw/TvY4Wroj4SI/AAAAAAAAADo/Zs1x7S86a5Q/s400/deleteme.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;For your purposes you might want to use one of the other controls so for your convenience here's a list of them all :-&lt;br /&gt;&lt;br /&gt;&lt;table&gt; &lt;tbody&gt;&lt;tr&gt;  &lt;td&gt;POPUP.CB_OK&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;POPUP.CB_CANCEL&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;POPUP.CB_CLEAR&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;POPUP.CB_ALL&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;POPUP.CB_FIND&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;POPUP.CB_PRINT&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Returning to our timer event - the first thing that we're going to do is to modify the TEXT of the print button to make it read "Display".&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: #fefefe; border: 1px solid #7389AE; color: black; font-family: Consolas,Courier New,Courier,Verdana,Arial; font-size: 10pt; margin: 0px 10px auto; padding: 10px 20px; white-space: nowrap;"&gt;printButton&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"POPUP.CB_PRINT"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;objxArray&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;printButton&lt;br /&gt;propArray&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"TEXT"&lt;/span&gt;&amp;nbsp;&lt;br /&gt;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"Display"&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;set_Property&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;objxArray&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;propArray&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;br /&gt;With that done we need to go about modifying the action to take on the click.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The use of Window Common&lt;/b&gt; &lt;br /&gt;To use Window Common you just have to add the following code to your subroutine.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: #fefefe; border: 1px solid #7389AE; color: black; font-family: Consolas,Courier New,Courier,Verdana,Arial; font-size: 10pt; margin: 0px 10px auto; padding: 10px 20px; white-space: nowrap;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;winId&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"POPUP"&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;$Insert&lt;/span&gt;&amp;nbsp;oiwin_Comm_Init&lt;/div&gt;&lt;br /&gt;If you're not familiar with Window Common then &lt;a href="http://www.sprezzatura.com/library/senl/senl-vol1-8.pdf" target="_blank"&gt;where've you been for the past 15 years?&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The structure of the Window Common used for quick events&lt;/b&gt; &lt;br /&gt;Window Common was effectively documented in detail in Technical Bulletin #2 - Compiled Window Structures, available on an old Works CD. We only need a very limited subset however so we'll deal with that.&lt;br /&gt;&lt;br /&gt;Each control on the window has the events associated with it in the variable controlSemantics@. So we need to firstly find the control, then find the CLICK event associated with it and then remove the logic that is currently there and replace it with a call to OUR routine instead.&lt;br /&gt;&lt;br /&gt;The quickevent structure that we need is as follows :-&lt;br /&gt;&lt;br /&gt;quickEventInfo&amp;lt;0, 0, 0, 1 &amp;gt;&amp;nbsp; =&amp;nbsp; Code for type of event&lt;br /&gt;quickEventInfo&amp;lt;0, 0, 0, 2 &amp;gt;&amp;nbsp; =&amp;nbsp; The action to take&lt;br /&gt;quickEventInfo&amp;lt;0, 0, 0, 3&amp;gt;&amp;nbsp; :=&amp;nbsp; The routine to call&lt;br /&gt;quickEventInfo&amp;lt;0, 0, 0, 4&amp;gt;&amp;nbsp;&amp;nbsp; =&amp;nbsp; The parameters to pass&lt;br /&gt;&lt;br /&gt;So when the popup is originally launched the labelled common looks like this&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-A3W7FRzT7AU/TvY_XqoDUFI/AAAAAAAAAD0/tWUOFawVb18/s1600/deleteme.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-A3W7FRzT7AU/TvY_XqoDUFI/AAAAAAAAAD0/tWUOFawVb18/s1600/deleteme.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;We want to modify it to look like this&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-IKEHpB_XDec/TvY_xOKcJPI/AAAAAAAAAEA/5H0TYhbAItI/s1600/deleteme.png" imageanchor="1"&gt;&lt;img border="0" height="64" src="http://1.bp.blogspot.com/-IKEHpB_XDec/TvY_xOKcJPI/AAAAAAAAAEA/5H0TYhbAItI/s400/deleteme.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The code required to do this is as follows :-&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: #fefefe; border: 1px solid #7389AE; color: black; font-family: Consolas,Courier New,Courier,Verdana,Arial; font-size: 10pt; margin: 0px 10px auto; padding: 10px 20px; white-space: nowrap;"&gt;&lt;span style="color: blue;"&gt;Locate&lt;/span&gt;&amp;nbsp;printButton&amp;nbsp;&lt;span style="color: blue;"&gt;In&lt;/span&gt;&amp;nbsp;controlMap&lt;span style="color: purple;"&gt;@&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;using&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@fm&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;setting&lt;/span&gt;&amp;nbsp;gotIt &lt;span style="color: blue;"&gt;then&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: green; font-style: italic;"&gt;/*&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;OK&amp;nbsp;let's&amp;nbsp;change&amp;nbsp;the&amp;nbsp;quickevent&amp;nbsp;to&amp;nbsp;call&amp;nbsp;OUR&amp;nbsp;program&amp;nbsp;passing&amp;nbsp;in&amp;nbsp;the&amp;nbsp;usual&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;quickEventInfo&amp;nbsp;&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"R"&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Tm&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;quickEventInfo&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"EXECUTE"&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Tm&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;quickEventInfo&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@appId&lt;/span&gt;&lt;span style="color: purple;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;1&lt;/span&gt;&lt;span style="color: purple;"&gt;&amp;gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"*STPROCEXE**"&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;atSelf&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Tm&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;quickEventInfo&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"@SELF"&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@stm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"@EVENT"&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@stm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"@PARAM1"&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;|&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@stm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"@PARAM2"&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@stm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"@PARAM3"&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@stm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;|&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: teal;"&gt;"@PARAM4"&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@stm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"@PARAM5"&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@stm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"@PARAM6"&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@tm&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;quickEventInfo&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@tm&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;Locate&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"CLICK"&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;In&lt;/span&gt;&amp;nbsp;controlSemantics&lt;span style="color: purple;"&gt;@&lt;/span&gt;&lt;span style="color: purple;"&gt;&amp;lt;&lt;/span&gt;&amp;nbsp;gotIt&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;8&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;&amp;gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;using&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@svm&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;setting&lt;/span&gt;&amp;nbsp;gotClick&amp;nbsp;&lt;span style="color: blue;"&gt;then&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;controlSemantics&lt;span style="color: purple;"&gt;@&lt;/span&gt;&lt;span style="color: purple;"&gt;&amp;lt;&lt;/span&gt;&amp;nbsp;got&lt;span style="color: purple;"&gt;It,&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;9&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;gotClick&amp;nbsp;&lt;span style="color: purple;"&gt;&amp;gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;quickEventInfo&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;end&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;So now all we need to do is to take whatever action we want in our commuter program when the CLICK event is triggered. Here's the code from earlier in this blog post.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: #fefefe; border: 1px solid #7389AE; color: black; font-family: Consolas,Courier New,Courier,Verdana,Arial; font-size: 10pt; margin: 0px 10px auto; padding: 10px 20px; white-space: nowrap;"&gt;&lt;span style="font-size: 11pt; font-weight: bold;"&gt;onClick:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;begin&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;case&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;case&lt;/span&gt;&amp;nbsp;object&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"POPUP.CB_PRINT"&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;objxArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"POPUP.ET_POPUP"&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;propArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"LIST"&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;objxArray&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"POPUP.ET_POPUP"&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;propArray&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"SELPOS"&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;get_Property&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;objxArray&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;propArray&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;list&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;dataArray&lt;span style="color: purple;"&gt;[&lt;/span&gt;&lt;span style="color: maroon;"&gt;1&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&lt;span style="color: purple;"&gt;]&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;selPos&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;dataArray&lt;span style="color: purple;"&gt;[&lt;/span&gt;&lt;span style="color: blue;"&gt;col2&lt;/span&gt;&lt;span style="color: purple;"&gt;(&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;span style="color: purple;"&gt;+&lt;/span&gt;&lt;span style="color: maroon;"&gt;1&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&lt;span style="color: purple;"&gt;]&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;call&lt;/span&gt;&amp;nbsp;Msg&lt;span style="color: purple;"&gt;(&lt;/span&gt;&lt;span style="color: #8000ff;"&gt;@window&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"Your&amp;nbsp;cursor&amp;nbsp;is&amp;nbsp;on&amp;nbsp;"&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;list&lt;span style="color: purple;"&gt;&amp;lt;&lt;/span&gt;&amp;nbsp;selPos&lt;span style="color: purple;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;2&lt;/span&gt;&lt;span style="color: purple;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;1&lt;/span&gt;&lt;span style="color: purple;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;end&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;case&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Hopefully this will give you ideas of your own to extend the power and flexibility of popups.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-2676276217614194997?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/2676276217614194997/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2011/12/you-want-to-do-what-with-popups-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2676276217614194997'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2676276217614194997'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2011/12/you-want-to-do-what-with-popups-part-2.html' title='You want to do WHAT with Popups - Part 2'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-roCOJtN2dXI/TvdxQPqlNpI/AAAAAAAAAEM/Rgau3-4LCo4/s72-c/deleteme.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-1661152750474732174</id><published>2011-12-14T16:22:00.001Z</published><updated>2011-12-14T16:42:02.196Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='options'/><category scheme='http://www.blogger.com/atom/ns#' term='color_by_pos'/><category scheme='http://www.blogger.com/atom/ns#' term='timer'/><category scheme='http://www.blogger.com/atom/ns#' term='Popup'/><title type='text'>You want to do WHAT with a Popup? Oh - OK then...</title><content type='html'>A recent Works forum posting posed the question "Is it possible to set the color for individual rows in a popup rather than odd/even row colors?". Received wisdom is that "you cannot change colors on specific rows using COLOR_BY_POS due to the modality of the popup". This set the folks in Sprezz Towers to thinking about how this could actually be accomplished. This blog posting reflects the fruits of the combined thoughts and efforts of both the UK and Philadelphia Sprezz offices.&lt;br /&gt;&lt;br /&gt;Take as a simple example a gender popup :-&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-uwwQB5JRhMA/TugxSRt4QII/AAAAAAAAAC4/IOlWmX9oNWo/s1600/popup.png" imageanchor="1"&gt;&lt;img border="0" height="156" src="http://4.bp.blogspot.com/-uwwQB5JRhMA/TugxSRt4QII/AAAAAAAAAC4/IOlWmX9oNWo/s400/popup.png" width="243" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;It might be nice to render this as follows :-&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-Bu_va89EuMo/TugxuQc9vWI/AAAAAAAAADE/ivaPpgIIUC0/s1600/popup2.png" imageanchor="1"&gt;&lt;img border="0" height="154" src="http://1.bp.blogspot.com/-Bu_va89EuMo/TugxuQc9vWI/AAAAAAAAADE/ivaPpgIIUC0/s400/popup2.png" width="242" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;To achieve this we need to be familiar with&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;User Defined Properties&lt;/li&gt;&lt;li&gt;The TIMER event&lt;/li&gt;&lt;li&gt;The TIMER property&lt;/li&gt;&lt;li&gt;The HANDLE property&lt;/li&gt;&lt;li&gt;The COLOR_BY_POS send_Message message.&lt;/li&gt;&lt;li&gt;The Window structure of a popup &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;User Defined Properties&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;The developer can add additional properties to any control within an OI app simply by setting a property name prefixed with an @. So call set_Property(@Window, "@SPREZZ", "FIDDLESTICKS") would set the @SPREZZ property of the current window to the value "FIDDLESTICKS". Any other process could retrieve this property using get_Property.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;The TIMER event&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;The TIMER event is fired by OpenInsight as specified by the TIMER property &lt;i&gt;regardless&lt;/i&gt;&lt;b&gt; &lt;/b&gt;of whether the current dialog/popup/whatever is currently modal.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;The TIMER property&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;The TIMER property tells the system when it should fire the TIMER event and at what intervals.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;The HANDLE property&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;The HANDLE property provides a convenient shortcut to establish whether or not a control exists. If it exists it &lt;i&gt;will &lt;/i&gt;have a handle.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;The COLOR_BY_POS message&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;The COLOR_BY_POS message allows individual rows, columns or cells of an edit table to be set to a specific colour.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;The Window structure of a popup&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;At its simplest a popup consists of an edit table (where the results are shown) and buttons for selection or cancelling. The edit table is always called POPUP.ET_POPUP.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Implementation&lt;/b&gt;&lt;br /&gt;It might be easier before actually showing the mechanics of how to achieve the effect required, to describe in simple terms how it is achieved. The key is in the seemingly innocous comment above that&amp;nbsp;&lt;b&gt; &lt;/b&gt;"The TIMER event is fired by OpenInsight as specified by the TIMER property &lt;i&gt;regardless&lt;/i&gt;&lt;b&gt; &lt;/b&gt;of whether the current dialog/popup/whatever is currently modal".&lt;br /&gt;&lt;br /&gt;Within our program that calls the popup we are going to do the following :-&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Within the OPTIONS event for the prompt set two user defined properties&lt;/li&gt;&lt;ul&gt;&lt;li&gt;One listing the rows to have their colour set&lt;/li&gt;&lt;li&gt;One listing the colours to set the rows to&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Set a TIMER event for the Window BEFORE calling the popup&lt;/li&gt;&lt;li&gt;Call the popup&lt;/li&gt;&lt;li&gt;Within the TIMER event, grab the user defined properties, set the colours using COLOR_BY_POS and then disable the TIMER event.&lt;/li&gt;&lt;/ul&gt;Whilst this may seem like a hack it works remarkably well with simple popups. Complex popups may require more error trapping.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;The OPTIONS event would look like this :-&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: #fefefe; border: 1px solid #7389AE; color: black; font-family: Consolas,Courier New,Courier,Verdana,Arial; font-size: 10pt; margin: 0px 10px auto; padding: 10px 20px; white-space: nowrap;"&gt;&lt;span style="font-size: 11pt; font-weight: bold;"&gt;onOptions:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;objxArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt; @Window&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;propArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"@ROWS"&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;1&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Fm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;2&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;objxArray&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt; @Window&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;propArray&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"@COLOURS"&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;BLUE$&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Fm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;PINK$&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;objxArray&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt; @Window&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;propArray&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"TIMER"&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;50&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;set_Property&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;objxArray&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;propArray&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;retVal&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;popup&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Window&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;""&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"GENDER"&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;objxArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;object&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;propArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"DEFPROP"&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;retval&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;set_Property&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;objxArray&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;propArray&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;So we firstly indicate that we would like to change the colours of rows 1 and 2 of the popup. We then explain that we'd like them set to blue and pink (using some previously declared EQUATES). We then tell the TIMER event to kick off 50 milliseconds later and then we call the popup. On a successful return from the popup we accept the value and put it into the control that has just triggered this OPTIONS event.&lt;br /&gt;&lt;br /&gt;So the popup will display and within 50 milliseconds the TIMER event will kick in. This has the following code :-&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: #fefefe; border: 1px solid #7389AE; color: black; font-family: Consolas,Courier New,Courier,Verdana,Arial; font-size: 10pt; margin: 0px 10px auto; padding: 10px 20px; white-space: nowrap;"&gt;&lt;span style="font-size: 11pt; font-weight: bold;"&gt;onTimer:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;objxArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt; @Window&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;propArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"@ROWS"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;objxArray&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt; @Window&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;propArray&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"@COLOURS"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;objxArray&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"POPUP"&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;propArray&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"HANDLE"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;get_Property&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;objxArray&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;propArray&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rows&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;dataArray&lt;span style="color: purple;"&gt;[&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;1&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@rm&lt;/span&gt;&lt;span style="color: purple;"&gt;]&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;colours&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;dataArray&lt;span style="color: purple;"&gt;[&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;Col2&lt;/span&gt;&lt;span style="color: purple;"&gt;(&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;1&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&lt;span style="color: purple;"&gt;]&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;handle&amp;nbsp;&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;dataArray&lt;span style="color: purple;"&gt;[&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;Col2&lt;/span&gt;&lt;span style="color: purple;"&gt;(&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;1&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Rm&lt;/span&gt;&lt;span style="color: purple;"&gt;]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;Len&lt;/span&gt;&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;handle&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;then&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ptr1&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;1&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ptr2&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;1&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;loop&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;nextRow&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;rows&lt;span style="color: purple;"&gt;[&lt;/span&gt;&amp;nbsp;ptr1&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Fm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;]&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ptr1&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;col2&lt;/span&gt;&lt;span style="color: purple;"&gt;(&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;1&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;while&lt;/span&gt; &lt;span style="color: blue;"&gt;len&lt;/span&gt;&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;nextRow&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;nextColour&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;colours&lt;span style="color: purple;"&gt;[&lt;/span&gt;&amp;nbsp;ptr2&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Fm&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;]&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ptr2&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;col2&lt;/span&gt;&lt;span style="color: purple;"&gt;(&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;1&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;call&lt;/span&gt; send_Message&lt;span style="color: purple;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;"POPUP.ET_POPUP"&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"COLOR_BY_POS"&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;1&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;nextRow&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;nextColour&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;repeat&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;objxArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt; @Window&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;propArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"TIMER"&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;""&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;set_Property&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;objxArray&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;propArray&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Return&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;In this code we retrieve the rows to colour and the colours to set them to. We also retrieve the HANDLE&amp;nbsp; of the popup to ensure that it has been created successfully. If it has we use send_Message to colour the individual rows of the popup before setting the TIMER property to null to prevent it from being called again. In theory we ought to be able to set the TIMER property to 0 but there seems to be a bug in the 9.2.1 implementation which ignores the zero and continues calling the TIMER event.&lt;br /&gt;&lt;br /&gt;Thus we are able simply to modify the popup &lt;i&gt;after &lt;/i&gt;it has been launched.&lt;br /&gt;&lt;br /&gt;In the next article in this series we will show how to add a button to the popup to call a user defined routine to display additional information about the current row in the popup.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-1661152750474732174?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/1661152750474732174/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2011/12/you-want-to-do-what-with-popup-oh-ok.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/1661152750474732174'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/1661152750474732174'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2011/12/you-want-to-do-what-with-popup-oh-ok.html' title='You want to do WHAT with a Popup? Oh - OK then...'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-uwwQB5JRhMA/TugxSRt4QII/AAAAAAAAAC4/IOlWmX9oNWo/s72-c/popup.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-5223179422965856048</id><published>2011-11-25T15:40:00.001Z</published><updated>2011-11-25T15:40:51.279Z</updated><title type='text'>Using the Table Browser from within a program</title><content type='html'>A developer recently asked on the Works forum if it was possible to use the table browser from within a program. Well the simple answer is "Yes". The slightly more complex answer is that since so many of the OI tools are now written in OI itself it is frequently possible to use these tools from within programs.The first thing we need to know is what the table browser window is called. It may come as a surprise to those more familiar with obscure naming conventions to find out that it is called "TABLE_BROWSER". So to call it programmatically we'd simply&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: #fefefe; border: 1px solid #7389AE; color: black; font-family: Consolas,Courier New,Courier,Verdana,Arial; font-size: 10pt; margin: 0px 10px auto; padding: 10px 20px; white-space: nowrap;"&gt;atWindow&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;Start_Window&lt;span style="color: purple;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;"TABLE_BROWSER"&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Window&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Of course launching it might not be enough - we might also want to populate it with the contents of a table. To do this we need to know the control names. To save you the investigative work we've included a table below :-&lt;br /&gt;&lt;br /&gt;&lt;table style="width: 100%;"&gt; &lt;tbody&gt;&lt;tr&gt;  &lt;td&gt;TABLE_BROWSER&lt;/td&gt;  &lt;td&gt;The window&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;TABLE_BROWSER.BTN_CANCEL&lt;/td&gt;  &lt;td&gt;The cancel button&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;TABLE_BROWSER.BTN_LOAD&lt;/td&gt;  &lt;td&gt;The load button&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;TABLE_BROWSER.BTN_OK&lt;/td&gt;  &lt;td&gt;The Ok button&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;TABLE_BROWSER.BTN_OPTIONS&lt;/td&gt;  &lt;td&gt;The options button&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;TABLE_BROWSER.DATA_TABLE&lt;/td&gt;  &lt;td&gt;The results edit table&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;TABLE_BROWSER.NUM_RECORDS&lt;/td&gt;  &lt;td&gt;The number of records to display&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;TABLE_BROWSER.SELECTION_BTN&lt;/td&gt;  &lt;td&gt;The selection button&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;TABLE_BROWSER.TABLENAME&lt;/td&gt;  &lt;td&gt;The table name edit field&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;TABLE_BROWSER.TEXT_1&lt;/td&gt;  &lt;td&gt;The Tablename static&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td&gt;TABLE_BROWSER.TEXT_2&lt;/td&gt;  &lt;td&gt;The Number of Records static&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So to launch the browser and load the AVERY_LABELS table we could&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: #fefefe; border: 1px solid #7389AE; color: black; font-family: Consolas,Courier New,Courier,Verdana,Arial; font-size: 10pt; margin: 0px 10px auto; padding: 10px 20px; white-space: nowrap;"&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;Declare&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;Function&lt;/span&gt;&amp;nbsp;set_Property&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;start_Window&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;atWindow&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;Start_Window&lt;span style="color: purple;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;"TABLE_BROWSER"&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@Window&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;objxArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&amp;nbsp;atWindow&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;".TABLENAME"&lt;/span&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;propArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"DEFPROP"&lt;/span&gt;&lt;br /&gt;&amp;nbsp;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"AVERY_LABELS"&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;set_Property&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;objxArray&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;propArray&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;dataArray&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;Call&lt;/span&gt;&amp;nbsp;send_Event&lt;span style="color: purple;"&gt;(&lt;/span&gt;atWindow&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;".BTN_LOAD"&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"CLICK"&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-5223179422965856048?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/5223179422965856048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2011/11/using-table-browser-from-with-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/5223179422965856048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/5223179422965856048'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2011/11/using-table-browser-from-with-in.html' title='Using the Table Browser from within a program'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-8692474901668485281</id><published>2011-11-04T12:14:00.001Z</published><updated>2011-11-04T12:14:45.920Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='reduce'/><category scheme='http://www.blogger.com/atom/ns#' term='latent'/><category scheme='http://www.blogger.com/atom/ns#' term='cursor'/><category scheme='http://www.blogger.com/atom/ns#' term='resolved'/><category scheme='http://www.blogger.com/atom/ns#' term='select'/><title type='text'>Working with Multiple Cursors</title><content type='html'>Finishing up our series on extended selects and readnexts, we will now turn our attention to managing the cursors.&lt;br /&gt;&lt;br /&gt;When working with the extended select and readnext statements, the developer is required to maintain the status of the select and readnext cursor.  Additionally, as we hinted in our previous entries on &lt;a href="http://sprezzblog.blogspot.com/2011/05/latent-and-resolved-selects.html"&gt;Latent and Resolved Selects&lt;/a&gt; and &lt;a href="http://sprezzblog.blogspot.com/2011/08/selects-and-file-resizing.html"&gt;Selects and File Resizing&lt;/a&gt;, the extended select and readnext statements allow the developer to work with multiple cursors.  Multiple cursors means that it's possible to have up to 9 active select statements working at any particular time.&lt;br /&gt;&lt;br /&gt;We'll start with cursor status, since that needs to be maintained no matter how many selects may be active at any given time.&lt;br /&gt;&lt;br /&gt;We previously mentioned that the extended select syntax is:&lt;br /&gt;&lt;br /&gt;&lt;div    style="white-space:nowrap;background-color:#FEFEFE;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;color:#000000;"&gt;&lt;span style="color:#0000FF;"&gt;select&lt;/span&gt; table &lt;span style="color:#0000FF;"&gt;by&lt;/span&gt; columns &lt;span style="color:#0000FF;"&gt;using&lt;/span&gt; cursor then...&lt;/div&gt;&lt;br /&gt;While that's true, it's a little simplistic as there are two other keywords, SETTING and ASSIGNING, that you may use as well. The following table describes each keyword in a little more detail:&lt;br /&gt;&lt;br /&gt;&lt;table cellspacing="2" cellpadding="4" style="background-color:white; width:75%;border-style:solid;border-color:#7676AD;border-width:1px;margin:0px 10px auto;"&gt;&lt;tr&gt;&lt;th style="background-color:#CCCCFB;padding:4px;width:25%"&gt;Keyword&lt;/th&gt;&lt;th style="background-color:#CCCCFB;"&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;Using&lt;/td&gt;&lt;td style="background-color:#EEEEFB;padding-left:2px;"&gt;Assigns new criteria to the cursor. If a new table is specified, then the existing criteria is lost.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;Setting&lt;/td&gt;&lt;td style="background-color:#EEEEFB;padding-left:2px;"&gt;Assigns the criteria to the next available cursor.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;Assigning&lt;/td&gt;&lt;td style="background-color:#EEEEFB;padding-left:2px;"&gt;Allows you to assign the results of the cursor to a different table. Any existing results are assigned to the new table.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;There are a total of 9 cursors available to the developer (0 through 8) and they can all be active at any given time.  By allocating specifically nominated cursors, you can set the system so that cursor 1 is processing your CUSTOMERS table while cursor 2 is processing your INVOICES table.  This would be useful if you wanted a report on your invoices sorted in a very specific customer order.  As you readnext each customer using cursor 1, you can then issue a new series of selects against cursor 2 finding the invoices for each customer.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Note:  While cursor 0 is not reserved exclusively for system use, it is the cursor the system uses.  When working with multiple cursors, it's best to only use cursors 1 through 8.&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;We do realize that you can simply call btree.extract() to return results from the INVOICE table.  However, using that you will find that the rows will be returned in key sorted order.  If you want any additional sorting then you will need to process the sort, which will normally require an additional file pass.  Additionally, since you are managing the cursors, you do not have to worry as much about the system using the cursor from under you, or issuing select statements in subroutines.  The SETTING keyword ensures you have a new cursor to manage your selection.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;u&gt;USING keyword&lt;/u&gt;&lt;/em&gt;&lt;br /&gt;The USING keyword is the most analogous to the basic system SELECT statement.  By issuing repeated USING calls to a specific cursor, you can refine the results of your select.  Normally, this is mostly used when making a two pass selection.  The first pass would resolve based on indexed fields, while the second pass can trim down the results working on a subset of the data.  Unlike a standard system select, you cannot take the results of one table and apply the results to a different table.  If you do, the original results will be cleared and only the new criteria will be applied to the new table.  The &lt;a href="#assigning"&gt;assigning&lt;/a&gt; keyword allows this functionality.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;u&gt;SETTING keyword&lt;/u&gt;&lt;/em&gt;&lt;br /&gt;The SETTING keyword finds the next unused cursor and applies the criteria to that cursor.  It's the recommended method of starting off a new set of criteria.  Which cursor you use doesn't matter, and if you nominate specific cursors, you might accidentally step on a cursor you are using.  So, for a two pass report, you would set up the initial select using SETTING, then finish it off with USING.&lt;br /&gt;&lt;br /&gt;&lt;a name="assigning"&gt;&lt;em&gt;&lt;u&gt;ASSIGNING keyword&lt;/u&gt;&lt;/em&gt;&lt;/a&gt;&lt;br /&gt;The ASSIGNING keyword is only valid on an active cursor.  It is used when you wish to assign existing criteria from one table to a different table.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;u&gt;MODE keyword&lt;/u&gt;&lt;/em&gt;&lt;br /&gt;Sometimes you may not know at design time which keyword you require.  MODE allows you to specify the criteria using a variable.  The variable must contain an integer value which identifies the keywork type.&lt;br /&gt;&lt;br /&gt;&lt;table cellspacing="2" cellpadding="4" style="background-color:white; width:50%;border-style:solid;border-color:#7676AD;border-width:1px;margin:0px 10px auto;"&gt;&lt;tr&gt;&lt;th style="background-color:#CCCCFB;padding:4px;width:50%"&gt;Keyword&lt;/th&gt;&lt;th style="background-color:#CCCCFB;"&gt;Mode Value&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;Setting&lt;/td&gt;&lt;td style="background-color:#EEEEFB;text-align:center;padding:3px;"&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;Using&lt;/td&gt;&lt;td style="background-color:#EEEEFB;text-align:center;padding:3px;"&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;Assigning&lt;/td&gt;&lt;td style="background-color:#EEEEFB;text-align:center;padding:3px;"&gt;3&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;For example, if you do not know if you are working with an existing cursor, because you are allowing the user to refine the result list, you can allocate "setting" or "using" through a simple check.&lt;br /&gt;&lt;br /&gt;&lt;div    style="white-space:nowrap;background-color:#FEFEFE;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;color:#000000;"&gt;&lt;span style="font-style:italic;color:#008000;" &gt;* // refineFlag is defined elsewhere and indicates if this&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style:italic;color:#008000;" &gt;* // is an existing selection being refined&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt; &lt;span style="color:#800080;"&gt;(&lt;/span&gt;refineFlag &lt;span style="color:#800080;"&gt;=&lt;/span&gt; TRUE$ &lt;span style="color:#800080;"&gt;)&lt;/span&gt; &lt;span style="color:#0000FF;"&gt;then&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;cursorMode &lt;span style="color:#800080;"&gt;=&lt;/span&gt; &lt;span style="color:#800000;"&gt;1&lt;/span&gt;  &lt;span style="color:#800080;"&gt;;&lt;/span&gt; &lt;span style="font-style:italic;color:#008000;" &gt;* // using&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt; &lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;cursorMode &lt;span style="color:#800080;"&gt;=&lt;/span&gt; &lt;span style="color:#800000;"&gt;2&lt;/span&gt;  &lt;span style="color:#800080;"&gt;;&lt;/span&gt; &lt;span style="font-style:italic;color:#008000;" &gt;* // setting&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#0000FF;"&gt;select&lt;/span&gt; hTable &lt;span style="color:#0000FF;"&gt;by&lt;/span&gt; columns mode cursorMode &lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#800080;"&gt;.&lt;/span&gt;&lt;span style="color:#800080;"&gt;.&lt;/span&gt;&lt;span style="color:#800080;"&gt;.&lt;/span&gt;&lt;span style="color:#800080;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;em&gt;&lt;u&gt;READNEXT line&lt;/u&gt;&lt;/em&gt;&lt;br /&gt;Finally, once you have the criteria resolved as you wish, you need to issue the READNEXT command.  It's important to remember to include the "USING cursorVariable" portion of the READNEXT when working with multiple cursors.  Without this section, the system will assume you are using cursor 0.&lt;br /&gt;&lt;br /&gt;READNEXT also supports an optional "by" clause.  It's used to determine the direction keys are extracted from a cursor:&lt;br /&gt;&lt;br /&gt;&lt;table cellspacing="2" cellpadding="4" style="background-color:white; width:75%;border-style:solid;border-color:#7676AD;border-width:1px;margin:0px 10px auto;"&gt;&lt;tr&gt;&lt;th style="background-color:#CCCCFB;padding:4px;width:25%"&gt;Integer&lt;/th&gt;&lt;th style="background-color:#CCCCFB;padding:4px;width:25%"&gt;Literal&lt;/th&gt;&lt;th style="background-color:#CCCCFB;"&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;0&lt;/td&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;AT&lt;/td&gt;&lt;td style="background-color:#EEEEFB;padding-left:2px;"&gt;Ascending Terminating.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;1&lt;/td&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;AN&lt;/td&gt;&lt;td style="background-color:#EEEEFB;padding-left:2px;"&gt;Ascending Non-Terminating.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;2&lt;/td&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;DT&lt;/td&gt; &lt;td style="background-color:#EEEEFB;padding-left:2px;"&gt;Descending Terminating.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;3&lt;/td&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;DN&lt;/td&gt;&lt;td style="background-color:#EEEEFB;padding-left:2px;"&gt;Descending Non-Terminating.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;For example:&lt;br /&gt;&lt;br /&gt;&lt;div    style="white-space:nowrap;background-color:#FEFEFE;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;color:#000000;"&gt;&lt;span style="color:#0000FF;"&gt;select&lt;/span&gt; &lt;span style="color:#008080;"&gt;"MYFILE"&lt;/span&gt; &lt;span style="color:#0000FF;"&gt;by&lt;/span&gt; &lt;span style="color:#008080;"&gt;"SORT_FIELD"&lt;/span&gt; &lt;span style="color:#0000FF;"&gt;setting&lt;/span&gt; cursorVar &lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#800080;"&gt;.&lt;/span&gt;&lt;span style="color:#800080;"&gt;.&lt;/span&gt;&lt;span style="color:#800080;"&gt;.&lt;/span&gt;&lt;span style="color:#800080;"&gt;.&lt;/span&gt;&lt;span style="color:#800080;"&gt;.&lt;/span&gt;&lt;span style="color:#800080;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000FF;"&gt;readnext&lt;/span&gt; thisKey &lt;span style="color:#0000FF;"&gt;using&lt;/span&gt; cursorVar &lt;span style="color:#0000FF;"&gt;by&lt;/span&gt; &lt;span style="color:#0000FF;"&gt;DT&lt;/span&gt; &lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;will return the keys in the reverse order returned in the cursor, giving the same results as:&lt;br /&gt;&lt;br /&gt;&lt;div    style="white-space:nowrap;background-color:#FEFEFE;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;color:#000000;"&gt;&lt;span style="color:#0000FF;"&gt;select&lt;/span&gt; &lt;span style="color:#008080;"&gt;"MYFILE"&lt;/span&gt; &lt;span style="color:#0000FF;"&gt;by&lt;/span&gt; &lt;span style="color:#008080;"&gt;"#SORT_FIELD"&lt;/span&gt; &lt;span style="color:#0000FF;"&gt;setting&lt;/span&gt; cursorVar &lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#800080;"&gt;.&lt;/span&gt;&lt;span style="color:#800080;"&gt;.&lt;/span&gt;&lt;span style="color:#800080;"&gt;.&lt;/span&gt;&lt;span style="color:#800080;"&gt;.&lt;/span&gt;&lt;span style="color:#800080;"&gt;.&lt;/span&gt;&lt;span style="color:#800080;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000FF;"&gt;readnext&lt;/span&gt; thisKey &lt;span style="color:#0000FF;"&gt;using&lt;/span&gt; cursorVar &lt;span style="color:#0000FF;"&gt;by&lt;/span&gt; &lt;span style="color:#0000FF;"&gt;AT&lt;/span&gt; &lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Note:  When using the literals (AT, AN, DT &amp;amp; DN) you must not enclose them in quotes.&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;u&gt;CLEARSELECT&lt;/u&gt;&lt;/em&gt;&lt;br /&gt;CLEARSELECT allows you to clear a cursor by referencing the cursor number you wish to clear.&lt;br /&gt;&lt;br /&gt;&lt;div    style="white-space:nowrap;background-color:#FEFEFE;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;color:#000000;"&gt;&lt;span style="color:#0000FF;"&gt;clearSelect&lt;/span&gt; cursorVar&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-size:11pt;" &gt;Additional Commands&lt;/span&gt;&lt;br /&gt;A little known feature of the Basic+ language is the ability to use a cursor instead of a file handle in file I/O statements.  These can be used in READ, WRITE, DELETE, LOCK, UNLOCK, MATREAD and MATWRITE.  The basic syntax is the same for each command, just substitute "CURSOR cursorNumber" for the file handle.&lt;br /&gt;For example&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div    style="white-space:nowrap;background-color:#FEFEFE;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;color:#000000;"&gt;&lt;span style="color:#0000FF;"&gt;read&lt;/span&gt; atRecord &lt;span style="color:#0000FF;"&gt;from&lt;/span&gt; cursor cursorVar&lt;span style="color:#800080;"&gt;,&lt;/span&gt; atID &lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;As you've seen, working with multiple cursors gives a developer much more flexibility in working with the system.  The small increase in code length and complexity is a small price to pay for the productivity gains you can achieve.  As anecdotal proof of this, I once modified a sales report that used a PERFORM SELECT and a series of BTREE.EXTRACTS which was taking over 6 hours to run into a two cursor selection routine and dropped the execution time to just over an hour.&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-8692474901668485281?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/8692474901668485281/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2011/11/working-with-multiple-cursors.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/8692474901668485281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/8692474901668485281'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2011/11/working-with-multiple-cursors.html' title='Working with Multiple Cursors'/><author><name>apk</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-2189371212391148089</id><published>2011-10-26T17:17:00.000+01:00</published><updated>2011-10-26T17:18:25.966+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='profile'/><category scheme='http://www.blogger.com/atom/ns#' term='run_report'/><title type='text'>Run_Report, Walk_Report, Crawl_Report</title><content type='html'>We'd recently installed a new report using RUN_REPORT at the client and the client complained that as the report progressed it became slower and slower and slower until it was taking minutes to print a line. When the report DID finally conclude it crashed with a SYS1000 error message.&lt;br&gt;&lt;br&gt;We tested ourselves and sure enough the report was painful. We started it running against a couple of thousand records before going home for the night and by the time we came back in the morning it wasn't even half way through. When it did eventually finish it crashed! Still this last bit was something we were familiar with having already documented it &lt;a href="http://sprezzblog.blogspot.com/2011/06/open-and-shut-case.html"&gt;in this blog posting.&lt;/a&gt; The slowdown on the otherhand was something else. So we did what most developers do in these circumstances and stripped the report back to bare bones and continued adding features in until it started misbehaving. The report had several BY clauses and several BREAK-ONs but it was when we came to the BREAK-ON modifier "'BP'" that problems started. Without this reports were produced at normal speed - with it they progressively got slower and slower.&lt;br&gt;&lt;br&gt;Now much as we'd love to just throw the issue at Revelation, we know that the more information that we can provide, the more likely they are to be able to find a fix.Thus began several days of sleuthing. The first resort - as is our wont - was to install a profile file. This quickly grew to humongous proportions and we were faced with analysing a 3.6 GB profile log. Fortunately we have tools for this as regular readers will know, and pretty soon we were able to establish that the culprint seemed to be based around calls to get various printer object related properties. &lt;br&gt;&lt;br&gt;Taking our investigations one step further we found that with every new line printed in the report an additional 700 GET/SET_PROPERTY calls were made.&lt;br&gt;&lt;br&gt;To produce the first line of the report 5,324 calls were made&lt;br&gt;To produce the second line of the report 6,024 calls were made&lt;br&gt;To produce the third line of the report 6,724 calls were made&lt;br&gt;&lt;br&gt;and by the time the 60th line of the report was reached GET/SET_PROPERTY was being called 40,000 times to print that one line! Using some additional tools we were able to establish what properties were being requested over and over again.&lt;br&gt;&lt;br&gt;Armed with this information the stalwarts at Revelation were able to go off and discover a total variable not being cleared when the 'B' option was used. A patch was issued and once again we had RUN_Report. We did then run into another issue but we'll save that for another day!&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-2189371212391148089?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/2189371212391148089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2011/10/runreport-walkreport-crawlreport.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2189371212391148089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2189371212391148089'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2011/10/runreport-walkreport-crawlreport.html' title='Run_Report, Walk_Report, Crawl_Report'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-1718780379637577130</id><published>2011-08-25T02:56:00.010+01:00</published><updated>2011-08-25T10:08:42.477+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='http'/><category scheme='http://www.blogger.com/atom/ns#' term='ftp'/><category scheme='http://www.blogger.com/atom/ns#' term='https'/><category scheme='http://www.blogger.com/atom/ns#' term='engine farm'/><category scheme='http://www.blogger.com/atom/ns#' term='sftp'/><title type='text'>Down on the farm</title><content type='html'>With conference coming up soon in October (see you there we hope?) we had to carefully select our presentations to ensure that they remained educational and weren't just product showcases. One of the subjects that we therefore decided not to cover was creating scaleable distributed applications using our proprietary engine farm. Whilst the techniques involved are interesting we'd ultimately be promoting our proprietary technology and if you wanted a sales presentation you'd have asked for one, right? So we decided to create a blog article about it instead! The results are what you're now reading.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What &lt;i&gt;is&lt;/i&gt; an engine farm?&lt;/b&gt;&lt;br /&gt;An engine farm is a program that is designed to spin up and spin down a variable number of OpenEngines on a server to deal with incoming and outgoing transactions. As load volumes increase, more engines are brought into play and as demand decreases engines are retired. The farm also has to deal with engines crashing - be it through programmer error or operating system intervention, and has the ability to kill hung engines so that license count usage does not creep up until the system becomes disabled. The Sprezz engine farm was designed to be pluggable as we deal with a number of different clients (see later for a brief description of these) and as such it is currently dealing wih SFTP, FTP, HTTP, HTTPS and obviously SOAP for XML.  It’s a native Windows Service controlled (normally) by a control panel app.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is it used for?&lt;/b&gt;&lt;br /&gt;Well the answer is, ultimately, whatever you want to use it for. In this section we'll look at a few of the uses that Sprezzatura's clients have put the engine farm to. The clients will have to remain anonymous for reasons of both commercial confidentiality and national security.&lt;br /&gt;&lt;br /&gt;In one application the farm is used for maintaining a phone billing system and front end billing web site. Whilst one engine is downloading call data records using SFTP and then parsing them to create billing records another set of engines might be servicing web site requests to top up individuals phone accounts using HTTPS to do the credit card transactions. &lt;br /&gt;&lt;br /&gt;In another application, localised engine farms at branch offices collect transactions from the local network and securely transmit these to another server farm which maintains a centralised database. This database is in turn published to the web from a secure site that is in turn run by a server farm. Data entered on the local systems is live on the national database and available for query within a second or two of entry.&lt;br /&gt;&lt;br /&gt;Finally in another application an engine farm sitting on a local server consumes XML requests generated by an external entity and in turn publishes the requested XML back to the requester. As volumes increase more engines ensure that the system remains responsive.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Why not just use the OESocketServer?&lt;/b&gt;&lt;br /&gt;Well naturally everyone is going to feel that their solution is the best solution but there's more to our answer than that. The major bullet points that we believe distinguish the Sprezz engine farm are as follows :-&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;When the Sprezz engine farm was developed the socket server was not available&lt;/li&gt;&lt;li&gt;The Sprezz engine farm runs as a native Windows service so configuration is easier as there is no reliance on the Java runtime being installed nor on using a 3rd party service host to run as a service.&lt;/li&gt;&lt;li&gt;The Sprezz engine farm talks directly to engines via revCAPI not via a Java Native  Interface so there is no performance loss from string marshalling&lt;/li&gt;&lt;li&gt;As clients are written per installation it is possible to create highly secure connections without needing to configure a secure tunnel&lt;/li&gt;&lt;li&gt;The control panel application makes configuration more understandable&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;What does it look like?&lt;/b&gt;&lt;br /&gt;Well that's the million dollar question! What do you WANT it to look like? In all cases as the engine farm is a service it doesn't look like anything. The only thing that you'll see is the configuration window - be this an application or a control panel component. For the purposes of this blog post we'll use the phone billing application as the example.&lt;br /&gt;&lt;br /&gt;Whilst the core engine farm remains the same throughout, the front end is modified per application. In this instance the configuration window for the engine farm is an executable, in other instances it is a control panel app. &lt;br /&gt;&lt;br /&gt;When it's running as said previously it's a native Windows Service - so the only sign that it is running is an entry in the services list :-&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-XiJpLoR0lX8/TlClfn2UmyI/AAAAAAAAABs/_kSjcMZr-hw/s1600/blog1.png" imageanchor="1"&gt;&lt;img border="0" height="97" src="http://1.bp.blogspot.com/-XiJpLoR0lX8/TlClfn2UmyI/AAAAAAAAABs/_kSjcMZr-hw/s400/blog1.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="MsoPlainText"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoPlainText"&gt;The remote engines are designed to periodically run specified stored procedures.&amp;nbsp; These programs are periodically polled by the engines to perform the required tasks.&amp;nbsp; For this application, we need two tasks running.&amp;nbsp; These are the&amp;nbsp; "CDR Handler Proc" and "FP Handler Proc" functions.&lt;/div&gt;&lt;br /&gt;In the Phone Billing app the configuration window looks like this :-&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-2dSgyQ5J1jM/TlClmpj4sZI/AAAAAAAAAB0/o0XXq9W7GBY/s1600/blog2.png" imageanchor="1"&gt;&lt;img border="0" height="299" src="http://1.bp.blogspot.com/-2dSgyQ5J1jM/TlClmpj4sZI/AAAAAAAAAB0/o0XXq9W7GBY/s400/blog2.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;In the first subtab we specify how to log into the engine, and the procedure name utilised by the farm to pull down and price call records (SFTP) and the procedure name used by the farm to do the credit card billing (HTTPS).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-QZzgDV3Pjs0/TlCls-s3ovI/AAAAAAAAAB8/Zh6Cllvl5Do/s1600/blog3.png" imageanchor="1"&gt;&lt;img border="0" height="299" src="http://1.bp.blogspot.com/-QZzgDV3Pjs0/TlCls-s3ovI/AAAAAAAAAB8/Zh6Cllvl5Do/s400/blog3.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;In the second subtab we actually configure information about the engine farm itself. The prompts are relatively self explanatory but to deal with them in order :-&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Engine Folder&lt;/i&gt; - where the engines should be launched from&lt;br /&gt;&lt;i&gt;Show Engines&lt;/i&gt; - whether the individual engines should be visible&lt;br /&gt;&lt;i&gt;Persistent Engines&lt;/i&gt; - whether the engines should "stay alive" after they have been launched. If not checked the engine will be closed as soon as it has completed the requested task.&lt;br /&gt;&lt;i&gt;Idle Timeout&lt;/i&gt; - if the engines &lt;i&gt;are&lt;/i&gt; persistent how long must they be idle before they are closed?&lt;br /&gt;&lt;i&gt;Min Engines&lt;/i&gt; - the minimum number of engines to have alive at any one point&lt;br /&gt;&lt;i&gt;Max Engines&lt;/i&gt; - the maximum number of engines to have alive at any one point. This prevents the engine farm from taking ALL of the engines if there are local network users too.&lt;br /&gt;&lt;i&gt;RCL Mode&lt;/i&gt; - as with the Universal Driver - how should communication with the engines take place?&lt;br /&gt;&lt;i&gt;TCPIP Start Port&lt;/i&gt; - for when TCPIP is selected over Named Pipe&lt;br /&gt;&lt;i&gt;Pipe Prefix&lt;/i&gt; - if Names Pipes is used, what prefix should be used for the pipe name?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-viFTJOj4B8o/TlCl5ZGdyEI/AAAAAAAAACE/4dXFAChE9zk/s1600/blog4.png" imageanchor="1"&gt;&lt;img border="0" height="299" src="http://1.bp.blogspot.com/-viFTJOj4B8o/TlCl5ZGdyEI/AAAAAAAAACE/4dXFAChE9zk/s400/blog4.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The final tab contains less used information. Again the prompts are relatively self explanatory but :-&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Init Proc&lt;/i&gt; - the routine to run when an engine is first started&lt;br /&gt;&lt;i&gt;Final Proc&lt;/i&gt; - the routine to run before an engine closes&lt;br /&gt;&lt;i&gt;Execution Timeout&lt;/i&gt; - if an engine has not responded after this many minutes, kill it as it is assumed to have died&lt;br /&gt;&lt;i&gt;GC Interval&lt;/i&gt; - time between internal housekeeping events&lt;br /&gt;&lt;i&gt;Bind Engines&lt;/i&gt; - this tells the engine manager to generate a unique ID for an engine so they can be identified easily.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-zuonEPmqabY/TlCmA1XfIBI/AAAAAAAAACM/G0DcHOLajV8/s1600/blog5.png" imageanchor="1"&gt;&lt;img border="0" height="299" src="http://1.bp.blogspot.com/-zuonEPmqabY/TlCmA1XfIBI/AAAAAAAAACM/G0DcHOLajV8/s400/blog5.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;In this particular application we need to log onto an SFTP server and if the logon fails walk through a list of alternate servers. This table is used to configure this.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-wjzwYOcbGjk/TlCmFrbqVkI/AAAAAAAAACU/w8kDv3PTnbM/s1600/blog6.png" imageanchor="1"&gt;&lt;img border="0" height="298" src="http://3.bp.blogspot.com/-wjzwYOcbGjk/TlCmFrbqVkI/AAAAAAAAACU/w8kDv3PTnbM/s400/blog6.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;In the event of errors the service will mail the error details to a nominated email address. This is configured here.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-LVopzSFLtK0/TlCmM9SMKYI/AAAAAAAAACc/RCkpZ9Xoyig/s1600/blog7.png" imageanchor="1"&gt;&lt;img border="0" height="299" src="http://2.bp.blogspot.com/-LVopzSFLtK0/TlCmM9SMKYI/AAAAAAAAACc/RCkpZ9Xoyig/s400/blog7.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For trouble shooting the service can be asked to keep a log on what it gets up to (this is in addition to the routine updating of the event log with errors that happens normally). The log contains details of all aspects of the service's operations rather than just error conditions.&lt;br /&gt;&lt;br /&gt;A redacted sample of an error log follows :-&lt;br /&gt;&lt;br /&gt;26/10/2010 11:17:34 0000016   6040 : E:\revsoft\OpenInsight\pbs_resources\zzPBSSvc\v1.3\zzPBSSvc.exe - v1.3.0.22&lt;br /&gt;: ===========================================================================&lt;br /&gt;:  &lt;br /&gt;26/10/2010 11:17:34 0000016   6040 : zzPBSSvc loaded log configuration settings:&lt;br /&gt;:   -&amp;gt; LogDirectory        - E:\revsoft\OpenInsight\pbs_resources\zzPBSSvc\v1.3&lt;br /&gt;:   -&amp;gt; LogFile             - zzPBSSvc.log&lt;br /&gt;26/10/2010 11:17:34 0000016   6040 : zzPBSSvc loaded OEM configuration settings:&lt;br /&gt;:   -&amp;gt; APIPath             - E:\revsoft\OpenInsight&lt;br /&gt;:   -&amp;gt; AppID               - PBS&lt;br /&gt;:   -&amp;gt; UserID              - PBS&lt;br /&gt;:   -&amp;gt; Password            - &lt;br /&gt;:   -&amp;gt; HandlerProc         - PBS_ZZPBSSVC&lt;br /&gt;:   -&amp;gt; InitProc            - PBS_ZZPBSSVC_INIT&lt;br /&gt;:   -&amp;gt; FinalProc           - &lt;br /&gt;:   -&amp;gt; PersistantEngines   - 1&lt;br /&gt;:   -&amp;gt; MinEngines          - 2&lt;br /&gt;:   -&amp;gt; MaxEngines          - 3&lt;br /&gt;:   -&amp;gt; UseTCP              - 0&lt;br /&gt;:   -&amp;gt; TCPStartPort        - 54321&lt;br /&gt;:   -&amp;gt; PipePrefix          - OEM&lt;br /&gt;:   -&amp;gt; ShowEngines         - 1&lt;br /&gt;:   -&amp;gt; IdleTimeout         - 10&lt;br /&gt;:   -&amp;gt; ExecTimeout         - 10&lt;br /&gt;:   -&amp;gt; GCInterval          - 5&lt;br /&gt;:   -&amp;gt; CallAttachCmd       - 0&lt;br /&gt;26/10/2010 11:17:34 0000047   6040 : zzPBSSvc loaded SFTP configuration settings:&lt;br /&gt;26/10/2010 11:17:34 0000047   6040 :   -&amp;gt; SFTP Server         - redact&lt;br /&gt;:   -&amp;gt; SFTP UserName       - redact&lt;br /&gt;:   -&amp;gt; SFTP Password       - redact&lt;br /&gt;:   -&amp;gt; SFTP Unbilled Path  - redact/unbilled&lt;br /&gt;26/10/2010 11:17:34 0000047   6040 : -------------------------- &lt;br /&gt;26/10/2010 11:17:34 0000047   6040 :   -&amp;gt; SFTP Server         - redact&lt;br /&gt;:   -&amp;gt; SFTP UserName       - redact&lt;br /&gt;:   -&amp;gt; SFTP Password       - redact/unbilled&lt;br /&gt;26/10/2010 11:17:34 0000047   6040 : -------------------------- &lt;br /&gt;26/10/2010 11:17:34 0000047   6040 :   -&amp;gt; SFTP Frequency      - 5&lt;br /&gt;26/10/2010 11:17:34 0000047   6040 :   -&amp;gt; SFTP Download Path  - E:\revsoft\OpenInsight\pbs\CDR Files\&lt;br /&gt;26/10/2010 11:17:34 0000047   6040 : zzPBSSvc loaded EMail configuration settings:&lt;br /&gt;:   -&amp;gt; Email To            - support@sprezzatura.com&lt;br /&gt;:   -&amp;gt; Email From          - SPBS_Service@redact&lt;br /&gt;:   -&amp;gt; SMTP Server         - &lt;br /&gt;:   -&amp;gt; SMTP UserName       - post.redact.net&lt;br /&gt;:   -&amp;gt; SMTP Password       - &lt;br /&gt;:   -&amp;gt; SMTP Secure         - 0&lt;br /&gt;26/10/2010 11:17:34 0000047   6040 : zzPBSSvc starting OE Manager...&lt;br /&gt;26/10/2010 11:17:36 0001813   6040 : zzPBSSvc started OE Manager OK&lt;br /&gt;26/10/2010 11:17:36 0001813   6040 : zzPBSSvc main thread entering processing loop...&lt;br /&gt;26/10/2010 11:17:36 0001875   4124 : zzPBSSvc thread reports main PBS thread has finished initialization&lt;br /&gt;:   -&amp;gt; initError is 0&lt;br /&gt;26/10/2010 11:17:36 0001922   6040 : zzPBSSvc beginning Regular Payment check...&lt;br /&gt;26/10/2010 11:17:36 0001922   6040 : zzPBSSvc processing regular payments...&lt;br /&gt;26/10/2010 11:17:36 0001922   6040 : zzPBSSvc processed regular payments OK&lt;br /&gt;26/10/2010 11:17:36 0001922   6040 : zzPBSSvc ending Regular Payment check&lt;br /&gt;26/10/2010 11:17:36 0001922   6040 : zzPBSSvc beginning CDR check...&lt;br /&gt;: &lt;br /&gt;26/10/2010 11:17:36 0002016    6040 : ** EXCEPTION! **********************************&lt;br /&gt;: ** Swapping to backup SFTP Server redact [Connection lost]&lt;br /&gt;: &lt;br /&gt;: &lt;br /&gt;26/10/2010 11:17:36 0002282    6040 : ** EXCEPTION! **********************************&lt;br /&gt;: ** Exhausted SFTP backup servers1 [Connection lost]&lt;br /&gt;: &lt;br /&gt;26/10/2010 11:22:36 0302391   6040 : zzPBSSvc beginning CDR check...&lt;br /&gt;: &lt;br /&gt;26/10/2010 11:22:37 0302485    6040 : ** EXCEPTION! **********************************&lt;br /&gt;: ** Swapping to backup SFTP Server redact [Connection lost]&lt;br /&gt;: &lt;br /&gt;: &lt;br /&gt;26/10/2010 11:22:37 0303375    6040 : ** EXCEPTION! **********************************&lt;br /&gt;: ** Exhausted SFTP backup servers1 [Connection lost]&lt;br /&gt;: &lt;br /&gt;26/10/2010 11:25:16 0462344   4124 : zzPBSSvc received STOP request...&lt;br /&gt;26/10/2010 11:25:16 0462344   4124 : zzPBSSvc handled STOP request OK&lt;br /&gt;26/10/2010 11:25:16 0462344   6040 : zzPBSSvc main thread exiting processing loop...&lt;br /&gt;26/10/2010 11:25:16 0462344   6040 : zzPBSSvc stopping OE Manager...&lt;br /&gt;26/10/2010 11:25:16 0462360   6040 : zzPBSSvc stopped OE Manager OK&lt;br /&gt;26/10/2010 11:25:16 0462360   6040 : zzPBSSvc engines statistics:&lt;br /&gt;:   -&amp;gt; TotalRequestCount         - 1&lt;br /&gt;:   -&amp;gt; PeakRequestCount          - 1&lt;br /&gt;:   -&amp;gt; PeakRequestsWaitingCount  - 1&lt;br /&gt;:   -&amp;gt; PeakEngineCount           - 2&lt;br /&gt;:   -&amp;gt; CreateEngineFailureCount  - 0&lt;br /&gt;:   -&amp;gt; TerminatedEngineCount     - 0&lt;br /&gt;:   -&amp;gt; RetiredEngineCount        - 0&lt;br /&gt;26/10/2010 11:25:16 0462360   6040 : zzPBSSvc main thread is exiting ...&lt;br /&gt;26/10/2010 11:25:17 0462454   4124 : zzPBSSvc thread waiting for main PBS thread to exit&lt;br /&gt;26/10/2010 11:25:17 0462454   4124 : zzPBSSvc thread reports main PBS thread has finished&lt;br /&gt;26/10/2010 11:25:17 0462454   4124 : zzPBSSvc thread reports main PBS thread has been released&lt;br /&gt;26/10/2010 11:25:17 0462454   4124 : zzPBSSvc thread exiting OK&lt;br /&gt;&lt;br /&gt;&lt;b&gt;In conclusion&lt;/b&gt;&lt;br /&gt;Engine farms aren't for everybody but when you want a robust, failsafe, self recovering engine farm service which can process pretty much anything and scale to meet your needs we have the technology that has been field proven over the past several years and we are confident it can meet your requirements. For further information or to request a quotation contact sales@sprezzatura.com.&lt;br /&gt;&lt;br/&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-1718780379637577130?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/1718780379637577130/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2011/08/down-on-farm.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/1718780379637577130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/1718780379637577130'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2011/08/down-on-farm.html' title='Down on the farm'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-XiJpLoR0lX8/TlClfn2UmyI/AAAAAAAAABs/_kSjcMZr-hw/s72-c/blog1.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-6156246122975907130</id><published>2011-08-23T12:51:00.001+01:00</published><updated>2011-08-23T12:52:44.323+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='reduce'/><category scheme='http://www.blogger.com/atom/ns#' term='sizelock'/><category scheme='http://www.blogger.com/atom/ns#' term='latent'/><category scheme='http://www.blogger.com/atom/ns#' term='resolved'/><category scheme='http://www.blogger.com/atom/ns#' term='select'/><title type='text'>Selects and File Resizing</title><content type='html'>In a previous blog on &lt;a href="http://sprezzblog.blogspot.com/2011/05/latent-and-resolved-selects.html"&gt;Latent and Resolved Selects&lt;/a&gt;, we talked about how processing through the Basic+ reduce function and select statements were quicker than using the RLIST command.  As hinted at in the prior article, the speed increase comes with additional maintenance required by the developer.  In this part of our series on Selection, we'll talk about this maintenance, and the steps you need to take.&lt;br /&gt;&lt;br /&gt;There are three areas that the developer needs to be aware of.  The first is file resizing.  The second is readnext termination.  The third is cursor status, which will be covered in the next in this series of postings.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;File Resizing&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As most of you know, Revelation's Linear Hash Filing System (LH) is more accurately known as "Linear hashing with two partial expansions, separate chaining, distributed control and variable length records".  It's the "distributed control" portion we're interested in here, since that's the part that manages the file resizing.&lt;br /&gt;&lt;br /&gt;Without going into a detailed technical discussion about how and why the system chooses to resize the file, we know it happens without requiring any specific action by the user.  The system checks for a resize on certain file access.  When a file resizes, it generally interacts with only one or two groups.  The records in these groups can be split and moved anywhere across the entire file.  This means, when you read a record from a table, you can potentially trigger a resize.&lt;br /&gt;&lt;br /&gt;Since there is no way of knowing where the records in the group will move to, it's possible that the records will move to a group with a lower group number.  This means it will be positioned earlier in the file than the current position.&lt;br /&gt;&lt;br /&gt;This is important, because when the system is processing a non-indexed select without an active key list, it starts at group 0 and moves through each group, examining each record.  If the file resizes while this is happening, a record can be moved to a group that has already been processed, meaning the record will be skipped.  Of course, the opposite can happen as well, in that a record that has already been processed can be moved forward to a group that hasn't been processed yet.  This record can then potentially show up twice.&lt;br /&gt;&lt;br /&gt;To avoid this problem, the RLIST function increases the sizelock by two when issuing a select.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;A sizelock of 0 means the file will resize normally, growing or shrinking as required.&lt;/li&gt;&lt;li&gt;A sizelock of 1 means the file will only grow when required.  It will never shrink.&lt;/li&gt;&lt;li&gt;A sizelock of 2 or more means the file will never resize.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;Increasing the sizelock by two ensures that the file will not resize out from under you while the select is being processed.&lt;br /&gt;&lt;br /&gt;Since you are managing the select and readnext yourself, and not RLIST, you need to manually set the sizelock.  This can easily be accomplished using the FIX_LH routine.&lt;br /&gt;&lt;br /&gt;&lt;div    style="white-space:nowrap;background-color:#FEFEFE;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;color:#000000;"&gt;&lt;span style="color:#0000FF;"&gt;$insert&lt;/span&gt; DB_MGMT_EQUATES&lt;br /&gt;&lt;span style="color:#0000FF;"&gt;equ&lt;/span&gt; INCREMENT_SIZELOCK$ &lt;span style="color:#0000FF;"&gt;to&lt;/span&gt; &lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000FF;"&gt;call&lt;/span&gt; fix_lh&lt;span style="color:#800080;"&gt;(&lt;/span&gt; tableName&lt;span style="color:#800080;"&gt;,&lt;/span&gt; UPDATE_SIZELOCK$&lt;span style="color:#800080;"&gt;,&lt;/span&gt; INCREMENT_SIZELOCK$ &lt;span style="color:#800080;"&gt;)&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;When you have finished processing the list, you must decrement the sizelock back.&lt;br /&gt;&lt;br /&gt;&lt;div    style="white-space:nowrap;background-color:#FEFEFE;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;color:#000000;"&gt;&lt;span style="color:#0000FF;"&gt;$insert&lt;/span&gt; DB_MGMT_EQUATES&lt;br /&gt;&lt;span style="color:#0000FF;"&gt;equ&lt;/span&gt; DECREMENT_SIZELOCK$ &lt;span style="color:#0000FF;"&gt;to&lt;/span&gt; &lt;span style="color:#800000;"&gt;0&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000FF;"&gt;call&lt;/span&gt; fix_lh&lt;span style="color:#800080;"&gt;(&lt;/span&gt; tableName&lt;span style="color:#800080;"&gt;,&lt;/span&gt; UPDATE_SIZELOCK$&lt;span style="color:#800080;"&gt;,&lt;/span&gt; DECREMENT_SIZELOCK$ &lt;span style="color:#800080;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;It's important to remember that you should not decrement the sizelock until after you have completely finish processing the file.  That means when you have finished processing the &lt;span style="font-style:italic;"&gt;readNext&lt;/span&gt; loop, not just after you have issued the select statement.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;ReadNext Termination&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The second item to be aware of is readnext termination.  When working with a latent list, the system continues to process the select in a non-terminating loop.  To avoid this, you must use the AT (ascending terminating) or DT (descending terminating) options when issuing the readnext statement.&lt;br /&gt;&lt;br /&gt;The extended ReadNext syntax is&lt;br /&gt;&lt;br /&gt;&lt;div    style="white-space:nowrap;background-color:#FEFEFE;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;color:#000000;"&gt;&lt;span style="color:#0000FF;"&gt;readNext&lt;/span&gt; atId &lt;span style="color:#0000FF;"&gt;using&lt;/span&gt; cursorVar &lt;span style="color:#0000FF;"&gt;by&lt;/span&gt; &lt;span style="color:#0000FF;"&gt;AT&lt;/span&gt; else...&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;where the "by" option can be the following literals or numbers.&lt;br/&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;Literal&lt;/th&gt;&lt;th style="padding:0em 1em;"&gt;Number&lt;/th&gt;&lt;th style="text-align:left"&gt;Direction&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;AT&lt;/td&gt;&lt;td style="text-align:center;"&gt;0&lt;/td&gt;&lt;td&gt;Ascending Terminating&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;AN&lt;/td&gt;&lt;td style="text-align:center;"&gt;1&lt;/td&gt;&lt;td&gt;Ascending Non-Terminating&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;DT&lt;/td&gt;&lt;td style="text-align:center;"&gt;2&lt;/td&gt;&lt;td&gt;Descending Terminating&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;DT&lt;/td&gt;&lt;td style="text-align:center;"&gt;3&lt;/td&gt;&lt;td&gt;Descending Non-Terminating&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Note:  Do not put the "by" option in quotes.  It's a statement, not a passed string.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you know the sort mode at compile time, you can use either the literal or the number.&lt;br /&gt;If you will only know the sort mode at runtime, you must use the number, which you can assign to a variable.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space:nowrap;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;"&gt;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&amp;nbsp;option&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;ASCEND$&amp;nbsp;&lt;span style="color:#0000FF;"&gt;then&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;sortMode&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;0&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;AT&amp;nbsp;-&amp;nbsp;ascending&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;sortMode&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;2&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;DT&amp;nbsp;-&amp;nbsp;descending&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000FF;"&gt;readNext&lt;/span&gt;&amp;nbsp;atId&amp;nbsp;&lt;span style="color:#0000FF;"&gt;using&lt;/span&gt;&amp;nbsp;cursorVar&amp;nbsp;&lt;span style="color:#0000FF;"&gt;by&lt;/span&gt;&amp;nbsp;sortMode&amp;nbsp;else...&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Cursor Status&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As mentioned above, cursor status and working with multiple cursors will be covered in the next post in the Select Series.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-6156246122975907130?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/6156246122975907130/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2011/08/selects-and-file-resizing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/6156246122975907130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/6156246122975907130'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2011/08/selects-and-file-resizing.html' title='Selects and File Resizing'/><author><name>apk</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-4759674234774319179</id><published>2011-08-19T18:39:00.000+01:00</published><updated>2011-08-19T18:39:27.237+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Window Common'/><category scheme='http://www.blogger.com/atom/ns#' term='JoinMap'/><category scheme='http://www.blogger.com/atom/ns#' term='AREV Behaviour'/><title type='text'>DATAFILE= In OpenInsight</title><content type='html'>One of the nice features that AREV has that is missing from OpenInsight is the ability to change the datafile of a databound window on the fly by adding the modifier DATAFILE=NewDataFileName onto the sentence being used to launch the window. This was frequently used when multiple files shared the exact same structure - for example a "current" file and the associated archive files.&lt;br /&gt;&lt;br /&gt;As we've mentioned we're working on a large AREV-&gt;OI conversion and we really missed this facility so in true Sprezz style we decided that we'd better implement it. &lt;br /&gt;&lt;br /&gt;This proved to be easier than even we had anticipated due to the similarity between OI Window Common and AREV Window Common. The workaround we implemented is only good for windows which only update one file, though it wouldn't take much to make it suitable for multi-file windows. The following code shows how to implement it in a create event although of course if you have a promoted event framework you might choose to do it there.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space:nowrap;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;winId&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@Window&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;$Insert&lt;/span&gt;&amp;nbsp;OIWin_Comm_Init&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;$Insert&lt;/span&gt;&amp;nbsp;OIWin_Equates&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:11pt;font-weight:bold;"&gt;create:&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;changeRequired&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;index&lt;/span&gt;&lt;span style="color:#800080;"&gt;(&lt;/span&gt;&amp;nbsp;param1&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"DATAFILE="&lt;/span&gt;&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&amp;nbsp;changeRequired&amp;nbsp;&lt;span style="color:#0000FF;"&gt;then&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;newFile&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;param1&lt;span style="color:#800080;"&gt;[&lt;/span&gt;&amp;nbsp;changeRequired&amp;nbsp;&lt;span style="color:#800080;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;9&lt;/span&gt;&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@Fm&lt;/span&gt;&lt;span style="color:#800080;"&gt;]&lt;/span&gt;&lt;span style="color:#800080;"&gt;[&lt;/span&gt;1&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"&amp;nbsp;"&lt;/span&gt;&lt;span style="color:#800080;"&gt;]&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;JoinMap@&gt;&amp;lt;1&lt;span style="color:#800080;"&gt;,&lt;/span&gt;JMAP_TABLENAME$&lt;span style="color:#800080;"&gt;&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;newFile&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000FF;"&gt;return&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-4759674234774319179?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/4759674234774319179/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2011/08/datafile-in-openinsight.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/4759674234774319179'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/4759674234774319179'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2011/08/datafile-in-openinsight.html' title='DATAFILE= In OpenInsight'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-976895248736953614</id><published>2011-08-18T11:24:00.003+01:00</published><updated>2011-08-18T17:28:12.760+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EditTable'/><category scheme='http://www.blogger.com/atom/ns#' term='EditTable Cookbook'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenInsight'/><title type='text'>EditTable Cookbook - Trapping the ENTER key</title><content type='html'>A recent question on the Revelation Forum asked how to detect an ENTER keypress when  using an EditTable as this is not exposed by the standard OpenInsight CHAR event (ENTER is one of the keys that the EditTable normally considers to be "reserved" like TAB and the Arrow keys).&lt;br /&gt;&lt;br /&gt;Despite this limitation it is actually possible to detect an ENTER keypress with WM_KEYDOWN window message and the WINMSG event &lt;span style="font-style:italic;"&gt;but ONLY if the EditTable is set to "Protected"&lt;/span&gt;, i.e.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-E5dJ-8zl-ok/TkzTl0Dey2I/AAAAAAAAABk/UzIfLfp-aaU/s1600/EditTable%2BProtected.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 385px; height: 274px;" src="http://4.bp.blogspot.com/-E5dJ-8zl-ok/TkzTl0Dey2I/AAAAAAAAABk/UzIfLfp-aaU/s400/EditTable%2BProtected.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5642117079770254178" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To trap the ENTER key we first need to tell OpenInsight that we want to be notified of any WM_KEYDOWN window messages that are sent to the EditTable by using the OpenInsight  QUALIFY_EVENT message.  This is normally done in the form's CREATE event:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space:nowrap;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;"&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0001&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;$insert&lt;/span&gt;&amp;nbsp;winAPI_WindowMessage_Equates&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0002&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;$insert&lt;/span&gt;&amp;nbsp;logical&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0003&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0004&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;call&lt;/span&gt;&amp;nbsp;send_Message&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@window&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;".TABLE_1"&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"QUALIFY_EVENT"&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;|&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0005&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WM_KEYDOWN$&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;TRUE$&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0006&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Once we've done this we can write a WINMSG event handler for the EditTable that responds to the VK_RETURN keycode:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space:nowrap;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;"&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0001&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;/*&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0002&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Example&amp;nbsp;WINMSG&amp;nbsp;event&amp;nbsp;handler&amp;nbsp;to&amp;nbsp;trap&amp;nbsp;the&amp;nbsp;Enter&amp;nbsp;key&amp;nbsp;(VK_RETURN$)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0003&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;while&amp;nbsp;processing&amp;nbsp;the&amp;nbsp;WM_KEYDOWN$&amp;nbsp;window&amp;nbsp;message.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0004&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0005&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hwnd&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;gt;&amp;nbsp;handle&amp;nbsp;of&amp;nbsp;the&amp;nbsp;EditTable&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0006&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;message&amp;nbsp;-&amp;gt;&amp;nbsp;Message&amp;nbsp;number&amp;nbsp;-&amp;nbsp;should&amp;nbsp;be&amp;nbsp;WM_KEYDOWN$&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0007&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wParam&amp;nbsp;&amp;nbsp;-&amp;gt;&amp;nbsp;Virtual&amp;nbsp;Keycode&amp;nbsp;-&amp;nbsp;we&amp;nbsp;are&amp;nbsp;looking&amp;nbsp;for&amp;nbsp;VK_RETURN$&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0008&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lParam&amp;nbsp;&amp;nbsp;-&amp;gt;&amp;nbsp;Keydown&amp;nbsp;flags&amp;nbsp;-&amp;nbsp;see&amp;nbsp;MSDN&amp;nbsp;for&amp;nbsp;more&amp;nbsp;info!&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0009&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0010&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0011&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0012&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;$insert&lt;/span&gt;&amp;nbsp;winAPI_WindowMessage_Equates&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0013&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;$insert&lt;/span&gt;&amp;nbsp;winAPI_VirtualKey_Equates&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0014&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;$insert&lt;/span&gt;&amp;nbsp;logical&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0015&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0016&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;begin&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;case&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0017&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;case&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;message&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;WM_KEYDOWN$&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0018&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0019&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;begin&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;case&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0020&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;case&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;wParam&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;VK_RETURN$&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0021&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;//&amp;nbsp;Write&amp;nbsp;your&amp;nbsp;code&amp;nbsp;to&amp;nbsp;handle&amp;nbsp;the&amp;nbsp;event&amp;nbsp;here&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0022&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;call&lt;/span&gt;&amp;nbsp;msg&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@window&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"Enter&amp;nbsp;key&amp;nbsp;pressed!"&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0023&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0024&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;case&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0025&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0026&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;case&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0027&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0028&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;return&lt;/span&gt;&amp;nbsp;TRUE$&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;(Note in these examples we are using some insert records from our WinAPI Library that &lt;a href="http://sprezzblog.blogspot.com/2010/06/sprezzatura-windows-api-library.html"&gt;you can find here)&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-976895248736953614?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/976895248736953614/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2011/08/edittable-cookbook-trapping-enter-key.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/976895248736953614'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/976895248736953614'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2011/08/edittable-cookbook-trapping-enter-key.html' title='EditTable Cookbook - Trapping the ENTER key'/><author><name>Captain C</name><uri>http://www.blogger.com/profile/11670880508839547673</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_4bqKz2bf81g/S5Snb292BNI/AAAAAAAAAAM/VaeT498dvMI/S220/Darth+C.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-E5dJ-8zl-ok/TkzTl0Dey2I/AAAAAAAAABk/UzIfLfp-aaU/s72-c/EditTable%2BProtected.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-5115684568434377844</id><published>2011-06-21T13:30:00.002+01:00</published><updated>2011-06-21T13:30:24.645+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PDF'/><category scheme='http://www.blogger.com/atom/ns#' term='OIPI'/><category scheme='http://www.blogger.com/atom/ns#' term='BFS'/><category scheme='http://www.blogger.com/atom/ns#' term='MFS'/><category scheme='http://www.blogger.com/atom/ns#' term='SYS1000'/><title type='text'>An Open and Shut Case</title><content type='html'>We've been working quite a bit with OIPI at Sprezz Towers recently, and having not had a problem creating PDFs locally we were flummoxed when the same PDFs would not create on the client's workstations - rather, every time we called Set_Printer("TERM") we'd get the following...&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-NO1kkdTAjuU/TgB3B_0lBhI/AAAAAAAAABk/xaWsUuUoaK0/s1600/deleteme.png" imageanchor="1" style=""&gt;&lt;img border="0" height="400" width="304" src="http://3.bp.blogspot.com/-NO1kkdTAjuU/TgB3B_0lBhI/AAAAAAAAABk/xaWsUuUoaK0/s400/deleteme.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Being a little overawed by the apparent complexity of the INIT call we checked and rechecked our code but could find nothing wrong with it. Finally we gave in and contacted Revelation Support in the US who asked simply "Do you have a SYSTEMP table?". Well as it happens, locally we do - but on client sites we tend to only install directories we need so - as we weren't using AREV32 - we hadn't installed the AREV_DIR subdirectory and a file called SYSTEMP that lives there.&lt;br /&gt;&lt;br /&gt;So we created a SYSTEMP table and lo and behold our formerly recalcitrant program began creating PDFs like they were going out of fashion.&lt;br /&gt;&lt;br /&gt;But this still begs the question - why a SYS1000 loading error? To understand this we have to understand how file IO works in OpenInsight - especially in relation to file handles. In OpenInsight a file handle is effectively the name of the various Modified Filing Systems (MFSs) attached to the file followed by the program responsible for implementing the various IO opcodes (the Base Filing System - BFS), followed by the name of the DOS file that the operation should be performed upon. So taking a simple example of an indexed file, the file handle might look like this :-&lt;br /&gt;&lt;br /&gt;SI.MFS²RTP57²REV10101.LK&lt;br /&gt;&lt;br /&gt;When the system encounters say a read opcode, it would take the first program in the list (SI.MFS) and call it passing in RTP57²REV10101.LK. SI.MFS would then do it's thing (which in this case is to call RTP57 passing it REV10101.LK, and on return update index transactions) and then exit.&lt;br /&gt;&lt;br /&gt;How does this help us? &lt;br /&gt;&lt;br /&gt;Well look at the call stack - we've gone from our program to SET_PRINTER1, to RTP36, to RTP27. To explain this simply, our program has called SET_PRINTER1 with a TERM request. SET_PRINTER1 has tried to place a lock on a table (RTP36), but RTP27 - the program loader - has complained that it has been asked to call a null program. Why would RTP36 try to load a null program? Referring back to our logic, IO opcodes strip the first program from the file handle and call it. They don't check to see if there is anything IN the file handle as why would a programmer ever ask the system to use a null file handle?&lt;br /&gt;&lt;br /&gt;From this we're able to conclude that the file handle for SYSTEMP (fingered as the culprit by RevSoft earlier) must have been null. From this we can extrapolate that somewhere in the code for SET_PRINTER1 there is an&lt;br /&gt;&lt;br /&gt;Open "SYSTEMP" to vSystemp Else vSystemp = ""&lt;br /&gt;&lt;br /&gt;Rev assure us that this has been fixed in 9.3 but it's worth bearing in mind that when faced with a SYS1000 error you might be looking at a blank file handle.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-5115684568434377844?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/5115684568434377844/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2011/06/open-and-shut-case.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/5115684568434377844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/5115684568434377844'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2011/06/open-and-shut-case.html' title='An Open and Shut Case'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-NO1kkdTAjuU/TgB3B_0lBhI/AAAAAAAAABk/xaWsUuUoaK0/s72-c/deleteme.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-3045878538473100003</id><published>2011-05-24T17:16:00.003+01:00</published><updated>2011-05-25T17:50:33.097+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='progress'/><category scheme='http://www.blogger.com/atom/ns#' term='select'/><title type='text'>Making Progress With Selects</title><content type='html'>One of our current mega-projects is converting a very large AREV system over to OpenInsight and of course like most large systems it relies heavily on batch processes that perform selects and refine these selects before presenting the results. AREV had the useful status line update facility to let you know how processing was going but regretfully OpenInsight omitted this - presumably because lacking a dedicated status line there was nowhere to put it. With hindsight a SEND_INFO every 1% would at least have allowed the developer to intercept and update the information from a select.&lt;br /&gt;&lt;br /&gt;We tried the usual approach of looking the other way but when some of the queries were taking upwards of five minutes to return results to the user we decided that enough was enough.&lt;br /&gt;&lt;br /&gt;The problem as we saw it was split into two areas - selects against entire non-indexed files and selects against indexes. This article deals with the former. The next article in this series will deal with the latter.&lt;br /&gt;&lt;br /&gt;To start let's be frank. This blog isn't about giving away the family silver. It's about telling you what is possible using Rev products and giving you enough information to do it yourself if you want to. To this end we won't be publishing reams of code - we'll be publishing snippets and explanations of how to achieve the end result!&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The steps involved&lt;/strong&gt;&lt;br /&gt;At its simplest the easiest way of providing the user with a progress indicator when reading through a file or a resolved active select list is as follows :-&amp;nbsp;include within the select statement an additional column which makes a callback to a user defined routine to provide feedback to the user about where we are in the process. Like most consultancy houses, Sprezz has a generic progress window that we use to keep the user informed of progress through a process. This is called in one of four ways :-&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;To start the progress window&lt;/li&gt;&lt;li&gt;To update the progress window&lt;/li&gt;&lt;li&gt;To update the log portion of the progress window&lt;/li&gt;&lt;li&gt;To end the progress window&lt;/li&gt;&lt;/ul&gt;Thinking about this, this means that for our select statement to report back to us, we need to do the following :-&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Initialise our counter variables and any labelled common&lt;/li&gt;&lt;li&gt;Start our progress window&lt;/li&gt;&lt;li&gt;Call our rlist select command&lt;/li&gt;&lt;li&gt;From within the rlist select command call back to a routine to update the progress window&lt;/li&gt;&lt;li&gt;On termination close down the progress window&lt;/li&gt;&lt;/ul&gt;Now that's all very well, but it's a faff to have to go in and change all of our existing calls to RLIST to do this set of actions, so it makes sense to create our own select program that encapsulates all of the above steps. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Result&lt;/strong&gt;&lt;br /&gt;Having done this we can then just issue a call to our replacement routine passing it the select statement required, and Bob as they say, is the brother of your mother. So in our simple example we issue the command :-&lt;br /&gt;&lt;br /&gt;Call gen_Select_With_Progress( "SELECT CLAIMS" )&lt;br /&gt;&lt;br /&gt;and the result we see is :-&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-zoG15nMdx-E/TdbzCcZcByI/AAAAAAAAABc/KJ_CgkNU6dU/s1600/deleteme.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="159" src="http://2.bp.blogspot.com/-zoG15nMdx-E/TdbzCcZcByI/AAAAAAAAABc/KJ_CgkNU6dU/s320/deleteme.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;(Please excuse the background colour of the MDI Frame. Like most development shops we use three systems, development, testing and live and we colour the background vividly to remind the person working on the system just where they currently are!)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Breakdown&lt;/strong&gt;&lt;br /&gt;So looking at the important parts, let's see how they work - firstly let's look at a simplified version of our gen_select_with_progress. Our full version has more flexibility built in but we've stripped this down to the bare bones to make it easier to understand.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The shell program&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: #fefefe; border: 1px solid rgb(115, 137, 174); color: black; font-family: Consolas,Courier New,Courier,Verdana,Arial; font-size: 10pt; margin: 0px 10px auto; padding: 10px 20px; white-space: nowrap;"&gt;&lt;span style="color: blue;"&gt;Function&lt;/span&gt;&amp;nbsp;PList&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;object&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;method&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;param1&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;param2&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;param3&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;param4&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: green; font-style: italic;"&gt;/*&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Author&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;AMcA&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Purpose&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;To&amp;nbsp;do&amp;nbsp;a&amp;nbsp;select&amp;nbsp;with&amp;nbsp;a&amp;nbsp;progress&amp;nbsp;bar&lt;br /&gt;&lt;br /&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;equ&lt;/span&gt;&amp;nbsp;version$&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;To&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"1.0.0"&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;$uses&lt;/span&gt;&amp;nbsp;CMG&lt;span style="color: purple;"&gt;*&lt;/span&gt;APPROW&lt;span style="color: purple;"&gt;*&lt;/span&gt;&lt;span style="color: purple;"&gt;*&lt;/span&gt;GEN_CONFIGURATION&lt;span style="color: purple;"&gt;:&lt;/span&gt;GEN_RESOURCES&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;Declare&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;Function&lt;/span&gt;&amp;nbsp;get.reccount&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;gen_progress&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;retStack&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;zzx_res2Str&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;$insert&lt;/span&gt;&amp;nbsp;gen_dict_callback_equates&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;$insert&lt;/span&gt;&amp;nbsp;gen_module_equates&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;retVal&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;TRUE$&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;atSelf&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;retStack&lt;span style="color: purple;"&gt;()&amp;lt;1&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;if&lt;/span&gt;&amp;nbsp;method&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;""&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;Or&lt;/span&gt;&amp;nbsp;method&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"SELECT"&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;then&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;call&lt;/span&gt;&amp;nbsp;set_status&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;0&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: green; font-style: italic;"&gt;/*&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;assume&amp;nbsp;that&amp;nbsp;object&amp;nbsp;contains&amp;nbsp;the&amp;nbsp;select&amp;nbsp;statement&amp;nbsp;To&amp;nbsp;execute&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;object&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;trim&lt;/span&gt;&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;object&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;table&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;f&lt;span style="color: blue;"&gt;ield&lt;/span&gt;&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;object&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"&amp;nbsp;"&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;2&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;o&lt;span style="color: blue;"&gt;pen&lt;/span&gt;&amp;nbsp;table&amp;nbsp;&lt;span style="color: blue;"&gt;To&lt;/span&gt;&amp;nbsp;vTable&amp;nbsp;&lt;span style="color: blue;"&gt;then&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;@rec.count&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;then&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rowCount&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;@rec.count&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;end&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;Else&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowCount&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;get.recCount&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;vTable&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;""&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;""&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;loopCounter&lt;span style="color: purple;"&gt;@&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;0&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;;&lt;/span&gt;&amp;nbsp;&lt;span style="color: green; font-style: italic;"&gt;*&amp;nbsp;loop&amp;nbsp;counter&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: green; font-style: italic;"&gt;*&amp;nbsp;start&amp;nbsp;the&amp;nbsp;progress&amp;nbsp;window&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;retVal&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;gen_progress&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"STARTWIN"&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;rowCount&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;caption&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: green; font-style: italic;"&gt;*&amp;nbsp;log&amp;nbsp;what&amp;nbsp;is&amp;nbsp;being&amp;nbsp;done&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;retVal&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;gen_Progress&lt;span style="color: purple;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;"LOG"&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;""&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;object&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: green; font-style: italic;"&gt;*&amp;nbsp;add&amp;nbsp;our&amp;nbsp;callback&amp;nbsp;into&amp;nbsp;the&amp;nbsp;select&amp;nbsp;-&amp;nbsp;it&amp;nbsp;will&amp;nbsp;now&amp;nbsp;be&amp;nbsp;called&amp;nbsp;once&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: green; font-style: italic;"&gt;*&amp;nbsp;per&amp;nbsp;row&amp;nbsp;evaluation&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;addOn&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"&amp;nbsp;WITH&amp;nbsp;ZZX_CALLBACK&amp;nbsp;=&amp;nbsp;1"&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;if&lt;/span&gt;&amp;nbsp;i&lt;span style="color: blue;"&gt;ndex&lt;/span&gt;&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;object&amp;nbsp;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"&amp;nbsp;WITH&amp;nbsp;"&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;1&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;then&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;addOn&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"&amp;nbsp;AND&amp;nbsp;"&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;addOn&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;end&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;call&lt;/span&gt;&amp;nbsp;rlist&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;object&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&amp;nbsp;addOn&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;5&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;""&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;""&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;""&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;;&lt;/span&gt;&amp;nbsp;&lt;span style="color: green; font-style: italic;"&gt;*&amp;nbsp;do&amp;nbsp;the&amp;nbsp;actual&amp;nbsp;select&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;call&lt;/span&gt;&amp;nbsp;gen_progress&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"END"&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;end&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;else&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;call&lt;/span&gt;&amp;nbsp;fsMsg&lt;span style="color: purple;"&gt;(&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;end&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;end&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;l&lt;span style="color: blue;"&gt;ocate&lt;/span&gt;&amp;nbsp;method&amp;nbsp;&lt;span style="color: blue;"&gt;In&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"UPDATE"&lt;/span&gt;&amp;nbsp;u&lt;span style="color: blue;"&gt;sing&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;","&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;setting&lt;/span&gt;&amp;nbsp;pos&amp;nbsp;&lt;span style="color: blue;"&gt;then&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;o&lt;span style="color: blue;"&gt;n&lt;/span&gt;&amp;nbsp;pos&amp;nbsp;&lt;span style="color: blue;"&gt;goSub&lt;/span&gt;&amp;nbsp;update&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;end&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt;&amp;nbsp;retVal&lt;/div&gt;&lt;br /&gt;That copes with list items 1, 2, 3 and 5 so how does the CALLBACK dictionary item work?&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;CALLBACK Dictionary Item&lt;/strong&gt;&lt;br /&gt;If you place a compiled dictionary item into the SYSDICT table it can be used in all of your SELECT statements. All that this has to do is to call your update program. Again a simplified version of our SYSDICT item...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: #fefefe; border: 1px solid rgb(115, 137, 174); color: black; font-family: Consolas,Courier New,Courier,Verdana,Arial; font-size: 10pt; margin: 0px 10px auto; padding: 10px 20px; white-space: nowrap;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;declare&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;function&lt;/span&gt;&amp;nbsp;gen_select_with_progress&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;isEventContext&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;$insert&lt;/span&gt;&amp;nbsp;gen_dict_callback_equates&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@ANS&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;''&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;if&lt;/span&gt;&amp;nbsp;isEventContext&lt;span style="color: purple;"&gt;(&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;then&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dict&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@DICT&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;id&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@ID&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mv&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@MV&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;record&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@RECORD&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rnc&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt; &lt;span style="color: #8000ff;"&gt;@RN.COUNTER&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@ans&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;gen_select_with_progress&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;""&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"UPDATE"&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@DICT&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;dict&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@ID&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;id&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@MV&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;mv&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@RECORD&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;record&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #8000ff;"&gt;@RN.COUNTER&lt;/span&gt; &lt;span style="color: purple;"&gt;=&lt;/span&gt; rnc&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@ans&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;As an aside, for efficiency we'd be better off using the transfer statement to move @RECORD and @DICT in the above code as all strings over 20 characters in length are held on the heap rather than in a descriptor, so a copy statement wastes resource.&lt;br /&gt;&lt;strong&gt;The Update Routine&lt;/strong&gt;&lt;br /&gt;Finally the part of gen_select_with_progress that updates the progress meter.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: #fefefe; border: 1px solid rgb(115, 137, 174); color: black; font-family: Consolas,Courier New,Courier,Verdana,Arial; font-size: 10pt; margin: 0px 10px auto; padding: 10px 20px; white-space: nowrap;"&gt;&lt;span style="font-size: 11pt; font-weight: bold;"&gt;update:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;loopCounter&lt;span style="color: purple;"&gt;@&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;+=&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;1&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;mod&lt;/span&gt;&lt;span style="color: purple;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;20&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;loopCounter&lt;span style="color: purple;"&gt;@&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;0&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;then&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;call&lt;/span&gt;&amp;nbsp;gen_select_with_progress&lt;span style="color: purple;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;"UPDATE"&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;loopCounter&lt;span style="color: purple;"&gt;@&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;|&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: teal;"&gt;"{COUNT}&amp;nbsp;of&amp;nbsp;{MAX}&amp;nbsp;-&amp;nbsp;estimated&amp;nbsp;time&amp;nbsp;remaining|&lt;/span&gt;&lt;br /&gt;&lt;span style="color: teal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{ETR}"&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;br /&gt;The only thing to mention is that loopCounter@ is a labelled common variable. Because the update program and the calling dictionary item are on the program stack there is minimal overhead to this approach. It also allows for the user to press a cancel button and exit a protracted select. In our testing we've seen this add anywhere between 5 and 20% overhead. This might seem like a lot but when a user is staring at a blank screen waiting for a result time drags a lot more slowly. In addition the estimated end time allows the user to plan their time more effectively :).&lt;br /&gt;&lt;br /&gt;In the next article we'll look at indexed selects.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-3045878538473100003?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/3045878538473100003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2011/05/making-progress-with-selects.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/3045878538473100003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/3045878538473100003'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2011/05/making-progress-with-selects.html' title='Making Progress With Selects'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-zoG15nMdx-E/TdbzCcZcByI/AAAAAAAAABc/KJ_CgkNU6dU/s72-c/deleteme.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-8033104899876658839</id><published>2011-05-23T13:16:00.002+01:00</published><updated>2011-05-23T13:21:02.439+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='reduce'/><category scheme='http://www.blogger.com/atom/ns#' term='latent'/><category scheme='http://www.blogger.com/atom/ns#' term='resolved'/><category scheme='http://www.blogger.com/atom/ns#' term='select'/><title type='text'>Latent and Resolved Selects</title><content type='html'>Recently at Sprezz Towers, we had an interesting discussion on resolved selects, latent (or unresolved) selects, sizelocks and manipulating records while in a select list.  Surprisingly, there was some confusion, even between ourselves.  Once we hashed it all out, we thought it would be a good idea to post on the topic.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Types of Selects&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As most of you know, there are two types of selects in the Revelation environment, latent and resolved.  In resolved selects, the results are processed and stored in a temporary &lt;span style="font-family:courier new;"&gt;SYSLISTS &lt;/span&gt;(or &lt;span style="font-family:courier new;"&gt;LISTS&lt;/span&gt;) record.  In latent selects, the record IDs are not returned until the &lt;span style="font-family:courier new;"&gt;READNEXT &lt;/span&gt;(or &lt;span style="font-family:courier new;"&gt;READNEXT BY&lt;/span&gt;) statement is executed.  Resolved selects are initiated through the &lt;span style="font-family:courier new;"&gt;RLIST &lt;/span&gt;function or &lt;span style="font-family:courier new;"&gt;PERFORM &lt;/span&gt;statement.  Latent selects are initiated through the Basic+ &lt;span style="font-family:courier new;"&gt;reduce&lt;/span&gt; subroutine and &lt;span style="font-family:courier new;"&gt;select&lt;/span&gt; statement.&lt;br /&gt;&lt;br /&gt;What many people do not know is that inside each resolved select is a latent select waiting to get out.  In order to generate the resolved select, the system must process the select through a latent list.&lt;br /&gt;&lt;br /&gt;So, if you were to issue the following as a resolved select:&lt;br /&gt;&lt;pre&gt;  SELECT SYSPROCS WITH TYPEID = 'STPROC' BY ENTITYID BY APPID&lt;/pre&gt; the system will basically execute code similar to this:&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space:nowrap;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;"&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0001&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;Parse&amp;nbsp;the&amp;nbsp;sentence&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0002&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;Assign&amp;nbsp;some&amp;nbsp;vars&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0003&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;Open&amp;nbsp;handles&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0004&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;Other&amp;nbsp;initialization&amp;nbsp;based&amp;nbsp;stuff&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0005&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;abort&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;FALSE$&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0006&amp;nbsp;&amp;nbsp;&lt;/span&gt;script&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"WITH&amp;nbsp;{TYPEID}&amp;nbsp;EQ&amp;nbsp;'STPROC'"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0007&amp;nbsp;&amp;nbsp;&lt;/span&gt;sortList&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"APPID"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0008&amp;nbsp;&amp;nbsp;&lt;/span&gt;mode&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;NEW.REDUCE$&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0009&amp;nbsp;&amp;nbsp;&lt;/span&gt;tableName&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"SYSREPOS"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0010&amp;nbsp;&amp;nbsp;&lt;/span&gt;cursor&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0011&amp;nbsp;&amp;nbsp;&lt;/span&gt;flag&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;""&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0012&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0013&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;call&lt;/span&gt;&amp;nbsp;fix_lh&lt;span style="color:#800080;"&gt;(&lt;/span&gt;&amp;nbsp;tableName&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;UPDATE_SIZELOCK$&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;INCREMENT_SIZELOCK$&amp;nbsp;&lt;span style="color:#800080;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0014&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0015&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;call&lt;/span&gt;&amp;nbsp;reduce&lt;span style="color:#800080;"&gt;(&lt;/span&gt;&amp;nbsp;script&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;sortList&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;mode&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;tableName&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;cursor&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;successFlag&amp;nbsp;&lt;span style="color:#800080;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0016&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&amp;nbsp;successflag&amp;nbsp;&lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0017&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;set&amp;nbsp;error&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0018&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;abort&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;TRUE$&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0019&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0020&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0021&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;abort&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0022&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;select&lt;/span&gt;&amp;nbsp;tableName&amp;nbsp;&lt;span style="color:#0000FF;"&gt;by&lt;/span&gt;&amp;nbsp;sortList&amp;nbsp;&lt;span style="color:#0000FF;"&gt;using&lt;/span&gt;&amp;nbsp;cursor&amp;nbsp;&lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0023&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;set&amp;nbsp;error&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0024&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;abort&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;TRUE$&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0025&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0026&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0027&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0028&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;abort&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0029&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;listData&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;""&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0030&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;reccount&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0031&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;done&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;FALSE$&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0032&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;loop&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0033&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;readnext&lt;/span&gt;&amp;nbsp;id&amp;nbsp;&lt;span style="color:#0000FF;"&gt;using&lt;/span&gt;&amp;nbsp;cursor&amp;nbsp;&lt;span style="color:#0000FF;"&gt;by&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;AT&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0034&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;done&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;TRUE$&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0035&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0036&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;until&lt;/span&gt;&amp;nbsp;done&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0037&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;listData&amp;nbsp;&lt;span style="color:#800080;"&gt;:&lt;/span&gt;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;id&amp;nbsp;&lt;span style="color:#800080;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@FM&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0038&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;reccount&amp;nbsp;&lt;span style="color:#800080;"&gt;+=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0039&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;repeat&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0040&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0041&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;listData&lt;span style="color:#800080;"&gt;[&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;-&lt;/span&gt;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;]&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;""&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0042&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;call&lt;/span&gt;&amp;nbsp;dostime&lt;span style="color:#800080;"&gt;(&lt;/span&gt;&amp;nbsp;dateTime&amp;nbsp;&lt;span style="color:#800080;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0043&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;listKey&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"W*"&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@STATION&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"*"&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@APPID&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"*"&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;:&lt;/span&gt;&amp;nbsp;dateTime&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0044&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;listHeader&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@VM&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;:&lt;/span&gt;&amp;nbsp;dateTime&amp;nbsp;&lt;span style="color:#800080;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@VM&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@APPID&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@VM&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;:&lt;/span&gt;&amp;nbsp;reccount&amp;nbsp;&lt;span style="color:#800080;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@VM&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0045&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;listRec&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;listHeader&amp;nbsp;&lt;span style="color:#800080;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@FM&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;:&lt;/span&gt;&amp;nbsp;listData&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0046&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;write&lt;/span&gt;&amp;nbsp;listRec&amp;nbsp;&lt;span style="color:#0000FF;"&gt;on&lt;/span&gt;&amp;nbsp;hLists&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;listKey&amp;nbsp;&lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0047&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;set&amp;nbsp;error&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0048&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0049&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0050&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0051&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;abort&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0052&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;call&lt;/span&gt;&amp;nbsp;make.list&lt;span style="color:#800080;"&gt;(&lt;/span&gt;&amp;nbsp;cursor&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;listData&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;hDataHandle&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;hDictHandle&amp;nbsp;&lt;span style="color:#800080;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0053&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0054&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0055&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;call&lt;/span&gt;&amp;nbsp;fix_lh&lt;span style="color:#800080;"&gt;(&lt;/span&gt;&amp;nbsp;tableName&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;UPDATE_SIZELOCK$&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;DECREMENT_SIZELOCK$&amp;nbsp;&lt;span style="color:#800080;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;More or less...it's not perfect, but it's a pretty rough idea of what happens.&lt;br /&gt;&lt;br /&gt;The system parses your sentence, generates a reduce, performs a select/readnext, stores all the returned keys, writes them off to a LISTS record (and updates the save select list queue) and then does a make.list so they are active and available.&lt;br /&gt;&lt;br /&gt;In short, resolved selects are a giant shell around reduce/select.  When you work with a resolved select, you're processing the list twice;  once to resolve it, and once to process it.&lt;br /&gt;&lt;br /&gt;It's always quicker to skip the shell and work with reduce/select yourself.  However, as with many shelled functions, the system also handles some maintenance work for you.&lt;br /&gt;&lt;br /&gt;In the next article, we'll talk about the maintenance work required to handle all this correctly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-8033104899876658839?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/8033104899876658839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2011/05/latent-and-resolved-selects.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/8033104899876658839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/8033104899876658839'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2011/05/latent-and-resolved-selects.html' title='Latent and Resolved Selects'/><author><name>apk</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-8625518675669067093</id><published>2011-04-07T15:18:00.000+01:00</published><updated>2011-04-07T15:18:01.606+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OeProfile'/><category scheme='http://www.blogger.com/atom/ns#' term='Repository'/><category scheme='http://www.blogger.com/atom/ns#' term='Logs'/><category scheme='http://www.blogger.com/atom/ns#' term='LH'/><title type='text'>OI Log Files - a practical demonstation of sleuthing</title><content type='html'>Those of you who attended our talk at the last User Conference in Vegas will know that we're a big fan of using system logs to help track down aberrant behaviour. Recently we were asked by RevSoft UK to help solve a recalcitrant problem that was being encountered by one of their clients.&lt;br /&gt;&lt;br /&gt;Put simply, the client had upgraded to 9.2.1 from 9.2 and was finding that whilst they could use the System Editor++ to open rows, any attempts to open Stored Procedures would result in a system hang. The engine would report that it was "processing" but was unresponsive and could only be closed from the task manager. &lt;br /&gt;&lt;br /&gt;The first thing that we did was confirm that the SE++ worked as expected in SYSPROG. It did. We then created a new application and repeated the test there. It still worked. We then created an application inheriting from the client application and tested there. It failed. So we knew that the issue was localised to the client application. The question was WHERE was it actually crashing? We created a profile log and ran the application to point of crash and we were able to determine that the system was hanging inside a UTILITY call from DIALOG_BOX.&lt;br /&gt;&lt;br /&gt;Moving on to the next logical step we wrote a small program to look for programs in SYSPROG that also existed in the client application. This revealed only a few potential mismatches. Of particular interest was a localised version of CENTER_WINDOW that took only 1 parameter instead of 3 and a localised version of OBJ_CALL_EVENT that took 0 parameters instead of 12.&lt;br /&gt;&lt;br /&gt;Looking at the SYSREPOSEVENTEXEs for the Open Source Code dialog it was apparent that it made heavy use of OBJ_CALL_EVENT but that the Open Row dialog didn't use it at all. &lt;br /&gt;&lt;br /&gt;So problem solved... DELETE_ROW "SYSOBJ","$OBJ_CALL_EVENT*CLIENTAPP" log off, log back in and all would be good.&lt;br /&gt;&lt;br /&gt;Except it wasn't. We still had the same problem.&lt;br /&gt;&lt;br /&gt;Time for the next phase - we installed a linear hash log and what we saw was as follows :-&lt;br /&gt;&lt;br /&gt;RD 48 SYSPROG*OIWINEXE**RTI_EDITOR_ENTITY_OPEN OK&lt;br /&gt;RD 54 SYSPROG**RTI_EDITOR_ENTITY_OPEN OK&lt;br /&gt;RD 67 SYSPROG**RTI_EDITOR_ENTITY_OPEN ERROR:100 FILE:0 GROUP:0&lt;br /&gt;RD 48 CLIENTAPP*STPROCEXE**OBJ_CALL_EVENT OK&lt;br /&gt;RD 43 $OBJ_CALL_EVENT*CLIENTAPP ERROR:100 FILE:0 GROUP:0&lt;br /&gt;RD 13 SET_DIALOG_INFO ERROR:100 FILE:0 GROUP:0&lt;br /&gt;RD 43 $SET_DIALOG_INFO OK&lt;br /&gt;&lt;br /&gt;So interpreting this for you... firstly the code RD simply means "Read". The number following is a filehandle. The file corresponding to the file handle can be found earlier in the log.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;RD 48 SYSPROG*OIWINEXE**RTI_EDITOR_ENTITY_OPEN OK&lt;/i&gt;&lt;br /&gt;The system reads the SYSREPOS entry for RTI_EDITOR_ENTITY_OPEN and determines that it must read the RTI_EDITOR_ENTITY_OPEN from SYSREPOSWINEXES. As stated we can tell that this is reading from SYSREPOS as described above OR by deducing it from the key structure.&lt;br /&gt;&lt;i&gt;&lt;br /&gt;RD 54 SYSPROG**RTI_EDITOR_ENTITY_OPEN OK&lt;/i&gt;&lt;br /&gt;The compiled window is read&lt;br /&gt;&lt;br /&gt;&lt;i&gt;RD 67 SYSPROG**RTI_EDITOR_ENTITY_OPEN ERROR:100 FILE:0 GROUP:0&lt;/i&gt;&lt;br /&gt;The SYSREPOSLANGUAGES table is checked to see if any alternative language defintions have been set up for this window. There haven't been so we get an FS100 - REC_DNE_EXIST$. This is benign.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;RD 48 CLIENTAPP*STPROCEXE**OBJ_CALL_EVENT OK&lt;/i&gt;&lt;br /&gt;It then goes back to SYSREPOS because the CREATE quick event of the window tells it to run a procedure calleed OBJ_CALL_EVENT. So it looks for the SYSREPOS entry called CLIENTAPP*STPROCEXE**OBJ_CALL_EVENT. It find this entry and the next line&lt;br /&gt;&lt;br /&gt;&lt;i&gt;RD 43 $OBJ_CALL_EVENT*CLIENTAPP ERROR:100 FILE:0 GROUP:0&lt;/i&gt;&lt;br /&gt;shows that it has been told that it will find this object code in SYSOBJ with a row id of $OBJ_CALL_EVENT*CLIENTAPP. This read fails (because earlier we deleted the code) - this is not quite so benign as now the CREATE event will fail.&lt;br /&gt;&lt;br /&gt;The system then carries on with the Dialog Logic :-&lt;br /&gt;&lt;br /&gt;&lt;i&gt;RD 13 SET_DIALOG_INFO ERROR:100 FILE:0 GROUP:0&lt;br /&gt;RD 43 $SET_DIALOG_INFO OK&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Now note that it DOESN'T try and read $OBJ_CALL_EVENT*SYSPROG as an RTP27 call would. RTP27 would automatically traverse the inheritance chain looking for the object code. Rather it assumes that it has got the correct definition and continues. This is because OBJ_CALL_EVENT is a Quick Event on the CREATE of the Source Code Open Dialog so it is called via a REPOSITORY EXECUTE. When the REPOSITORY EXECUTE is unable to load the code, rather than error out it just ignores the failure. Consequently the CREATE event never runs and the Dialog (which starts life invisible) is never made visible. So it is there on the desktop awaiting input but can never be closed as it can not be seen. Earlier in the log we could see GET_REPOS_ENTITIES being called and this was a clue to the fact that the Dialog was operating.&lt;br /&gt;&lt;br /&gt;So we went into the Application Manager and deleted the SYSREPOS entry for OBJ_CALL_EVENT, logged out, back in and all was well with the world again. And the moral of this story (apart from the one involving routines named the same way as system routines)? When dealing with items that are tracked in the Repository - use Repository methods to manipulate them!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-8625518675669067093?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/8625518675669067093/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2011/04/oi-log-files-practical-demonstation-of.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/8625518675669067093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/8625518675669067093'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2011/04/oi-log-files-practical-demonstation-of.html' title='OI Log Files - a practical demonstation of sleuthing'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-3223362019214178350</id><published>2011-02-09T23:17:00.001Z</published><updated>2011-02-09T23:17:56.609Z</updated><title type='text'>Revelation Conference 2011</title><content type='html'>As you'll all doubtless be aware Revelation have announced the dates of the next conference (Tuesday, October 4th - Friday, October 7th, 2011 if you weren't) and whilst we've got some great ideas for presentations we're always on the lookout for more.&lt;br /&gt;&lt;br /&gt;So we're appealing to you dear reader. Is there an aspect of the product you'd like to see taken apart in typical Sprezzatura fashion? What nooks and crannies would you want pushed and prodded? What esoteric diversion would you see pursued?&lt;br /&gt;&lt;br /&gt;Answers on a postcard... or an email... or a blog comment. If you don't come back you'll just have to take what we give you :)&lt;br /&gt;&lt;br /&gt;Thanks in advance!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-3223362019214178350?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/3223362019214178350/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2011/02/revelation-conference-2011.html#comment-form' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/3223362019214178350'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/3223362019214178350'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2011/02/revelation-conference-2011.html' title='Revelation Conference 2011'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-7914499098821694496</id><published>2011-01-12T16:39:00.002Z</published><updated>2011-01-12T16:39:17.234Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='index'/><category scheme='http://www.blogger.com/atom/ns#' term='v119'/><category scheme='http://www.blogger.com/atom/ns#' term='sort file'/><title type='text'>Indexing Enigma</title><content type='html'>Recently a Sprezz client's client experienced server issues and commissioned a new server to host the client's application. Shortly thereafter an index failure occurred and the client tried to rebuild the indexes in question. They were thwarted in their efforts however by the fact that no tables would show in the DM_INDEXES_ADD window. They tried everything, removing the indexes and adding back programmatically, rebuilding system indexes, recreating DBTs but nothing would work.&lt;br /&gt;&lt;br /&gt;A Sprezz technician remoted into the system and performed some initial checks. This rapidly became an object lesson in the pursuit of red herrings. An LH3 log was generated and briefly checked for errors - but none were found. An engine profile log was generated and briefly checked for errors - but none were found. The files were detached and reattached but still they wouldn't show up. &lt;br /&gt;&lt;br /&gt;The files were attached from Sysprog and the indexes were there for all to see. In addition a strange anomaly was found. At one of the locations being attached there was a table called "0" - yes, that's ZERO.&lt;br /&gt;&lt;br /&gt;The technician was delighted - this must be the cause. Obviously this table showed up first in any list and the system must be using boolean checks to assemble a list of tables to display, you know the sort of thing :-&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space:nowrap;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;"&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0001&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;filePtr&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0002&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;loop&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0003&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;nextFile&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;fileList&lt;span style="color:#800080;"&gt;[&lt;/span&gt;&amp;nbsp;filePtr&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@Fm&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0004&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;filePtr&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;col2&lt;/span&gt;&lt;span style="color:#800080;"&gt;(&lt;/span&gt;&lt;span style="color:#800080;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0005&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;while&lt;/span&gt;&amp;nbsp;nextFile&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0006&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;goSub&lt;/span&gt;&amp;nbsp;process&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0007&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;repeat&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;instead of the safer :-&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space:nowrap;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;"&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0001&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;filePtr&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0002&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;loop&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0003&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;nextFile&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;fileList&lt;span style="color:#800080;"&gt;[&lt;/span&gt;&amp;nbsp;filePtr&lt;span style="color:#800080;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@Fm&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0004&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;filePtr&amp;nbsp;&lt;span style="color:#800080;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;col2&lt;/span&gt;&lt;span style="color:#800080;"&gt;(&lt;/span&gt;&lt;span style="color:#800080;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800080;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0005&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;while&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;len&lt;/span&gt;&lt;span style="color:#800080;"&gt;(&lt;/span&gt;&amp;nbsp;nextFile&amp;nbsp;&lt;span style="color:#800080;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0006&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;goSub&lt;/span&gt;&amp;nbsp;process&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;"&gt;0007&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;repeat&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;So the file was renamed (well the media map entries were copied around and deleted) and the location was reattached and the system indexes rebuilt. But still the issue persisted.&lt;br /&gt;&lt;br /&gt;A new application was created and the files were attached and again indexes were present. So now the speculation was that a promoted event was interfering with the (now OI based) database manager window. A more thorough analysis of the engine profile log revealed that the only promoted event in use during the execution of the DM_INDEXES_ADD routine was a CLOSE event. So back to the drawing board again.&lt;br /&gt;&lt;br /&gt;Next up the LH3 log file was examined in greater detail and the individual index files could be seen being opened and the *INDEX records being read. So there wasn't an issue with the files themselves - they were plainly there.&lt;br /&gt;&lt;br /&gt;Finally the technician stopped and reasoning that the problem had to be associated with the move to the new server, he undertook a more detailed analysis of the processes associated with the DM_INDEXES_ADD dialog. With this new focus the technician observed that the DM_INDEXES_ADD called V119 and a light went off in his brain. Moving back to the Database Manager he called up the environment settings and noted that the sort path referenced there had not been created on the new server. Create the directory, log out and back in and all was "sorted".&lt;br /&gt;&lt;br /&gt;Sometimes the easiest solution is just that - the easiest solution.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-7914499098821694496?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/7914499098821694496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2011/01/indexing-enigma.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/7914499098821694496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/7914499098821694496'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2011/01/indexing-enigma.html' title='Indexing Enigma'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-4781031212634175369</id><published>2010-12-29T02:17:00.001Z</published><updated>2010-12-29T02:19:50.118Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='humor'/><title type='text'>The finer details.</title><content type='html'>&lt;em&gt;Sprezzatura's attention to the smallest details are legendary.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;On Thursday I finished up the code for a window we're converting from ARev to OI 9.2.  I was just about to start on the softkeys when I see it's 4:00 so I figure this is  a good stopping point and I head off to pick up the kids.&lt;br /&gt;&lt;br /&gt;I leave the office, and Ellen (the office manager at Sprezz Towers West) teases me about leaving before her on Christmas break.&lt;br /&gt;&lt;br /&gt;I head home, and cycling down Spruce Street I think there's loads of extra  delivery trucks, but very little traffic.  I chalk this up to being just before Christmas.&lt;br /&gt;&lt;br /&gt;As I walk to the daycare center, I talk to my dad, whose a little  confused why I'm picking them up now.&lt;br /&gt;&lt;br /&gt;I get Jacob and his class is on the way to the gym, and I thought that's  a bit odd at this time of day, but I've only been picking up the kids  since Monday, so I'm not clear on their schedule.&lt;br /&gt;&lt;br /&gt;As we walk home, Jacob and I are talking about how the days are getting  longer and how it's still light going home, and I think to myself, it is really  light out considering how dark the walk home had been the past few days, the change isn't that drastic so quickly.&lt;br /&gt;&lt;br /&gt;Then he wants to go to the park, and I tell him it's far too late and we  need to make dinner.  He argues that it's not, and we have time, so I  take out my watch to show him the time, and it's not 5:20 at all.  It's  4:20.  I think my clock's wrong, so I call my dad to ask him the time,  and sure enough its only 4:20.&lt;br /&gt;&lt;br /&gt;I was looking the clock on the client's box (the work is done remotely) and they're an hour ahead, on Atlantic time.  So,  despite looking at the clock by the front desk when I left the office,  and despite looking at the clock at the house when I dropped of the bicycle, and despite my Dad  wondering why I was picking the kids up now,  and despite looking at the  clock at daycare when I arrived, I never noticed it was an hour earlier  than I thought.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-4781031212634175369?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/4781031212634175369/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/12/finer-details.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/4781031212634175369'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/4781031212634175369'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/12/finer-details.html' title='The finer details.'/><author><name>apk</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-643942151021207219</id><published>2010-12-28T16:50:00.002Z</published><updated>2010-12-28T16:50:48.778Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='GETMAIL'/><category scheme='http://www.blogger.com/atom/ns#' term='MIME'/><category scheme='http://www.blogger.com/atom/ns#' term='9.2'/><category scheme='http://www.blogger.com/atom/ns#' term='UDH'/><category scheme='http://www.blogger.com/atom/ns#' term='BASE64DECODE'/><title type='text'>Another week, another month's work</title><content type='html'>Just before Christmas we were invited by one of our clients to visit their site and to perform a number of OI related tasks in a very finite time frame. Specifically to upgrade a 16 bit OI 3.7.5 production system and an OI 8.0 web based system to OI 9.2+ whilst installing the UD Heavy. We were allocated 5 days to do this so were confident that it was achievable.&lt;br /&gt;&lt;br /&gt;Of course our confidence was rooted in real world experience - both of of our combined skill sets and of typical UK weather...&lt;br /&gt;&lt;br /&gt;So early Friday afternoon came and exercising caution the Sprezz lead consultant ("the Sprezzie") on this project began the 200 mile drive to the client - this was to be a Sat/Sun/Mon/Tue/Wed job to minimise impact on the factory production system and to fit in with some tight scheduling requirements for Sprezz. Unbeknownst to us this was to mark the beginning of some of the worst weather in recent UK history. In a normal world this 200 mile journey would take 3.5 hours.&lt;br /&gt;&lt;br /&gt;Two hours into the journey the Sat Nav decided to change the route due to traffic conditions ahead and rerouted the car to within 20 miles of the original starting point then started again... snow was blizzarding and road conditions were becoming treacherous. Average speeds dropped and past experience of snow driving became essential. The next 5 hours or so were not fun but eventually the Sprezzie arrived at their target hostelry - a snowed in Bed and Breakfast in the middle of nowhere - just in time to discover that after a 7.5 hour journey, all the places serving food had shut. And so to bed.&lt;br /&gt;&lt;br /&gt;The next morning dawned and the 12 mile drive to the client had never looked so difficult. The roads were snowed in and the gritting lorries had yet to visit. Thanking providence for front wheel drive the Sprezzie eventually got to the client and started work. The initial UD Heavy installation was a cinch, it installed and it did what it said on the tin. The 4.6 UDH is one we at Sprezz Towers have a lot of experience with and we have no hesitation in recommending it to our clients. It addresses a lot of issues found in previous releases of the UDH and the documentation is an order of magnitude better!&lt;br /&gt;&lt;br /&gt;The 9.2 upgrade was a bit more of an issue - the install was fine but combining the 3.7.5 and the 8.0 system proved to be a bit more of a challenge. Eventually two APPBACKUPs were taken and a custom program was created in conjunction with the client to combine "the best of both worlds" and this custom program installed all elements into a virgin 9.2 system without the need for an APPRESTORE.&lt;br /&gt;&lt;br /&gt;Everything came together BUT the system wasn't running for some reason. So thus began the multi-sourcing quest. First off we downloaded Sprezz's "Recompile All" utility. This recompiled all events, stored procedures and windows. Things started to run again but the windows looked ugly. So then we downloaded Rev's "Font changer" utility and changed all the fonts to Tahoma in Windows and Popups. Finally we downloaded and ran SRP's form fixer to reset the errant style bits and we were back in the running.&lt;br /&gt;&lt;br /&gt;Next up the client agreed that hiding the LK and OV files was a worthy goal - no more users accidentally trashing systems. So we followed the incredibly simple instructions in the UDH installation guide and attempted to hide the files. It should be said that the installation was on a 64 bit server. The Sprezzie in charge tried and tried but could not get the files to hide - the registry settings would not take. So throwing it open to all Sprezz crew he mailed the internal distribution list and was cajoled by colleagues into triple checking his registry entries. To much embarrassment it became apparent that Rev create two key sets in the WOW3264 section - one as Revelation Software for the client - and one as RevSoft for the UDH. It behoves the developer to use the RevSoft key if s/he wants Shares to work...&lt;br /&gt;&lt;br /&gt;So onto the next thing on Santa's wish list - converting their OECGI installation to OECGI3 on an IIS 7 web server. Quick start read, product up and running in less than an hour. Way to go RevSoft! These quick start guides REALLY help.&lt;br /&gt;&lt;br /&gt;Starting to wrap up and wind down the client mentions that they'd like to convert their existing mail server (all based around Rev's MAPI technology) to a more future proof technology. No problem - Sprezz's free SMTP mail client is downloaded and installed and the conversion of the mail server continues apace - until.... what? You want to CONSUME mail as well as PRODUCE it? Uh Oh....&lt;br /&gt;&lt;br /&gt;It suddenly became apparent that there is a gap in the RevSoft offerings...&lt;br /&gt;&lt;br /&gt;GETMAIL as shipped with OI is a handy socket based POP3 mail client which pulls down the mail from the pop server and delivers it as text files to the client - the only downside is that it&lt;br /&gt;&lt;br /&gt;a) is underdocumented and&lt;br /&gt;b) it delivers effectively binary streams unlike the MAPI equivalent that delivers nicely documented structures.&lt;br /&gt;&lt;br /&gt;Fortunately for us (and the client) the client only needed to consume several very specific mail formats so again mining the collective Sprezz gestalt we were reminded of the existence of BASE64DECODE in OI and were able to put together an OI based program to decode multi part MIME emails in a manner consistent with the existing MAPI calls. This allowed the existing Mail Server technology to be migrated to SMTP/POP3 with minimal change.&lt;br /&gt;&lt;br /&gt;All in all a fun filled and technically challenging week made possible by the flexiblity of the OI product, the contributions of the Rev community and the whole being greater than the parts that is the Sprezz consultancy team.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-643942151021207219?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/643942151021207219/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/12/another-week-another-months-work.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/643942151021207219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/643942151021207219'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/12/another-week-another-months-work.html' title='Another week, another month&apos;s work'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-7500692256725669138</id><published>2010-11-04T12:26:00.000Z</published><updated>2010-11-04T12:27:21.066Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Basic+'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenInsight'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>Building a better Delay() - Part 1</title><content type='html'>In this post we’re going to turn our attention to an old Arev subroutine called Delay() that can still be used in OpenInsight.  It’s a simple function and is designed to halt a Basic+ program for a specified number of seconds before continuing again (full details can be found in the OpenInsight on-line help).&lt;br /&gt; &lt;br /&gt;However, while Delay() made the transition to the Windows world, it still behaves in a fashion befitting its DOS/Arev heritage - i.e. it expects to run in a single, non-multitasking environment.  Internally it simply sits in a tight until loop until the nominated interval has passed after which it returns.  This is all well and good but on a modern OS this steals virtually all the CPU time, which is silly when you consider that the actual intent is to simply “do nothing”!&lt;br /&gt;&lt;br /&gt;So, assuming that we actually want to introduce a delay of some sort into a program, what we really need to do is only put the actual OpenEngine thread (i.e. the thread that executes your Basic+ code) into a state whereby it uses no CPU processing time until the required interval has passed, after which processing can resume.&lt;br /&gt;&lt;br /&gt;The Windows API has several functions for putting threads to “sleep”.  i.e. putting them into a state whereby they use no CPU resources until they are “woken up” based one or more wake criteria, and we’ll begin by looking at the most simple of these called, appropriately enough, Sleep().&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Sleep() function&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;This is a very simple Windows API call that suspends the calling thread for at least the specified number of milliseconds.  It is documented by Microsoft like so:&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px 10px 20px;margin:0px 10px auto;"&gt;&lt;span style="font-family:Courier New;"&gt;VOID WINAPI Sleep(  DWORD dwMilliseconds );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Parameters&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;dwMilliseconds&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="margin-left:30px;"&gt;The time interval for which execution is to be suspended, in milliseconds.&lt;br /&gt;&lt;br /&gt;A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run. If there are no other threads of equal priority ready to run, the function returns immediately, and the thread continues execution.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Return Value&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="margin-left:30px;"&gt;This function does not return a value.&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;(Full details on Sleep can be found at: &lt;a href="http://msdn.microsoft.com/en-us/library/ms686298(VS.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/ms686298(VS.85).aspx&lt;/a&gt;, though we make no promises on the future validity of that URL as MSDN seems to get a new facelift far too often :)&lt;/i&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Using Sleep()&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;As Sleep() is a Windows API function it must be prototyped before you can use it from Basic+. You can create your own prototype if you wish, but it is already included in OpenInsight, aliased with the curious name of "Sleepery" in the DLL_KERNEL32 prototype record so you may use that version if you prefer (Quite why Sleep() was aliased to Sleepery() is beyond your humble authors understanding, but I digress...)&lt;br /&gt;&lt;br /&gt;(It is also available in our &lt;a href="http://sprezzblog.blogspot.com/2010/06/sprezzatura-windows-api-library.html"&gt;Windows API Library&lt;/a&gt; package, aliased as "WinAPI_Sleep", for those of you who have installed it into your systems.  However, for this example we'll use the version installed with OpenInsight)&lt;br /&gt;&lt;br /&gt;So the Sleep() function, on the surface, sounds ideal and we can write our new version of Delay() something like this:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space:nowrap;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;"&gt;&lt;span style="color:#0000FF;"&gt;compile&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;subroutine&lt;/span&gt;&amp;nbsp;DelayEx&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;delayTime&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;call&lt;/span&gt;&amp;nbsp;sleepery&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;delayTime&amp;nbsp;&lt;span style="color:#800040;"&gt;*&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1000&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;;&lt;/span&gt;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;Sleep&amp;nbsp;works&amp;nbsp;with&amp;nbsp;milliseconds&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="color:#0000FF;"&gt;return&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;If you test-run this function you’ll see that your CPU usage is kept at 0% during the Sleep() interval and everything appears fine... or does it?&lt;br /&gt;&lt;br /&gt;Every thread in Windows has a message queue, and messages can be posted to this queue to interact with the thread (Forms and controls that are created by a thread also share its message queue, so any messages posted to them will end up here too).  Unfortunately, during a Sleep() interval, the thread won’t check it’s message queue (or do anything else for that matter) which means that other clients relying on the result of the message may even appear hung, and this can happen readily in the case of programs which &lt;span style="font-style:italic;"&gt;broadcast&lt;/span&gt; messages to every top level window in the system and wait for a response before continuing.  You may well think that this won’t apply to OpenEngine, as it’s only running Basic+ code right?  Wrong.  Don’t forget OpenEngine has its own window (you know, the actual OpenEngine window with the list of executed commands and the ‘Debug’ and ‘Log’ buttons) and that window still exists &lt;span style="font-style:italic;"&gt;even when you launch OpenInsight and specify that you don’t want a visible engine&lt;/span&gt;. It hasn’t gone anywhere – you just can’t see it!&lt;br /&gt;&lt;br /&gt;So, what we need is a function that can put a thread to sleep for a defined period of time BUT has the capability to be awakened should a message need to be processed.  The Windows API provides just such a function in the form of MsgWaitForMultipleObjects(), and this is something we’ll look at in the next post. &lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-7500692256725669138?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/7500692256725669138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/11/building-better-delay-part-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/7500692256725669138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/7500692256725669138'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/11/building-better-delay-part-1.html' title='Building a better Delay() - Part 1'/><author><name>Captain C</name><uri>http://www.blogger.com/profile/11670880508839547673</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_4bqKz2bf81g/S5Snb292BNI/AAAAAAAAAAM/VaeT498dvMI/S220/Darth+C.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-2839217934267446349</id><published>2010-10-21T20:38:00.001+01:00</published><updated>2010-10-21T20:38:49.588+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OpenInsight'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows 7'/><title type='text'>OI and the Windows 7 System Font</title><content type='html'>For a while now I've been suffering with an annoying problem when running OI on my Windows 7 laptop: any window or control that used the "default" font was rendered at the wrong size - it was being rendered as though I had a high DPI (120) set, which of course I didn't - the laptop was set to run at 96 DPI.&lt;br /&gt;&lt;br /&gt;Here's a couple of examples to show you what I mean:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_4bqKz2bf81g/TMBCGI3ktDI/AAAAAAAAABI/Vz4m-Mk5M4s/s1600/120_DPI_RDK.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 311px; height: 311px;" src="http://3.bp.blogspot.com/_4bqKz2bf81g/TMBCGI3ktDI/AAAAAAAAABI/Vz4m-Mk5M4s/s400/120_DPI_RDK.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5530493015638193202" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_4bqKz2bf81g/TMBCOExuUdI/AAAAAAAAABQ/Kg998povJos/s1600/120_DPI_ET_Prop.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 150px;" src="http://1.bp.blogspot.com/_4bqKz2bf81g/TMBCOExuUdI/AAAAAAAAABQ/Kg998povJos/s400/120_DPI_ET_Prop.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5530493151978869202" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;None of my other PCs running OI had this problem - just my laptop.  The only difference was that the laptop OS was installed by Dell, whereas all my other machines were installed by me. &lt;br /&gt;&lt;br /&gt;After some searching I came across the following blog post which gave the solution:&lt;br /&gt;&lt;br /&gt;   &lt;a href="http://blogs.msdn.com/b/developingfordynamicsgp/archive/2009/11/25/windows-7-bitmap-fonts-and-microsoft-dynamics-gp.aspx"&gt;Windows 7, bitmap fonts and Microsoft Dynamics GP&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Basically the DPI was set to 120 &lt;span style="font-style:italic;"&gt;during the installation process&lt;/span&gt; which means that the standard OS bitmapped fonts were installed as 120 DPI rather than their 96 DPI versions.  Unfortunately in Windows 7 these fonts are not changed by a user's individual DPI settings - they are system wide, and so affect all users regardless of their DPI setup.&lt;br /&gt;&lt;br /&gt;Making the registry changes described in the MSDN blog article above solved the problem and OI now looks normal on my laptop again.&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-2839217934267446349?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/2839217934267446349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/10/oi-and-windows-7-system-font.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2839217934267446349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2839217934267446349'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/10/oi-and-windows-7-system-font.html' title='OI and the Windows 7 System Font'/><author><name>Captain C</name><uri>http://www.blogger.com/profile/11670880508839547673</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_4bqKz2bf81g/S5Snb292BNI/AAAAAAAAAAM/VaeT498dvMI/S220/Darth+C.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_4bqKz2bf81g/TMBCGI3ktDI/AAAAAAAAABI/Vz4m-Mk5M4s/s72-c/120_DPI_RDK.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-3517177654946239440</id><published>2010-09-17T09:21:00.000+01:00</published><updated>2010-09-17T09:22:31.365+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Repository'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenInsight'/><category scheme='http://www.blogger.com/atom/ns#' term='Form Designer'/><title type='text'>The Mysterious Case of the Dialog Box checkbox</title><content type='html'>To my mind one of the longest-standing mysteries in OpenInsight has been the purpose of the "Dialog box" checkbox in the Window Properties dialog as you can see here:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_4bqKz2bf81g/TJKqt3qA9WI/AAAAAAAAABA/0XrEWz3cNzA/s1600/Dialog_Box.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 307px; height: 400px;" src="http://4.bp.blogspot.com/_4bqKz2bf81g/TJKqt3qA9WI/AAAAAAAAABA/0XrEWz3cNzA/s400/Dialog_Box.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5517660198493287778" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For years the function of this checkbox has eluded me (and my erstwhile colleagues), so much so that I believed it was simply something that the original Rev programmers intended to use but never implemented.  &lt;br /&gt;&lt;br /&gt;Well, after some recent work with the Revelation crew I came across the answer, and it's really simple: &lt;br /&gt;&lt;br /&gt;It's used by the Repository( "EXECUTE" ) method for launching a window - if it's checked then the Repository function calls the Dialog_Box() function to execute the window instead of the normal Start_Window() function.&lt;br /&gt;&lt;br /&gt;Mystery solved!&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-3517177654946239440?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/3517177654946239440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/09/mysterious-case-of-dialog-box-checkbox.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/3517177654946239440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/3517177654946239440'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/09/mysterious-case-of-dialog-box-checkbox.html' title='The Mysterious Case of the Dialog Box checkbox'/><author><name>Captain C</name><uri>http://www.blogger.com/profile/11670880508839547673</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_4bqKz2bf81g/S5Snb292BNI/AAAAAAAAAAM/VaeT498dvMI/S220/Darth+C.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_4bqKz2bf81g/TJKqt3qA9WI/AAAAAAAAABA/0XrEWz3cNzA/s72-c/Dialog_Box.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-636136708758135541</id><published>2010-09-15T09:30:00.002+01:00</published><updated>2010-09-15T09:33:53.647+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OpenInsight'/><category scheme='http://www.blogger.com/atom/ns#' term='Menu'/><category scheme='http://www.blogger.com/atom/ns#' term='Set_Property'/><title type='text'>The Case of the Absent MENU Event</title><content type='html'>Here at Sprezz Towers we're hard at work on the Big Project: a large Arev to OI conversion using our shiny new promoted event framework (well it ain't that new but it gets more polished each time we use it). Part of this week's programming fun has been implementing Arev Softkeys functionality as a menu that dynamically configures itself based on the active MDI child - we have a promoted event that simply alters a static "placeholder" menu on the fly using a combination of properties such as VISIBLE, ENABLED, TEXT and so on.&lt;br /&gt;&lt;br /&gt;Visually all this was working really well, but as I waded into event handling I came across an unexpected problem: &lt;span style="font-style:italic;"&gt;No&lt;/span&gt; events for the softkey menu items would fire!  Hmm...&lt;br /&gt;&lt;br /&gt;First of all I decided to check if the MDI frame was actually being told by Windows about the menu click: The trusty Microsoft Spy++ tool soon revealed that the frame was indeed receiving the menu item's WM_COMMAND message, but still nothing was getting to OpenEngine.  This was really strange as normally &lt;span style="font-style:italic;"&gt;ALL&lt;/span&gt; menu items call the RUN_EVENT function to see if there's a MENU event handler to execute - this time there was no action whatsoever.&lt;br /&gt;&lt;br /&gt;Next I started turning off the Set_Property calls one by one to see if I could determine if any particular property was responsible for the strange behaviour and I came across an interesting result: As soon as I set the ENABLED property to FALSE$ the menu item lost the ability to execute a MENU event, &lt;span style="font-style:italic;"&gt;even if I re-enabled it by setting ENABLED back to TRUE$&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;This had me stumped at first until I tested some more and removed the code setting the VISIBLE property: If I didn't use the VISIBLE property then ENABLED worked as advertised.  Progress of a sort I guess...&lt;br /&gt;&lt;br /&gt;More testing revealed this: If I removed a menu item by setting it's VISIBLE and ENABLED properties to FALSE$, in that order, and then I subsequently set the VISIBLE and ENABLED properties back to TRUE$, again in that order, then the menu item's event handling stopped working. So, the next question was ... Why?&lt;br /&gt;&lt;br /&gt;The evidence suggested that the ENABLED property did something different based on whether or not a menu item was hidden. A little more work with Spy++ showed that a hidden disabled menu item still raised a WM_COMMAND message when fired (via an accelerator key combination), but RUN_EVENT wasn't called. However, if the menu item &lt;span style="font-style:italic;"&gt;was&lt;/span&gt; visible and disabled no WM_COMMAND message was raised.  Ergo the menu ENABLED property must trigger a switch inside OpenInsight that turned off hidden menu item event handling. &lt;br /&gt;&lt;br /&gt;Thinking about this some more led me to the following conclusions: &lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;When a menu item is visible OpenInsight can use the Windows API EnableMenuItem function to disable it - the menu item is "grayed out" and clicking on it produces no WM_COMMAND message.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;When a menu item is hidden it is actually deleted from its parent menu - Windows knows nothing about it and therefore EnableMenuItem can't be used. However, OpenInsight still keeps the item details in memory so that hidden items can be executed via accelerator keys, so there must be a mechanism to disable this as needed.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Indeed there is, and it's even there on a checkbox I totally ignore when designing menus in the Form Designer:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_4bqKz2bf81g/TI_6S0iuGZI/AAAAAAAAAA4/q-gKYwLHnoo/s1600/MenuDes_NoEvent.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 374px;" src="http://3.bp.blogspot.com/_4bqKz2bf81g/TI_6S0iuGZI/AAAAAAAAAA4/q-gKYwLHnoo/s400/MenuDes_NoEvent.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5516903269801007506" /&gt;&lt;/a&gt;&lt;br /&gt;You can actually turn off menu item event processing by design and it's this flag that the ENABLED property is setting when you use it with a hidden item.  The actual OpenInsight bug is that &lt;span style="font-style:italic;"&gt;the flag is never set or removed if you use the ENABLED property on a visible item!&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;In other words, if you disable a hidden item you &lt;span style="font-style:italic;"&gt;must&lt;/span&gt; re-enable it &lt;span style="font-style:italic;"&gt;before &lt;/span&gt;you make it visible again if you want it to fire events.&lt;br /&gt;&lt;br /&gt;So, armed with this new wisdom it was a simple matter to ensure that the ENABLED and VISIBLE properties were set in a better order, and now event handling works like a charm - another case closed!&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-636136708758135541?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/636136708758135541/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/09/case-of-absent-menu-event.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/636136708758135541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/636136708758135541'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/09/case-of-absent-menu-event.html' title='The Case of the Absent MENU Event'/><author><name>Captain C</name><uri>http://www.blogger.com/profile/11670880508839547673</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_4bqKz2bf81g/S5Snb292BNI/AAAAAAAAAAM/VaeT498dvMI/S220/Darth+C.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_4bqKz2bf81g/TI_6S0iuGZI/AAAAAAAAAA4/q-gKYwLHnoo/s72-c/MenuDes_NoEvent.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-950639209303125413</id><published>2010-09-04T12:59:00.002+01:00</published><updated>2010-09-04T12:59:34.115+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='humour'/><title type='text'>Bespoke? Well yes but...</title><content type='html'>The Rev community probably won't be aware of this but this month we're running an advert for Sprezzatura in a "mostly small business" magazine here in the UK. We figure that small business owners are sufficiently independently minded that they'll be able to see the benefit of custom software over commercial off the shelf software that still needs heavy customisation but costs ten times as much.&lt;br /&gt;&lt;br /&gt;The target market place is sophisticated so we don't want to hit them with reams of copy - rather we want to appeal to their innate good sense. You don't as a rule get to grow a small business by being stupid. So the advert we came up with is reproduced here :-&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_nkYTSTH4AUU/TIFnuQPKFSI/AAAAAAAAABA/2WHk_bg1pps/s1600/Sprezz-Centurion.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_nkYTSTH4AUU/TIFnuQPKFSI/AAAAAAAAABA/2WHk_bg1pps/s320/Sprezz-Centurion.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;We thought (and fought) long and hard about it internally and were pleased with the end result. The advert was due to go to press on September 1st. Today (September 3rd) we received an email addressed to info@sprezzatura.com from a gentleman who wanted us to fit him in for an appointment to tailor a suit for him.&lt;br /&gt;&lt;br /&gt;We were mortified. Adverts aren't cheap and to think that we might have so misjudged it that people thought we tailored bespoke suits?&lt;br /&gt;&lt;br /&gt;A flurry of investigation followed and one of our smarter members noticed that the person asking for the tailoring might have a Canadian presence as their company was present there. A couple of clicks in a browser and the answer was apparent. There exists in Canada a bespoke tailors with a website of www.sprezzatura.ca. It has existed for quite some time BUT the first time in our existence we get a tailoring query is two days after our "bespoke" advert went to press....&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_nkYTSTH4AUU/TIFpTmi__oI/AAAAAAAAABI/Ww7-du6oikk/s1600/sprezz+ca.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_nkYTSTH4AUU/TIFpTmi__oI/AAAAAAAAABI/Ww7-du6oikk/s320/sprezz+ca.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Of course with hindsight if it went to press two days ago it is unlikely to be in the wild yet so the chances of the mail being in response to our advert is 0% but hindsight is always 20/20!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-950639209303125413?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/950639209303125413/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/09/bespoke-well-yes-but.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/950639209303125413'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/950639209303125413'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/09/bespoke-well-yes-but.html' title='Bespoke? Well yes but...'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_nkYTSTH4AUU/TIFnuQPKFSI/AAAAAAAAABA/2WHk_bg1pps/s72-c/Sprezz-Centurion.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-2946305105234746495</id><published>2010-08-27T18:17:00.002+01:00</published><updated>2010-08-27T18:17:45.583+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='-   OpenInsight'/><category scheme='http://www.blogger.com/atom/ns#' term='9.11'/><category scheme='http://www.blogger.com/atom/ns#' term='Bugs'/><category scheme='http://www.blogger.com/atom/ns#' term='Popup'/><title type='text'>Popups - OI Downs</title><content type='html'>We recently came across a situation where launching a popup would display a white screen where the popup should be and then GPF OpenInsight. This wasn't the effect we were actually looking for so we turned to our old friend WinDbg to track down the issue. Unsurprisingly it came down to the data table dll. (We say unsurprisingly because at the end of the day a popup is just an edittable with some extra buttons). &lt;br /&gt;&lt;br /&gt;Unfortunately this didn't help so an anguished cry rent the air as your weary reporter decried the vexatious piece of software. Another Sprezzie hearing the cry enquired as to its cause. Upon being told he asked "would you have a long column heading on your dictionary item?". This was rapidly checked and sure enough the dictionary column heading was three lines deep. This was modified to just be the necessary length and lo and behold the popup now worked. &lt;br /&gt;&lt;br /&gt;It hasn't been blogged previously by the other Sprezzie as it hadn't been reproducible - it was just a suspicion. Suspicions confirmed we're pleased to blog it lest anyone else be equally as baffled!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-2946305105234746495?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/2946305105234746495/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/08/popups-oi-downs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2946305105234746495'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2946305105234746495'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/08/popups-oi-downs.html' title='Popups - OI Downs'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-4612120084728819518</id><published>2010-08-19T16:04:00.004+01:00</published><updated>2010-08-19T16:10:38.725+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Universal Driver'/><category scheme='http://www.blogger.com/atom/ns#' term='Linear Hash'/><category scheme='http://www.blogger.com/atom/ns#' term='UDH'/><title type='text'>Semiversal Driver</title><content type='html'>It has come to our attention recently about a misconception regarding the lore of the Universal Driver.  It has been commonly accepted by all (including us here at Sprezz Towers) that on small networks (2-4 users), using one of the Universal Drivers without an NT Service is the preferred network configuration.&lt;br /&gt;&lt;br /&gt;However, after a lengthy debugging session involving OpenInsight 9.1.1 and the UD 4.6, Revelation US has verified that without a Linear Hash Server product, you must use the All Networks Driver.&lt;br /&gt;&lt;br /&gt;To quote Revelation:&lt;br /&gt;&lt;div style="margin-left: 25px; margin-right: 40px;"&gt;&lt;br /&gt;Yes, out of the box the UD clients are included but that is to ease the installation. You still need a proper server setup for shared access.&lt;br /&gt;&lt;br /&gt;You are right, but the “Universal Driver” refers to the combination of the Linear Hash Service and the Client Driver. Together the service and client drivers are the “Universal Driver” package. Using only the client driver without the service is only half the setup.&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;No, the “All Networks” driver was a unique code base and worked on a completely different principle than the Universal Driver. To think of the UD as an all networks driver is not accurate.&lt;br /&gt;&lt;br /&gt;OpenInsight 9.x includes the Universal Driver (LinearHash service and client driver) for , as I believe, the reason of making the setup of a proper stable multi-user setup easier. This is especially true for small 5 user networks that couldn’t justify the cost of the LinearHash service.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;With the Universal Driver NUL (Network User License) free for all OpenInsight 9.x customers, we urge all pure OpenInsight shops not using a Linear Hash service to install the Universal Driver 4.6 NUL on your servers.&lt;br /&gt;&lt;br /&gt;Those customer that choose not to upgrade to 9.x and are not using a Linear Hash Service product should switch drivers to the All Networks as soon as possible.  Remember, switching back to the All Networks driver could cause you problems if any of your tables have been created with the new UD style header.&lt;br /&gt;&lt;br /&gt;To help with this, Sprezzatura has enhanced our Revert LH Utility.  This takes a linear hash table with the new UD 3 style header and converts it to standard LH format, readable by all network drivers.&lt;br /&gt;&lt;br /&gt;Since the last release a few years back, we've fixed a few small bugs involving keys traversing frame boundaries.  We've also added a new user interface window to help you with reverting your files back to the original header structure.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_wxXWa8fiVK8/TGPbOtSqvgI/AAAAAAAAAAk/oz7IkNEz74M/s1600/ZZ_REVERTLH.png"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 300px;" src="http://2.bp.blogspot.com/_wxXWa8fiVK8/TGPbOtSqvgI/AAAAAAAAAAk/oz7IkNEz74M/s400/ZZ_REVERTLH.png" alt="" id="BLOGGER_PHOTO_ID_5504484215299423746" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Our new user interface allows you to see the Revelation file names of the files you wish to revert.  It also allows you to pick and choose files, if, for some reason, you'd like to keep the new header on some files.&lt;br /&gt;&lt;br /&gt;This is a free of charge utility, and can be obtained by contacting us &lt;a href="http://www.sprezzatura.com/contact.php"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Please note:  The free version of the UD 4.6 does not work with any version of OpenInsight prior to version 9.  It also does not work with Advanced Revelation.&lt;br /&gt;&lt;br /&gt;(This post brought to you by the letter A(aron))&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-4612120084728819518?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/4612120084728819518/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/08/semiversal-driver.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/4612120084728819518'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/4612120084728819518'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/08/semiversal-driver.html' title='Semiversal Driver'/><author><name>Captain C</name><uri>http://www.blogger.com/profile/11670880508839547673</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_4bqKz2bf81g/S5Snb292BNI/AAAAAAAAAAM/VaeT498dvMI/S220/Darth+C.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_wxXWa8fiVK8/TGPbOtSqvgI/AAAAAAAAAAk/oz7IkNEz74M/s72-c/ZZ_REVERTLH.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-2286730515532438800</id><published>2010-07-29T19:52:00.000+01:00</published><updated>2010-07-29T19:53:04.107+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Basic+'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenInsight'/><title type='text'>Random numbers in OpenInsight</title><content type='html'>One issue that recently reared it's head again at Sprezz Towers Support Central was the problem of using the Basic+ Rnd() function to generate a random number sequence - apparently the same series of numbers was being produced every time.&lt;br /&gt;&lt;br /&gt;On first investigation it appeared that the customer was not using the InitRnd() function to seed the Rnd() generator before asking for the random numbers. This is a documented requirement - Calling InitRnd() is an absolute necessity before using the Rnd() function.&lt;br /&gt;&lt;br /&gt;Even so, using InitRnd() as specified in the online help failed to produce sufficiently random results so we decided to take a closer look at the process to see what the problem was and how we could improve it.&lt;br /&gt;&lt;br /&gt;Under the hood the Basic+ InitRnd() and Rnd() functions are little more than thin wrappers around the srand() and rand() functions in the Windows C-runtime library. The rand() function actually produces a &lt;i&gt;pseudorandom&lt;/i&gt; sequence of numbers, so it is not truly random at all - instead the srand() function is used to seed the starting point for the pseudorandom sequence so it begins in a different place after each initialisation.  Also, if srand() is called again with the same seed &lt;i&gt;the same sequence of numbers is generated by rand()!&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Going back to the problem, the OpenInsight online help gives an example of using InitRnd() with a seed based on the current time and date (which is what our customer tried next):&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space:nowrap;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;"&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0001&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;/*&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0002&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;The&amp;nbsp;present&amp;nbsp;time&amp;nbsp;and&amp;nbsp;date&amp;nbsp;set&amp;nbsp;the&amp;nbsp;random&amp;nbsp;number&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0003&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;generator&amp;nbsp;with&amp;nbsp;a&amp;nbsp;unique&amp;nbsp;value.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0004&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0005&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0006&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;InitRnd&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;Time&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;Date&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Unfortunately for this example using the date results in a seed value that doesn't show much variance in it's low order value (it only increments by one per day), and this appears to have the effect of generating a identical Rnd() sequence between each initialisation (especially if called multiple times on the same day which is something that should be avoided).  We then thought about swapping the date and time around so that the low order value would hopefully be more varied, but here we find ourselves in danger of generating predictable sequences if we started our application at the same time every day (like at 9:15am for example).&lt;br /&gt;&lt;br /&gt;What we needed was some way to fulfil the following criteria:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Ensure that InitRnd() is only called once per session to avoid the same seed being used more than once.&lt;/li&gt;&lt;li&gt;Provide InitRnd with a varied seed value that is less predictable and has a greater "spread" than a simple date/time value.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;We quickly put together the following function to do this that gave much better results:&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space:nowrap;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;"&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0001&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;subroutine&lt;/span&gt;&amp;nbsp;zz_InitRnd&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;bReset&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0002&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;/*&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0003&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Author&amp;nbsp;&amp;nbsp;:&amp;nbsp;Mr&amp;nbsp;C,&amp;nbsp;Sprezzatura&amp;nbsp;Ltd&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0004&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:&amp;nbsp;29&amp;nbsp;July&amp;nbsp;2010&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0005&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Purpose&amp;nbsp;:&amp;nbsp;Simple&amp;nbsp;function&amp;nbsp;to&amp;nbsp;call&amp;nbsp;initRnd&amp;nbsp;with&amp;nbsp;with&amp;nbsp;a&amp;nbsp;more&amp;nbsp;varied&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0006&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;seed&amp;nbsp;value,&amp;nbsp;and&amp;nbsp;to&amp;nbsp;also&amp;nbsp;ensure&amp;nbsp;we&amp;nbsp;only&amp;nbsp;call&amp;nbsp;it&amp;nbsp;once&amp;nbsp;per&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0007&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;session.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0008&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0009&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Parameters&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0010&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;==========&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0011&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0012&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;bReset&amp;nbsp;&amp;nbsp;:&amp;nbsp;If&amp;nbsp;TRUE$&amp;nbsp;then&amp;nbsp;call&amp;nbsp;initRnd&amp;nbsp;regardless&amp;nbsp;of&amp;nbsp;whether&amp;nbsp;or&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0013&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;not&amp;nbsp;it's&amp;nbsp;been&amp;nbsp;called&amp;nbsp;before.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0014&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0015&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0016&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;declare&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;function&lt;/span&gt;&amp;nbsp;getTickCount&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;getEngineWindow&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0017&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;$insert&lt;/span&gt;&amp;nbsp;logical&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0018&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0019&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;assigned&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;bReset&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&amp;nbsp;bReset&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;""&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0020&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0021&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;common&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;/&lt;/span&gt;&lt;span style="color:#800040;"&gt;%&lt;/span&gt;&lt;span style="color:#800040;"&gt;%&lt;/span&gt;_ZZ_INITRND_&lt;span style="color:#800040;"&gt;%&lt;/span&gt;&lt;span style="color:#800040;"&gt;%&lt;/span&gt;&lt;span style="color:#800040;"&gt;/&lt;/span&gt;&amp;nbsp;zzInitRndSeed&lt;span style="color:#800040;"&gt;@&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0022&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0023&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;Check&amp;nbsp;to&amp;nbsp;see&amp;nbsp;if&amp;nbsp;we've&amp;nbsp;already&amp;nbsp;been&amp;nbsp;called&amp;nbsp;this&amp;nbsp;session.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0024&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&amp;nbsp;zzInitRndSeed&lt;span style="color:#800040;"&gt;@&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0025&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;We've&amp;nbsp;called&amp;nbsp;it&amp;nbsp;already&amp;nbsp;-&amp;nbsp;are&amp;nbsp;we&amp;nbsp;asking&amp;nbsp;for&amp;nbsp;a&amp;nbsp;reset?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0026&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&amp;nbsp;bReset&amp;nbsp;&lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0027&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;Nope!&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0028&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;return&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0029&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0030&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0031&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0032&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;Start&amp;nbsp;off&amp;nbsp;with&amp;nbsp;the&amp;nbsp;tickcount&amp;nbsp;(ms)&amp;nbsp;and&amp;nbsp;the&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0033&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;OE&amp;nbsp;hwnd&amp;nbsp;...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0034&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;seed&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;getTickCount&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;+&lt;/span&gt;&amp;nbsp;getEngineWindow&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0035&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0036&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;Now&amp;nbsp;adjust&amp;nbsp;this&amp;nbsp;slightly&amp;nbsp;to&amp;nbsp;help&amp;nbsp;avoid&amp;nbsp;the&amp;nbsp;time&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0037&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;factor&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0038&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;mod&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;seed&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;2&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0039&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;b&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;seed&lt;span style="color:#800040;"&gt;[&lt;/span&gt;&lt;span style="color:#800040;"&gt;-&lt;/span&gt;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;span style="color:#800040;"&gt;]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0040&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&amp;nbsp;b&amp;nbsp;&lt;span style="color:#0000FF;"&gt;then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0041&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;seed&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;int&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;seed&amp;nbsp;&lt;span style="color:#800040;"&gt;/&lt;/span&gt;&amp;nbsp;b&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0042&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0043&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;seed&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;int&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;seed&amp;nbsp;&lt;span style="color:#800040;"&gt;/&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;3&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0044&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0045&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0046&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0047&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;Right&amp;nbsp;-&amp;nbsp;run&amp;nbsp;it&amp;nbsp;through&amp;nbsp;some&amp;nbsp;more&amp;nbsp;mods&amp;nbsp;to&amp;nbsp;keep&amp;nbsp;it&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0048&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;within&amp;nbsp;range&amp;nbsp;of&amp;nbsp;a&amp;nbsp;short&amp;nbsp;int&amp;nbsp;if&amp;nbsp;it's&amp;nbsp;not&amp;nbsp;already...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0049&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;loop&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0050&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;while&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;seed&amp;nbsp;&lt;span style="color:#800040;"&gt;&amp;gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;0x7FFF&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0051&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;mod&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;seed&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;2&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0052&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;seed&amp;nbsp;&lt;span style="color:#800040;"&gt;-=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;0x7FFF&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0053&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0054&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;b&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;seed&lt;span style="color:#800040;"&gt;[&lt;/span&gt;&lt;span style="color:#800040;"&gt;-&lt;/span&gt;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;span style="color:#800040;"&gt;]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0055&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&amp;nbsp;b&amp;nbsp;&lt;span style="color:#0000FF;"&gt;then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0056&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;seed&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;int&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;seed&amp;nbsp;&lt;span style="color:#800040;"&gt;/&lt;/span&gt;&amp;nbsp;b&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0057&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0058&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;seed&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;int&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;seed&amp;nbsp;&lt;span style="color:#800040;"&gt;/&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;3&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0059&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0060&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0061&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;repeat&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0062&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0063&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;initRnd&lt;/span&gt;&amp;nbsp;seed&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0064&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0065&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;Flag&amp;nbsp;that&amp;nbsp;we've&amp;nbsp;already&amp;nbsp;called&amp;nbsp;this...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0066&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;zzInitRndSeed&lt;span style="color:#800040;"&gt;@&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;seed&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0067&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0068&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;return&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;i&gt;(Note that we have a global variable in place to ensure that initRnd is only called once per session, unless we explicitly override this)&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;You can download a text version of zz_InitRnd &lt;a href="http://www.sprezzatura.com/downloads/code/zz_InitRnd.txt"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Disclaimer&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="margin-left:10px;border:1px solid #7389AE;padding:4px;background-color:#FAFAFE;"&gt;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;/div&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-2286730515532438800?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/2286730515532438800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/07/random-numbers-in-openinsight.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2286730515532438800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2286730515532438800'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/07/random-numbers-in-openinsight.html' title='Random numbers in OpenInsight'/><author><name>Captain C</name><uri>http://www.blogger.com/profile/11670880508839547673</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_4bqKz2bf81g/S5Snb292BNI/AAAAAAAAAAM/VaeT498dvMI/S220/Darth+C.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-8583498247302902760</id><published>2010-07-12T11:16:00.001+01:00</published><updated>2010-07-12T11:18:05.059+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EditTable'/><category scheme='http://www.blogger.com/atom/ns#' term='EditTable Cookbook'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenInsight'/><title type='text'>EditTable Cookbook - Row selection without focus</title><content type='html'>Following on from our &lt;a href="http://sprezzblog.blogspot.com/2010/06/edittable-cookbook-clearing-single-row.html"&gt;recent post&lt;/a&gt; on how to remove the row-selection from an EditTable we came across a related issue last week that we think you might like to know about.&lt;br /&gt;&lt;br /&gt;Basically we designed a form with several EditTables, all row-select enabled, but during testing it became difficult to know where the actual input focus was as so many controls had a selection highlighted.  We could have used the technique in the aforementioned blog post to clear the row-selection during the LOSTFOCUS event, but in this case we still needed to see which row was selected even though the focus was on another control.&lt;br /&gt;&lt;br /&gt;The solution we used was to change the highlight color of the EditTable during the LOSTFOCUS event, toning it down to a lighter shade than normal.  We then reset it during the GOTFOCUS event.  This is actually quite easy to achieve with the COLOR_BY_POS message, the only real challenge is to devise an algorithm to fade the highlight color.&lt;br /&gt;&lt;br /&gt;As usual we've saved you the trouble - here's small function that you can use as a starting point for your own application should you wish to use a similar technique:&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space:nowrap;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;"&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0001&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;subroutine&lt;/span&gt;&amp;nbsp;edt_FadeSelection&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;edtID&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;bFade&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0002&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;/*&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0003&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Author&amp;nbsp;&amp;nbsp;&amp;nbsp;:&amp;nbsp;Darth&amp;nbsp;C,&amp;nbsp;Sprezzatura&amp;nbsp;Actual&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0004&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:&amp;nbsp;12 Jul&amp;nbsp;2010&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0005&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Purpose&amp;nbsp;&amp;nbsp;:&amp;nbsp;Function&amp;nbsp;to&amp;nbsp;adjust&amp;nbsp;the&amp;nbsp;row&amp;nbsp;selection&amp;nbsp;color&amp;nbsp;of&amp;nbsp;an&amp;nbsp;edit&amp;nbsp;table&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0006&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0007&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Parameters&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0008&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;==========&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0009&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0010&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;edtID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;gt;&amp;nbsp;Fully&amp;nbsp;qualified&amp;nbsp;name&amp;nbsp;of&amp;nbsp;the&amp;nbsp;edit&amp;nbsp;table&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0011&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0012&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;bFade&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;gt;&amp;nbsp;If&amp;nbsp;TRUE&amp;nbsp;then&amp;nbsp;fade&amp;nbsp;the&amp;nbsp;selection&amp;nbsp;color,&amp;nbsp;otherwise&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0013&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;reset&amp;nbsp;it&amp;nbsp;to&amp;nbsp;normal&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0014&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0015&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Requirements&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0016&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;============&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0017&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0018&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0019&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;declare&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;function&lt;/span&gt;&amp;nbsp;rgb&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0020&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;$insert&lt;/span&gt;&amp;nbsp;winAPI_EditTable_Equates&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0021&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;$insert&lt;/span&gt;&amp;nbsp;winAPI_SysColor_Equates&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0022&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;$insert&lt;/span&gt;&amp;nbsp;logical&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0023&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0024&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;assigned&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;edtID&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&amp;nbsp;edtID&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;""&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0025&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;assigned&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;bFade&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&amp;nbsp;bFade&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;FALSE$&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0026&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0027&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;len&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;edtID&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0028&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;bFade&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0029&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;goSub&lt;/span&gt;&amp;nbsp;fadeSelectionColor&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0030&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0031&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;goSub&lt;/span&gt;&amp;nbsp;resetSelectionColor&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0032&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0033&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0034&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0035&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;return&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0036&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0037&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;///////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0038&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;///////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0039&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0040&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size:11pt;font-weight:bold;"&gt;fadeSelectionColor:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0041&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0042&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;origColor&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;winAPI_GetSysColor&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;SYSCOLOR_HIGHLIGHT$&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0043&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0044&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;origColor&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;fmt&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;oconv&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;origColor&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"MB"&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"R(0)#32"&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0045&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;bleach&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;185&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;;&lt;/span&gt;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;this&amp;nbsp;is&amp;nbsp;how&amp;nbsp;much&amp;nbsp;white&amp;nbsp;we&amp;nbsp;want&amp;nbsp;to&amp;nbsp;add...(0..255)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0046&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0047&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;selColor&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;iconv&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;origColor&lt;span style="color:#800040;"&gt;[&lt;/span&gt;&lt;span style="color:#800000;"&gt;25&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&lt;span style="color:#800000;"&gt;8&lt;/span&gt;&lt;span style="color:#800040;"&gt;]&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"MB"&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0048&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;selColor&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@fm&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;iconv&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;origColor&lt;span style="color:#800040;"&gt;[&lt;/span&gt;&lt;span style="color:#800000;"&gt;17&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&lt;span style="color:#800000;"&gt;8&lt;/span&gt;&lt;span style="color:#800040;"&gt;]&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"MB"&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0049&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;selColor&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@fm&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;iconv&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;origColor&lt;span style="color:#800040;"&gt;[&lt;/span&gt;&lt;span style="color:#800000;"&gt;9&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&lt;span style="color:#800000;"&gt;8&lt;/span&gt;&lt;span style="color:#800040;"&gt;]&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"MB"&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0050&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0051&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;Now&amp;nbsp;add&amp;nbsp;the&amp;nbsp;bleach&amp;nbsp;to&amp;nbsp;each&amp;nbsp;component&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0052&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;for&lt;/span&gt;&amp;nbsp;x&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0053&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pct&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;-&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;selColor&lt;span style="color:#800040;"&gt;&amp;lt;&lt;/span&gt;x&lt;span style="color:#800040;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#800040;"&gt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;255&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0054&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;selColor&lt;span style="color:#800040;"&gt;&amp;lt;&lt;/span&gt;x&lt;span style="color:#800040;"&gt;&amp;gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;selColor&lt;span style="color:#800040;"&gt;&amp;lt;&lt;/span&gt;x&lt;span style="color:#800040;"&gt;&amp;gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;int&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;pct&amp;nbsp;&lt;span style="color:#800040;"&gt;*&lt;/span&gt;&amp;nbsp;bleach&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0055&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;next&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0056&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0057&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;selColor&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;rgb&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;selColor&lt;span style="color:#800040;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;span style="color:#800040;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;selColor&lt;span style="color:#800040;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;2&lt;/span&gt;&lt;span style="color:#800040;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;selColor&lt;span style="color:#800040;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;3&lt;/span&gt;&lt;span style="color:#800040;"&gt;&amp;gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0058&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;txtColor&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;winAPI_GetSysColor&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;SYSCOLOR_WINDOWTEXT$&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0059&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;if&lt;/span&gt;&amp;nbsp;txtColor&amp;nbsp;&lt;span style="color:#0000FF;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0060&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;0&amp;nbsp;(BLACK)&amp;nbsp;means&amp;nbsp;"default&amp;nbsp;color"&amp;nbsp;in&amp;nbsp;COLOR_BY_POS&amp;nbsp;processing!!!&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0061&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;txtColor&amp;nbsp;&lt;span style="color:#800040;"&gt;+=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0062&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0063&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0064&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;dtcs&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DT_DEFAULTCOLOR$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;|&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0065&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@fm&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;DT_DEFAULTCOLOR$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;|&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0066&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@fm&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;selColor&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;|&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0067&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@fm&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;txtColor&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0068&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0069&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;call&lt;/span&gt;&amp;nbsp;send_Message&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;edtID&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"COLOR_BY_POS"&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;0&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;0&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;dtcs&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0070&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0071&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;return&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0072&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0073&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;///////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0074&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0075&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size:11pt;font-weight:bold;"&gt;resetSelectionColor:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0076&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0077&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;dtcs&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DT_DEFAULTCOLOR$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;|&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0078&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@fm&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;DT_DEFAULTCOLOR$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;|&lt;/span&gt;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0079&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@fm&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;DT_DEFAULTCOLOR$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;|&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0080&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@fm&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;DT_DEFAULTCOLOR$&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0081&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0082&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;call&lt;/span&gt;&amp;nbsp;send_Message&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;edtID&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"COLOR_BY_POS"&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;0&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;0&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;dtcs&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0083&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0084&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;return&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0085&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0086&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;///////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0087&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;///////////////////////////////////////////////////////////////////////////////&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;In your EditTable LOSTFOCUS event you call this:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space:nowrap;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;call&lt;/span&gt;&amp;nbsp;edt_FadeSelection&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@window&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;".TABLE_1"&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;TRUE$&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;And to reset the colors in your EditTable GOTFOCUS event you call this:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space:nowrap;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;call&lt;/span&gt;&amp;nbsp;edt_FadeSelection&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@window&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;".TABLE_1"&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;FALSE$&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;(You'll notice that the function uses two "WinAPI" $insert records, both of which can be found the &lt;a href="http://sprezzblog.blogspot.com/2010/06/sprezzatura-windows-api-library.html"&gt;WinAPI Library that we recently posted&lt;/a&gt;.)&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;You can download a text version of edt_FadeSelection &lt;a href="http://www.sprezzatura.com/downloads/code/edt_FadeSelection.txt"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Disclaimer&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="margin-left:10px;border:1px solid #7389AE;padding:4px;background-color:#FAFAFE;"&gt;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;/div&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-8583498247302902760?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/8583498247302902760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/07/edittable-cookbook-row-selection.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/8583498247302902760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/8583498247302902760'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/07/edittable-cookbook-row-selection.html' title='EditTable Cookbook - Row selection without focus'/><author><name>Captain C</name><uri>http://www.blogger.com/profile/11670880508839547673</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_4bqKz2bf81g/S5Snb292BNI/AAAAAAAAAAM/VaeT498dvMI/S220/Darth+C.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-8577792648679522816</id><published>2010-07-12T11:14:00.000+01:00</published><updated>2010-07-12T11:15:26.954+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EditTable'/><category scheme='http://www.blogger.com/atom/ns#' term='EditTable Cookbook'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenInsight'/><title type='text'>EditTable Cookbook - Selecting and deselecting rows</title><content type='html'>There's a quick way to select or deselect all rows in a multi-select edit table, and that's via the DTM_SELALLROWS message.  It takes a single wParam argument which is TRUE$ to select all rows, or FALSE$ to deselect them.&lt;br /&gt;&lt;br /&gt;Here's an example:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space:nowrap;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;$insert&lt;/span&gt;&amp;nbsp;logical&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;equ&lt;/span&gt;&amp;nbsp;DTM_SELALLROWS$&amp;nbsp;&lt;span style="color:#0000FF;"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1085&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;;&lt;/span&gt;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;(&amp;nbsp;WM_USER&amp;nbsp;+&amp;nbsp;61&amp;nbsp;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;hwndEdt&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;get_Property&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span style="color:#8000FF;"&gt;@window&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;".TABLE_1"&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"HANDLE"&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;Select&amp;nbsp;all&amp;nbsp;rows....&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;call&lt;/span&gt;&amp;nbsp;sendMessage&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;hwndEdt&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;DTM_SELALLROWS$&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;TRUE$&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;0&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;Deselect&amp;nbsp;all&amp;nbsp;rows....&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;call&lt;/span&gt;&amp;nbsp;sendMessage&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;hwndEdt&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;DTM_SELALLROWS$&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;FALSE$&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;0&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-8577792648679522816?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/8577792648679522816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/07/edittable-cookbook-selecting-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/8577792648679522816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/8577792648679522816'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/07/edittable-cookbook-selecting-and.html' title='EditTable Cookbook - Selecting and deselecting rows'/><author><name>Captain C</name><uri>http://www.blogger.com/profile/11670880508839547673</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_4bqKz2bf81g/S5Snb292BNI/AAAAAAAAAAM/VaeT498dvMI/S220/Darth+C.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-2039294094931953355</id><published>2010-06-25T14:58:00.000+01:00</published><updated>2010-06-25T14:58:27.647+01:00</updated><title type='text'>From the department of shooting oneself in the foot...</title><content type='html'>Here at Sprezz Towers we're big fans of trying to write clean, maintainable code that lends itself to easy modification. As part of this, we like to keep our resource strings in a separate configuration row and pull them in at runtime using a call to one of our function libraries.&lt;br /&gt;&lt;br /&gt;Today this technique rose up and bit us on the proverbial... consider the following code :-&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: #fefefe; border: 1px solid rgb(115, 137, 174); color: black; font-family: Consolas,Courier New,Courier,Verdana,Arial; font-size: 10pt; margin: 0px 10px auto; padding: 10px 20px; white-space: nowrap;"&gt;&lt;span style="color: blue;"&gt;begin&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;case&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;case&lt;/span&gt;&amp;nbsp;memberRelatedCall&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;''&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: green; font-style: italic;"&gt;//*&amp;nbsp;CTC012:&amp;nbsp;Member&amp;nbsp;call&amp;nbsp;question&amp;nbsp;must&amp;nbsp;be&amp;nbsp;answered|&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;errorText&amp;nbsp;&lt;span style="color: purple;"&gt;:&lt;/span&gt;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;zzx_Utility&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"RESSTR"&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;RESKEY2$&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;"CTC012"&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;""&lt;/span&gt;&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;1&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;You'll see that as a friendly reminder to following programmers we include the text of the error message as a comment before the call to retrieve the error text.&lt;br /&gt;&lt;br /&gt;We were unit testing a module and ensuring that the appropriate errors messages were displayed when error conditions were found. But try as we might we couldn't get the errors to display and clearly incorrect data was somehow escaping validation.&lt;br /&gt;&lt;br /&gt;This frustrated us no end. We single stepped through code and whilst the error condition was clearly there we just couldn't get it to set the error text to flag the exception. Even more mysteriously in the debugger we couldn't get the cursor to stop on the assignment of the error text.&lt;br /&gt;&lt;br /&gt;Finally light dawned. As we were building up a potentially long error message we were including pipes in the literal as above. And whilst a pipe in a message means &lt;b&gt;new line&lt;/b&gt; a pipe on the end of a program statement means the opposite - &lt;b&gt;continue line&lt;/b&gt;. So our error text assignment was being seen as a comment and was not acted upon.&lt;br /&gt;&lt;br /&gt;Of course if we'd thought to use #PRAGMA OUTPUT &lt;i&gt;Table Row&lt;/i&gt; our mistake would have become immediately apparent.... hindsight eh?&lt;br /&gt;&lt;br /&gt;As Homer so accurately says... D'oh!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-2039294094931953355?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/2039294094931953355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/06/from-department-of-shooting-oneself-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2039294094931953355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2039294094931953355'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/06/from-department-of-shooting-oneself-in.html' title='From the department of shooting oneself in the foot...'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-7935221681252191510</id><published>2010-06-11T13:30:00.000+01:00</published><updated>2010-06-11T13:32:00.764+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DLL Prototyping'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenInsight'/><category scheme='http://www.blogger.com/atom/ns#' term='freeware'/><category scheme='http://www.blogger.com/atom/ns#' term='DLL'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows API'/><title type='text'>Sprezzatura Windows API Library</title><content type='html'>The Windows API provides a rich set of features for your application to utilise, but it can be a daunting task unless you’ve spent many hours programming in C/C++. Although the Windows API is well-documented on-line these days it can be a arduous task trying to map OI to Windows data types when prototyping functions and defining structures, or even searching C/C++ header files for constant definitions.&lt;br /&gt;&lt;br /&gt;Here at Sprezz Towers we've done a lot of Windows API programming over the years and we've managed to amass quite a collection of DLL function definitions, structures and constants, and you can find them all in an RDK at the link below.&lt;br /&gt;&lt;br /&gt;We've used some naming conventions with these so hopefully they don't collide with your own definitions:&lt;br /&gt;&lt;br /&gt;DLL prototype records are prefixed "DLL_WINAPI_"&lt;br /&gt;DLL functions are prefixed "WINAPI_"&lt;br /&gt;Structures are prefixed "WIN32_"&lt;br /&gt;Inserts are prefixed "WINAPI_"&lt;br /&gt;&lt;br /&gt;A list of all the library components can be found in the RDK &lt;span style="font-style:italic;"&gt;README.TXT&lt;/span&gt; file.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.sprezzatura.com/downloads/products/zzx_WinAPI/zzx_WinAPI.v.2.1.9.src.zip"&gt;Sprezzatura Windows API Library Download&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Enjoy!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Disclaimer&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="margin-left:10px;border:1px solid #7389AE;padding:4px;background-color:#FAFAFE;"&gt;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;/div&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-7935221681252191510?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/7935221681252191510/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/06/sprezzatura-windows-api-library.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/7935221681252191510'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/7935221681252191510'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/06/sprezzatura-windows-api-library.html' title='Sprezzatura Windows API Library'/><author><name>Captain C</name><uri>http://www.blogger.com/profile/11670880508839547673</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_4bqKz2bf81g/S5Snb292BNI/AAAAAAAAAAM/VaeT498dvMI/S220/Darth+C.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-2180242484074982027</id><published>2010-06-11T11:48:00.002+01:00</published><updated>2010-06-11T11:48:57.814+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EditTable'/><category scheme='http://www.blogger.com/atom/ns#' term='EditTable Cookbook'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenInsight'/><title type='text'>EditTable Cookbook - Clearing single row selection</title><content type='html'>One of the more annoying visual traits we find with the EditTable is with single row selection: There seems to be no way to unselect a row and remove the highlight once it's there, and this can lead to a confusing state when it appears that more than one control has the focus.&lt;br /&gt;&lt;br /&gt;We've often been asked how to rectify this as simply setting the SELPOS property doesn't suffice, so here's the solution - we use the Windows API SendMessage function to clear the selection like so...&lt;style type="text/css" media="all"&gt;&lt;br /&gt;.bpPre {&lt;br /&gt;   white-space:nowrap;&lt;br /&gt;   font-family:Consolas,Courier New,Courier,Verdana,Arial;&lt;br /&gt;   font-size:10pt;&lt;br /&gt;   background-color:#FEFEFE;&lt;br /&gt;   color:#000000;&lt;br /&gt;   border:1px solid #7389AE;&lt;br /&gt;   padding:10px 20px;&lt;br /&gt;   margin:0px 10px auto;&lt;br /&gt;}&lt;br /&gt;.bpComment {&lt;br /&gt;   font-style:italic;&lt;br /&gt;   color:#008000;&lt;br /&gt;}&lt;br /&gt;.bpDirective {&lt;br /&gt;   color:#808000;&lt;br /&gt;}&lt;br /&gt;.bpKeyword {&lt;br /&gt;   color:#0000FF;&lt;br /&gt;}&lt;br /&gt;.bpNumber {&lt;br /&gt;   color:#800000;&lt;br /&gt;}&lt;br /&gt;.bpString {&lt;br /&gt;   color:#008080;&lt;br /&gt;}&lt;br /&gt;.bpSymbol {&lt;br /&gt;   color:#800040;&lt;br /&gt;}&lt;br /&gt;.bpSysVar {&lt;br /&gt;   color:#8000FF;&lt;br /&gt;}&lt;br /&gt;.bpDebug {&lt;br /&gt;   font-size:12pt;&lt;br /&gt;   font-weight:bold;&lt;br /&gt;   color:#FF0000;&lt;br /&gt;}&lt;br /&gt;.bpDict {&lt;br /&gt;   color:#FF8000;&lt;br /&gt;}&lt;br /&gt;.bpLabel {&lt;br /&gt;   font-size:11pt;&lt;br /&gt;   font-weight:bold;&lt;br /&gt;}&lt;br /&gt;.bpLineNo {&lt;br /&gt;   font-family:Courier New, Courier, monospace;&lt;br /&gt;   color:#808080;&lt;br /&gt;   background-color:#F5F5F5;&lt;br /&gt;}&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="bpPre"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;$insert&lt;/span&gt;&amp;nbsp;logical&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;DTM_SELROW$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;1083&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;;&lt;/span&gt;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;(&amp;nbsp;WM_USER&amp;nbsp;+&amp;nbsp;59&amp;nbsp;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;DTPOS_INVALID$&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;-&lt;/span&gt;&lt;span class="bpNumber"&gt;3&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;hwndEdt&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;get_Property&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span class="bpSysVar"&gt;@window&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;".TABLE_1"&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;"HANDLE"&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;call&lt;/span&gt;&amp;nbsp;sendMessage&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;hwndEdt&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;DTM_SELROW$&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;FALSE$&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;DTPOS_INVALID$&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&amp;nbsp;&lt;br /&gt;&lt;/div&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-2180242484074982027?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/2180242484074982027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/06/edittable-cookbook-clearing-single-row.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2180242484074982027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2180242484074982027'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/06/edittable-cookbook-clearing-single-row.html' title='EditTable Cookbook - Clearing single row selection'/><author><name>Captain C</name><uri>http://www.blogger.com/profile/11670880508839547673</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_4bqKz2bf81g/S5Snb292BNI/AAAAAAAAAAM/VaeT498dvMI/S220/Darth+C.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-3437202210295744750</id><published>2010-05-06T17:14:00.001+01:00</published><updated>2010-05-07T09:48:49.195+01:00</updated><title type='text'>Thou shalt encrypt</title><content type='html'>One of the more scary things to come out of the recent Revelation conference was the frequent discussions about the new legislation coming through in the US mandating the encryption of data like SSNs.  This is something that is obviously of concern to end-users and software developers alike.  As some commentators mentioned:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;a href="http://yro.slashdot.org/article.pl?sid=10/04/25/1745210"&gt;If you have a database that contains 1,000 names of Massachusetts residents and lose it without the data being encrypted, that's $5,000,000.&lt;/a&gt;&lt;/blockquote&gt;&lt;br /&gt;Yikes could your business, or that of your clients, afford to take such a risk with unencrypted data?&lt;br /&gt;&lt;br /&gt;A product that we’ve been using ourselves for several years provides secure commercial grade encryption capability for OpenInsight applications (OpenInsight’s ENCRYPT_FORMAT uses an algorithm which is widely viewed as not being suitable for new applications).  S/Encrypt provides multiple encryption algorithms (including AES256) to satisfy the most demanding of clients (in our case security aware financial firms and “sensitive” Government Agencies). &lt;br /&gt;&lt;br /&gt;This is a topic that every software developer, working with sensitive data, needs to be taking seriously these days.  If you find yourself in this camp, then you’ll be interested in S/Encrypt as your fast, secure and economical solution to this legal requirement.  To learn more, please contact Martyn (Martyn at Sprezzatura dot Com) for a copy of the latest S/Encrypt documentation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-3437202210295744750?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/3437202210295744750/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/05/thou-shalt-encrypt.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/3437202210295744750'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/3437202210295744750'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/05/thou-shalt-encrypt.html' title='Thou shalt encrypt'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-2823820238259760201</id><published>2010-05-04T15:16:00.001+01:00</published><updated>2010-05-04T15:16:07.860+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='conference'/><title type='text'>RevCon 2010 - the dust settles...</title><content type='html'>Well we're back from another successful Revelation Conference and we'd just like to say a big "thank you" to Revelation for organising it. Thank you also to all of the attendees who dropped by our stand and opted to "take Sprezzatura's Speakers home with them". Whilst we don't know if it's true that "Sprezzatura always have the best giveaways" as several people commented, it is nice to know that our efforts to provide giveaways that combine a promotional message with something that you can actually use are appreciated.&lt;br /&gt;&lt;br /&gt;Highlights and lowlights of the conference will differ for everybody, but for us some of the highlights included the comments of our fellow developers.&lt;br /&gt;&lt;br /&gt;The fact that Aaron Kaplan is back with Sprezz after a two year hiatus met with universal approval - especially as he will be moving back to Philly and thus be more on time zone to help with our US clients there. He won't actually be there until summer - there are too many logistics to sort out, but we know many of you look forward to seeing him again - if not before then at next year's conference.&lt;br /&gt;&lt;br /&gt;Carl's talk on embedding the web browser control was admired by many for the way in which he took a potentially highly technically complex subject and reduced it to a series of easily comprehensible slides and presentations. As one delegate said afterwards "you know - I consider myself to be a technically competent developer, but when I see the things that Carl puts together I realise that I'm just not in the same league". We don't know about that, but we appreciated the sentiment.&lt;br /&gt;&lt;br /&gt;Andrew's talk on troubleshooting OI systems using system logs was well received with one delegate expressing surprise that such powerful tools had been in the product for so long, but that he'd never heard of them. Perhaps our favourite delegate quote was from one well respected developer who commented that this presentation had taught him more long-term useful information than any other session he'd attended at this conference. Even Sean (Revelation’s documentation maven) left with some information he said he could add to the documentation.&lt;br /&gt;&lt;br /&gt;The low point of the conference for us had to be Andrew's concussion (caused by a wind borne heavy cushion – hence a con-cushion) at the roof party on the Tuesday evening which led to a lost evening for him. Andrew lost the next day as the concussion continued to move him in and out of consciousness before his hospital visit followed by a sometimes painful and frequently scary next few days as the concussion played havoc with his short term memory and anxiety levels. He is very grateful to all delegates who helped him avoid trouble in the aftermath of the post party concussion and those who volunteered to submit witness statements to the hotel management concerning the event. Four days after the event, the symptoms continue but at least they seem to be lessening.&lt;br /&gt;&lt;br /&gt;Perhaps the highlight of the conference for most was seeing just how mature the O4W product has become. It really seems as though this might be the next generation of development tools from the Rev stable to help our community easily deliver Web 2.0 based applications. In the medium term, this could even be the tool to help us to reach out to a wider community. Equally as exciting was the announcement of the new M class licensing for people who wish to use another back end database, but use the OI front end tools for development. &lt;br /&gt;&lt;br /&gt;Finally we have to give a big shout out to the newer Revelation Staff - Jared Bratu and Erik Smith - who both provided incredibly polished maiden talks, made all the more impressive by their lack of previous form. It's great to see such obvious enthusiasm from the next generation of Revelation programmers.&lt;br /&gt;&lt;br /&gt;All in all the conference had something for everyone and so we look forward to seeing you all at the Rio again next year for RevCon 2011!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-2823820238259760201?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/2823820238259760201/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/05/revcon-2010-dust-settles.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2823820238259760201'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2823820238259760201'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/05/revcon-2010-dust-settles.html' title='RevCon 2010 - the dust settles...'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-506953435254164331</id><published>2010-04-18T02:15:00.000+01:00</published><updated>2010-04-18T02:15:17.246+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='UDH'/><title type='text'>UDH 4.6 - Cracking the code</title><content type='html'>We've got a couple of clients with UDH installations and this weekend we upgraded one of them to 4.6 - the latest and greatest. There's so much to like about this release - not least the improved documentation and improved replay of journalling. But sometimes the unforeseen happens and you hit a "Well nobody would ever do that would they?" moment - the moment when just as you ask yourself the question you see several possible scenarios unfold where not only might they &lt;i&gt;do&lt;/i&gt; that, they'd have damn good reasons for doing it.&lt;br /&gt;&lt;br /&gt;So after the weekend was over we returned to base and expected a tranquil week. Until Monday morning that is. We seemed to have two unrelated problems :-&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Users were getting kicked out with "Maximum number of variables" in RTP32&lt;/li&gt;&lt;li&gt;The Event Viewer on the (Windows 2008 r2) UDH Server was full of thousands of similar error messages.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Well fixing the RTP32 problem was going to be easy - &lt;a href="http://www.sprezzatura.com/library/revmedia/vol1-iss4-art9.php"&gt;We just consulted our on-line REVMEDIA for what RTP32 actually does.&lt;/a&gt;&amp;nbsp; OK FIELDSTORE. So we'd just look for where that was going into an infinite loop. For details of how we'd actually achieve this why not come to our talk on using logs to troubleshoot Revelation problems at&lt;a href="http://www.revelationconference.com/topics.html"&gt; RevCon 2010&lt;/a&gt;?&lt;br /&gt;&lt;br /&gt;Regretfully it didn't seem to be as easy as that as we weren't actually making much use of FIELDSTORE. So we'd come back to that issue and concentrate on the Event Viewer issue. As we said the Event Viewer on the (Windows 2008 r2) UDH Server was full of thousands of similar error messages. All of which made no sense whatsoever to us. To make matters worse, scattered amongst these errors were more meaningful ones.&lt;br /&gt;&lt;br /&gt;Thankfully as ever the tech team at RevSoft swang into action and decided that we was seeing two problems. One they thought might be related to messages (we'll come back to that) and one that might indicate that we did in fact have data errors in some of our tables.&lt;br /&gt;&lt;br /&gt;Tracking down the data errors was made difficult by the fact that with nearly 10,000 errors to choose from it's difficult to search for a specific message - in this case the text "REV" to find the actual DOS files affected. Initial attempts to export from the Event Viewer failed as selecting Tab delimited text resulted in a small subset of the log being exported. After several failed attempts we dropped back to CSV and lo and behold, a 70K file became a 12 MB file. With this we were able to open in notepad and identify the files in question. One was FUBAR, a 10K LK and a 4 GB OV - on a dictionary file. That was soon rectified. The second was a null key which caused the UDH to report a LHReadNextKeyIdGroup error with an unfeasibly large error code.&lt;br /&gt;&lt;br /&gt;Now we had the physical errors sorted it was time to address the  logical. Revelation suggested that what we might be seeing could be a  problem with overly long messages.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_nkYTSTH4AUU/S8Y2TxQ-b5I/AAAAAAAAAAM/SofceIm0sEw/s1600/EventVwr.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_nkYTSTH4AUU/S8Y2TxQ-b5I/AAAAAAAAAAM/SofceIm0sEw/s320/EventVwr.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;We were slightly at a loss as to why this might be until they pointed out that in AREV when you call MSG it firstly assumes that the first passed parameter is a row id and tries first to read it from MESSAGES and then SYSMESSAGES before deciding that it was a literal and attempting to display it. The reason this becomes a problem is that in 4.6 maximum row id lengths are enforced and generate errors if exceeded.&lt;br /&gt;&lt;br /&gt;We set about creating&amp;nbsp; proof of this hypothesis and wrote a program to display an increasingly long message.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_nkYTSTH4AUU/S8Y3Zy0XfCI/AAAAAAAAAAU/Fou24jMtqPA/s1600/breakingit.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_nkYTSTH4AUU/S8Y3Zy0XfCI/AAAAAAAAAAU/Fou24jMtqPA/s320/breakingit.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;and sure enough we dropped to the debugger&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_nkYTSTH4AUU/S8Y3vi_WahI/AAAAAAAAAAc/62Busu0zr28/s1600/rtp32.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_nkYTSTH4AUU/S8Y3vi_WahI/AAAAAAAAAAc/62Busu0zr28/s320/rtp32.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;in RTP32! Hurrah! And what was the magic number?&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_nkYTSTH4AUU/S8Y4Aig4HKI/AAAAAAAAAAk/Xh8qNG74-BI/s1600/553.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_nkYTSTH4AUU/S8Y4Aig4HKI/AAAAAAAAAAk/Xh8qNG74-BI/s320/553.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;553 - one more than the maximum allowed key length of 552.&lt;br /&gt;&lt;br /&gt;So now we had the problem the solution became obvious (well talking it over with colleagues helped - "by the power of Sprezz"....) - we'd just write a shell program to intercept message calls and if they were longer than the longest message key we'd pass over a message map that told MSG that what was being passed was a literal so it didn't need to try reading it. So $MSG was copied to $MSG_RTI and our replacement was created. And as you can see it worked...&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_nkYTSTH4AUU/S8Y45x3CnKI/AAAAAAAAAAs/Ps-TtVv8Aus/s1600/longmessage.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_nkYTSTH4AUU/S8Y45x3CnKI/AAAAAAAAAAs/Ps-TtVv8Aus/s320/longmessage.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;We implemented and all seemed to be going swimmingly but just when we thought it was safe to go back into the water we started getting a new batch of errors which seemed to be coming from input validation not direct message calls. Fortunately now that we had our own message shell it was easier to check the program stack and find out the culprit...&lt;br /&gt;&lt;br /&gt;It seems that when the user was entering an invalid key there were a number of possible patterns the key could match. So IN.PATTERN was called to see which, if any it passed. On determining that the pattern match had failed PAT_CHECK was called to construct an "English type" failure message. This message was passed to MSG as a msgRec with msg being left blank. So once again MSG_RTI looked at the script and tried to read it as a message - failing as before. So once again all we had to do was check any passed script and if it was longer than our maximum row id length set the literal flag. Once these modifications were made all that was left were legitimate day to day errors.&lt;br /&gt;&lt;br /&gt;We present below the code we used which you are free to use &lt;i&gt;at your own risk - Sprezzatura makes no warranties etc etc etc&lt;/i&gt;. If you want warranties we'll happily come and help you for our usual daily rate!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: #fefefe; border: 1px solid rgb(115, 137, 174); color: black; font-family: Consolas,Courier New,Courier,Verdana,Arial; font-size: 10pt; margin: 0px 10px auto; padding: 10px 20px; white-space: nowrap;"&gt;&lt;span style="color: blue;"&gt;Subroutine&lt;/span&gt;&amp;nbsp;Msg&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;msg&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;msgRec&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;resp&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;args&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: green; font-style: italic;"&gt;/*&lt;br /&gt;&amp;nbsp;&amp;nbsp;Author&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;AMcA&lt;br /&gt;&amp;nbsp;&amp;nbsp;Date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;14th&amp;nbsp;April&amp;nbsp;2010&lt;br /&gt;&amp;nbsp;&amp;nbsp;Purpose&amp;nbsp;&amp;nbsp;&amp;nbsp;To&amp;nbsp;provide&amp;nbsp;a&amp;nbsp;shell&amp;nbsp;to&amp;nbsp;normal&amp;nbsp;system&amp;nbsp;MSG&amp;nbsp;as&amp;nbsp;with&amp;nbsp;the&amp;nbsp;new&amp;nbsp;UDH&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;there&amp;nbsp;are&amp;nbsp;issues&amp;nbsp;if&amp;nbsp;it&amp;nbsp;does&amp;nbsp;not&amp;nbsp;know&amp;nbsp;the&amp;nbsp;first&amp;nbsp;parameter&amp;nbsp;is&amp;nbsp;a&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;literal.&amp;nbsp;Given&amp;nbsp;this&amp;nbsp;system&amp;nbsp;will&amp;nbsp;not&amp;nbsp;be&amp;nbsp;changing&amp;nbsp;we&amp;nbsp;have&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;simply&amp;nbsp;found&amp;nbsp;the&amp;nbsp;longest&amp;nbsp;message&amp;nbsp;in&amp;nbsp;SYSMESSAGES&amp;nbsp;and&amp;nbsp;MESSAGES&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(29&amp;nbsp;characters)&amp;nbsp;and&amp;nbsp;told&amp;nbsp;MSG_RTI&amp;nbsp;that&amp;nbsp;if&amp;nbsp;it&amp;nbsp;is&amp;nbsp;longer&amp;nbsp;than&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;35&amp;nbsp;it&amp;nbsp;is&amp;nbsp;a&amp;nbsp;literal.&amp;nbsp;If&amp;nbsp;your&amp;nbsp;system&amp;nbsp;is&amp;nbsp;still&amp;nbsp;in&amp;nbsp;active&amp;nbsp;development&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;then&amp;nbsp;you&amp;nbsp;might&amp;nbsp;want&amp;nbsp;to&amp;nbsp;set&amp;nbsp;the&amp;nbsp;MAXIDLEN$&amp;nbsp;equate&amp;nbsp;to&amp;nbsp;something&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;larger&amp;nbsp;to&amp;nbsp;avoid&amp;nbsp;shooting&amp;nbsp;yourself&amp;nbsp;in&amp;nbsp;the&amp;nbsp;foot.&lt;br /&gt;*/&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;If&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;Assigned&lt;/span&gt;&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;msg&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;Else&lt;/span&gt;&amp;nbsp;msg&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;''&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;If&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;Assigned&lt;/span&gt;&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;msgRec&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;Else&lt;/span&gt;&amp;nbsp;msgRec&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;""&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;If&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;Assigned&lt;/span&gt;&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;resp&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;Else&lt;/span&gt;&amp;nbsp;resp&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;""&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;If&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;Assigned&lt;/span&gt;&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;args&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;Else&lt;/span&gt;&amp;nbsp;args&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;""&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;Equ&lt;/span&gt;&amp;nbsp;MAXIDLEN$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;To&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;35&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;saveMsgRec&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;msgRec&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;If&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;Len&lt;/span&gt;&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;msg&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&amp;nbsp;GE&amp;nbsp;MAXIDLEN$&amp;nbsp;&lt;span style="color: blue;"&gt;Or&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;Len&lt;/span&gt;&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;msgRec&lt;span style="color: purple;"&gt;&amp;lt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;11&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&amp;nbsp;GE&amp;nbsp;MAXIDLEN$ &lt;span style="color: blue;"&gt;Then&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;msgRec&lt;span style="color: purple;"&gt;&amp;lt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;13&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;&amp;gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;1&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color: green; font-style: italic;"&gt;*&amp;nbsp;Literal&amp;nbsp;-&amp;nbsp;do&amp;nbsp;no&amp;nbsp;reads&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;End&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;Else&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;msgRec&lt;span style="color: purple;"&gt;&amp;lt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;13&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;&amp;gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: teal;"&gt;""&lt;/span&gt;&amp;nbsp;&lt;span style="color: purple;"&gt;;&lt;/span&gt;&amp;nbsp;&lt;span style="color: green; font-style: italic;"&gt;*&amp;nbsp;Normal&amp;nbsp;-&amp;nbsp;check&amp;nbsp;MESSAGES&amp;nbsp;and&amp;nbsp;SYSMESSAGES&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;End&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;Call&lt;/span&gt;&amp;nbsp;Msg_RTI&lt;span style="color: purple;"&gt;(&lt;/span&gt;&amp;nbsp;msg&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;msgRec&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;resp&lt;span style="color: purple;"&gt;,&lt;/span&gt;&amp;nbsp;args&amp;nbsp;&lt;span style="color: purple;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;msgRec&amp;nbsp;&lt;span style="color: purple;"&gt;=&lt;/span&gt;&amp;nbsp;saveMsgRec&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Return&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-506953435254164331?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/506953435254164331/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/04/udh-46-cracking-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/506953435254164331'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/506953435254164331'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/04/udh-46-cracking-code.html' title='UDH 4.6 - Cracking the code'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_nkYTSTH4AUU/S8Y2TxQ-b5I/AAAAAAAAAAM/SofceIm0sEw/s72-c/EventVwr.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-3946331147549252869</id><published>2010-04-09T19:43:00.000+01:00</published><updated>2010-04-09T19:43:15.098+01:00</updated><title type='text'>Danger Will Robinson!</title><content type='html'>Working with 9.1.1 today I had occasion to use the global search and replace utility built into the Editor++. In this instance I was replacing one resource string with references to another. The search found six programs so I selected them all and told the editor to go ahead and do the replace.&lt;br /&gt;&lt;br /&gt;Imagine my surprise to find that what actually happened was that the six programs were completely replaced with blank rows other than the line to be changed. This was definitely not the result I had wanted - especially as it also compiled the programs (at my request) thereby wiping out the existing object code.&lt;br /&gt;&lt;br /&gt;Revelation are aware of the issue and hopefully it will be fixed in 9.2. In the meantime exercise extreme caution if using this utility.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-3946331147549252869?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/3946331147549252869/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/04/danger-will-robinson.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/3946331147549252869'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/3946331147549252869'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/04/danger-will-robinson.html' title='Danger Will Robinson!'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-2762808218758187452</id><published>2010-03-23T21:30:00.000Z</published><updated>2010-03-23T21:30:23.694Z</updated><title type='text'>BFSs Redux - being an examination of the concept of Base Filing Systems</title><content type='html'>Those of you with long memories may well remember the heyday of Advanced Revelation when it seemed that every week somebody would come out with a new BFS – or “Bond” as we then called it. Starting with Icicle Software and their Lotus 123 bond followed by AS400 bonds, dBase bonds, SQL Server Bonds, Universe Bonds – the list grew and grew. These days though we seem not to hear quite so much about them so we thought that with the forthcoming re-introduction of the SQL Bond in 9.2 it might be time to revisit this subject. &lt;br /&gt;&lt;br /&gt;So what is a BFS? &lt;br /&gt;&lt;br /&gt;The clue is – as ever – in the title. Base Filing System. A Base Filing System is the lowest level of file system available in a Revelation environment. Ultimately it is an abstraction of all of the operations required to manipulate a particular file format encapsulated into one conceptual black box program. We say “conceptual” because there is nothing stopping a BFS being made up of more than one program – a classic example of this is the Linear Hash BFS, which uses both RTP57 and RTP57A to implement Linear Hash.&lt;br /&gt;&lt;br /&gt;Consider the problem faced by Revelation back in the day. They wanted to create a tool set that could work against ANY back end without requiring reprogramming. Such a tool set would be a boon for developers and users alike. So they came up with the concept of a BFS. They created a list of primitive codes that a filing system would need to support and the codified this in the BFS standard.&amp;nbsp; Basically they said “if you respond in the following manner to the following requests we really don’t care what it is you’re talking to on the back end”.&lt;br /&gt;&lt;br /&gt;So how does it work?&lt;br /&gt;&lt;br /&gt;In the first instance we need to provide OpenInsight with some information about the data we're trying to access. If you think about it, all that OI needs to be told is just the name of a data row that defines both the location we're interested in and the name of the BFS to use. And this is exactly what a volume pointer is. Now admittedly it might need some additional information such as where to keep shadow dictionaries but location and the BFS are the main constituents.&lt;br /&gt;&lt;br /&gt;Attaching a volume could be mapped as follows :-&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.sprezzatura.com/blog/uploaded_images/attach-712246.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="92" src="http://www.sprezzatura.com/blog/uploaded_images/attach-712244.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;So let's describe a simple application of this by reference to an imaginary BFS called dBASE.BFS which is a program that has been created to read and write dBASE files. We can obviously store dBASE files anywhere on the disk so we need to tell OI their exact location. Let's assume that we're going to keep them in DATAVOL - yes we can mix and match different file types at the same location because we're using different BFSs. So to "dry run" the above diagram we firstly create a volume pointer called "DBASE_INFO" that tells OI that the BFS is called DBASE.BFS and that the location is called DATAVOL...&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Attach a volume - we ask OI to attach DBASE_INFO&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Read Volume Pointer - OI reads the volume pointer and gets back DBASE.BFS : @Fm : DATAVOL&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Determine BFS - OI takes field one&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Determine location - OI takes field two&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Call BFS passing location - a series of calls are placed to DBASE.BFS asking it to open the media map for the location, select the rows in the map and return these rows. In actuality the DBASE.BFS would implement this by doing an InitDir(Location : "\*.DBF") and returning the file list&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Update SysTables - SYSTABLES would have the names of the DBF files added into the array along with the fact that they use the DBASE BFS&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;So now if you looked at SYSTABLES you would find rows for each DBF table detaiing its location and the fact that it uses the DBASE.BFS. For the sake of argument let us assume that one such row was called MEMBERS.DBF.&lt;br /&gt;&lt;br /&gt;Now when we come to want to open the file for any reason RTP9 (the routine responsible for opening files) would be called with the parameter MEMBERS.DBF. It would read the row from SYSTABLES and establish that the BFS used for that file was DBASE.BFS. It would then call DBASE.BFS passing it the location and the name of the file to open - so DATAVOL and MEMBERS.DBF. DBASE.BFS would simply validate that the file existed and if it did it would return a file handle which could have any structure that the DBASE.BFS wanted &lt;i&gt;as long as&lt;/i&gt; it followed the syntax BFS_NAME : @Vm : HandleIdentifyingFile. In its most simple form this could be DBASE.BFS : @Vm : MEMBERS.DBF. This resulting handle would be put into the variable that the file was opened to and would become our file handle.&lt;br /&gt;&lt;br /&gt;So now we have a file handle. When we come to read or write to the file handle OI is completely agnostic as to what the BFS actually is. It doesn't care if we are reading or writing Linear Hash, DBASE or SQL. The engine in its role as opcode interpreter simply comes across the opcode for, say a read and says "Oooh a read - so the next opcode will identify the file handle, the next opcode will identify the row id and the next opcode will identify the variable to place the resultant read in". It then looks at the file handle and effectively says&lt;br /&gt;&lt;br /&gt;FirstBitOfFileHandle = FileHandle&lt;0, 1&gt;&lt;br /&gt;Call @FirstBitOfFileHandle(Read, FileHandle, RowId, Record, Unused, Flag)&lt;br /&gt;&lt;br /&gt;which you'll recognise if you've ever written an MFS. It is then down to DBASE.BFS to implement the read as it sees fit - as long as it sets the Flag variable to indicate a successful or unsuccessful operation (and in the event of it being unsuccessful ideally sets @File.Error to indicate the nature of the failure) OI will be perfectly happy. &lt;br /&gt;&lt;br /&gt;So in conclusion - BFSs abstract the logical layer from the physical layer and OI tools work with the logical layer rather than the physical layer. If the BFS is well written then all of OI's data manipulation tools (Window, Popups, Rlist, Basic+ etc) will just assume that the underlying filing system is effectively linear hash.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-2762808218758187452?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/2762808218758187452/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/03/bfss-redux-being-examination-of-concept.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2762808218758187452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2762808218758187452'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/03/bfss-redux-being-examination-of-concept.html' title='BFSs Redux - being an examination of the concept of Base Filing Systems'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-67677644734416159</id><published>2010-03-20T17:59:00.002Z</published><updated>2010-03-20T17:59:53.908Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Basic+'/><category scheme='http://www.blogger.com/atom/ns#' term='Unicode'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>UTF8 - The BRemove statement</title><content type='html'>&lt;a href="http://www.sprezzatura.com/blog/2010/03/utf8-and-extended-string-operators.html"&gt;Recent changes&lt;/a&gt; to the "[]" operators in OpenInsight 9.2 have resulted in substantial performance improvements to UTF8 mode string handling.  This post highlights another such enhancement introduced in 9.2 to help bring UTF8 mode applications up to the standard of their ANSI counterparts.&lt;br /&gt;&lt;br /&gt;Consider the Loop/Remove construct below:&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space:nowrap;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;"&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0001&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;/*&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0002&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Example&amp;nbsp;showing&amp;nbsp;standard&amp;nbsp;loop/remove&amp;nbsp;construct&amp;nbsp;used&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0003&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;to&amp;nbsp;parse&amp;nbsp;dynamic&amp;nbsp;arrays&amp;nbsp;at&amp;nbsp;high&amp;nbsp;speed&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0004&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0005&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0006&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;mark&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0007&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;pos&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;;&lt;/span&gt;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;This&amp;nbsp;is&amp;nbsp;the&amp;nbsp;CHARACTER&amp;nbsp;position&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0008&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;Loop&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0009&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;Remove&lt;/span&gt;&amp;nbsp;nextVal&amp;nbsp;&lt;span style="color:#0000FF;"&gt;From&lt;/span&gt;&amp;nbsp;dynArray&amp;nbsp;&lt;span style="color:#0000FF;"&gt;At&lt;/span&gt;&amp;nbsp;pos&amp;nbsp;&lt;span style="color:#0000FF;"&gt;Setting&lt;/span&gt;&amp;nbsp;mark&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0010&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0011&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;//&amp;nbsp;Process&amp;nbsp;nextVal...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0012&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0013&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;While&lt;/span&gt;&amp;nbsp;mark&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0014&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;Repeat&lt;/span&gt;&amp;nbsp;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;This is a common way to efficiently parse dynamic arrays in Basic+, but just like the normal "[]" operators it suffers from a severe performance degradation in UTF8 mode due to the need to find the byte offset of a character when given the position.&lt;br /&gt;&lt;br /&gt;To alleviate this Revelation have introduced the &lt;span style="font-weight:bold;"&gt;BRemove &lt;/span&gt;statement - this operates in exactly the same fashion as the normal Remove statement, but the index variable used in BRemove refers to a byte offset rather than a character position.&lt;br /&gt;&lt;br /&gt;Here is the same example rewritten to use BRemove:&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space:nowrap;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;"&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0001&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;/*&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0002&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Example&amp;nbsp;showing&amp;nbsp;UTF8-friendly&amp;nbsp;loop/remove&amp;nbsp;construct&amp;nbsp;used&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0003&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;to&amp;nbsp;parse&amp;nbsp;dynamic&amp;nbsp;arrays&amp;nbsp;at&amp;nbsp;high&amp;nbsp;speed&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0004&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0005&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0006&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;mark&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0007&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;pos&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;;&lt;/span&gt;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;This&amp;nbsp;is&amp;nbsp;the&amp;nbsp;BYTE&amp;nbsp;offset&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0008&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;Loop&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0009&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;BRemove&lt;/span&gt;&amp;nbsp;nextVal&amp;nbsp;&lt;span style="color:#0000FF;"&gt;From&lt;/span&gt;&amp;nbsp;dynArray&amp;nbsp;&lt;span style="color:#0000FF;"&gt;At&lt;/span&gt;&amp;nbsp;pos&amp;nbsp;&lt;span style="color:#0000FF;"&gt;Setting&lt;/span&gt;&amp;nbsp;mark&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0010&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0011&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;//&amp;nbsp;Process&amp;nbsp;nextVal...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0012&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0013&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;While&lt;/span&gt;&amp;nbsp;mark&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0014&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;Repeat&lt;/span&gt;&amp;nbsp;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;As you can see it's a simple change and one worth making - using BRemove in your UTF8 applications will ensure that your dynamic array parsing remains fast and efficient.&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-67677644734416159?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/67677644734416159/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/03/utf8-bremove-statement.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/67677644734416159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/67677644734416159'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/03/utf8-bremove-statement.html' title='UTF8 - The BRemove statement'/><author><name>Captain C</name><uri>http://www.blogger.com/profile/11670880508839547673</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_4bqKz2bf81g/S5Snb292BNI/AAAAAAAAAAM/VaeT498dvMI/S220/Darth+C.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-8804287443033928019</id><published>2010-03-13T10:43:00.003Z</published><updated>2010-03-13T10:44:09.763Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='indexing'/><title type='text'>Indexing in OpenInsight Part 3 - How transactions get updated</title><content type='html'>So now we’ve covered how the index transactions get put into the bang table all that is left is to discuss how they move from the bang table as transactions into the bang table as balanced index nodes.&lt;br /&gt;&lt;br /&gt;In the first article we explained that transactions were introduced to allow slow hardware to distribute the transaction processing. In addition to this the engineers at Cosmos had to come up with a way of allowing individual workstations to use spare processing power (when the PC was left unused) to move the transactions from the bang file into the index itself in a way that was easily interruptible if the user wanted to take control of their PC again. This being the case they opted not to move transactions straight from the bang file into the indexes as this could be an intensive operation.&lt;br /&gt;&lt;br /&gt;Before pressing on with an explanation of this let’s briefly review what the transactions actually contain.&amp;nbsp; At this stage we’re not going to explain the precise structure of the index transaction rows, just the concepts behind them. As part II explained transaction records are made up of the changes to the indexed columns, specifically the row id of the row that has changed, the column that has changed and the old and new values of the indexed column. If time were no constraint each transaction row could be picked up and all of the indexes referenced therein be updated before returning control to the user. However it is unlikely that a user would be prepared to wait this long so the process has been subdivided into tasks.&lt;br /&gt;&lt;br /&gt;There are essentially two tasks – move the transactions from generic transactions to indexed column specific transactions and finally move the index specific transactions into the index, removing the old value if appropriate and inserting the new. This is achieved using three routines :-&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; REV_BGND_UPDATE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; F.DISTRIBUTOR&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; F.INDEXER&lt;br /&gt;&lt;br /&gt;&lt;b&gt;REV_BGND_UPDATE&lt;/b&gt;&lt;br /&gt;This is the routine that runs when the system is idle. It works through the indexed files in the system – seemingly using the system variable @INDEX.TIME which has three fields – field one contains an @Vm delimited list of indexed tables, field two contains the table number to start on and field three contains the pointer to the indexed column to work on. It is responsible for calling F.DISTRIBUTOR and F.INDEXER as required.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;F.DISTRIBUTOR&lt;/b&gt;&lt;br /&gt;This is the routine that moves the generic transactions (0, 1, 2, et al) into column specific transactions (e.g. NAME, NAME*1, NAME*2 et al). &lt;br /&gt;&lt;br /&gt;&lt;b&gt;F.INDEXER&lt;/b&gt;&lt;br /&gt;This is the routine that takes the columns specific transactions (be they BTree, Relational or Computational) and updates the appropriate index row.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-8804287443033928019?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/8804287443033928019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/03/indexing-in-openinsight-part-3-how.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/8804287443033928019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/8804287443033928019'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/03/indexing-in-openinsight-part-3-how.html' title='Indexing in OpenInsight Part 3 - How transactions get updated'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-4500062265536946813</id><published>2010-03-12T13:21:00.007Z</published><updated>2010-03-20T16:50:49.822Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Basic+'/><category scheme='http://www.blogger.com/atom/ns#' term='Unicode'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>UTF8 and the extended string operators</title><content type='html'>As was pointed out in a &lt;a href="http://www.sprezzatura.com/blog/2010/03/utf8-to-malloc-or-not-to-malloc-that-is.html"&gt;recent post&lt;/a&gt; the performance of the "[]" string operators in UTF8 mode is pretty poor.  In fact it's downright painful - If you've not seen the effects before go and create yourself a UTF8 application and then try compiling a program.  The speed drop you see is due to the system pre-compiler (REV_COMPILER_EXPAND) making heavy use of the "[]" operators during the compilation process in a manner similar to this:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space:nowrap;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;"&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0001&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;/*&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0002&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;This&amp;nbsp;is&amp;nbsp;the&amp;nbsp;usual&amp;nbsp;way&amp;nbsp;of&amp;nbsp;implementing&amp;nbsp;fast&amp;nbsp;string&amp;nbsp;parsing&amp;nbsp;in&amp;nbsp;Basic+.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0003&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;We&amp;nbsp;scan&amp;nbsp;along&amp;nbsp;the&amp;nbsp;string&amp;nbsp;looking&amp;nbsp;for&amp;nbsp;a&amp;nbsp;delimiter,&amp;nbsp;and&amp;nbsp;remember&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0004&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;where&amp;nbsp;we&amp;nbsp;found&amp;nbsp;it&amp;nbsp;via&amp;nbsp;the&amp;nbsp;Col2()&amp;nbsp;function.&amp;nbsp;For&amp;nbsp;the&amp;nbsp;next&amp;nbsp;iteration&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0005&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;we&amp;nbsp;increment&amp;nbsp;that&amp;nbsp;position&amp;nbsp;and&amp;nbsp;scan&amp;nbsp;from&amp;nbsp;that&amp;nbsp;point.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0006&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;*/&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0007&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;src&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;xlate&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"SYSPROCS"&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"MSG"&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;""&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"X"&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0008&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0009&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;pos&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0010&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;eof&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;len&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;src&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0011&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0012&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;loop&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0013&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;token&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;src&lt;span style="color:#800040;"&gt;[&lt;/span&gt;pos&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&lt;span style="color:#008080;"&gt;"&amp;nbsp;"&lt;/span&gt;&lt;span style="color:#800040;"&gt;]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0014&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pos&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;col2&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0015&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0016&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;Do&amp;nbsp;stuff...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0017&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0018&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;while&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;pos&amp;nbsp;&lt;span style="color:#800040;"&gt;&amp;lt;&lt;/span&gt;&amp;nbsp;eof&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0019&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;repeat&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The problem is caused by the need to find the correct starting &lt;span style="font-style:italic;"&gt;character &lt;/span&gt;position before any string processing can take place.  Because UTF8 is a multi-byte encoding scheme it is necessary to start looking from the beginning of the string to find the &lt;span style="font-style:italic;"&gt;byte &lt;/span&gt;offset of the specified character, as it's possible for a character to be encoded in more than one byte. As you can appreciate, parsing a large string over many iterations wastes a lot of time looking for the character at the specified position - we could get much better performance if we had some way to access the actual byte offset and pass that to the "[]" operators instead.&lt;br /&gt;&lt;br /&gt;Well, the good news is that with the upcoming release of OpenInsight 9.2 Revelation have addressed this problem by extending the "[]" operators and adding two new functions to allow access to the byte offset: BCol1() and BCol2().&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;BCol1() and BCol2()&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The usual way to access the position of delimiters found with the "[]" operators or the Field() function is to use the Col1() and Col2() functions, which return the character position. The new BCol1() and BCol2() functions work in a similar fashion but return the byte offset instead, so you know how many bytes from the beginning of the string that a particular character was found.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;The extended "[]" operators&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Although BCol1() and BCol2() allow access to the byte offsets they can't be used with a normal "[]" operator because it expects the character index as the first argument not the byte offset.  The extended "[]" operators take an extra argument (a simple "1" as a flag) to indicate that the first argument &lt;span style="font-style:italic;"&gt;is &lt;/span&gt;a byte offset, and can be used like so:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="white-space:nowrap;font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;"&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0001&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;/*&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0002&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;This&amp;nbsp;example&amp;nbsp;shows&amp;nbsp;a&amp;nbsp;UTF8-friendly&amp;nbsp;way&amp;nbsp;of&amp;nbsp;parsing&amp;nbsp;a&amp;nbsp;string&amp;nbsp;using&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0003&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;byte&amp;nbsp;offsets&amp;nbsp;with&amp;nbsp;the&amp;nbsp;extended&amp;nbsp;"[]"&amp;nbsp;operators.&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0004&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-style:italic;color:#008000;"&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0005&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;src&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;xlate&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"SYSPROCS"&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"MSG"&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;""&lt;/span&gt;&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"X"&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0006&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0007&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;pos&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0008&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;delim&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#008080;"&gt;"&amp;nbsp;"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0009&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;delimSize&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;GetByteSize&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;delim&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0010&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;eof&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;GetByteSize&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;src&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0011&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0012&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;loop&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0013&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;token&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;src&lt;span style="color:#800040;"&gt;[&lt;/span&gt;pos&lt;span style="color:#800040;"&gt;,&lt;/span&gt;delim&lt;span style="color:#800040;"&gt;,&lt;/span&gt;&lt;span style="color:#800000;"&gt;1&lt;/span&gt;&lt;span style="color:#800040;"&gt;]&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;;&lt;/span&gt;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;Extended&amp;nbsp;-&amp;nbsp;note&amp;nbsp;the&amp;nbsp;last&amp;nbsp;"1"&amp;nbsp;argument&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0014&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pos&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;BCol2&lt;/span&gt;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;+&lt;/span&gt;&amp;nbsp;delimSize&amp;nbsp;&lt;span style="color:#800040;"&gt;;&lt;/span&gt;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;Get&amp;nbsp;the&amp;nbsp;byte&amp;nbsp;offset&amp;nbsp;and&amp;nbsp;increment&amp;nbsp;by&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0015&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#800040;"&gt;;&lt;/span&gt;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;the&amp;nbsp;delimiter&amp;nbsp;_byte_&amp;nbsp;size&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0016&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0017&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-style:italic;color:#008000;"&gt;*&amp;nbsp;//&amp;nbsp;Do&amp;nbsp;stuff...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0018&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0019&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;while&lt;/span&gt;&amp;nbsp;&lt;span style="color:#800040;"&gt;(&lt;/span&gt;&amp;nbsp;pos&amp;nbsp;&lt;span style="color:#800040;"&gt;&amp;lt;&lt;/span&gt;&amp;nbsp;eof&amp;nbsp;&lt;span style="color:#800040;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;"&gt;0020&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000FF;"&gt;repeat&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;(Note also that we check the byte size of the delimiter we are using - although we *know* that a space is 1 byte in both ANSI and UTF8 modes, it's good practice to check this at runtime in case you ever end up using a delimiter that is multi-byte encoded instead)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Both Field() and the normal "[]" operators update the BCol1 and BCol2 offsets, as well as the normal Col1 and Col2 positions.  The extended "[]" operators only update the BCol1 and BCol2 offsets for obvious reasons.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;[EDIT: 20 March 2010]&lt;/span&gt; To maintain naming consistency with other UTF8-related enhancements the Col1B and Col2B functions have been renamed to &lt;span style="font-weight:bold;"&gt;BCol1&lt;/span&gt; and &lt;span style="font-weight:bold;"&gt;BCol2 &lt;/span&gt;- this has been changed in the post above.&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-4500062265536946813?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/4500062265536946813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/03/utf8-and-extended-string-operators.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/4500062265536946813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/4500062265536946813'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/03/utf8-and-extended-string-operators.html' title='UTF8 and the extended string operators'/><author><name>Captain C</name><uri>http://www.blogger.com/profile/11670880508839547673</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_4bqKz2bf81g/S5Snb292BNI/AAAAAAAAAAM/VaeT498dvMI/S220/Darth+C.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-8495988801444813561</id><published>2010-03-10T10:03:00.000Z</published><updated>2010-03-10T10:04:06.080Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Basic+'/><category scheme='http://www.blogger.com/atom/ns#' term='Unicode'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>UTF8 - To Malloc or not to Malloc - that is another question</title><content type='html'>In our &lt;a href="http://www.sprezzatura.com/blog/2010/03/to-malloc-or-not-to-malloc-that-is.html"&gt;recent post&lt;/a&gt; on using memory pre-allocation when building large strings commenter M@ pointed out quite correctly that using the normal [] operators while in UTF8 mode results in a severe performance hit due to the necessity of calculating the character position of the insertion point during each iteration.&lt;br /&gt;&lt;br /&gt;A workaround that was suggested was to temporarily switch to ANSI mode for the [] operation and then switch back afterwards.  This is a valid solution and one we've used ourselves before, but it does create a possible failure point: If your system hits a fatal debug condition before you switch back you might unknowingly be stuck in ANSI mode which could result in subsequent data corruption.&lt;br /&gt;&lt;br /&gt;A safer alternative to this is to use the PutBinaryValue function that we documented &lt;a href="http://www.sprezzatura.com/blog/2010/03/utf8-and-binary-manipulation.html"&gt;here &lt;/a&gt;- this ignores any string-encoding and does a straightforward binary copy to the specified offset.&lt;br /&gt;&lt;br /&gt;Here's the Preallocation sample program from the previous post updated with the binary functions:&lt;br /&gt;&lt;style type="text/css" media="all"&gt;&lt;br /&gt;.bpPre {&lt;br /&gt;   white-space:nowrap;&lt;br /&gt;   font-family:Consolas,Courier New,Courier,Verdana,Arial;&lt;br /&gt;   font-size:10pt;&lt;br /&gt;   background-color:#FEFEFE;&lt;br /&gt;   color:#000000;&lt;br /&gt;   border:1px solid #7389AE;&lt;br /&gt;   padding:10px 20px;&lt;br /&gt;   margin:0px 10px auto;&lt;br /&gt;}&lt;br /&gt;.bpComment {&lt;br /&gt;   font-style:italic;&lt;br /&gt;   color:#008000;&lt;br /&gt;}&lt;br /&gt;.bpDirective {&lt;br /&gt;   color:#808000;&lt;br /&gt;}&lt;br /&gt;.bpKeyword {&lt;br /&gt;   color:#0000FF;&lt;br /&gt;}&lt;br /&gt;.bpNumber {&lt;br /&gt;   color:#800000;&lt;br /&gt;}&lt;br /&gt;.bpString {&lt;br /&gt;   color:#008080;&lt;br /&gt;}&lt;br /&gt;.bpSymbol {&lt;br /&gt;   color:#800040;&lt;br /&gt;}&lt;br /&gt;.bpSysVar {&lt;br /&gt;   color:#8000FF;&lt;br /&gt;}&lt;br /&gt;.bpDebug {&lt;br /&gt;   font-size:12pt;&lt;br /&gt;   font-weight:bold;&lt;br /&gt;   color:#FF0000;&lt;br /&gt;}&lt;br /&gt;.bpDict {&lt;br /&gt;   color:#FF8000;&lt;br /&gt;}&lt;br /&gt;.bpLabel {&lt;br /&gt;   font-size:11pt;&lt;br /&gt;   font-weight:bold;&lt;br /&gt;}&lt;br /&gt;.bpLineNo {&lt;br /&gt;   font-family:Courier New, Courier, monospace;&lt;br /&gt;   color:#808080;&lt;br /&gt;   background-color:#F5F5F5;&lt;br /&gt;}&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="bpPre"&gt;&lt;span class="bpKeyword"&gt;Subroutine&lt;/span&gt;&amp;nbsp;ZZ_SpeedTest&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;Void&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;Declare&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;Function&lt;/span&gt;&amp;nbsp;TimeGetTime&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;startTime&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;TimeGetTime&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;stringLength&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;GetByteSize&lt;/span&gt;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span class="bpSysVar"&gt;@Upper.Case&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span class="bpSysVar"&gt;@Fm&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;totalLength&amp;nbsp;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;stringLength&amp;nbsp;&lt;span class="bpSymbol"&gt;*&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;99999&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;newArray&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;Space&lt;/span&gt;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;totalLength&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;arrayPtr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;For&lt;/span&gt;&amp;nbsp;loopPtr&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;1&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;To&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;99999&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;PutBinaryValue&lt;/span&gt;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;newArray&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;arrayPtr&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;CHAR&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpSysVar"&gt;@Upper.Case&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span class="bpSysVar"&gt;@Fm&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arrayPtr&amp;nbsp;&lt;span class="bpSymbol"&gt;+=&lt;/span&gt;&amp;nbsp;stringLength&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;Next&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;endTime&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;TimeGetTime&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;totalTime&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;endTime&amp;nbsp;&lt;span class="bpSymbol"&gt;-&lt;/span&gt;&amp;nbsp;startTime&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;Call&lt;/span&gt;&amp;nbsp;Msg&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&lt;span class="bpSysVar"&gt;@Window&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;"Total&amp;nbsp;time&amp;nbsp;was&amp;nbsp;"&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;:&lt;/span&gt;&amp;nbsp;totalTime&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="bpKeyword"&gt;Return&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;This option took 95 milliseconds in UTF8 mode in our testing.  Pretty much on a par with the [] operator in ANSI mode (As a aside the [] operator in UTF8 mode took....... well we don't know actually - we gave up after 10 minutes of waiting for it to finish!)&lt;br /&gt;&lt;br /&gt;We also tested the concatenation (:=) option in UTF8 mode - this slowed down the program by half - better than the [] operators but still not great.&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-8495988801444813561?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/8495988801444813561/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/03/utf8-to-malloc-or-not-to-malloc-that-is.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/8495988801444813561'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/8495988801444813561'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/03/utf8-to-malloc-or-not-to-malloc-that-is.html' title='UTF8 - To Malloc or not to Malloc - that is another question'/><author><name>Captain C</name><uri>http://www.blogger.com/profile/11670880508839547673</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_4bqKz2bf81g/S5Snb292BNI/AAAAAAAAAAM/VaeT498dvMI/S220/Darth+C.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-73092056324015835</id><published>2010-03-09T23:21:00.001Z</published><updated>2010-03-09T23:25:47.605Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Basic+'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>To Malloc or not to Malloc - that is the question</title><content type='html'>As part of one of our conference presentations we're showing log file analysis in OpenInsight. If you've ever tried any of this you'll know that the files can get pretty big pretty quickly and trawling through them extracting substrings and building new arrays can be a time consuming process.&lt;br /&gt;&lt;br /&gt;For one particular application we had to build a field mark delimited array from the data we were retrieving from file and - conscious of the penalty incurred by using &lt;-1&gt; operators - we were merrily using &lt;span style="font-style: italic;"&gt;:= String : @Fm&lt;/span&gt; syntax. Despite this attempt at efficiency the operation was still woefully slow - not so much as put the kettle on slow as cook gourmet dinner from scratch, eat and wash up slow.&lt;br /&gt;&lt;br /&gt;So we had to find a way to speed up the operation. Fortunately as we've &lt;a href="http://www.revelation.com/OIdiscuss.nsf/All+by+Date/8DCA8B7F6FEC117A852571DB006435D7?OpenDocument"&gt;posted on the Revelation forum before&lt;/a&gt; there is an easy way to do this - preallocating memory. Let's compare the rival techniques and see how we get on.&lt;br /&gt;&lt;style type="text/css" media="all"&gt;&lt;br /&gt;.bpPre {&lt;br /&gt;   white-space:nowrap;&lt;br /&gt;   font-family:Consolas,Courier New,Courier,Verdana,Arial;&lt;br /&gt;   font-size:10pt;&lt;br /&gt;   background-color:#FEFEFE;&lt;br /&gt;   color:#000000;&lt;br /&gt;   border:1px solid #7389AE;&lt;br /&gt;   padding:10px 20px;&lt;br /&gt;   margin:0px 10px auto;&lt;br /&gt;}&lt;br /&gt;.bpComment {&lt;br /&gt;   font-style:italic;&lt;br /&gt;   color:#008000;&lt;br /&gt;}&lt;br /&gt;.bpDirective {&lt;br /&gt;   color:#808000;&lt;br /&gt;}&lt;br /&gt;.bpKeyword {&lt;br /&gt;   color:#0000FF;&lt;br /&gt;}&lt;br /&gt;.bpNumber {&lt;br /&gt;   color:#800000;&lt;br /&gt;}&lt;br /&gt;.bpString {&lt;br /&gt;   color:#008080;&lt;br /&gt;}&lt;br /&gt;.bpSymbol {&lt;br /&gt;   color:#800040;&lt;br /&gt;}&lt;br /&gt;.bpSysVar {&lt;br /&gt;   color:#8000FF;&lt;br /&gt;}&lt;br /&gt;.bpDebug {&lt;br /&gt;   font-size:12pt;&lt;br /&gt;   font-weight:bold;&lt;br /&gt;   color:#FF0000;&lt;br /&gt;}&lt;br /&gt;.bpDict {&lt;br /&gt;   color:#FF8000;&lt;br /&gt;}&lt;br /&gt;.bpLabel {&lt;br /&gt;   font-size:11pt;&lt;br /&gt;   font-weight:bold;&lt;br /&gt;}&lt;br /&gt;.bpLineNo {&lt;br /&gt;   font-family:Courier New, Courier, monospace;&lt;br /&gt;   color:#808080;&lt;br /&gt;   background-color:#F5F5F5;&lt;br /&gt;}&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The &lt;-1&gt; Operator&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="bpPre"&gt;&lt;span class="bpKeyword"&gt;Subroutine&lt;/span&gt;&amp;nbsp;ZZ_SpeedTest&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;Void&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;Declare&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;Function&lt;/span&gt;&amp;nbsp;TimeGetTime&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;startTime&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;TimeGetTime&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;newArray&amp;nbsp;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;""&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;For&lt;/span&gt;&amp;nbsp;loopPtr&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;1&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;To&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;99999&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;newArray&lt;span class="bpSymbol"&gt;&amp;lt;&lt;/span&gt;&lt;span class="bpSymbol"&gt;-&lt;/span&gt;&lt;span class="bpNumber"&gt;1&lt;/span&gt;&lt;span class="bpSymbol"&gt;&amp;gt;&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpSysVar"&gt;@Upper.Case&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;Next&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;endTime&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;TimeGetTime&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;totalTime&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;endTime&amp;nbsp;&lt;span class="bpSymbol"&gt;-&lt;/span&gt;&amp;nbsp;startTime&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;Call&lt;/span&gt;&amp;nbsp;Msg&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&lt;span class="bpSysVar"&gt;@Window&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;"Total&amp;nbsp;time&amp;nbsp;was&amp;nbsp;"&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;:&lt;/span&gt;&amp;nbsp;totalTime&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="bpKeyword"&gt;Return&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;This option took 4207 milliseconds&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The := Operator&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="bpPre"&gt;&lt;span class="bpKeyword"&gt;Subroutine&lt;/span&gt;&amp;nbsp;ZZ_SpeedTest&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;Void&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;Declare&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;Function&lt;/span&gt;&amp;nbsp;TimeGetTime&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;startTime&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;TimeGetTime&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;newArray&amp;nbsp;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;""&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;For&lt;/span&gt;&amp;nbsp;loopPtr&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;1&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;To&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;99999&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;newArray&amp;nbsp;&lt;span class="bpSymbol"&gt;:&lt;/span&gt;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpSysVar"&gt;@Upper.Case&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span class="bpSysVar"&gt;@Fm&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;Next&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;newArray&lt;span class="bpSymbol"&gt;[&lt;/span&gt;&lt;span class="bpSymbol"&gt;-&lt;/span&gt;&lt;span class="bpNumber"&gt;1&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&lt;span class="bpNumber"&gt;1&lt;/span&gt;&lt;span class="bpSymbol"&gt;]&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;""&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;endTime&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;TimeGetTime&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;totalTime&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;endTime&amp;nbsp;&lt;span class="bpSymbol"&gt;-&lt;/span&gt;&amp;nbsp;startTime&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;Call&lt;/span&gt;&amp;nbsp;Msg&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&lt;span class="bpSysVar"&gt;@Window&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;"Total&amp;nbsp;time&amp;nbsp;was&amp;nbsp;"&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;:&lt;/span&gt;&amp;nbsp;totalTime&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="bpKeyword"&gt;Return&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;This option took 4164 milliseconds&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Preallocation Option&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="bpPre"&gt;&lt;span class="bpKeyword"&gt;Subroutine&lt;/span&gt;&amp;nbsp;ZZ_SpeedTest&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;Void&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;Declare&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;Function&lt;/span&gt;&amp;nbsp;TimeGetTime&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;startTime&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;TimeGetTime&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;stringLength&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;Len&lt;/span&gt;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&lt;span class="bpSysVar"&gt;@Upper.Case&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span class="bpSysVar"&gt;@Fm&lt;/span&gt;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;totalLength&amp;nbsp;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;stringLength&amp;nbsp;&lt;span class="bpSymbol"&gt;*&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;99999&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;newArray&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;Space&lt;/span&gt;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;totalLength&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;arrayPtr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;For&lt;/span&gt;&amp;nbsp;loopPtr&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;1&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;To&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;99999&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;newArray&lt;span class="bpSymbol"&gt;[&lt;/span&gt;arrayPtr&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;stringLength&lt;span class="bpSymbol"&gt;]&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpSysVar"&gt;@Upper.Case&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span class="bpSysVar"&gt;@Fm&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arrayPtr&amp;nbsp;&lt;span class="bpSymbol"&gt;+=&lt;/span&gt;&amp;nbsp;stringLength&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;Next&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;endTime&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;TimeGetTime&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;totalTime&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;endTime&amp;nbsp;&lt;span class="bpSymbol"&gt;-&lt;/span&gt;&amp;nbsp;startTime&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;Call&lt;/span&gt;&amp;nbsp;Msg&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&lt;span class="bpSysVar"&gt;@Window&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;"Total&amp;nbsp;time&amp;nbsp;was&amp;nbsp;"&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;:&lt;/span&gt;&amp;nbsp;totalTime&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="bpKeyword"&gt;Return&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;This option took 81 milliseconds - so 50 times quicker - and the bigger the string you are creating,  the more impressive the improvement in speed.&lt;br /&gt;&lt;br /&gt;The reason for this is simple - when we concatenate to a string the engine has to grab more memory using a process called a &lt;span style="font-style: italic;"&gt;malloc&lt;/span&gt; - &lt;span style="font-weight: bold; font-style: italic;"&gt;m&lt;/span&gt;emory &lt;span style="font-weight: bold; font-style: italic;"&gt;alloc&lt;/span&gt;ation. These operations are resource intensive as they need to juggle memory around to make room for the new string.  Resource intensive operations are, by their very nature, slow. By preallocating the space needed we do all of our mallocing in one fell swoop and can concentrate on the task at hand.&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-73092056324015835?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/73092056324015835/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/03/to-malloc-or-not-to-malloc-that-is.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/73092056324015835'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/73092056324015835'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/03/to-malloc-or-not-to-malloc-that-is.html' title='To Malloc or not to Malloc - that is the question'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-9150828585166279394</id><published>2010-03-08T07:20:00.000Z</published><updated>2010-03-08T07:25:16.084Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='EditTable'/><category scheme='http://www.blogger.com/atom/ns#' term='EditTable Cookbook'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenInsight'/><title type='text'>EditTable Cookbook - Handling Large Arrays</title><content type='html'>Way back in the days of OpenInsight 7.2.1 the EditTable was modified so that the speed of &lt;span style="font-style:italic;"&gt;setting&lt;/span&gt; large amounts of data via the LIST or ARRAY properties was significantly increased.&lt;br /&gt;&lt;br /&gt;What was not changed was the speed of &lt;span style="font-style:italic;"&gt;getting &lt;/span&gt;data via LIST or ARRAY and this can have a impact on the setting speed if you're not careful, because each Set_Property operation performs an implicit Get_Property regardless of whether or not you actually want the original data.&lt;br /&gt;&lt;br /&gt;For example, if you already have 10000 lines of data in your EditTable and you want to use the LIST or ARRAY property to set new data you may still see a speed drop as the system uses the slow Get_Property to retrieve the original data before the update.&lt;br /&gt;&lt;br /&gt;To overcome this problem you can tell the EditTable to clear the existing data before you use Set_Property, that way the implicit Get_Property has nothing to process. This can be done with SendMessage() and the DTM_RESETDATA message like so:&lt;br /&gt;&lt;style type="text/css" media="all"&gt;&lt;br /&gt;.bpPre {&lt;br /&gt;   white-space:nowrap;&lt;br /&gt;   font-family:Consolas,Courier New,Courier,Verdana,Arial;&lt;br /&gt;   font-size:10pt;&lt;br /&gt;   background-color:#FEFEFE;&lt;br /&gt;   color:#000000;&lt;br /&gt;   border:1px solid #7389AE;&lt;br /&gt;   padding:10px 20px;&lt;br /&gt;   margin:0px 10px auto;&lt;br /&gt;}&lt;br /&gt;.bpComment {&lt;br /&gt;   font-style:italic;&lt;br /&gt;   color:#008000;&lt;br /&gt;}&lt;br /&gt;.bpDirective {&lt;br /&gt;   color:#808000;&lt;br /&gt;}&lt;br /&gt;.bpKeyword {&lt;br /&gt;   color:#0000FF;&lt;br /&gt;}&lt;br /&gt;.bpNumber {&lt;br /&gt;   color:#800000;&lt;br /&gt;}&lt;br /&gt;.bpString {&lt;br /&gt;   color:#008080;&lt;br /&gt;}&lt;br /&gt;.bpSymbol {&lt;br /&gt;   color:#800040;&lt;br /&gt;}&lt;br /&gt;.bpSysVar {&lt;br /&gt;   color:#8000FF;&lt;br /&gt;}&lt;br /&gt;.bpDebug {&lt;br /&gt;   font-size:12pt;&lt;br /&gt;   font-weight:bold;&lt;br /&gt;   color:#FF0000;&lt;br /&gt;}&lt;br /&gt;.bpDict {&lt;br /&gt;   color:#FF8000;&lt;br /&gt;}&lt;br /&gt;.bpLabel {&lt;br /&gt;   font-size:11pt;&lt;br /&gt;   font-weight:bold;&lt;br /&gt;}&lt;br /&gt;.bpLineNo {&lt;br /&gt;   font-family:Courier New, Courier, monospace;&lt;br /&gt;   color:#808080;&lt;br /&gt;   background-color:#F5F5F5;&lt;br /&gt;}&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="bpPre"&gt;&lt;span class="bpLineNo"&gt;0001&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;DTM_RESETDATA$&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;1025&lt;/span&gt;&lt;br /&gt;&lt;span class="bpLineNo"&gt;0002&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span class="bpLineNo"&gt;0003&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;hwndEdt&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;get_Property&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span class="bpSysVar"&gt;@window&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;".TABLE_1"&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;"HANDLE"&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="bpLineNo"&gt;0004&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;call&lt;/span&gt;&amp;nbsp;sendMessage&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;hwndEdt&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;DTM_RESETDATA$&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;0&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;0&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span class="bpLineNo"&gt;0005&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;span class="bpLineNo"&gt;0006&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;call&lt;/span&gt;&amp;nbsp;set_Property&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span class="bpSysVar"&gt;@window&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;".TABLE_1"&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;"LIST"&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;lotsOfStuff&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-9150828585166279394?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/9150828585166279394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/03/edittable-cookbook-handling-large.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/9150828585166279394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/9150828585166279394'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/03/edittable-cookbook-handling-large.html' title='EditTable Cookbook - Handling Large Arrays'/><author><name>Captain C</name><uri>http://www.blogger.com/profile/11670880508839547673</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_4bqKz2bf81g/S5Snb292BNI/AAAAAAAAAAM/VaeT498dvMI/S220/Darth+C.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-2872630949105026802</id><published>2010-03-03T09:45:00.009Z</published><updated>2010-03-05T12:12:08.017Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='OpenInsight'/><category scheme='http://www.blogger.com/atom/ns#' term='UTF8'/><category scheme='http://www.blogger.com/atom/ns#' term='Unicode'/><title type='text'>UTF8 and Binary Manipulation</title><content type='html'>One of the most important points to bear in mind when using the Basic+ string handling functions is that all normal string operations are character-based - not byte-based. This has major implications if you wish to manipulate your data in a byte-oriented fashion when in UTF8 mode, because UTF8 is a multi-byte encoding scheme; i.e. it doesn't always follow that one byte represents one character as is the case in ANSI mode.&lt;br /&gt;&lt;br /&gt;To overcome this issue Revelation introduced several new Basic+ functions way back in OpenInsight 7.0 that explicitly allows binary manipulation regardless of the string-handling mode you are currently in (Note that these functions are intrinsic to the Basic+ language and do not need to be declared before use).&lt;br /&gt;&lt;br /&gt;These functions are:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;GetByteSize&lt;/li&gt;&lt;li&gt;GetBinaryValue&lt;/li&gt;&lt;li&gt;PutBinaryValue&lt;/li&gt;&lt;li&gt;CreateBinaryData&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;The intention of this blog post is to document these functions and to make you aware of them so that you can develop your applications correctly should you wish to work in UTF8 mode.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;(Also note that most of these functions expect you to specify a variable type when using them.  This type should be chosen from one of the standard "C" types understood by the Basic+ compiler and listed at the end of this post)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;font-size:11pt;"&gt;GetByteSize&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Returns the number of bytes occupied by the specified variable. This is in contrast to the Len() function which returns the number of &lt;span style="font-style:italic;"&gt;characters&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;margin:0px 10px auto;"&gt;sizeInBytes = GetByteSize( varData )&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;table cellspacing="2" cellpadding="4" style="background-color:white; width:65%;border-style:solid;border-color:#7676AD;border-width:1px;margin:0px 10px auto;"&gt;&lt;tr&gt;&lt;th style="background-color:#CCCCFB;padding:4px;width:25%"&gt;Argument&lt;/th&gt;&lt;th style="background-color:#CCCCFB;"&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;varData&lt;/td&gt;&lt;td style="background-color:#EEEEFB;padding-left:2px;"&gt;Variable to query.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;E.g.&lt;style type="text/css" media="all"&gt;&lt;br /&gt;.bpPre {&lt;br /&gt;   white-space:nowrap;&lt;br /&gt;   font-family:Consolas,Courier New,Courier,Verdana,Arial;&lt;br /&gt;   font-size:10pt;&lt;br /&gt;   background-color:#FEFEFE;&lt;br /&gt;   color:#000000;&lt;br /&gt;   border:1px solid #7389AE;&lt;br /&gt;   padding:10px 20px;&lt;br /&gt;   margin:0px 10px auto;&lt;br /&gt;}&lt;br /&gt;.bpComment {&lt;br /&gt;   font-style:italic;&lt;br /&gt;   color:#008000;&lt;br /&gt;}&lt;br /&gt;.bpDirective {&lt;br /&gt;   color:#808000;&lt;br /&gt;}&lt;br /&gt;.bpKeyword {&lt;br /&gt;   color:#0000FF;&lt;br /&gt;}&lt;br /&gt;.bpNumber {&lt;br /&gt;   color:#800000;&lt;br /&gt;}&lt;br /&gt;.bpString {&lt;br /&gt;   color:#008080;&lt;br /&gt;}&lt;br /&gt;.bpSymbol {&lt;br /&gt;   color:#800040;&lt;br /&gt;}&lt;br /&gt;.bpSysVar {&lt;br /&gt;   color:#8000FF;&lt;br /&gt;}&lt;br /&gt;.bpDebug {&lt;br /&gt;   font-size:12pt;&lt;br /&gt;   font-weight:bold;&lt;br /&gt;   color:#FF0000;&lt;br /&gt;}&lt;br /&gt;.bpDict {&lt;br /&gt;   color:#FF8000;&lt;br /&gt;}&lt;br /&gt;.bpLabel {&lt;br /&gt;   font-size:11pt;&lt;br /&gt;   font-weight:bold;&lt;br /&gt;}&lt;br /&gt;.bpLineNo {&lt;br /&gt;   font-family:Courier New, Courier, monospace;&lt;br /&gt;   color:#808080;&lt;br /&gt;   background-color:#F5F5F5;&lt;br /&gt;}&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="bpPre"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;rec&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;Xlate&lt;/span&gt;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;"SYSOBJ"&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;"$WRITE_ROW"&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;""&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;"X"&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;recSize&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;GetByteSize&lt;/span&gt;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;rec&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;font-size:11pt;"&gt;GetBinaryValue&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This function extracts a binary value from a variable at a specified offset. You must specify the type of data to extract, and if you are extracting a type with a variable length, such as a string of bytes, you must also pass the number of bytes you wish to copy.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;margin:0px 10px auto;"&gt;binVal = GetBinaryValue( varData, byteOffset, varType, [,noOfBytes] )&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;table cellspacing="2" cellpadding="4" style="background-color:white; width:65%;border-style:solid;border-color:#7676AD;border-width:1px;margin:0px 10px auto;"&gt;&lt;tr&gt;&lt;th style="background-color:#CCCCFB;padding:4px;width:25%;"&gt;Argument&lt;/th&gt;&lt;th style="background-color:#CCCCFB;"&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;varData&lt;/td&gt;&lt;td style="background-color:#EEEEFB;padding-left:2px;"&gt;Variable to extract the binary value from.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;byteOffset&lt;/td&gt;&lt;td style="background-color:#EEEEFB;padding-left:2px;"&gt;1-based offset into varData to extract the binary value from.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;varType&lt;/td&gt;&lt;td style="background-color:#EEEEFB;padding-left:2px;"&gt;Type of data to extract. This must be one of the Basic+ "C" types as listed below.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;noOfBytes&lt;/td&gt;&lt;td style="background-color:#EEEEFB;padding-left:2px;"&gt;Number of bytes to extract. This argument is only required if varType is CHAR or BINARY.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;E.g.&lt;br /&gt;&lt;br /&gt;&lt;div class="bpPre"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;rec&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;Xlate&lt;/span&gt;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;"SYSOBJ"&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;"$WRITE_ROW"&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;""&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;"X"&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;//&amp;nbsp;Get&amp;nbsp;the&amp;nbsp;first&amp;nbsp;byte&amp;nbsp;of&amp;nbsp;the&amp;nbsp;record&amp;nbsp;as&amp;nbsp;a&amp;nbsp;number&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;firstByte&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;GetBinaryValue&lt;/span&gt;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;rec&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;1&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;BYTE&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;//&amp;nbsp;Get&amp;nbsp;the&amp;nbsp;next&amp;nbsp;10&amp;nbsp;bytes&amp;nbsp;as&amp;nbsp;a&amp;nbsp;binary&amp;nbsp;string&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;someBytes&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;GetBinaryValue&lt;/span&gt;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;rec&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;2&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;BINARY&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;10&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;font-size:11pt;"&gt;PutBinaryValue&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This subroutine modifies a variable by replacing binary data at a specifed byte offset. You must specify the type of data you wish to insert as well as the data itself.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;margin:0px 10px auto;"&gt;PutBinaryValue( binData, byteOffset, varType, varData )&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;table cellspacing="2" cellpadding="4" style="background-color:white; width:65%;border-style:solid;border-color:#7676AD;border-width:1px;margin:0px 10px auto;"&gt;&lt;tr&gt;&lt;th style="background-color:#CCCCFB;padding:4px;width:25%;"&gt;Argument&lt;/th&gt;&lt;th style="background-color:#CCCCFB;"&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;binData&lt;/td&gt;&lt;td style="background-color:#EEEEFB;padding-left:2px;"&gt;Variable containing binary data to modify.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;byteOffset&lt;/td&gt;&lt;td style="background-color:#EEEEFB;padding-left:2px;"&gt;1-based starting starting position to begin the modification from.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;varType&lt;/td&gt;&lt;td style="background-color:#EEEEFB;padding-left:2px;"&gt;Type of data to copy into binData. This must be one of the Basic+ "C" types as listed below.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;varData&lt;/td&gt;&lt;td style="background-color:#EEEEFB;padding-left:2px;"&gt;Data to copy into binData. OpenEngine converts this to the binary format specified by the varType argument before copying.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;E.g.&lt;br /&gt;&lt;br /&gt;&lt;div class="bpPre"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;Example&amp;nbsp;showing&amp;nbsp;how&amp;nbsp;to&amp;nbsp;access&amp;nbsp;and&amp;nbsp;update&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;a&amp;nbsp;Windows&amp;nbsp;API&amp;nbsp;structure&amp;nbsp;using&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;the&amp;nbsp;binary&amp;nbsp;operators.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;A&amp;nbsp;RECT&amp;nbsp;structure&amp;nbsp;consists&amp;nbsp;of&amp;nbsp;four&amp;nbsp;LONG&amp;nbsp;types&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;(32-bit&amp;nbsp;signed&amp;nbsp;integer,&amp;nbsp;each&amp;nbsp;4&amp;nbsp;bytes&amp;nbsp;long)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;typedef&amp;nbsp;tagRECT{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;&amp;nbsp;&amp;nbsp;LONG&amp;nbsp;left,&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;&amp;nbsp;&amp;nbsp;LONG&amp;nbsp;top,&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;&amp;nbsp;&amp;nbsp;LONG&amp;nbsp;right,&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;&amp;nbsp;&amp;nbsp;LONG&amp;nbsp;bottom&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;}&amp;nbsp;RECT;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;We're&amp;nbsp;going&amp;nbsp;to&amp;nbsp;use&amp;nbsp;the&amp;nbsp;GetWindowRect&amp;nbsp;API&amp;nbsp;function&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;to&amp;nbsp;get&amp;nbsp;some&amp;nbsp;RECT&amp;nbsp;coordinates&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;hwnd&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;Get_Property&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span class="bpSysVar"&gt;@window&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;"HANDLE"&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;rect&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;blank_Struct&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;"RECT"&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;rect&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;GetWindowRect&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;hwnd&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;rect&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;Increment&amp;nbsp;the&amp;nbsp;top&amp;nbsp;member&amp;nbsp;by&amp;nbsp;10&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;top&amp;nbsp;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;GetBinaryValue&lt;/span&gt;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;rect&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;5&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;LONG&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;top&amp;nbsp;&amp;nbsp;&lt;span class="bpSymbol"&gt;+=&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;10&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;PutBinaryValue&lt;/span&gt;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;rect&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;5&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;LONG&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;top&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;font-size:11pt;"&gt;CreateBinaryData&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This function creates and returns a "blank" binary variable of the specified type.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;margin:0px 10px auto;"&gt;binVal = CreateBinaryData( varType, varData )&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;table cellspacing="2" cellpadding="4" style="background-color:white; width:65%;border-style:solid;border-color:#7676AD;border-width:1px;margin:0px 10px auto;"&gt;&lt;tr&gt;&lt;th style="background-color:#CCCCFB;padding:4px;width:25%"&gt;Argument&lt;/th&gt;&lt;th style="background-color:#CCCCFB;"&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;varType&lt;/td&gt;&lt;td style="background-color:#EEEEFB;padding-left:2px;"&gt;Type of variable to create. This must be one of the Basic+ "C" types as listed below.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="background-color:#E3E3F2;text-align:center;padding:3px;"&gt;varData&lt;/td&gt;&lt;td style="background-color:#EEEEFB;padding-left:2px;"&gt;Initial value of the new variable.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;E.g.&lt;br /&gt;&lt;br /&gt;&lt;div class="bpPre"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;Create&amp;nbsp;a&amp;nbsp;binary&amp;nbsp;integer&amp;nbsp;with&amp;nbsp;an&amp;nbsp;initial&amp;nbsp;value&amp;nbsp;of&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;100&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;"100"&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;intA&amp;nbsp;&lt;span class="bpSymbol"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;CreateBinaryData&lt;/span&gt;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span class="bpKeyword"&gt;INT&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;a&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;font-size:11pt;"&gt;Basic+ "C" types&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The following is a list of variable types that may be used with the Basic+ binary manipulation functions described above.&lt;br /&gt;&lt;br /&gt;&lt;table cellspacing="4" cellpadding="4"&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;ul&gt;&lt;li&gt;CHAR&lt;/li&gt;&lt;li&gt;BYTE&lt;/li&gt;&lt;li&gt;UBYTE&lt;/li&gt;&lt;li&gt;SHORT&lt;/li&gt;&lt;li&gt;USHORT&lt;/li&gt;&lt;li&gt;LONG&lt;/li&gt;&lt;li&gt;ULONG&lt;/li&gt;&lt;li&gt;FLOAT&lt;/li&gt;&lt;li&gt;LPVOID&lt;/li&gt;&lt;li&gt;LPCHAR&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;ul&gt;&lt;li&gt;LPBYTE&lt;/li&gt;&lt;li&gt;LPUBYTE&lt;/li&gt;&lt;li&gt;LPSHORT&lt;/li&gt;&lt;li&gt;LPUSHORT&lt;/li&gt;&lt;li&gt;LPLONG&lt;/li&gt;&lt;li&gt;LPULONG&lt;/li&gt;&lt;li&gt;LPFLOAT&lt;/li&gt;&lt;li&gt;LPDOUBLE&lt;/li&gt;&lt;li&gt;DOUBLE&lt;/li&gt;&lt;li&gt;HANDLE&lt;/li&gt;&lt;/ul&gt;&lt;/td valign="top"&gt;&lt;td&gt;&lt;ul&gt;&lt;li&gt;INT&lt;/li&gt;&lt;li&gt;UINT&lt;/li&gt;&lt;li&gt;LPINT&lt;/li&gt;&lt;li&gt;LPUINT&lt;/li&gt;&lt;li&gt;LPHANDLE&lt;/li&gt;&lt;li&gt;ACHAR&lt;/li&gt;&lt;li&gt;WCHAR&lt;/li&gt;&lt;li&gt;LPACHAR&lt;/li&gt;&lt;li&gt;LPWCHAR&lt;/li&gt;&lt;li&gt;LPSTR&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;ul&gt;&lt;li&gt;LPASTR&lt;/li&gt;&lt;li&gt;LPWSTR&lt;/li&gt;&lt;li&gt;BINARY&lt;/li&gt;&lt;li&gt;LPBINARY&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;[EDIT: 05 March 2010]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Due to a recently discovered compiler bug (since fixed) the following "C" types will &lt;span style="font-style:italic;"&gt;NOT &lt;/span&gt;work with the binary manipulation functions prior to OpenInsight 9.2.0:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;ACHAR&lt;/li&gt;&lt;li&gt;WCHAR&lt;/li&gt;&lt;li&gt;LPACHAR&lt;/li&gt;&lt;li&gt;LPWCHAR&lt;/li&gt;&lt;li&gt;LPSTR&lt;/li&gt;&lt;li&gt;LPASTR&lt;/li&gt;&lt;li&gt;LPWSTR&lt;/li&gt;&lt;li&gt;BINARY&lt;/li&gt;&lt;li&gt;LPBINARY&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;Probably the biggest impact this will have is processing BINARY types, but you can work around this by using the CHAR type instead as they both perform exactly the same operation.&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-2872630949105026802?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/2872630949105026802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/03/utf8-and-binary-manipulation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2872630949105026802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/2872630949105026802'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/03/utf8-and-binary-manipulation.html' title='UTF8 and Binary Manipulation'/><author><name>Captain C</name><uri>http://www.blogger.com/profile/11670880508839547673</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_4bqKz2bf81g/S5Snb292BNI/AAAAAAAAAAM/VaeT498dvMI/S220/Darth+C.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-5361069522622604025</id><published>2010-03-01T12:05:00.000Z</published><updated>2010-03-01T12:06:14.978Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='EditTable'/><category scheme='http://www.blogger.com/atom/ns#' term='EditTable Cookbook'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenInsight'/><title type='text'>EditTable Cookbook - Trapping Mouse Messages</title><content type='html'>Getting notification of mouse messages has always been something of a problem with OpenInsight EditTable controls. With other controls this process is quite easy - you simply qualify the WINMSG event with the relevent mouse message number and you can easily respond to it, but with an EditTable this process fails.&lt;br /&gt;&lt;br /&gt;This is mainly due to the architecture of the EditTable itself - it's not really a single control, it's actually two: The visible control that you interact with (known as the "DataTbl" control) and a very thin parent wrapper around it (called the "Editable" control).  &lt;br /&gt;&lt;br /&gt;When you use an EditTable control in your application OpenInsight creates the wrapper control which in turn creates the visible "DataTbl" control. When you interact with an EditTable in Basic+ you are interacting directly with the wrapper - it simply passes on your request to the "DataTbl" as appropriate. If you qualify the WINMSG event on an EditTable you are qualifying against the &lt;span style="font-style:italic;"&gt;wrapper &lt;/span&gt;- you are &lt;span style="font-style:italic;"&gt;NOT&lt;/span&gt; qualifying against the visible "DataTbl" control!&lt;br /&gt;&lt;br /&gt;When the user interacts with the EditTable control they communicate with the visible "DataTbl", so it is this part that receives the mouse messages.  These messages are interpreted and the relevant notifications passed up to the wrapper and then onto OpenInsight - they are not passed directly, so you will never be able use a WINMSG event with the usual mouse messages.&lt;br /&gt;&lt;br /&gt;However, since OpenInsight 9.1 it has been possible to trap mouse messages by another means.  In this version, when the "DataTbl" receives a mouse message, it actually sends a notification message to the wrapper that you &lt;span style="font-style:italic;"&gt;can&lt;/span&gt; pick up with a WINMSG event.  The mouse message itself is simply offset by the value 3124 (WM_USER + 2100).&lt;br /&gt;&lt;br /&gt;For example to detect a "Right Mouse Button Down" message you would qualify against WM_RBUTTONDOWN + 3124 like so:&lt;br /&gt;&lt;style type="text/css" media="all"&gt;&lt;br /&gt;.bpPre {&lt;br /&gt;   white-space:nowrap;&lt;br /&gt;   font-family:Consolas,Courier New,Courier,Verdana,Arial;&lt;br /&gt;   font-size:10pt;&lt;br /&gt;   background-color:#FEFEFE;&lt;br /&gt;   color:#000000;&lt;br /&gt;   border:1px solid #7389AE;&lt;br /&gt;   padding:10px 20px;&lt;br /&gt;   margin:0px 10px auto;&lt;br /&gt;}&lt;br /&gt;.bpComment {&lt;br /&gt;   font-style:italic;&lt;br /&gt;   color:#008000;&lt;br /&gt;}&lt;br /&gt;.bpDirective {&lt;br /&gt;   color:#808000;&lt;br /&gt;}&lt;br /&gt;.bpKeyword {&lt;br /&gt;   color:#0000FF;&lt;br /&gt;}&lt;br /&gt;.bpNumber {&lt;br /&gt;   color:#800000;&lt;br /&gt;}&lt;br /&gt;.bpString {&lt;br /&gt;   color:#008080;&lt;br /&gt;}&lt;br /&gt;.bpSymbol {&lt;br /&gt;   color:#800040;&lt;br /&gt;}&lt;br /&gt;.bpSysVar {&lt;br /&gt;   color:#8000FF;&lt;br /&gt;}&lt;br /&gt;.bpDebug {&lt;br /&gt;   font-size:12pt;&lt;br /&gt;   font-weight:bold;&lt;br /&gt;   color:#FF0000;&lt;br /&gt;}&lt;br /&gt;.bpDict {&lt;br /&gt;   color:#FF8000;&lt;br /&gt;}&lt;br /&gt;.bpLabel {&lt;br /&gt;   font-size:11pt;&lt;br /&gt;   font-weight:bold;&lt;br /&gt;}&lt;br /&gt;.bpLineNo {&lt;br /&gt;   font-family:Courier New, Courier, monospace;&lt;br /&gt;   color:#808080;&lt;br /&gt;   background-color:#F5F5F5;&lt;br /&gt;}&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="bpPre"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;$insert&lt;/span&gt;&amp;nbsp;logical&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;From&amp;nbsp;the&amp;nbsp;Windows&amp;nbsp;SDK&amp;nbsp;headers:&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;WM_USER$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;0x0400&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;WM_LBUTTONDOWN$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;0x0201&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;WM_LBUTTONUP$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;0x0202&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;WM_LBUTTONDBLCLK$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;0x0203&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;WM_RBUTTONDOWN$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;0x0204&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;WM_RBUTTONUP$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;0x0205&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;WM_RBUTTONDBLCLK$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;0x0206&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;WM_MBUTTONDOWN$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;0x0207&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;WM_MBUTTONUP$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;0x0208&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;WM_MBUTTONDBLCLK$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;0x0209&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;Offset&amp;nbsp;value&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;ETM_MOUSEMSGOFFSET&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;WM_USER$&amp;nbsp;&lt;span class="bpSymbol"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span class="bpNumber"&gt;2100&lt;/span&gt;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;;&lt;/span&gt;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;3124&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;EditTable&amp;nbsp;Mouse&amp;nbsp;message&amp;nbsp;notifications&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;ETM_LBUTTONDOWN$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;ETM_MOUSEMSGOFFSET$&amp;nbsp;&lt;span class="bpSymbol"&gt;+&lt;/span&gt;&amp;nbsp;WM_LBUTTONDOWN$&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;ETM_LBUTTONUP$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;ETM_MOUSEMSGOFFSET$&amp;nbsp;&lt;span class="bpSymbol"&gt;+&lt;/span&gt;&amp;nbsp;WM_LBUTTONUP$&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;ETM_LBUTTONDBLCLK$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;ETM_MOUSEMSGOFFSET$&amp;nbsp;&lt;span class="bpSymbol"&gt;+&lt;/span&gt;&amp;nbsp;WM_LBUTTONDBLCLK$&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;ETM_MBUTTONDOWN$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;ETM_MOUSEMSGOFFSET$&amp;nbsp;&lt;span class="bpSymbol"&gt;+&lt;/span&gt;&amp;nbsp;WM_MBUTTONDOWN$&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;ETM_MBUTTONUP$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;ETM_MOUSEMSGOFFSET$&amp;nbsp;&lt;span class="bpSymbol"&gt;+&lt;/span&gt;&amp;nbsp;WM_MBUTTONUP$&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;ETM_MBUTTONDBLCLK$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;ETM_MOUSEMSGOFFSET$&amp;nbsp;&lt;span class="bpSymbol"&gt;+&lt;/span&gt;&amp;nbsp;WM_MBUTTONDBLCLK$&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;ETM_RBUTTONDOWN$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;ETM_MOUSEMSGOFFSET$&amp;nbsp;&lt;span class="bpSymbol"&gt;+&lt;/span&gt;&amp;nbsp;WM_RBUTTONDOWN$&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;ETM_RBUTTONUP$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;ETM_MOUSEMSGOFFSET$&amp;nbsp;&lt;span class="bpSymbol"&gt;+&lt;/span&gt;&amp;nbsp;WM_RBUTTONUP$&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;equ&lt;/span&gt;&amp;nbsp;ETM_RBUTTONDBLCLK$&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;to&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;(&lt;/span&gt;ETM_MOUSEMSGOFFSET$&amp;nbsp;&lt;span class="bpSymbol"&gt;+&lt;/span&gt;&amp;nbsp;WM_RBUTTONDBLCLK$&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpComment"&gt;*&amp;nbsp;//&amp;nbsp;To&amp;nbsp;trap&amp;nbsp;a&amp;nbsp;right&amp;nbsp;button&amp;nbsp;down&amp;nbsp;message:&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="bpKeyword"&gt;call&lt;/span&gt;&amp;nbsp;Send_Message&lt;span class="bpSymbol"&gt;(&lt;/span&gt;&amp;nbsp;&lt;span class="bpSysVar"&gt;@window&lt;/span&gt;&amp;nbsp;&lt;span class="bpSymbol"&gt;:&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;".TABLE_1"&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span class="bpString"&gt;"QUALIFY_EVENT"&lt;/span&gt;&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;ETM_RBUTTONDOWN$&lt;span class="bpSymbol"&gt;,&lt;/span&gt;&amp;nbsp;TRUE$&amp;nbsp;&lt;span class="bpSymbol"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-5361069522622604025?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/5361069522622604025/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/03/edittable-cookbook-trapping-mouse.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/5361069522622604025'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/5361069522622604025'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/03/edittable-cookbook-trapping-mouse.html' title='EditTable Cookbook - Trapping Mouse Messages'/><author><name>Captain C</name><uri>http://www.blogger.com/profile/11670880508839547673</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_4bqKz2bf81g/S5Snb292BNI/AAAAAAAAAAM/VaeT498dvMI/S220/Darth+C.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-7067718052027795115</id><published>2010-02-20T11:22:00.000Z</published><updated>2010-02-20T11:23:50.918Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Atrbt 3.12 2.12'/><title type='text'>A week in the life of a Revelation Consultant</title><content type='html'>I've just spent one of the most frustrating weeks of my life working on an AREV 2.12 to AREV 3.12 conversion prior to an OI Upgrade. The upgrade itself was relatively painless but the application itself then began to fail in mysterious ways - the worst of which was in a custom program designed to display grids of information. This program - checking in at nearly three thousand lines of code - just wouldn't display the current line in the grid correctly - everything was off by 4 bytes.&lt;br /&gt;&lt;br /&gt;Well as the object code hadn't changed it had to be something that had changed between AREV 2.12 and 3.12 right?&lt;br /&gt;&lt;br /&gt;So I started comparing @Variables between the two systems and found a few likely contenders - @CRTHIGH for example. But try as I might nothing worked. Finally as Friday evening approached a small light went off in my head. The program referenced @ATRBT and this doesn't actually compile in AREV 3.12...&lt;br /&gt;&lt;br /&gt;So all we had to do was load a non-existent variable with its old value and then everything would work... suffice to say this proved challenging to say the least but eventually I had a routine that loaded what @ATRBT used to be and lo and behold the recalcitrant program now worked.&lt;br /&gt;&lt;br /&gt;It's not very often that you have to know about the absolutely obscure aspects of system internals but when you do you're grateful for the knowledge.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-7067718052027795115?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/7067718052027795115/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/02/week-in-life-of-revelation-consultant.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/7067718052027795115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/7067718052027795115'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/02/week-in-life-of-revelation-consultant.html' title='A week in the life of a Revelation Consultant'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-3841582121407782897</id><published>2010-02-10T10:45:00.001Z</published><updated>2010-02-10T11:24:25.310Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='share'/><category scheme='http://www.blogger.com/atom/ns#' term='revparam'/><category scheme='http://www.blogger.com/atom/ns#' term='citrix'/><title type='text'>Installation Procedures for an OpenInsight Thin Client System</title><content type='html'>&lt;span style="font-style:italic;"&gt;From the Sprezz archives we dig out this venerable document as it still seems to have relevance to our customers in the marketplace today!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The new Universal Driver 3.0 from Revelation Software gives customers new methods of formatting and structuring the location of data files.&lt;br /&gt;&lt;br /&gt;One of these methods is the ability to run OpenInsight applications in a thin client model. For the purposes of this document, “thin client” means storing the repository files (or REVBOOT) on a local workstation while storing the datafiles on a remote server. This relies on the hiding files concept of the Universal Driver, and requires some initial configuration of the local system and the registry on the server the UD is installed on.&lt;br /&gt;&lt;br /&gt;This document will describe how to move a system from your local development system to a client’s site. During development, we will have everything stored in one path. For example, OpenInsight sits in the following directory path:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;S:\APPS\TABLET\OINSIGHT\RELEASE&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is the directory that contains the OINSIGHT.EXE, which we’ll refer&lt;br /&gt;to as REVBOOT. Underneath, we have all of our data volumes, stored in&lt;br /&gt;the DATA volume.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;S:\APPS\TABLET\OINSIGHT\RELEASE\DATA\CUSTS&lt;br /&gt;S:\APPS\TABLET\OINSIGHT\RELEASE\DATA\PRODS&lt;br /&gt;S:\APPS\TABLET\OINSIGHT\RELEASE\DATA\INVS&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;When the application gets installed at the client site, the client will install&lt;br /&gt;this in two sections, on the client’s server, which we’ll call SVR1PHL, the entire application will be installed on the D:\WINAPPS\3RDPTY directory. (Installing the entire application allows for server side maintenance of the data, but is&lt;br /&gt;optional.) This means that we’ll have paths like &lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;D:\WINAPPS\3RDPTY&lt;br /&gt;D:\WINAPPS\3RDPTY\DATA\CUSTS&lt;br /&gt;D:\WINAPPS\3RDPTY\DATA\PRODS&lt;br /&gt;D:\WINAPPS\3RDPTY\DATA\INVS&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;On each workstation, the user only needs a REVBOOT directory and single directory called DATA. Following standard Windows™ conventions for program installation, our client workstation would probably have installed this section as &lt;span style="font-weight:bold;"&gt;C:\Program Files\My Company\TabletApp&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Everything up to this point gets installed and placed as would be expected. The data is on the server, the programs and windows are stored on the local workstation. What we need to do now is tell the workstation how to find the files.&lt;br /&gt;&lt;br /&gt;There’s a new attribute of the REVPARAM file which allows the definition of a share name to store data. This attribute is called ShareName. This is used in conjunction with the ServerName attribute. What we need to do is create a DATA subdirectory underneath the REVBOOT of our workstation copy. This gives us&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;C:\Program Files\My Company\TabletApp\Data&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In that subdirectory, we put in a single file, REVPARAM, with the following entries:&lt;br /&gt;&lt;br /&gt;TcpIpPort = 777&lt;br /&gt;ServerOnly = 1&lt;br /&gt;ServerName = SVR1PHL&lt;br /&gt;ShareName = DATA&lt;br /&gt;&lt;br /&gt;Because of the path tree method of the UD driver, when we go to access any LH volume in this directory (or lower), the driver will find the REVPARAM and use that for instructions.&lt;br /&gt;&lt;br /&gt;The UD driver finds the paired attributes ServerName and ShareName and determines that whenever the user wants anything from the DATA volume, it needs to go to the SVR1PHL server to get the files. This means if the user looks for DATA\PRODS, the UD driver will query the SVR1PHL server for the DATA\PRODS directory and use that as it’s file store.&lt;br /&gt;&lt;br /&gt;We also need to tell the server how to find this data, and for this, we need to make some additional modifications on the server. The first step is to go into the server’s registry and create some additional keys. Go to the registry location for the Universal Driver settings, which is &lt;br /&gt;&lt;br /&gt;HKEY_LOCAL_MACHINE\SOFTWARE\RevSoft\Revelation Universal Driver\3.0. &lt;br /&gt;&lt;br /&gt;Underneath this location, we need to create a new subkey called “shares”. This gives us&lt;br /&gt;&lt;br /&gt;HKEY_LOCAL_MACHINE\SOFTWARE\RevSoft\Revelation Universal Driver\3.0\Shares.&lt;br /&gt;&lt;br /&gt;Inside this section, we need to create a new string value called DATA, with&lt;br /&gt;a value of D:\WINAPPS\3RDPTY\DATA.&lt;br /&gt;&lt;br /&gt;This tells the LH Service that when it gets a request for the volume named DATA to start at this location. Because this also cascades down the directory tree, if the LH service gets a request for the DATA\CUSTS directory, it will look for the files in&lt;span style="font-weight:bold;"&gt; D:\WINAPPS\3RDPTY\DATA\CUSTS.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;There’s one more step, and that’s the creation of an additional REVPARAM file, this time in the&lt;span style="font-weight:bold;"&gt; D:\WINAPPS\3RDPTY\DATA&lt;/span&gt; directory. This REVPARAM file contains the following:&lt;br /&gt;&lt;br /&gt;TcpIpPort = 777&lt;br /&gt;ServerOnly = 1&lt;br /&gt;&lt;br /&gt;No other REVPARAM file is needed on the server.&lt;br /&gt;&lt;br /&gt;That’s all that’s needed to find and run OpenInsight in a thin client mode.&lt;br /&gt;&lt;br /&gt;How did this all work? This is possible through the initial REVPARAM created on the workstation. As far as the local workstation is concerned, all the data files are stored in directories below REVBOOT. As this tree is traversed, the UD Driver comes upon a REVPARAM file. In this REVPARAM file, there are the ServerName and ShareName attributes. This tells the UD driver that there’s no point in trying to find the files at this location, but to send a message to ServerName and ask for the data in ShareName. When ServerName receives the request, it queries its registry for a ShareName matching ShareName, and finishes the directory traversal from that point.&lt;br /&gt;&lt;br /&gt;By extension, using the volumes we defined above, we could have on the workstation, the following:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;C:\Program Files\My Company\TabletApp\Data\CUSTS&lt;br /&gt;C:\Program Files\My Company\TabletApp\Data\PRODS&lt;br /&gt;C:\Program Files\My Company\TabletApp\Data\INVS&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Each of these folders could have a revparam pointing to a share on different servers. This would allow the CUSTS volume to exist on SVR1PHL, the PRODS volume to exist on SVR2PHL and the INVS volume to exist on SVR1NHMP.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-3841582121407782897?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/3841582121407782897/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/02/installation-procedures-for-openinsight.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/3841582121407782897'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/3841582121407782897'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/02/installation-procedures-for-openinsight.html' title='Installation Procedures for an OpenInsight Thin Client System'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-8736196157028555630</id><published>2010-02-09T11:14:00.001Z</published><updated>2010-02-09T11:15:59.431Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='registry'/><category scheme='http://www.blogger.com/atom/ns#' term='nsis'/><category scheme='http://www.blogger.com/atom/ns#' term='mashup'/><title type='text'>Sometimes it's good to be reminded...</title><content type='html'>of just how productive you can be using Revelation's tool set.&lt;br /&gt;&lt;br /&gt;Last week I spent a day on client's site as he had some issues of stability that he wished to resolve. We spent the morning going through these then, as afternoon approached, he asked "OK can you knock me up a copy protected installation routine for me to ship my product with?".&lt;br /&gt;&lt;br /&gt;Here's where a Revelation/Open Source Community mashup really comes into its own.&lt;br /&gt;&lt;br /&gt;Firstly download &lt;a href="http://nsis.sourceforge.net/Main_Page"&gt;NSIS &lt;/a&gt;- we have the engine to create a full SETUP.EXE.&lt;br /&gt;&lt;br /&gt;Next take the &lt;a href="http://isupport.srpcs.com/Downloads/SRP_NSIS_Utilities_Install.exe"&gt;excellent NSIS installation script&lt;/a&gt; provided at one of the conferences by our friends at &lt;a href="http://www.srpcs.com"&gt;SRP&lt;/a&gt; and spend 5 minutes customising it - we have the working OI Installation routine.&lt;br /&gt;&lt;br /&gt;Next install Sprezzatura's registry method handling routines &lt;a href="http://www.sprezzatura.com/blog/registry_methods.zip"&gt;registry_methods.zip&lt;/a&gt; - we have the wherewithal to copy protect the application by embedding encrypted registry keys.&lt;br /&gt;&lt;br /&gt;Finally write a new front end screen for the application that compares the Windows computer name (using the GetComputerName declaration in DLL_KERNEL32) to an encrypted version thereof in the registry and if found launches the app, if not launches a newly written registration screen. Have the registration screen display an encrypted string to read to the client's tech support line to receive back an unlock code which permits the stamping of the registry. We have the solution.&lt;br /&gt;&lt;br /&gt;Now we're not claiming this is bullet proof (bullet proof we can do but it'd take longer) but it's one heck of a lot of return for 4 hours of invested time!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-8736196157028555630?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/8736196157028555630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2010/02/sometimes-its-good-to-be-reminded.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/8736196157028555630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/8736196157028555630'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2010/02/sometimes-its-good-to-be-reminded.html' title='Sometimes it&apos;s good to be reminded...'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-334612568581727040</id><published>2009-12-18T12:23:00.002Z</published><updated>2009-12-18T12:24:56.508Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='bang file'/><category scheme='http://www.blogger.com/atom/ns#' term='bang code'/><category scheme='http://www.blogger.com/atom/ns#' term='index'/><category scheme='http://www.blogger.com/atom/ns#' term='transaction'/><title type='text'>Indexing in Opensight Part 2 - How index transactions get created</title><content type='html'>In the last article we provided a generic overview of how indexing works. In this article we look at how the index transactions get into the bang table, and in the soon to be published followup article we look at how they get moved from being transaction rows to actually being meaningful data in the indexes.&lt;br /&gt;&lt;br /&gt;Index transactions are created by a modified filing system called SI.MFS – the Secondary Indexing MFS. The following description assumes that this is the first time that an index has been added to a table.&lt;br /&gt;&lt;br /&gt;When the developer adds an index to a column, SI.MFS is added to the table to ensure that the index transactions are created. The actual mechanism by which this happens is that a flag is set in the dictionary row for the column indicating what kind of index is being created along with its case sensitivity. The MFS responsible for looking after dictionaries, DICT.MFS, sees this flag and calls MAKE.INDEX to ensure that SI.MFS is added to the table. In addition it creates the ! table and populates the initial control information describing the index structures.&lt;br /&gt;&lt;br /&gt;The workhorse in the creation of the index transactions is a program stored in the ! file with a row id of ! – generally referred to as the bang code in the bang file/table. This  program code is structured as a symbolic dictionary item – so the object code is on attribute 8 of the row. The code itself looks at the row being written and compares it to the row on disk. If indexed columns have changed then it generates index transaction rows and puts them into the ! table.&lt;br /&gt;&lt;br /&gt;We can find out a lot about how this ! code works by looking at the source code for it and fortunately for us Revelation have made it very easy for us to examine it. Under normal circumstances the ! code is generated and compiled and written away without preserving the source code BUT if we as developers create a blank row with an id of !! in the ! table, the system will see this as an instruction to preserve the source code in the !! row. So if you wanted to examine specific ! code you would just take the following simple steps&lt;br /&gt;&lt;br /&gt;•    Delete the ! code from the ! table&lt;br /&gt;•    Create a blank row with an id of !! in the ! table&lt;br /&gt;•    Reattach the ! table&lt;br /&gt;•    Edit the data table&lt;br /&gt;&lt;br /&gt;These steps will leave the source code for the ! row in row !!.&lt;br /&gt;&lt;br /&gt;We generated some sample code ourselves and used it to create the following flowchart which explains the process in detail :-&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.sprezzatura.com/sandbox/uploaded_images/bangCode-721955.png"&gt;&lt;img style="cursor: pointer; width: 273px; height: 400px;" src="http://www.sprezzatura.com/sandbox/uploaded_images/bangCode-721952.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So explaining this flow chart in English...&lt;br /&gt;&lt;br /&gt;Assuming the table is indexed, when the write occurs, SI.MFS is called with a WRITE opcode.&lt;br /&gt;&lt;br /&gt;Now normally MFSs just do what they need to then call the next MFS in sequence. This carries on until the operation has been executed by the Base Filing System (BFS) and then the chain is reversed out of. SI.MFS doesn’t work this way. It doesn’t actually do the updating of the index transaction rows itself – rather is calls the ! code we discussed earlier. As it’s stored as a dictionary item it can’t call it directly – rather it invokes it using CALCULATEX – the system function for resolving a dictionary item.&lt;br /&gt;&lt;br /&gt;The ! code looks to see what it has been asked to do and if it has been asked to do an update it compares the old values with the new values to see what has changed. Normally it’ll try and use a cached copy of the old record but if it isn’t there it’ll reread the row.  If it determines that index updates are required, the code reads the 0 row in the ! table and appends the newly generated transactions to this row.&lt;br /&gt;&lt;br /&gt;If this forces the length of row 0 over 2000 bytes then it creates a row called XTRANS and writes this out to the ! table. It then grabs the next free transaction row number from the row 0 header and writes out the new transaction row to that number. Finally it updates the row 0 with the new number blanking down the transactions that were there and it deletes the XTRANS row.&lt;br /&gt;&lt;br /&gt;If the row 0 isn’t over 2000 characters the new transactions are simply written back to row 0&lt;br /&gt;Finally the ! code attempts to update the relational indexes if any are present by invoking RELATER.&lt;br /&gt;&lt;br /&gt;Note that on the flowchart above I've marked a few elements in red. These are areas where it would seem that the index code could be optimised for performance reasons.&lt;br /&gt;&lt;br /&gt;When updating a row in which there had been index changes you would expect there to be a read of row 0, a write of row 0 and possibly the creation of a new index transaction row. In fact what seems to be happening is that the 2/3 i/os occur but in addition if Row 0 exceeds 2000 bytes in length then an XTRANS row is created, written then deleted, thereby potentially doubling the disk i/o required for the update. This could have significant performance implications on mass updates.&lt;br /&gt;&lt;br /&gt;In addition even if the Relational Index updates correctly the index transactions are still left if the ! file to be reprocessed at a later date. This seems like a waste of resource.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-334612568581727040?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/334612568581727040/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2009/12/indexing-in-opensight-part-2-how-index.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/334612568581727040'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/334612568581727040'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2009/12/indexing-in-opensight-part-2-how-index.html' title='Indexing in Opensight Part 2 - How index transactions get created'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-1222504061750518109</id><published>2009-11-05T12:04:00.000Z</published><updated>2009-11-05T12:05:51.713Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='index'/><category scheme='http://www.blogger.com/atom/ns#' term='xref'/><category scheme='http://www.blogger.com/atom/ns#' term='relational'/><category scheme='http://www.blogger.com/atom/ns#' term='btree'/><category scheme='http://www.blogger.com/atom/ns#' term='cross reference'/><title type='text'>Indexing in OpenInsight – Part 1 – What is indexing?</title><content type='html'>A discussion on the Revelation Forum reminded us that we haven’t reviewed our public documentation of how Revelation indexing works in over 20 years. Whilst the RevMedia article on our website remains largely accurate we thought that this provided an excellent opportunity for us to revisit the subject with our improved understanding.&lt;br /&gt;&lt;br /&gt;The first question to ask is “what is an index in OpenInsight”?&lt;br /&gt;&lt;br /&gt;Well to answer this strictly we’d have to distinguish between Btree/Xref indexes and Relational indexes as they both are very different in structure. A Relational index by its very nature is just an inverted index (&lt;a href="http://en.wikipedia.org/wiki/Inverted_index"&gt;http://en.wikipedia.org/wiki/Inverted_index&lt;/a&gt;) and so it easy to maintain – a read of the inverted row, an insertion and a write of the inverted row. A Btree/Xref on the other hand (the two being identical in index structure, the difference being that an Xref is a Btree on sub strings of a column as opposed to a Btree on the entire column) requires a lot more maintenance. For details of how BTree indexes work see&lt;a href="http://en.wikipedia.org/wiki/B-tree"&gt; http://en.wikipedia.org/wiki/B-tree&lt;/a&gt;. The insertion of a new or revised entry into a Btree index could generate a large amount of disk i/o as the tree is rebalanced and the operation is a costly one in resource terms.&lt;br /&gt;&lt;br /&gt;When Revelation’s indexing was first introduced, hardware was a lot slower than it is today. When saving a single row it used to be possible to see the disk latency. You’d hit the save key then wait whilst the disk was updated. This was made acceptable in a data entry environment by adding a keyboard type ahead buffer (one of the reasons that Revelation used to ship with a utility to extend the keyboard typeahead buffer from the default 16 to the humungous 256 bytes required by touch typers). However forcing the user to wait whilst the BTree indexes associated with the table were updated would have introduced a completely unacceptable lag.&lt;br /&gt;&lt;br /&gt;So the architects of Revelation came up with the idea of not updating the indexes at the point of saving. Rather the fact that the indexes needed to be updated was recorded in a series of transactions rows in what came to be known as the “Bang table” (the separate table named after the source table but prefixed with an exclamation mark) and these were either flushed by idle workstations or by any operations which required the indexes to be up to date. This way the resource intensive balancing operation was pushed off onto non data entry personnel and throughput was maintained.&lt;br /&gt;&lt;br /&gt;In our next article we'll look at the way that index transactions get to be in the bang table in the first place.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-1222504061750518109?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/1222504061750518109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2009/11/indexing-in-openinsight-part-1-what-is.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/1222504061750518109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/1222504061750518109'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2009/11/indexing-in-openinsight-part-1-what-is.html' title='Indexing in OpenInsight – Part 1 – What is indexing?'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-6052035867737631510</id><published>2009-10-22T11:51:00.001+01:00</published><updated>2009-10-22T11:52:06.898+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ZZ_IDE_BP_PUBLISHER'/><category scheme='http://www.blogger.com/atom/ns#' term='Basic+'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenInsight'/><category scheme='http://www.blogger.com/atom/ns#' term='freeware'/><title type='text'>Blogging Basic+ - Version 1.7.0 update</title><content type='html'>Here's another update for those of you using our &lt;a href="http://www.sprezzatura.com/blog/2009/03/blogging-basic.html"&gt;Basic+ Source code publisher&lt;/a&gt;. This time I had a bit of a major rewrite to the HTML generator to handle the crazy 4K chunk HTML parsing in the Revelation Forum Domino server.  &lt;br /&gt;&lt;br /&gt;Originally I had wanted to keep the generated HTML for this blog and the forum pretty much the same, but alas that wasn't to be, so I had to drop back to "pre" tags again for the forum, and keep the "div" tags for here.&lt;br /&gt;&lt;br /&gt;Thanks to Jared at Revelation for his help in tracking down the weirdness.&lt;br /&gt;&lt;br /&gt;You can download version 1.7.0 from &lt;a href="http://www.sprezzatura.com/downloads/products/zz_ide_bp_publisher/zz_IDE_BP_Publisher [ALL].Obj.v1.7.0.zip"&gt;here&lt;/a&gt; in standard RDK format or &lt;a href="http://www.sprezzatura.com/downloads/products/zz_ide_bp_publisher/zz_IDE_BP_Publisher [ALL].Obj.v1.7.0.exe"&gt;here&lt;/a&gt; as an NSIS installer version.&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-6052035867737631510?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/6052035867737631510/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2009/10/blogging-basic-version-170-update.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/6052035867737631510'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/6052035867737631510'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2009/10/blogging-basic-version-170-update.html' title='Blogging Basic+ - Version 1.7.0 update'/><author><name>Captain C</name><uri>http://www.blogger.com/profile/11670880508839547673</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_4bqKz2bf81g/S5Snb292BNI/AAAAAAAAAAM/VaeT498dvMI/S220/Darth+C.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-1880199984383199418</id><published>2009-10-08T17:53:00.002+01:00</published><updated>2009-10-22T13:36:04.213+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='XP Mode'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows 7'/><category scheme='http://www.blogger.com/atom/ns#' term='Virtual PC'/><title type='text'>Windows 7</title><content type='html'>Well we've been running with Windows 7 on a couple of our laptops for a few weeks now and we like it! The ability to launch a program by typing just a few letters of its name is brilliant... the only downer was not being able to run AREV at all anymore - oh yes, and the fact that as of the time of writing OpenInsight 9.1 completely hangs - I mean COMPLETELY hangs Windows 7 64 bit.&lt;br /&gt;&lt;br /&gt;Note I said "was" because today we installed Virtual PC for Windows 7 along with XP Mode and huzzah - we have an environment where we can actually work with AREV and OI! You can read all about it &lt;a href="http://www.microsoft.com/windows/virtual-pc/"&gt;here.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The only thing to point out is that once you enabled virtualization in your BIOS you have to do a cold reboot - turn the machine completely off. Easily overlooked and potentially frustrating.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;[Edit] - The hanging issue is fixed for OI 9.1.1&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2607884204445547877-1880199984383199418?l=sprezzblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sprezzblog.blogspot.com/feeds/1880199984383199418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sprezzblog.blogspot.com/2009/10/windows-7.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/1880199984383199418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2607884204445547877/posts/default/1880199984383199418'/><link rel='alternate' type='text/html' href='http://sprezzblog.blogspot.com/2009/10/windows-7.html' title='Windows 7'/><author><name>Sprezz</name><uri>http://www.blogger.com/profile/08866141305592910267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2607884204445547877.post-3164966040672404337</id><published>2009-10-08T14:00:00.001+01:00</published><updated>2009-10-08T14:12:01.253+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EditTable'/><category scheme='http://www.b
