From Sprezz Towers

Notes from the workshop.

Technical discoveries, field notes, unlikely bugs and the occasional opinion.

Indexing in Opensight Part 2 - How index transactions get created

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. 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. 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 ! tabl...

Read article →

Indexing in OpenInsight – Part 1 – What is indexing?

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. The first question to ask is “what is an index in OpenInsight”? 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 ( http://en.wikipedia.org/wiki/Inverted_index ) 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 detail...

Read article →

Blogging Basic+ - Version 1.7.0 update

Here's another update for those of you using our Basic+ Source code publisher . 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. 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. Thanks to Jared at Revelation for his help in tracking down the weirdness. You can download version 1.7.0 from here in standard RDK format or here as an NSIS installer version.

Read article →

Windows 7

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. 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 here. 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. [Edit] - The hanging issue is fixed for OI 9.1.1

Read article → 4 comments

EditTable CookBook - Preventing row deletion

A common requirement when dealing with EditTables is to prevent a user from deleting a row on a case by case basis at runtime. In many applications we've seen this implemented by trapping the standard DELETEROW event and then sending an INSERT message with the deleted row contents, but this looks messy and unprofessional because the data disappears and reappears again. A better way to do this is to trap the low-level ETM_DELETEROW notification sent by the EditTable prior to the actual DELETEROW event occuring. However, this notification has to be handled in a synchronous fashion (via a WINMSG event), and we also have to tell OpenInsight to return a special value from its own low-level internal message handler so that the EditTable stops the deletion (This last requirement is why the event has to be handled synchronously, because we need to return a value at the point in time that the message is sent). We do this in two stages: First we tell OpenInsight to trap the WINMSG event for...

Read article →

EditTable CookBook - The MOVE_ROW message

Still on the topic of undocumented EditTable features here's the details of the MOVE_ROW message that you can use to move a row within an EditTable. The nice thing about this message is that it takes all the colour, style and formatting information when the row is moved, which makes it easier to use than deleting and inserting the row "manually" yourself. MOVE_ROW message Description Moves a row in a control Applies To Edit Table Syntax x = Send_Message( controlID , "MOVE_ROW", fromIndex , toIndex ) Parameters fromIndex   Position of the row to move toIndex   Position to move the row to. Specify -1 to move the row to the end of the Edit Table. Returns New position of the row E.g. 0001       * // EditTable MOVE_ROW message example to move the 0002       * // row at position 2 to position 4 0003       0004 ...

Read article →

EditTable CookBook - Setting TEXT_BY_POS

As documented the TEXT_BY_POS message may be used to retrieve the contents of a nominated cell. What is not documented is the fact that you can use it to update the contents of a cell as well. It's simply a matter of adding an extra parameter containing the data you wish to set. E.g. 0001       * // Example to show setting cell contents with the 0002       * // TEXT_BY_POS message. 0003       0004       * // Set the contents of cell [3,4] 0005      colNo     =   3 0006      rowNo     =   4 0007      cellText  =   "New Cell Data" 0008       0009       call  send_Message (   @window   : ...

Read article →

EditTable CookBook - The CHANGED event and NOTIFYPOS

While recently adding a new window into our internal admin system we ran into a subtle problem with the CHANGED event and the NOTIFYPOS property. NOTIFYPOS is an EditTable property that is always updated to contain the coordinates of the last cell to raise an event, but this is not restricted to the CHANGED event: Any EditTable event that is cell-oriented will also update NOTIFYPOS when triggered, common examples being DBLCLK and POSCHANGED. In our case the sequence of events ran like so: The user edited data in a cell and hit the down arrow to move to the cell beneath. The EditTable registered that the data had changed and set NOTIFYPOS to the edited cell position. The EditTable raised a CHANGED event. The EditTable registered that the cell position had changed and set NOTIFYPOS to the position of the 'new' cell. The EditTable raised a POSCHANGED event. The Basic+ event handler for the CHANGED event executed - but now NOTIFYPOS was pointing to the 'new' cell, not the e...

Read article →

Blogging Basic+ - Version 1.5.1 update

For any of you using our Basic+ Source code publisher we've now got an update to correct a Notes parsing issue when creating content for the Revelation Forum. You can download version 1.5.1 from here in standard RDK format or here as an NSIS installer version.

Read article →

EditTable Cookbook - How to get cell coordinates

Many of the applications we write need to display things like option dialog boxes near a specific control. In most cases this is quite easy to handle as we can easily obtain the SIZE property of a control and work out our positioning from that. A slightly more difficult task is to position something relative to an EditTable cell because OpenInsight doesn't expose this information as a property or a method. We've seen many attempts to calculate cell coordinates in Basic+ - we've even done it a few times ourselves and it's quite a pain, having to take into account all the different styles of the edit table, the width of columns, which columns are hidden and so forth. Well, there's a really easy way to do this, and that's by asking the EditTable itself what the coordinates are via the standard Windows API SendMessage function. We just need to know what message to send to the EditTable. DTM_READCELLRECT The message we need is called DTM_READCELLRECT, and it return...

Read article →

DLL Prototyping - The LockVariable statement

Whenever we have to deal with raw pointers in Basic+, as we did recently, we frequently end up using the GetPointer function. The documentation for GetPointer states that you should always use the LockVariable statement to "lock the string" before retrieving the pointer, but what does that actually mean? In the beginning... OpenInsight was originally designed as a 16-bit application running on a 16-bit platform (Windows 3.x), and that platform had a habit of moving chunks of memory around for performance reasons which meant that direct pointers to the memory could be made invalid unless certain steps were taken to guard against this. So that pointers could be used safely in a Windows 3.x, program memory was tracked by handles instead, and when we wanted a pointer we "locked" the memory via it's handle and got a pointer to it which we could then use, because Windows promised not to pull the bytes out from under our feet. This is essentially what the Basic+ Lock...

Read article →

DLL Prototyping - Strings And Things Part 3

Welcome to part 3 of the "Strings and Things" series on OpenInsight DLL prototyping. So far we've covered the theory of how Windows defines functions that use ANSI and Unicode versions (in Part 1 ), and we've also looked at the standard way of calling those functions from Basic+ (in Part 2 ). This time we're going to look at another way of passing string data to a Windows API function, but we'll show you how to handle the entire process yourself, and afterwards we'll look at why this is sometimes necessary. (Note: This article assumes you are familiar with the basics of DLL prototyping in OpenInsight. If not please consult the OpenInsight on-line help for more details) Passing Basic+ variables as string parameters - The Long Way Round Previously we looked at a method whereby OpenInsight took care of all the low-level details for you when passing string parameters, but you do have the option to handle this process yourself via the following steps: Prototyp...

Read article →