Goya Blog

BaseElements 3 beta 4

I've just finishing uploading BaseElements 3 beta 4 :

BaseElements_Mac.dmg - fp7 files.
BaseElements_Mac_Runtime.dmg - Runtime.

BaseElements_Win.zip - fp7 files.
BaseElements_Win_Runtime.zip - Runtime.

There is a windows as well as a mac version, and the fp7 version now has sharing enabled for all accounts. The full list of changes is :

  • More plugin error checking and reporting.
  • Fixed an issue where odbc Data Sources weren't being imported.
  • Fixed a false error in OSBC usernames and passwords - thanks Doug Rowe.
  • Fixed a superfluous warning in Layout Fields.
  • Added a dialog about running on PowerPC on Mac.
  • Changed the display of the BaseElements wording on layouts to display properly in FileMaker Go.
  • Built in a Minimum Required FMP version for calculations and script steps.
  • Changed the licencing so that the single user version can be shared with FileMaker Server to a single user.
  • Added more display checkboxes for layout objects to show printing, sliding etc.
  • Added a portal filter calculation portal to the Object layout.
  • Began work on a FileMaker Go Compatability Report.
  • Some plugin fixes and enhancements.

There is a lot in there, so I'll write some more about it in the next day or so, but it's now late here and it's time for dinner :)

One quick note, if you're using it on windows it will only load xml from a local path, not from network drives. ( You can map the path to a network drive and it will work fine. ) This is something in the way that the file paths are handled inside libxslt, and I haven't yet got a solution to that one.

Updated FileMaker New Features for Version 11

Yesterday I updated my list of new FileMaker features for version 11. The list I maintain doesn't include everything (like the new Quick Start Screen, or text highlighting), but includes all of the items that affect our ability to program in FileMaker. So things like new script steps or changes to calculations.

The reason for doing this yesterday was that I was building into BaseElements the ability to recognise which calculation functions and script steps came from which versions of FileMaker. Using this list you can then say that to open this file, you need to use at least a minimum of FMP version X. There is a little more to do in BaseElements though to make it comprehensive, like extra features within certain script steps or layout features like web viewers or filtered portals. However, the functions area is more technical and is built into the XSLT in BaseElements, so I wanted to get that coding done first.

But I stumbled across an interesting bug I'd never noticed before in the FileMaker DDR. To test the various functions, including the Get functions, I built a file with a single calculation that included every possible built in function. Then I ran the DDR for this file and had a look at the details. To understand how the DDR works, when you have a long calculation, FileMaker breaks it into chunks. There are chunks for Fields, Custom Functions, Functions and everything else is a "NoRef" chunk (in other words text).

All of the built in FileMaker functions were reported, correctly, as "FunctionRef" nodes. I had thought that the most likely answer for the collection of the "Get" functions, was that the Get part would be a FunctionRef and the rest would be NoRef. Because in reality, the parameter you pass to the Get function is just a reserved word and the actual function is called simply "Get". I was hoping that it might distinguish the reserved words in some way so I could figure out which ones it used, but I wasn't sure what it would do.

It turns out in FMP 10, and I presume earlier versions, FileMaker reports some of the parameters as "FunctionRef" chunks and ignores some of them, so they end up in the text along with the round brackets and any whitespace and also anything that follows the function. I wasn't sure what the logic for this was, there didn't seem to be any consistency to it. And even stranger it reported one Get reserved word as a Custom Function.

I was all set to report a bug to FMI when I realised I had generated the DDR with FMP 10 and realised I should run the same test with 11. Well in 11, every Get reserved word is reported as a FunctionRef, so I can accurately report on them in BaseElements. So no bug report is in order.

What this does mean is that there could also be other differences and inaccuracies with the DDR in older versions that are fixed in 11, and I'd suggest that if you're running any tool like BaseElements where you utilise the DDR that you should run it from version 11, just to be sure.

I do have a big feature request for the DDR though : That it broke the calculation into more discreet chunks. For example, plugin functions are reported as "FunctionRef" along side every built in function, it would be great to have a "PluginRef" type by itself. Comments and quoted text aren't put into anything separate, it would be handy to have them put into a "TextRef" or CommentRef section. And technically the Get function types aren't really functions, they're reserved words, so a "ReservedWordRef" would be nice. Maybe in v12 :)

BaseElements 3 Hardware and Software Requirements

A few people have asked me about which versions of their OS will BE3 run under. There is a little detail, so I'll include it all here with some explanations and put the specifics into the FAQ section.

Firstly, BE3 is designed for FMP 11 and will close if you attempt to open it under earlier copies of FileMaker Pro. We tend to update BaseElements for the latest features in the OS each time so that we can build on the new capabilities. We realise that not everyone will have the latest version straight away, but runtimes are available that mean you don't need to have the latest FMP to have the latest BE version.

So the general requirements for BaseElements are the same as the requirements for FMP 11.

I have tested BaseElements 3 on the iPad via FileMaker Go and it does load and work. There are some font issues that need to be worked around, and also some issues with the fact that plugins are not available. I'd like to think we could get a version of BaseElements that works, minus importing and translated dialogs for the iPad very soon. We may have a few issues with displaying of data and missing toolbars and menus, but they can also be resolved relatively simply.

I don't think it's feasible to run BE on an iPhone, although it would work the layouts are not designed for that, and it would be a lot of work to design more iPhone friendly layouts. I'm not going to do anything to prevent this, I just won't be working towards an iPhone version I don't think.

BaseElements Plugin Requirements

Plus we have a new plugin in BaseElements that has it's own separate requirements. The basic requirements are the same as for FMP 11 with some additional caveats :

The plugin is currently intel only. It's a non-trivial amount of work to get a PPC version up and running, and given the open source libraries we've used, there is additional work to convert those. Considering Apple last shipped a PPC Mac nearly 4 years ago, I would expect the number of users that this affects to be small and shrinking. That said, we are open sourcing the plugin and will consider a PPC version if there is demand for one.

The plugin should work as far back as FMP 8.5 at least. Initially we're not testing this far back ourselves, as BE requires FMP 11 anyway, so any other testing we do will come later.

We've been testing on Win XP and Win 7, but not Vista, even though Vista is a supported OS for FMP 11. There isn't though anything to suggest it won't run on Vista.

At present it's a client side only plugin, so can't be installed on FMS. This is definitely something we're looking to do in a future version although it may not make it for 3.0.0. I'd like to have a server side import process working in BE3.

Citrix and TS should work fine, although we haven't tested. If you have any feedback about this or can report success or failure, we'd love to know about it. We will have more options for plugin feedback once the open source code is released.

BaseElements on the iPad

I haven't seen a notice yet about this on FileMaker's site, but I found FileMaker Go for iPhone and iPad in the iTunes store this morning. And what else do I do but test BaseElements 3 on it. First impressions are that it looks good.

IMG_0005.jpg

There are some font issues and some other formatting strangeness, but it does load and I can click around on things. I did also get some dialogs to display which looked neat.

More to the point though is what we can do with this for clients and remote access to solutions. There is a lot to like, even if this is just the beginning. There is going to be a bit to catch up on about the differences between a full FMP app and the iPhone/iPad app, I'm looking forward to that. I've already got staff saying they need an iPad for testing now :)

Way to make things slow Nick...

Who would have thought, recursive XSLT is not only hard to program and make sense of, it's also awful slow.

If you had a play with BaseElements 3 beta 2 in the last few days, grab a copy of b3 today, it's much faster :)

BaseElements_Mac.dmg - fp7 files.
BaseElements_Mac_MU.dmg - Sharing enabled version.
BaseElements_Mac_Runtime.dmg - Runtime.

I've addressed some of the of the processing of filenames which gets me one step closer to a windows release as well.

The only issue to be aware of in this build is that variables used in Calculations aren't being referenced yet. I'm working on some non-recursive xslt instead to make that faster. Also I fixed an issue in calculations where you'd get an error when there was an empty calculation - thanks Doug Rowe for reporting that.

Thanks to all those who sent me notes about their times with b2, if you've got the patience to re-run this now with b3, and compare it to 2.6.7, that would be great. Send any details to

BaseElements 3 Beta 2

I've uploaded another beta version of BaseElements 3. I was hoping to have a windows build available as well this time, but it's not to be. There are a whole bunch of path related issues inside the xslt that are causing me grief so I've got to sort out those before it's ready for prime time. In the mean time for those on the mac :

BaseElements 3 Beta 2

Changes since b1

  • Fixed display issues on the Variables and File layouts - thanks Steve Wright.
  • Fixed an issues with File References used on the right side of Relationships.
  • Fixed an issue where processing of items wasn't always happening.
  • Fixed an issue where the right field in Join Predicates was missing.
  • Fixed an issue where quotes in comments would cause problems - thanks Doug Rowe.
  • Fixed a bunch of issues related to the processing of files and file paths.
  • Sorted out some privilege related issues that stopped you doing reports and importing more than one DDR - thanks Gordon Cox and others :)
  • Added some processing for TO Groups back in.

The links you need are :

BaseElements_Mac.dmg - fp7 files.
BaseElements_Mac_MU.dmg - Sharing enabled version.
BaseElements_Mac_Runtime.dmg - Runtime.

Also this has the xslt code built in for the plugins and variables although only variables is working at the moment. This means I'm not adding any more processing steps to the import steps. This is as detailed as it's going to be. I'd love to hear from you about any speed differences between this version and the same DDR under BaseElements 2.x as I don't expect it to change much at all between now and final.

As always send me any feedback or issues you find : or on twitter or our contact form.

I've got slow loops.

In my last blog post, I included a screenshot of some code from BaseElements 2. I'm always nervous exposing my code to the outside world, as there's a good chance that someone smarter than yourself will take a look and point out your weaknesses. Well, Daniel Wood from filemakerweetbix sent me a note to tell me I've been using slow looping methods in that code.

Basically I'm taking the list of variables and working through them one at a time. Each time I process the first one in the list, and then chop the list by doing a RightValues ( list, listlength -1 ). It's not the fastest method of looping and Daniel has a very good explanation of why and the various alternatives in a post on his blog, Thinking Outside the Loop. Well worth reading if you're interested in optimisations.

Looking back at my old code, I'm not sure what the reason for that looping style was, that particular bit of code was written about 2 years ago, and rarely touched since. I guess that means we should all publicise our code more often, and hope more smart people take an interest.

BaseElements has a new XSLT engine. Part 2 - Smarter XSLT.

Following on from part 1.

The second big change to the XSLT engine in BaseElements 3 is that we consolidated a lot of areas in the system. All of the old field, Custom Function, TO, ValueList, Variable and Plugin reference tables were all joined into a single "References" table. Although having one base table instead of 5 doesn't make things much faster inside BE, it meant we were able to do a single xslt run instead of five.

For example we're traversing the entire XML tree to find all the calculations. We do this again to find all of the references within the calculations. But if you imagine that a calculation can reference fields, CFs, TOs, variables and plugins, then repeating that traversal five times for each one is time consuming. So by putting the references into a single table we can do that just once.

But that's not all, we've brought into the xslt code some work that was previously being done as processing steps in BaseElements. If you've watched a BaseElements import, you will have seen some steps where it mentions "Processing Calculations". This was doing a few things : Digesting the calculation steps and producing plugin references and variable items, and also sorting out Indirection steps with function calls. It's a time consuming step in BaseElements 2, and can be up to a quarter of the total processing time. To give you an idea of the work being done, here is a screenshot of the code from BE2 :

Screen shot 2010-07-09 at 9.02.14 AM.png

In that there are lots of recursive custom functions ( great for simplifying code, not so great for massive data processing ), and lots of loops that run off and generate new records.

In BaseElements 3 this entire block of code is gone. In it's place we've built in the same functions into the References xslt file. I'm going to digress into some detailed xslt so if you're not interested, feel free to skim the technical steps or tune out :)

The first thing we needed to do was to be able to differentiate plugins from normal functions. FileMaker helpfully puts function calls in a separate part of the DDR, so we can track those, but it doesn't differentiate between plugins and other functions. To do this in xslt you build a lookup table reference :

<xsl:key name="plugin-lookup" match="PluginList/Plugin/Function" use="@name"/>

then you setup a variable to reference the external file :

<xsl:variable name="plugin-file" select="document('BE_Plugins.xml')" />

And finally when you've got a function call to lookup you look it up in your external table :


<xsl:for-each select="$plugin-file">
<xsl:if test="key('plugin-lookup', $FunctionName)">
<xsl:call-template name="RESULTSET"/>
</xsl:if>
</xsl:for-each>

We've used these key lookups in a few places other places as well and it makes a huge difference to the processing time.

The second part of that long script was the processing of variables used. FileMaker doesn't even distinguish variables from other parts of the text, and so they're just lumped in with text, math symbols and other whitespace as a "NoRef" type. As well as that, variables are now also in the text on layout objects, inside file references, perform find steps and set variable steps. Each one is slightly different, but essentially the process is the same for all of them : sort through the text and find the variables. This is actually harder than it seems. First, you don't want to find variables inside comments, so you need to remove those. Then you need to remove anything inside quote marks, but you need to first strip out any escaped quotes. Then you need to split the remaining text into dividers. Because a variable name can have spaces, the only way to tell when it ends is to just find the next non-variable name character after the $. This could be any of of the various math symbols or other characters that end a text block. So finally you have a list of the remaining text, and you convert those to nodes and loop through them to find any that start with a $.

This process is more complex to setup inside xsl than it is to code in FileMaker, but the end result is that the process runs much faster because you're not looping through records and generating multiple new variable reference records. The entire process fits inside the main reference xslt and is included in the single import that imports those.

I won't post the code here, but if anyone is interested in how it works, let me know and I'll document it in more detail.

It's these two changes, as well as the csv imports, that constitute the bulk of the reduced import time in BaseElements 3. It's funny, I thought I'd done a good job of making things faster in BE 2, and I wasn't sure where any extra savings would come from. It was only after the v11 update broke our old xsl that I went back to the drawing board and found other optimisations with the new xsl engine. So maybe if v11 still worked with the old code BE 3 might not have been as fast as it is...

BaseElements has a new XSLT engine. Part 1 - Details.

As you may have known from previous notes on the website about FileMaker 11 and BaseElements, there were changes in FMP 11 to the XSLT engine inside FileMaker. The basic details are that FileMaker uses Xalan / Xerces as their XML / XSLT engines, and these were updated to the latest release with the new v11.

Normally point releases like this don't cause any issues with XSLT, except for one change which affected the way BaseElements recorded data. I've written a long post about the details in the FAQ on our website.

I'd like to detail some of how we've worked around these issues and the changes it has meant for BaseElements 3.

First of all, the big priority with BaseElements is import speed. Anything we can do to increase import time is a bonus.

In some rudimentary testing we did, we found that FileMaker imports data from csv files faster than from an XML file. It's about 20% faster on our test data sets, although real world data may be different. All except about 3 of the imports that we're doing could be transformed easily into csv imports if we have the ability to generate them from the DDR. The ones that can't be changed into csv are things like script steps and calculation, where only XML can retain formatting of things like the step text or the calculation details.

But although you can do an xsl transform on import into FileMaker, you must produce XML, the xsl must come from an external file, and you can't do a transform outside of the import step. So if we're going to do XML -> csv and then import we need to have our own xsl engine to do this. So we've written a new BaseElements plugin that incorporates the libxml2 and libxslt libraries. This means we can do the xslt processing in the plugin, generate a temp csv file and then import that. This gives us lots of control over our processing and allows us to potentially incorporate new features from future changes to the xsl libraries faster than if using the in built engine.

A bonus for anyone doing xslt work in FileMaker : we're going to release the plugin code as open source once we've got a final version. We'd love to see what others can do with this new feature in FileMaker too.

Uploading Images to Drupal with MarsEdit

As a follow up to my previous post about MarsEdit, I was having an issue when trying to upload images. I was getting a really useless error :

It is not possible to upload the file, because it exceeded the maximum filesize of 0 bytes

So check the prefs inside drupal :

Right. Something's not quite talking there. It turns out the problem was in permissions. Although I'm logged in as user 1, which on the site has every privilege, the blog api uses the proper roles and won't allow you to upload if the permissions for your role doesn't have it explicitly set. When I turned on the correct privileges all was good again.

Syndicate content