In this article I would like to present you 10 highlights from the MBS Xojo Plugins innovations of 2022.
MongoDB
The MongoDB section joined the family of plugins in release 22.3 and has been developed further since then. You can use Xojo to access MongoDB databases, read, write and delete data. The special thing about Mongo DB is that it is not a rational database that is limited by relationships and tables, but is based on a JSON-like structure that also allows unusual queries. For example, you can formulate searches to see who has been in your company longer, the carpet in the warehouse or your employee. In rational databases, your carpet wouldn't normally appear in the same table as your employee. So you would have to design a separate table to be able to make this query. In Mongo DB, the records, here called documents, can coexist in the same collection and a simple query can be made.
In Release 22.5, another important innovation was added for this area. You can now also execute transactions on MongoDB. Normally, every change in the database is immediately applied as soon as it has been made. But this is not always desirable, e.g. when it comes to security relevant things where multiple records have to be changed. If in the middle the connection breaks we don't know in which state our database is, which records have been changed, which not. For this there are the transactions, with which we can tell the database to make all changes at once or to reject all changes made. If you would like to try Mongo DB, please check out our examples.
Since macOS Ventura was released in October, we got plenty of crash reports from Xojo developers. There are bugs in macOS Ventura when loading dynamic libraries. Loading a dylib crashes with a probability of around 1%. Now a full set of MBS Plugins has over 500 dylibs and in our tests the crashes usually happen in the higher ranges like after 300, 400 or 500 dylibs are loaded. The crash reports look like this:
First since there are several bugs and Apple fixes bugs, please install updates for MacOS Ventura. Also make sure you have recent versions of Xojo (2022r4.1) and MBS Plugins 22.5 (or 22.6pr4), so you benefit from fixes related to macOS Ventura.
Next, please reduce the number of plugins you use. MBS Plugins contain 500+ dylibs with thousands of classes, but you probably only need a few plugins. So instead of 50 plugins installed, you may just go with 10 to 20 and not see the crash described above. Please check dependencies here. You need at least Main plugin for version and license handling. If you use various MacOS related plugins, you also need MacBase for some base classes. But not everyone uses our XL, OCR or Phidgets plugins.
If you like to know what plugins you use, just look into the built application. For macOS open the package with contextual menu and look into Contents/Frameworks folder. For Windows and Linux, please looks in the Libs folder. You may then lookup plugin part names to find the plugin.
When Xojo still crashes on launch, just try again. Usually it works fine after one or two crashes. We hope Apple fixes their bugs in the future with an upcoming update. Or tells us what to change on linking to avoid this.
Recently Norman got surprised about a change in a framework class. The EmailMessage class now has a computed property instead of a method pair for the Source property. While that doesn't change the functionality much, it does prevent you from subclassing and overwriting the methods.
Let's make diffs between the different versions of the framework classes. First attempt is to use Introspection, but for that we have to collect all the class names, which may be error prone. With introspection, we miss modules, global functions and many details like parameter names.
We are happy to report, that Xojo with our plugins work fine in 64-bit ARM target for Linux:
Today we got Scintilla control (ScintillaControlMBS) updated to include a built-in library, so the control can be easily used out of the box without providing your own library.
The ChartDirector examples also work, but you need to install fonts and tell our plugin where they are with the CDBaseChartMBS.SetFontSearchPath function.
Since Xojo 2022r4 introduced building desktop, console and web applications, we see an increase in Linux developers asking about it. We'll add more Linux 64-bit ARM support and fix issues as we find them for the upcoming 23.0 release in January. Please report problems you find.
Connecting to a bluetooth LE device on Windows and reading values is a multi step asynchronous procedure. You have to manage the state in your code to know where you are. You call plenty of functions and later you receive the callbacks to react to them, either as event or delegate method call. Here are the steps you may need to do:
Use WindowsBluetoothLEDeviceMBS.FromBluetoothAddressAsync to create the device object from the address.
If you alternatively have the Id, you can use FromIdAsync method instead.
When your delegate is called later, take the device object and continue.
You can add a CallKit extension to your Xojo iOS application. This extension can provide names for phone numbers to iOS as well as block specific numbers. The extension is a background application, which is called from time to time to be asked for new data. Your main application may manage a database of phone numbers, which is then used by the extension.
Since we can't write the CallKit in Xojo right away, we need to write the extension in Xcode. In Xcode you make a new iOS App project. The name doesn't matter, but it may be good to match it to your main application in Xojo and use the same bundle identifier, so Xcode can setup provision profile for you. Then we you have the settings open for the project, on the bottom below the targets is a plus button. There you can add a new target for the Call Directory Extension.
Short before year's end, we get a 4th release for Xojo for 2022. Download here. Release Notes here. This release brings a couple of important bug fixes and new features, so let's dig into it:
Linux 64-bit for ARM
Finally we get 64-bit ARM support for Linux. And if you like to try it, be sure to install our MBS Plugins 22.6pr3 (or newer) to get support for the new platform. We worked on this for a year now and already updated all plugins to build for it. This includes MBS Xojo ChartDirector Plugin for our chart engine. The MBS Xojo XL Plugin is not yet updated for Linux 64-bit ARM as we plan to do this with the upcoming 4.1 release of LibXL. Let us know if you run into a class or function not working on Linux 64-bit on ARM, so we can check. Please try it for your desktop, console and web projects.
For other plugin vendors, it looks like Björn from Einhugur.com is also busy to update.
(more)
The year 2022 will end in less than three weeks. Do you need some more licenses?
You can order licenses for 2023 or later and have invoice, delivery and payment done in 2022. This way you secure the current pricing and the possibility to keep upgradeability for older licenses.
And of course you can order updates for several years in advance for all your MBS products.
As all our Xojo and DynaPDF plugin licenses are per developer, you should check if you got a new developer in your team this year and adjust licenses to match team size.
For MBS FileMaker Plugin please check if you have enough license for the number of seats or servers you have in use. If you upgrade to unlimited seats or servers, the plugin won't need to check the usage counts.
Especially if you run on a budget and you want to spend some money in the old year, you can buy updates for several years in advance.
If you need help to decide what Xojo, FileMaker or plugin license you need, we may be able to assist you.
We recently got our TimerMBS class (22.6 or later) to help in cases, where using a menu on Windows stops your background threads. On macOS and Linux your threads continue to run when the user clicks on the menu and takes a while to make a choice.
So for Windows you can run the following code in your app open event to install a global TimerMBS and have it yield time. This makes sure that your main loop runs at least 10 times a second, even if a menu is open.
Sub Opening()
#if TargetWin32
//starttimertoyieldinordertokeepthreadsrunningwhenyouusePopupMenusStatic timer As TimerMBS
timer = New TimerMBS(100, False)
timer.Yield = True#EndIfEnd Sub
Alternatively, you would only enable it, when a thread is running. And then stop it later when the thread is done.
Please try and let us know whether it works well for you.
There was a smaller two day conference in Nashville a few months ago, where we had a lot of fun to meet Xojo developers from around the world. Check out the video:
Do you think that our monkey is a bit pale around the nose? Today we want to change that. We also have a method from the GM16ImageMBS class that can change the saturation of an image. The modulate method. But not only the saturation can this method influence but also the brightness of the image and the hue. So we can change the Hsb values of an image. In the parameters we then specify the corresponding values. If one or more of these three values should not be changed in an image, then we write a 100 in this place in the parameters. The 100 is the neutal value.
image.modulate(100,100,100)
Brightness and saturation are relatively easy to understand if we set the brightness to a value greater than 100 then the image becomes brighter and if the value is less than 100 then it becomes darker. Similarly, if the saturation is greater than 100, the saturation will be higher, and if it is less than 100, the saturation will be lower. We can move within the value range from 0 to 200. With the Hue factor it is not so clear what we are actually doing. Here, too, the values are between 0 and 200. We know that from many programs we can specify colors with the help of the color wheel.
We recently added MongoChangeStreamMBS class to watch changes in the database. You can monitor a database, a collection or the whole system. We show you today on how to use that in Xojo.
Sometimes you may have a situation, where you want to try something, that may crash. This may be a problem outside your control like a system or library function. Or some pointer reading may cause a page fault and you like to try it. Or some code produces crash reports for your users and you like to catch it and show a bug reporter dialog to get more details on why it crashes in a method.
We got recently a CallDelegateCrashSafeMBS module with a CallDelegateCrashSafeMBS method, that calls a method on your behalf. If it crashes, we raise a DelegateCrashExceptionMBS to inform you about it. The error message may tell the error like: "Delegate crashed with invalid pointer access."